summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-12-24 21:15:40 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-12-24 21:15:40 -0500
commitd94266df915bf6b0747858aa9f51cb02a481cfaa (patch)
tree9b2f7a626a81c16c16df92e27050c1bbbb8ff608
parent5f3a7887f398385d93f61294c6fe876e6abb7c5d (diff)
fix crash on non-libinput pointers (e.g. X11 backend)
-rw-r--r--dwl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dwl.c b/dwl.c
index d25b5df..0c28cc0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -899,14 +899,16 @@ createlayersurface(struct wl_listener *listener, void *data)
void
createpointer(struct wlr_input_device *device)
{
- struct libinput_device *libinput_device = (struct libinput_device*)
+ if (wlr_input_device_is_libinput(device)) {
+ struct libinput_device *libinput_device = (struct libinput_device*)
wlr_libinput_get_device_handle(device);
- if (tap_to_click && libinput_device_config_tap_get_finger_count(libinput_device))
- libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED);
+ if (tap_to_click && libinput_device_config_tap_get_finger_count(libinput_device))
+ libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED);
- if (libinput_device_config_scroll_has_natural_scroll(libinput_device))
- libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling);
+ if (libinput_device_config_scroll_has_natural_scroll(libinput_device))
+ libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling);
+ }
/* We don't do anything special with pointers. All of our pointer handling
* is proxied through wlr_cursor. On another compositor, you might take this