[mutter/wip/multitouchr: 46/73] screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/multitouchr: 46/73] screen: Use meta_device_pointer_set_window_cursor() for startup sequence.
- Date: Sat, 3 Nov 2012 23:54:04 +0000 (UTC)
commit 8da5a01c920600d098c674b000e36b24395671a7
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 27e30da..cbe37d4 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4497,22 +4497,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 31a2469..f5d54f2 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -92,7 +92,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_foreach_window (MetaScreen *scree
gpointer data);
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 7b5df82..a2ec68a 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -767,10 +767,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;
@@ -795,8 +795,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 =
@@ -958,6 +956,8 @@ meta_screen_free (MetaScreen *screen,
g_free (screen->screen_name);
+ g_hash_table_destroy (screen->cursors);
+
g_object_unref (screen);
XFlush (display->xdisplay);
@@ -1576,31 +1576,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
@@ -3071,17 +3073,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]