text fields: button state in motion events + i-beam cursor
- Track current_buttons bitmask on press/release - Set u.motion.state = current_mods | current_buttons so WINGs text fields see WM_BUTTON1_MASK during click-drag selection - Implement wl_set_cursor via W_SetCursorImageFn hook for i-beam
This commit is contained in:
parent
7f5dd5f682
commit
c8053b98e5
|
|
@ -258,7 +258,13 @@ handle_pointer_button(struct wl_listener *listener, void *data)
|
|||
case 0x112: wev.u.button.button = 2; break;
|
||||
default: wev.u.button.button = (ev->button - 0x110) + 1; break;
|
||||
}
|
||||
wev.u.button.state = wl_state.current_mods;
|
||||
/* Track button mask for motion events (WM_BUTTON*_MASK = 0x100<<n) */
|
||||
unsigned int bmask = (1u << 8) << (wev.u.button.button - 1);
|
||||
if (ev->state == WLR_BUTTON_PRESSED)
|
||||
wl_state.current_buttons |= bmask;
|
||||
else
|
||||
wl_state.current_buttons &= ~bmask;
|
||||
wev.u.button.state = wl_state.current_mods | wl_state.current_buttons;
|
||||
/* For WINGs views, resolve the child widget at click coordinates.
|
||||
* Two cases:
|
||||
* 1. fb->id >= 0x20000000 — fb IS a WINGs view frame_buf, use directly.
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ handle_pointer_motion(struct wl_listener *listener, void *data)
|
|||
wev.u.motion.time = ev->time_msec;
|
||||
wev.u.motion.x_root = wl_state.pointer_x;
|
||||
wev.u.motion.y_root = wl_state.pointer_y;
|
||||
wev.u.motion.state = wl_state.current_mods | wl_state.current_buttons;
|
||||
/* Resolve WINGs child view (slider, etc.) at pointer for
|
||||
* motion routing during drag operations. */
|
||||
struct W_View *mtarget = NULL;
|
||||
|
|
@ -214,6 +215,7 @@ handle_pointer_motion_absolute(struct wl_listener *listener, void *data)
|
|||
wev.u.motion.time = ev->time_msec;
|
||||
wev.u.motion.x_root = wl_state.pointer_x;
|
||||
wev.u.motion.y_root = wl_state.pointer_y;
|
||||
wev.u.motion.state = wl_state.current_mods | wl_state.current_buttons;
|
||||
W_WL_EnqueueEvent(wmscr2, &wev, NULL);
|
||||
/* Emit synthetic LEAVE/ENTER on sub-window boundary crossings. */
|
||||
if (new_id != wl_state.last_hovered_id) {
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ struct wl_compositor_state {
|
|||
* handle_keyboard_modifiers. Used by handle_pointer_button to populate
|
||||
* u.button.state so frameMouseDown can detect Alt/Super+drag. */
|
||||
unsigned int current_mods;
|
||||
unsigned int current_buttons; /* WM_BUTTON*_MASK bits */
|
||||
};
|
||||
|
||||
extern struct wl_compositor_state wl_state;
|
||||
|
|
|
|||
Loading…
Reference in New Issue