aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-23 22:31:59 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-23 23:35:54 -0500
commit2f21445761112388ee482185d350e46d0f361bd0 (patch)
tree41d418908a102da52e2fcca3cf3a557653e194e1 /dwl.c
parent288f6397faea0285cf4eba9fc84459c60c2ed690 (diff)
style in buttonpress
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/dwl.c b/dwl.c
index 69c124d..af53435 100644
--- a/dwl.c
+++ b/dwl.c
@@ -237,29 +237,28 @@ buttonpress(struct wl_listener *listener, void *data)
/* 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);
- double sx, sy;
- struct wlr_surface *surface;
- Client *c = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
if (event->state == WLR_BUTTON_RELEASED) {
/* If you released any buttons, we exit interactive move/resize mode. */
cursor_mode = CurNormal;
- } else {
- /* Change focus if the button was _pressed_ over a client */
- if (c) {
- focus(c, surface);
- raiseclient(c);
- }
+ return;
+ }
- struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
- uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
- for (int i = 0; i < LENGTH(buttons); i++) {
- if (event->button == buttons[i].button &&
- CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
- buttons[i].func) {
- buttons[i].func(&buttons[i].arg);
- }
- }
+ /* Change focus if the button was _pressed_ over a client */
+ double sx, sy;
+ struct wlr_surface *surface;
+ Client *c = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
+ if (c) {
+ focus(c, surface);
+ raiseclient(c);
}
+
+ struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
+ uint32_t mods = wlr_keyboard_get_modifiers(keyboard);
+ for (int i = 0; i < LENGTH(buttons); i++)
+ if (event->button == buttons[i].button &&
+ CLEANMASK(mods) == CLEANMASK(buttons[i].mod) &&
+ buttons[i].func)
+ buttons[i].func(&buttons[i].arg);
}
void