diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-11-29 09:43:26 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-11-29 22:12:30 +0800 |
commit | d50deaf449913deaa71e05960e1c0f97cff05e93 (patch) | |
tree | 2920cc721b4f93d941a9d415ce9fe6c45f9691f0 | |
parent | 0b9efdacc1ff9bdc53e6cb6deb107597a9858c1e (diff) | |
download | gsoc2013-evolution-d50deaf449913deaa71e05960e1c0f97cff05e93.tar.gz gsoc2013-evolution-d50deaf449913deaa71e05960e1c0f97cff05e93.tar.zst gsoc2013-evolution-d50deaf449913deaa71e05960e1c0f97cff05e93.zip |
Avoid gdk_window_get_pointer().
Use gdk_window_get_device_position() instead.
-rw-r--r-- | mail/em-folder-tree.c | 8 | ||||
-rw-r--r-- | widgets/misc/e-buffer-tagger.c | 38 |
2 files changed, 39 insertions, 7 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 4226d5663a..615857eda1 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2654,13 +2654,19 @@ tree_autoscroll (EMFolderTree *folder_tree) GtkScrollable *scrollable; GdkRectangle rect; GdkWindow *window; + GdkDisplay *display; + GdkDeviceManager *device_manager; + GdkDevice *device; gdouble value; gint offset, y; /* Get the y pointer position relative to the treeview. */ tree_view = GTK_TREE_VIEW (folder_tree); window = gtk_tree_view_get_bin_window (tree_view); - gdk_window_get_pointer (window, NULL, &y, NULL); + display = gdk_window_get_display (window); + device_manager = gdk_display_get_device_manager (display); + device = gdk_device_manager_get_client_pointer (device_manager); + gdk_window_get_device_position (window, device, NULL, &y, NULL); /* Rect is in coorinates relative to the scrolled window, * relative to the treeview. */ diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c index 650abb3d9d..8a0d7ccbc3 100644 --- a/widgets/misc/e-buffer-tagger.c +++ b/widgets/misc/e-buffer-tagger.c @@ -126,6 +126,24 @@ markup_text (GtkTextBuffer *buffer) g_free (text); } +static void +get_pointer_position (GtkTextView *text_view, + gint *x, + gint *y) +{ + GdkWindow *window; + GdkDisplay *display; + GdkDeviceManager *device_manager; + GdkDevice *device; + + window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_WIDGET); + display = gdk_window_get_display (window); + device_manager = gdk_display_get_device_manager (display); + device = gdk_device_manager_get_client_pointer (device_manager); + + gdk_window_get_device_position (window, device, x, y, NULL); +} + static guint32 get_state (GtkTextBuffer *buffer) { @@ -338,7 +356,8 @@ update_mouse_cursor (GtkTextView *text_view, else gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor); - gdk_window_get_pointer (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_WIDGET), NULL, NULL, NULL); + /* XXX Is this necessary? Appears to be a no-op. */ + get_pointer_position (text_view, NULL, NULL); } hovering_over_link = (state & E_BUFFER_TAGGER_STATE_IS_HOVERING_TOOLTIP) != 0; @@ -438,7 +457,7 @@ update_ctrl_state (GtkTextView *textview, update_state (buffer, E_BUFFER_TAGGER_STATE_CTRL_DOWN, ctrl_is_down != FALSE); } - gdk_window_get_pointer (gtk_text_view_get_window (textview, GTK_TEXT_WINDOW_WIDGET), &x, &y, NULL); + get_pointer_position (textview, &x, &y); gtk_text_view_window_to_buffer_coords (textview, GTK_TEXT_WINDOW_WIDGET, x, y, &x, &y); update_mouse_cursor (textview, x, y); } @@ -471,10 +490,17 @@ textview_event_after (GtkTextView *textview, } if (!gdk_event_get_state (ev, &mt)) { - GdkWindow *w = gtk_widget_get_parent_window (GTK_WIDGET (textview)); + GdkWindow *window; + GdkDisplay *display; + GdkDeviceManager *device_manager; + GdkDevice *device; + + window = gtk_widget_get_parent_window (GTK_WIDGET (textview)); + display = gdk_window_get_display (window); + device_manager = gdk_display_get_device_manager (display); + device = gdk_device_manager_get_client_pointer (device_manager); - if (w) - gdk_window_get_pointer (w, NULL, NULL, &mt); + gdk_window_get_device_position (window, device, NULL, NULL, &mt); } update_ctrl_state (textview, (mt & GDK_CONTROL_MASK) != 0); @@ -533,7 +559,7 @@ textview_visibility_notify_event (GtkTextView *textview, g_return_val_if_fail (GTK_IS_TEXT_VIEW (textview), FALSE); - gdk_window_get_pointer (gtk_text_view_get_window (textview, GTK_TEXT_WINDOW_WIDGET), &wx, &wy, NULL); + get_pointer_position (textview, &wx, &wy); gtk_text_view_window_to_buffer_coords ( textview, |