don't pass compositor button events to client
This commit is contained in:
parent
b025b7bdbd
commit
6d5726e426
39
dwl.c
39
dwl.c
@ -265,24 +265,9 @@ chvt(const Arg *arg)
|
|||||||
void
|
void
|
||||||
buttonpress(struct wl_listener *listener, void *data)
|
buttonpress(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* This event is forwarded by the cursor when a pointer emits a button
|
|
||||||
* event. */
|
|
||||||
struct wlr_event_pointer_button *event = data;
|
struct wlr_event_pointer_button *event = data;
|
||||||
/* Notify the client with pointer focus that a button press has occurred */
|
switch (event->state) {
|
||||||
/* XXX probably don't want to pass the event if it's handled by the
|
case WLR_BUTTON_PRESSED:;
|
||||||
* compositor at the bottom of this function */
|
|
||||||
wlr_seat_pointer_notify_button(seat,
|
|
||||||
event->time_msec, event->button, event->state);
|
|
||||||
if (event->state == WLR_BUTTON_RELEASED) {
|
|
||||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
|
||||||
/* XXX should reset to the pointer focus's current setcursor */
|
|
||||||
if (cursor_mode != CurNormal)
|
|
||||||
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
|
||||||
"left_ptr", cursor);
|
|
||||||
cursor_mode = CurNormal;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change focus if the button was _pressed_ over a client */
|
/* Change focus if the button was _pressed_ over a client */
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
struct wlr_surface *surface;
|
struct wlr_surface *surface;
|
||||||
@ -297,8 +282,26 @@ buttonpress(struct wl_listener *listener, void *data)
|
|||||||
for (int i = 0; i < LENGTH(buttons); i++)
|
for (int i = 0; i < LENGTH(buttons); i++)
|
||||||
if (event->button == buttons[i].button &&
|
if (event->button == buttons[i].button &&
|
||||||
CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
|
CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
|
||||||
buttons[i].func)
|
buttons[i].func) {
|
||||||
buttons[i].func(&buttons[i].arg);
|
buttons[i].func(&buttons[i].arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WLR_BUTTON_RELEASED:
|
||||||
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* XXX should reset to the pointer focus's current setcursor */
|
||||||
|
if (cursor_mode != CurNormal) {
|
||||||
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
||||||
|
"left_ptr", cursor);
|
||||||
|
cursor_mode = CurNormal;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* If the event wasn't handled by the compositor, notify the client with
|
||||||
|
* pointer focus that a button press has occurred */
|
||||||
|
wlr_seat_pointer_notify_button(seat,
|
||||||
|
event->time_msec, event->button, event->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user