mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
cursor-tracker: Remove the grab cursor
We expect that meta_screen_set_cursor while grabbed will properly set the cursor on the root window. Make sure this works by simply always using the root cursor when we have an active grab.
This commit is contained in:
parent
da175bca52
commit
f57b0726a0
@ -37,22 +37,8 @@ struct _MetaCursorTracker {
|
||||
|
||||
gboolean is_showing;
|
||||
|
||||
/* The cursor tracker stores the cursor for the current grab
|
||||
* operation, the cursor for the window with pointer focus, and
|
||||
* the cursor for the root window, which contains either the
|
||||
* default arrow cursor or the 'busy' hourglass if we're launching
|
||||
* an app.
|
||||
*
|
||||
* We choose the first one available -- if there's a grab cursor,
|
||||
* we choose that cursor, if there's window cursor, we choose that,
|
||||
* otherwise we choose the root cursor.
|
||||
*
|
||||
* The displayed_cursor contains the chosen cursor.
|
||||
*/
|
||||
MetaCursorReference *displayed_cursor;
|
||||
|
||||
MetaCursorReference *grab_cursor;
|
||||
|
||||
/* Wayland clients can set a NULL buffer as their cursor
|
||||
* explicitly, which means that we shouldn't display anything.
|
||||
* So, we can't simply store a NULL in window_cursor to
|
||||
@ -74,8 +60,6 @@ struct _MetaCursorTrackerClass {
|
||||
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||
XEvent *xevent);
|
||||
|
||||
void meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
|
||||
MetaCursorReference *cursor);
|
||||
void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
|
||||
MetaCursorReference *cursor);
|
||||
void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker);
|
||||
|
@ -63,11 +63,11 @@ get_displayed_cursor (MetaCursorTracker *tracker)
|
||||
if (!tracker->is_showing)
|
||||
return NULL;
|
||||
|
||||
if (tracker->grab_cursor)
|
||||
return tracker->grab_cursor;
|
||||
|
||||
if (tracker->has_window_cursor)
|
||||
return tracker->window_cursor;
|
||||
if (tracker->screen->display->grab_op == META_GRAB_OP_NONE)
|
||||
{
|
||||
if (tracker->has_window_cursor)
|
||||
return tracker->window_cursor;
|
||||
}
|
||||
|
||||
return tracker->root_cursor;
|
||||
}
|
||||
@ -374,17 +374,6 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
|
||||
MetaCursorReference *cursor)
|
||||
{
|
||||
g_clear_pointer (&tracker->grab_cursor, meta_cursor_reference_unref);
|
||||
if (cursor)
|
||||
tracker->grab_cursor = meta_cursor_reference_ref (cursor);
|
||||
|
||||
sync_cursor (tracker);
|
||||
}
|
||||
|
||||
void
|
||||
meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
|
||||
MetaCursorReference *cursor)
|
||||
|
@ -1702,14 +1702,8 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
|
||||
{
|
||||
/* Set root cursor */
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (display->screen);
|
||||
MetaCursor cursor = meta_cursor_for_grab_op (op);
|
||||
MetaCursorReference *cursor_ref;
|
||||
|
||||
cursor_ref = meta_cursor_reference_from_theme (cursor);
|
||||
meta_cursor_tracker_set_grab_cursor (tracker, cursor_ref);
|
||||
if (cursor_ref)
|
||||
meta_cursor_reference_unref (cursor_ref);
|
||||
meta_screen_set_cursor (display->screen, meta_cursor_for_grab_op (op));
|
||||
|
||||
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
|
||||
display->grab_have_pointer = TRUE;
|
||||
@ -1862,8 +1856,6 @@ void
|
||||
meta_display_end_grab_op (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaCursorTracker *tracker;
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Ending grab op %u at time %u\n", display->grab_op, timestamp);
|
||||
|
||||
@ -1904,8 +1896,7 @@ meta_display_end_grab_op (MetaDisplay *display,
|
||||
meta_window_ungrab_all_keys (display->grab_window, timestamp);
|
||||
}
|
||||
|
||||
tracker = meta_cursor_tracker_get_for_screen (display->screen);
|
||||
meta_cursor_tracker_set_grab_cursor (tracker, NULL);
|
||||
meta_screen_set_cursor (display->screen, META_CURSOR_DEFAULT);
|
||||
|
||||
display->grab_timestamp = 0;
|
||||
display->grab_window = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user