mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 12:00:44 -05:00
screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
At the moment feedback is only provided for the Virtual Core Pointer
This commit is contained in:
parent
1dd50cf006
commit
972a9d231f
@ -4273,22 +4273,29 @@ meta_display_set_cursor_theme (const char *theme,
|
||||
{
|
||||
#ifdef HAVE_XCURSOR
|
||||
GSList *tmp;
|
||||
|
||||
GList *devices, *d;
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
XcursorSetTheme (display->xdisplay, theme);
|
||||
XcursorSetDefaultSize (display->xdisplay, size);
|
||||
|
||||
devices = meta_device_map_list_devices (display->device_map);
|
||||
tmp = display->screens;
|
||||
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaScreen *screen = tmp->data;
|
||||
|
||||
meta_screen_update_cursor (screen);
|
||||
|
||||
for (d = devices; d; d = d->next)
|
||||
{
|
||||
if (META_IS_DEVICE_POINTER (d->data))
|
||||
meta_screen_update_cursor (screen, d->data);
|
||||
}
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,8 @@ struct _MetaScreen
|
||||
MetaStack *stack;
|
||||
MetaStackTracker *stack_tracker;
|
||||
|
||||
MetaCursor current_cursor;
|
||||
/* per-pointer cursors */
|
||||
GHashTable *cursors;
|
||||
|
||||
Window flash_window;
|
||||
|
||||
@ -158,8 +159,10 @@ void meta_screen_queue_frame_redraws (MetaScreen *scree
|
||||
void meta_screen_queue_window_resizes (MetaScreen *screen);
|
||||
|
||||
void meta_screen_set_cursor (MetaScreen *screen,
|
||||
MetaDevice *pointer,
|
||||
MetaCursor cursor);
|
||||
void meta_screen_update_cursor (MetaScreen *screen);
|
||||
void meta_screen_update_cursor (MetaScreen *screen,
|
||||
MetaDevice *pointer);
|
||||
|
||||
void meta_screen_tab_popup_create (MetaScreen *screen,
|
||||
MetaTabList list_type,
|
||||
|
@ -778,10 +778,10 @@ meta_screen_new (MetaDisplay *display,
|
||||
screen->rect.x = screen->rect.y = 0;
|
||||
screen->rect.width = WidthOfScreen (screen->xscreen);
|
||||
screen->rect.height = HeightOfScreen (screen->xscreen);
|
||||
screen->current_cursor = -1; /* invalid/unset */
|
||||
screen->default_xvisual = DefaultVisualOfScreen (screen->xscreen);
|
||||
screen->default_depth = DefaultDepthOfScreen (screen->xscreen);
|
||||
screen->flash_window = None;
|
||||
screen->cursors = g_hash_table_new (NULL, NULL);
|
||||
|
||||
screen->wm_sn_selection_window = new_wm_sn_owner;
|
||||
screen->wm_sn_atom = wm_sn_atom;
|
||||
@ -806,8 +806,6 @@ meta_screen_new (MetaDisplay *display,
|
||||
screen->last_monitor_index = 0;
|
||||
|
||||
reload_monitor_infos (screen);
|
||||
|
||||
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
|
||||
|
||||
/* Handle creating a no_focus_window for this screen */
|
||||
screen->no_focus_window =
|
||||
@ -969,6 +967,8 @@ meta_screen_free (MetaScreen *screen,
|
||||
|
||||
g_free (screen->screen_name);
|
||||
|
||||
g_hash_table_destroy (screen->cursors);
|
||||
|
||||
g_object_unref (screen);
|
||||
|
||||
XFlush (display->xdisplay);
|
||||
@ -1582,31 +1582,33 @@ update_focus_mode (MetaScreen *screen)
|
||||
|
||||
void
|
||||
meta_screen_set_cursor (MetaScreen *screen,
|
||||
MetaDevice *pointer,
|
||||
MetaCursor cursor)
|
||||
{
|
||||
Cursor xcursor;
|
||||
MetaCursor old_cursor;
|
||||
|
||||
if (cursor == screen->current_cursor)
|
||||
old_cursor = GPOINTER_TO_UINT (g_hash_table_lookup (screen->cursors, pointer));
|
||||
|
||||
if (cursor == old_cursor)
|
||||
return;
|
||||
|
||||
screen->current_cursor = cursor;
|
||||
|
||||
xcursor = meta_display_create_x_cursor (screen->display, cursor);
|
||||
XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor);
|
||||
XFlush (screen->display->xdisplay);
|
||||
XFreeCursor (screen->display->xdisplay, xcursor);
|
||||
g_hash_table_insert (screen->cursors, pointer,
|
||||
GUINT_TO_POINTER (cursor));
|
||||
|
||||
meta_screen_update_cursor (screen, pointer);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_update_cursor (MetaScreen *screen)
|
||||
meta_screen_update_cursor (MetaScreen *screen,
|
||||
MetaDevice *pointer)
|
||||
{
|
||||
Cursor xcursor;
|
||||
MetaCursor cursor;
|
||||
|
||||
xcursor = meta_display_create_x_cursor (screen->display,
|
||||
screen->current_cursor);
|
||||
XDefineCursor (screen->display->xdisplay, screen->xroot, xcursor);
|
||||
cursor = GPOINTER_TO_UINT (g_hash_table_lookup (screen->cursors, pointer));
|
||||
meta_device_pointer_set_window_cursor (META_DEVICE_POINTER (pointer),
|
||||
screen->xroot,
|
||||
cursor);
|
||||
XFlush (screen->display->xdisplay);
|
||||
XFreeCursor (screen->display->xdisplay, xcursor);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3056,17 +3058,22 @@ static gboolean startup_sequence_timeout (void *data);
|
||||
static void
|
||||
update_startup_feedback (MetaScreen *screen)
|
||||
{
|
||||
MetaDevice *pointer;
|
||||
|
||||
pointer = meta_device_map_lookup (screen->display->device_map,
|
||||
META_CORE_POINTER_ID);
|
||||
|
||||
if (screen->startup_sequences != NULL)
|
||||
{
|
||||
meta_topic (META_DEBUG_STARTUP,
|
||||
"Setting busy cursor\n");
|
||||
meta_screen_set_cursor (screen, META_CURSOR_BUSY);
|
||||
meta_screen_set_cursor (screen, pointer, META_CURSOR_BUSY);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_STARTUP,
|
||||
"Setting default cursor\n");
|
||||
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
|
||||
meta_screen_set_cursor (screen, pointer, META_CURSOR_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user