From 0d3a1d0c8a0cb407d84f5f576c1b0a4455d7195f Mon Sep 17 00:00:00 2001 From: korei999 Date: Wed, 29 Nov 2023 22:26:28 +0200 Subject: [PATCH] fix smartborders --- dwl.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/dwl.c b/dwl.c index 4d342e5..e60c87b 100644 --- a/dwl.c +++ b/dwl.c @@ -808,8 +808,12 @@ commitnotify(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, commit); - if (client_surface(c)->mapped) - resize(c, c->geom, (c->isfloating && !c->isfullscreen), 1); + if (client_surface(c)->mapped) { + if (c->mon && c->mon->lt[c->mon->sellt]->arrange && !c->isfullscreen && !c->isfloating) + c->mon->lt[c->mon->sellt]->arrange(c->mon); + else + resize(c, c->geom, (c->isfloating && !c->isfullscreen), (c->isfloating && !c->isfullscreen)); + } /* mark a pending resize as completed */ if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) @@ -1069,6 +1073,8 @@ createnotify(struct wl_listener *listener, void *data) void createpointer(struct wlr_pointer *pointer) { + bool is_trackpad = false; + if (wlr_input_device_is_libinput(&pointer->base)) { struct libinput_device *libinput_device = (struct libinput_device*) wlr_libinput_get_device_handle(&pointer->base); @@ -1078,10 +1084,12 @@ createpointer(struct wlr_pointer *pointer) libinput_device_config_tap_set_drag_enabled(libinput_device, tap_and_drag); libinput_device_config_tap_set_drag_lock_enabled(libinput_device, drag_lock); libinput_device_config_tap_set_button_map(libinput_device, button_map); - } - 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); + is_trackpad = true; + } + } if (libinput_device_config_dwt_is_available(libinput_device)) libinput_device_config_dwt_set_enabled(libinput_device, disable_while_typing); @@ -1101,9 +1109,17 @@ createpointer(struct wlr_pointer *pointer) if (libinput_device_config_send_events_get_modes(libinput_device)) libinput_device_config_send_events_set_mode(libinput_device, send_events_mode); - if (libinput_device_config_accel_is_available(libinput_device)) { - libinput_device_config_accel_set_profile(libinput_device, accel_profile); - libinput_device_config_accel_set_speed(libinput_device, accel_speed); + /* different profiles for trackpad and mouse */ + if (is_trackpad) { + if (libinput_device_config_accel_is_available(libinput_device)) { + libinput_device_config_accel_set_profile(libinput_device, accel_profile_trackpad); + libinput_device_config_accel_set_speed(libinput_device, accel_speed_trackpad); + } + } else { + if (libinput_device_config_accel_is_available(libinput_device)) { + libinput_device_config_accel_set_profile(libinput_device, accel_profile); + libinput_device_config_accel_set_speed(libinput_device, accel_speed); + } } }