wl_pointer_grab: replace no-op stub with compositor-grab delegation
The WINGs view backend wl_pointer_grab was a no-op, meaning the press-drag-release sequence for popup menus had no effect on compositor state. On X11 this would call XGrabPointer to redirect events to the menu window; the equivalent on Wayland is to activate the compositor wl_pointer_grab which sets wl_state.grab_type and suppresses unwanted cursor resets and axis leaks during the interactive drag. Implementation: add function pointers W_WLPointerGrabFn and W_WLPointerUngrabFn in wview_wl.c, initialized to NULL. The compositor wires them to wl_pointer_grab / wl_pointer_ungrab at startup. The WINGs view backend now delegates to the compositor instead of silently returning.
This commit is contained in:
parent
7285ca6286
commit
3a2f5e96db
|
|
@ -897,16 +897,29 @@ static void wl_window_realize(void *vctx, W_View *view, const char *name,
|
|||
(void)vctx; (void)view; (void)name; (void)class; (void)owner;
|
||||
}
|
||||
|
||||
/* Function pointer set by the compositor to install a pointer grab
|
||||
* during press-drag-release sequences (popup menus, interactive moves).
|
||||
* The compositor uses this to set wl_state.grab_type and suppress
|
||||
* unwanted focus/cursor changes while the grab is active. */
|
||||
int (*W_WLPointerGrabFn)(WNativeWindow grab_win, WNativeWindow confine_to,
|
||||
unsigned int event_mask, int cursor_id,
|
||||
int owner_events, unsigned long timestamp) = NULL;
|
||||
|
||||
static void wl_pointer_grab(void *vctx, W_View *view, int owner_events, unsigned long time)
|
||||
{
|
||||
(void)vctx; (void)view; (void)owner_events; (void)time;
|
||||
/* No-op: Wayland uses implicit grab on button press; popup menus
|
||||
* receive events via the pointer focus mechanism. */
|
||||
(void)vctx;
|
||||
if (W_WLPointerGrabFn)
|
||||
W_WLPointerGrabFn(view ? view->window : WNATIVE_NONE,
|
||||
WNATIVE_NONE, 0, 0, owner_events, time);
|
||||
}
|
||||
|
||||
void (*W_WLPointerUngrabFn)(unsigned long timestamp) = NULL;
|
||||
|
||||
static void wl_pointer_ungrab(void *vctx, unsigned long time)
|
||||
{
|
||||
(void)vctx; (void)time;
|
||||
(void)vctx;
|
||||
if (W_WLPointerUngrabFn)
|
||||
W_WLPointerUngrabFn(time);
|
||||
}
|
||||
|
||||
static void wl_window_set_geometry(void *vctx, W_View *view)
|
||||
|
|
|
|||
|
|
@ -463,6 +463,15 @@ wl_display_open(const char *name)
|
|||
extern void wl_view_scene_node_set_enabled(unsigned long id, int enabled);
|
||||
W_ViewSceneNodeSetEnabledFn = wl_view_scene_node_set_enabled;
|
||||
|
||||
extern int (*W_WLPointerGrabFn)(WNativeWindow, WNativeWindow,
|
||||
unsigned int, int, int, unsigned long);
|
||||
extern void (*W_WLPointerUngrabFn)(unsigned long);
|
||||
extern int wl_pointer_grab(WNativeWindow, WNativeWindow,
|
||||
unsigned int, int, int, unsigned long);
|
||||
extern void wl_pointer_ungrab(unsigned long);
|
||||
W_WLPointerGrabFn = wl_pointer_grab;
|
||||
W_WLPointerUngrabFn = wl_pointer_ungrab;
|
||||
|
||||
extern void (*W_ClipboardStoreFn)(const char *text, int len);
|
||||
extern char *(*W_ClipboardFetchFn)(int *len_out);
|
||||
W_ClipboardStoreFn = wl_clipboard_store_to_seat;
|
||||
|
|
|
|||
Loading…
Reference in New Issue