Implement pointer_get_position: return tracked cursor coordinates

pointer_get_position was a noop returning (0,0), causing findMenu to
always return NULL. This made the menu close on every button release
regardless of pointer position. Now returns wl_state.pointer_x/y which
are updated on every pointer motion event.

With this fix, the root menu stays open when the pointer is over it on
release (matching X11 behavior), allowing entry selection or titlebar
pinning.
This commit is contained in:
Levi Neely 2026-05-13 17:52:17 +02:00
parent bfa248ae29
commit fb2d0ab2ef
1 changed files with 5 additions and 2 deletions

View File

@ -6888,7 +6888,10 @@ static void wl_noop_window_get_colormap(WNativeWindow win, unsigned long *c) { (
static WNativeWindow wl_noop_pointer_query_window(WNativeWindow root) { (void)root; return WNATIVE_NONE; }
static void wl_noop_dialog_paint_icon(unsigned long d, void *b, void *p, WScreen *s,
int x, int y, int w, int h) { (void)d;(void)b;(void)p;(void)s;(void)x;(void)y;(void)w;(void)h; }
static void wl_noop_pointer_get_position(int *x, int *y) { *x = 0; *y = 0; }
static void wl_pointer_get_position(int *x, int *y) {
*x = (int)wl_state.pointer_x;
*y = (int)wl_state.pointer_y;
}
static const char *wl_noop_keysym_to_string(unsigned long ks) { (void)ks; return ""; }
static int wl_noop_window_get_command(WNativeWindow win, char ***a, int *c) { (void)win; (void)a; *c=0; return 0; }
static int wl_noop_netwm_process_client_message(void *x) { (void)x; return 0; }
@ -7157,7 +7160,7 @@ const WMBackend wl_backend = {
.window_get_colormap = wl_noop_window_get_colormap,
.pointer_query_window = wl_noop_pointer_query_window,
.dialog_paint_icon = wl_noop_dialog_paint_icon,
.pointer_get_position = wl_noop_pointer_get_position,
.pointer_get_position = wl_pointer_get_position,
.keysym_to_string = wl_noop_keysym_to_string,
.window_get_command = wl_noop_window_get_command,
.netwm_process_client_message = wl_noop_netwm_process_client_message,