[PATCH weston 3/6] xwm: set appropriate cursors for the frame window
Tiago Vignatti
tiago.vignatti at linux.intel.com
Thu Jul 12 06:02:36 PDT 2012
On 07/12/2012 05:39 AM, Kristian Høgsberg wrote:
> On Thu, Jul 12, 2012 at 12:46:12AM +0300, Tiago Vignatti wrote:
>> +static void
>> +weston_wm_handle_leave(struct weston_wm *wm, xcb_generic_event_t *event)
>> +{
>> + xcb_leave_notify_event_t *leave_notify =
>> + (xcb_leave_notify_event_t *) event;
>> + struct weston_wm_window *window;
>> +
>> + window = hash_table_lookup(wm->window_hash, leave_notify->event);
>> + if (!window)
>> + return;
>> +
>> + weston_wm_frame_set_cursor(wm, window, XWM_CURSOR_LEFT_PTR);
>> +}
>
> We don't need to set the cursor on leave, whatever window the cursor
> moves into will set it. But we do need to set it on enter.
I believe this is not true.
Say we're moving the cursor from the desktop to an internal window of a
X client; this client has borders created by XWM and the client didn't
set cursor for its window. So first, the cursor is set to whatever the
location of the frame is and then the frame has to prepare a cursor
because the client window (which didn't set any cursor) will pick the
last one available (ChangeWindowDeviceCursor() in xserver). Therefore
the cursor has to be prepared on frame leave.
Check yourself. The counter-example is gtk3-demo-application (move the
cursor over the gray area).
> I'd
> suggest making weston_wm_frame_set_cursor take wm, window id, and x
> and y. We can look up the window and the cursor for the location
> there. Then both the motion and enter handlers can call this with the
> window id and coordinates they receive.
that doesn't work. What we do when we want to force a particular cursor,
like LEFT_PTR for the leave or root window? What do you think about what
I've introduce in the 4/6:
weston_wm_window_set_cursor(struct weston_wm *wm, xcb_window_t
window_id, int cursor)
Tiago
More information about the wayland-devel
mailing list