[GTK] gdk_display_get_device_manager and gdk_screen_get_width/height are deprecated
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 11:38:45 +0000 (11:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 11:38:45 +0000 (11:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198822

Patch by Ludovico de Nittis <ludovico.denittis@collabora.com> on 2019-06-13
Reviewed by Carlos Garcia Campos.

GdkSeat and GdkRectangle should be used, respectively.

Source/WebCore:

No behaviour changes.

* platform/gtk/GtkVersioning.c:
(getDefaultGDKPointerDevice):
(getScreenWorkArea):

Source/WebKit:

* UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
(WebKit::doMouseEvent):
(WebKit::doMotionEvent):
(WebKit::doKeyStrokeEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246398 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/gtk/GtkVersioning.c
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp

index da8ea14..3b25d88 100644 (file)
@@ -1,3 +1,18 @@
+2019-06-13  Ludovico de Nittis  <ludovico.denittis@collabora.com>
+
+        [GTK] gdk_display_get_device_manager and gdk_screen_get_width/height are deprecated
+        https://bugs.webkit.org/show_bug.cgi?id=198822
+
+        Reviewed by Carlos Garcia Campos.
+
+        GdkSeat and GdkRectangle should be used, respectively.
+
+        No behaviour changes.
+
+        * platform/gtk/GtkVersioning.c:
+        (getDefaultGDKPointerDevice):
+        (getScreenWorkArea):
+
 2019-06-12  Antoine Quint  <graouts@apple.com>
 
         [WHLSL] Hook up compute
index 0d51b38..01e5863 100644 (file)
@@ -30,7 +30,9 @@
 
 GdkDevice *getDefaultGDKPointerDevice(GdkWindow* window)
 {
-#ifndef GTK_API_VERSION_2
+#if GTK_CHECK_VERSION(3, 20, 0)
+    return gdk_seat_get_pointer(gdk_display_get_default_seat(gdk_window_get_display(window)));
+#elif !defined(GTK_API_VERSION_2)
     GdkDeviceManager *manager =  gdk_display_get_device_manager(gdk_window_get_display(window));
     return gdk_device_manager_get_client_pointer(manager);
 #else
@@ -233,10 +235,20 @@ static void getScreenWorkArea(GdkScreen *screen, GdkRectangle *area)
     Atom workArea = XInternAtom(display, "_NET_WORKAREA", True);
 
     /* Defaults in case of error. */
+#if GTK_CHECK_VERSION(3, 22, 0)
+    GdkRectangle geom;
+    GdkMonitor *monitor = gdk_display_get_primary_monitor(display);
+    gdk_monitor_get_geometry(monitor, &geom);
+    area->x = geom.x;
+    area->y = geom.y;
+    area->width = geom.width;
+    area->height = geom.height;
+#else
     area->x = 0;
     area->y = 0;
     area->width = gdk_screen_get_width(screen);
     area->height = gdk_screen_get_height(screen);
+#endif
 
     if (workArea == None)
         return;
index 0d99009..80a2155 100644 (file)
@@ -1,3 +1,17 @@
+2019-06-13  Ludovico de Nittis  <ludovico.denittis@collabora.com>
+
+        [GTK] gdk_display_get_device_manager and gdk_screen_get_width/height are deprecated
+        https://bugs.webkit.org/show_bug.cgi?id=198822
+
+        Reviewed by Carlos Garcia Campos.
+
+        GdkSeat and GdkRectangle should be used, respectively.
+
+        * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
+        (WebKit::doMouseEvent):
+        (WebKit::doMotionEvent):
+        (WebKit::doKeyStrokeEvent):
+
 2019-06-12  Antoine Quint  <graouts@apple.com>
 
         Show the web page URL when sharing an AR model
index 36f78a8..ce92b07 100644 (file)
@@ -75,7 +75,11 @@ static void doMouseEvent(GdkEventType type, GtkWidget* widget, const WebCore::In
     event->button.axes = 0;
     event->button.state = state;
     event->button.button = button;
+#if GTK_CHECK_VERSION(3, 20, 0)
+    event->button.device = gdk_seat_get_pointer(gdk_display_get_default_seat(gtk_widget_get_display(widget)));
+#else
     event->button.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(widget)));
+#endif
     int xRoot, yRoot;
     gdk_window_get_root_coords(gtk_widget_get_window(widget), location.x(), location.y(), &xRoot, &yRoot);
     event->button.x_root = xRoot;
@@ -93,7 +97,11 @@ static void doMotionEvent(GtkWidget* widget, const WebCore::IntPoint& location,
     event->motion.y = location.y();
     event->motion.axes = 0;
     event->motion.state = state;
+#if GTK_CHECK_VERSION(3, 20, 0)
+    event->motion.device = gdk_seat_get_pointer(gdk_display_get_default_seat(gtk_widget_get_display(widget)));
+#else
     event->motion.device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(widget)));
+#endif
     int xRoot, yRoot;
     gdk_window_get_root_coords(gtk_widget_get_window(widget), location.x(), location.y(), &xRoot, &yRoot);
     event->motion.x_root = xRoot;
@@ -142,7 +150,12 @@ static void doKeyStrokeEvent(GdkEventType type, GtkWidget* widget, unsigned keyV
     event->key.time = GDK_CURRENT_TIME;
     event->key.window = gtk_widget_get_window(widget);
     g_object_ref(event->key.window);
+
+#if GTK_CHECK_VERSION(3, 20, 0)
+    gdk_event_set_device(event.get(), gdk_seat_get_pointer(gdk_display_get_default_seat(gtk_widget_get_display(widget))));
+#else
     gdk_event_set_device(event.get(), gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(widget))));
+#endif
     event->key.state = state;
 
     // When synthesizing an event, an invalid hardware_keycode value can cause it to be badly processed by GTK+.
@@ -332,4 +345,3 @@ void WebAutomationSession::platformSimulateKeySequence(WebPageProxy& page, const
 }
 
 } // namespace WebKit
-