[Xfce4-commits] [xfce/libxfce4ui] 01/01: gdk_display_get_device_manager is deprecated

noreply at xfce.org noreply at xfce.org
Fri Jun 10 17:42:16 CEST 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/libxfce4ui.

commit 646c34add7ac18928048d0e79cdb6daa23a59195
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Tue Jun 7 16:20:00 2016 +0300

    gdk_display_get_device_manager is deprecated
    
    Add in the new way of doing the same thing and add a test while
    we're at it.
---
 libxfce4ui/xfce-gdk-extensions.c |  8 +++++++-
 tests/test-ui.c                  | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/libxfce4ui/xfce-gdk-extensions.c b/libxfce4ui/xfce-gdk-extensions.c
index 90599a0..7cfd8a1 100644
--- a/libxfce4ui/xfce-gdk-extensions.c
+++ b/libxfce4ui/xfce-gdk-extensions.c
@@ -53,7 +53,13 @@ xfce_gdk_screen_get_active (gint *monitor_return)
   gint              rootx, rooty;
   GdkScreen        *screen;
 
-#if GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION (3, 20, 0)
+  GdkSeat *seat;
+
+  display = gdk_display_get_default ();
+  seat = gdk_display_get_default_seat (display);
+  gdk_device_get_position (gdk_seat_get_pointer (seat), &screen, &rootx, &rooty);
+#elif GTK_CHECK_VERSION (3, 0, 0)
   GdkDeviceManager *manager;
 
   display = gdk_display_get_default ();
diff --git a/tests/test-ui.c b/tests/test-ui.c
index 4f2e7e9..c50bd68 100644
--- a/tests/test-ui.c
+++ b/tests/test-ui.c
@@ -281,6 +281,19 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
+static void
+show_xfce_gdk_screen_get_active (GtkButton *button,
+                                 gpointer unused)
+{
+  gint       monitor_num;
+  GdkScreen *screen;
+
+  screen = xfce_gdk_screen_get_active (&monitor_num);
+
+  xfce_dialog_show_info(NULL, NULL, "monitor num: %d of %d",
+                        monitor_num, gdk_screen_get_n_monitors (screen));
+}
+
 
 
 static void
@@ -370,6 +383,12 @@ create_main_window (void)
   gtk_container_add (GTK_CONTAINER (box), button);
   gtk_widget_show (button);
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (show_xfce_titled_dialog_new_with_mixed_buttons), NULL);
+
+  /* xfce_gdk_screen_get_active */
+  button = gtk_button_new_with_label ("show xfce_gdk_screen_get_active");
+  gtk_container_add (GTK_CONTAINER (box), button);
+  gtk_widget_show (button);
+  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (show_xfce_gdk_screen_get_active), NULL);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list