Skip to content

window: Fix keyboard resize increments and avoid crash under Wayland (Fixes #871) - #873

Open
DerLinke wants to merge 1 commit into
linuxmint:masterfrom
DerLinke:fix-keyboard-resize-increment
Open

DerLinke wants to merge 1 commit into
linuxmint:masterfrom
DerLinke:fix-keyboard-resize-increment

Conversation

@DerLinke

Copy link
Copy Markdown

Fixes #871

Summary

When using Alt + F8 (keyboard interactive resize grab), two issues occur under Wayland / nested sessions:

  1. Wayland NULL dereference crash in warp_grab_pointer():

    • In src/core/window.c:warp_grab_pointer(), meta_x11_error_trap_push(display->x11_display) and meta_x11_error_trap_pop_with_return(display->x11_display) are called unconditionally.
    • When running under pure Wayland / nested mode, display->x11_display is NULL, causing an immediate SIGSEGV crash when initiating resize with Alt + F8.
    • Guarded these calls with if (display->x11_display).
  2. Pointer motion events overriding 10px keyboard resize steps with 0px/1px jitter:

    • In src/core/window.c:meta_window_handle_mouse_grab_op_event(), CLUTTER_MOTION events were not checking whether the active grab operation is a keyboard grab (meta_grab_op_is_keyboard).
    • Every pointer warp (and subtle mouse/touchpad movement) during a directional keyboard resize generated a motion event that invoked update_resize().
    • update_resize() computed dx = x - grab_anchor_root_x and immediately overwrote the 10px keyboard increment with mouse deltas (often 0px or 1px), making resizing feel virtually stationary as if stuck on a 1px step.
    • Prevented motion events during directional keyboard grabs from calling update_resize() / update_move().
  3. Wayland resize pointer tracking synchronization:

    • Because Wayland buffer commits are asynchronous, window->rect is only updated when the client attaches the new buffer in meta_window_wayland_finish_move_resize().
    • Added a call to meta_window_update_keyboard_resize(window, FALSE) on buffer commit during keyboard resize grabs so that the pointer and grab anchor are warped and synchronized to the actual committed window dimensions.

- In meta_window_handle_mouse_grab_op_event(), prevent pointer motion
  events during active directional keyboard grabs from calling update_resize()
  or update_move(). Pointer warp and trackpad jitter were overriding the
  10px keyboard resize increments with tiny 0px/1px mouse deltas.
- In warp_grab_pointer(), guard meta_x11_error_trap_push() and
  meta_x11_error_trap_pop_with_return() with display->x11_display check
  to prevent a NULL pointer dereference crash when running in Wayland
  or nested modes.
- In meta_window_wayland_finish_move_resize(), call
  meta_window_update_keyboard_resize() once the Wayland client commits
  its resized buffer so the pointer and grab anchor are updated to the
  actual new window bounds.

Fixes linuxmint#871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alt + F8 moves the cursor in 1px increments, as if ctrl is being held down

1 participant