[mutter/wip/xinput2: 45/49] screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/xinput2: 45/49] screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
- Date: Fri, 15 Jul 2011 16:32:52 +0000 (UTC)
commit 972a9d231f08865c2ed66ecfc4cfe719a51002a7
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 4 20:23:33 2011 +0200
screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
At the moment feedback is only provided for the Virtual Core Pointer
src/core/display.c | 13 ++++++++++---
src/core/screen-private.h | 7 +++++--
src/core/screen.c | 45 ++++++++++++++++++++++++++-------------------
3 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index a9bdc79..69c58df 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -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
}
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index 92e724b..6820304 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -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,
diff --git a/src/core/screen.c b/src/core/screen.c
index dc434fd..971d696 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -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;
+
+ old_cursor = GPOINTER_TO_UINT (g_hash_table_lookup (screen->cursors, pointer));
- if (cursor == screen->current_cursor)
+ 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]