[gimp/gtk3-port: 200/233] app: use gdk_device_get_position() inetad of gdk_display_get_pointer()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 200/233] app: use gdk_device_get_position() inetad of gdk_display_get_pointer()
- Date: Thu, 22 Sep 2016 22:37:10 +0000 (UTC)
commit bf9a49f34deb9efe6d765fc05c0d4f1849edc344
Author: Michael Natterer <mitch gimp org>
Date: Sat Mar 5 21:29:21 2011 +0100
app: use gdk_device_get_position() inetad of gdk_display_get_pointer()
app/widgets/gimpuimanager.c | 20 ++++++++++++--------
libgimpwidgets/gimpwidgetsutils.c | 10 +++++++---
2 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c
index 1249191..4dc941d 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -796,20 +796,24 @@ gimp_ui_manager_menu_position (GtkMenu *menu,
gint *y,
gpointer data)
{
- GdkScreen *screen;
- GtkRequisition requisition;
- GdkRectangle rect;
- gint monitor;
- gint pointer_x;
- gint pointer_y;
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+ GdkScreen *screen;
+ GtkRequisition requisition;
+ GdkRectangle rect;
+ gint monitor;
+ gint pointer_x;
+ gint pointer_y;
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
g_return_if_fail (GTK_IS_WIDGET (data));
- gdk_display_get_pointer (gtk_widget_get_display (GTK_WIDGET (data)),
- &screen, &pointer_x, &pointer_y, NULL);
+ device_manager = gdk_display_get_device_manager (gtk_widget_get_display (data));
+ device = gdk_device_manager_get_client_pointer (device_manager);
+
+ gdk_device_get_position (device, &screen, &pointer_x, &pointer_y);
monitor = gdk_screen_get_monitor_at_point (screen, pointer_x, pointer_y);
gdk_screen_get_monitor_workarea (screen, monitor, &rect);
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index 54a409d..9c2eee5 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -343,12 +343,16 @@ gimp_widget_get_monitor (GtkWidget *widget)
gint
gimp_get_monitor_at_pointer (GdkScreen **screen)
{
- gint x, y;
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+ gint x, y;
g_return_val_if_fail (screen != NULL, 0);
- gdk_display_get_pointer (gdk_display_get_default (),
- screen, &x, &y, NULL);
+ device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
+ device = gdk_device_manager_get_client_pointer (device_manager);
+
+ gdk_device_get_position (device, screen, &x, &y);
return gdk_screen_get_monitor_at_point (*screen, x, y);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]