aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-04 17:32:22 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-04 17:32:22 +0000
commit21c1d9739b8570b9c1ded2e7d00310a5a97a400d (patch)
tree433b70e18ead6a23c82529dc9d8e21565656ad3b /input.c
parentinput: don’t assert when receiving a button release without a press event (diff)
input: don’t try to close an invalid FD
Diffstat (limited to 'input.c')
-rw-r--r--input.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/input.c b/input.c
index fe9e143a..e4a1f306 100644
--- a/input.c
+++ b/input.c
@@ -1596,7 +1596,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
xdg_toplevel_set_maximized(win->xdg_toplevel);
}
- else if (button == BTN_LEFT && win->csd.move_timeout_fd == -1) {
+ else if (button == BTN_LEFT && win->csd.move_timeout_fd < 0) {
const struct itimerspec timeout = {
.it_value = {.tv_nsec = 200000000},
};
@@ -1610,14 +1610,15 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
win->csd.serial = serial;
} else {
LOG_ERRNO("failed to configure XDG toplevel move timer FD");
- close(fd);
+ if (fd >= 0)
+ close(fd);
}
}
}
else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
struct wl_window *win = term->window;
- if (win->csd.move_timeout_fd != -1) {
+ if (win->csd.move_timeout_fd >= 0) {
fdm_del(wayl->fdm, win->csd.move_timeout_fd);
win->csd.move_timeout_fd = -1;
}