fix smartborders

This commit is contained in:
korei999 2023-11-29 22:26:28 +02:00
parent 0bbf1f65da
commit 0d3a1d0c8a

24
dwl.c
View file

@ -808,8 +808,12 @@ commitnotify(struct wl_listener *listener, void *data)
{ {
Client *c = wl_container_of(listener, c, commit); Client *c = wl_container_of(listener, c, commit);
if (client_surface(c)->mapped) if (client_surface(c)->mapped) {
resize(c, c->geom, (c->isfloating && !c->isfullscreen), 1); 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 */ /* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
@ -1069,6 +1073,8 @@ createnotify(struct wl_listener *listener, void *data)
void void
createpointer(struct wlr_pointer *pointer) createpointer(struct wlr_pointer *pointer)
{ {
bool is_trackpad = false;
if (wlr_input_device_is_libinput(&pointer->base)) { if (wlr_input_device_is_libinput(&pointer->base)) {
struct libinput_device *libinput_device = (struct libinput_device*) struct libinput_device *libinput_device = (struct libinput_device*)
wlr_libinput_get_device_handle(&pointer->base); 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_enabled(libinput_device, tap_and_drag);
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, drag_lock); libinput_device_config_tap_set_drag_lock_enabled(libinput_device, drag_lock);
libinput_device_config_tap_set_button_map(libinput_device, button_map); libinput_device_config_tap_set_button_map(libinput_device, button_map);
}
if (libinput_device_config_scroll_has_natural_scroll(libinput_device)) if (libinput_device_config_scroll_has_natural_scroll(libinput_device)) {
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling); libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, natural_scrolling);
is_trackpad = true;
}
}
if (libinput_device_config_dwt_is_available(libinput_device)) if (libinput_device_config_dwt_is_available(libinput_device))
libinput_device_config_dwt_set_enabled(libinput_device, disable_while_typing); libinput_device_config_dwt_set_enabled(libinput_device, disable_while_typing);
@ -1101,11 +1109,19 @@ createpointer(struct wlr_pointer *pointer)
if (libinput_device_config_send_events_get_modes(libinput_device)) if (libinput_device_config_send_events_get_modes(libinput_device))
libinput_device_config_send_events_set_mode(libinput_device, send_events_mode); libinput_device_config_send_events_set_mode(libinput_device, send_events_mode);
/* 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)) { if (libinput_device_config_accel_is_available(libinput_device)) {
libinput_device_config_accel_set_profile(libinput_device, accel_profile); libinput_device_config_accel_set_profile(libinput_device, accel_profile);
libinput_device_config_accel_set_speed(libinput_device, accel_speed); libinput_device_config_accel_set_speed(libinput_device, accel_speed);
} }
} }
}
wlr_cursor_attach_input_device(cursor, &pointer->base); wlr_cursor_attach_input_device(cursor, &pointer->base);
} }