[gtk/wip/matthiasc/popup5: 39/186] Use GtkNative APIs instead of GtkRoot



commit 93c385331058c15516affb5a7da80f081cf0a108
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 26 18:02:55 2019 +0000

    Use GtkNative APIs instead of GtkRoot

 demos/gtk-demo/changedisplay.c         |  2 +-
 demos/node-editor/node-editor-window.c |  3 +--
 gtk/gtkimcontextxim.c                  |  4 ++--
 gtk/gtkmain.c                          |  5 +++--
 gtk/gtktooltip.c                       |  4 ++--
 gtk/gtkwidget.c                        |  7 ++++---
 gtk/gtkwindow.c                        | 16 ----------------
 gtk/inspector/inspect-button.c         |  4 ++--
 gtk/inspector/logs.c                   |  4 ++--
 gtk/inspector/window.c                 |  4 ++--
 10 files changed, 19 insertions(+), 34 deletions(-)
---
diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c
index 5f5717c43d..1ef592b21f 100644
--- a/demos/gtk-demo/changedisplay.c
+++ b/demos/gtk-demo/changedisplay.c
@@ -74,7 +74,7 @@ find_toplevel_at_pointer (GdkDisplay *display)
   pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
 
   if (pointer_window)
-    widget = GTK_WIDGET (gtk_root_get_for_surface (pointer_window));
+    widget = GTK_WIDGET (gtk_native_get_for_surface (pointer_window));
 
   return widget;
 }
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index 1b853d4984..ac34aa1719 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -464,8 +464,7 @@ create_texture (NodeEditorWindow *self)
   if (node == NULL)
     return NULL;
 
-  /* ahem */
-  renderer = GTK_ROOT_GET_IFACE (gtk_widget_get_root (GTK_WIDGET (self)))->get_renderer (gtk_widget_get_root 
(GTK_WIDGET (self)));
+  renderer = gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (self)));
   texture = gsk_renderer_render_texture (renderer, node, NULL);
   gsk_render_node_unref (node);
 
diff --git a/gtk/gtkimcontextxim.c b/gtk/gtkimcontextxim.c
index c203f502df..1157286e4f 100644
--- a/gtk/gtkimcontextxim.c
+++ b/gtk/gtkimcontextxim.c
@@ -22,7 +22,7 @@
 
 #include "gtkimcontextxim.h"
 #include "gtkimmoduleprivate.h"
-#include "gtkroot.h"
+#include "gtknative.h"
 
 #include "gtk/gtkintl.h"
 
@@ -1536,7 +1536,7 @@ update_client_widget (GtkIMContextXIM *context_xim)
   GtkWidget *new_client_widget = NULL;
 
   if (context_xim->client_surface)
-    new_client_widget = gtk_root_get_for_surface (context_xim->client_surface);
+    new_client_widget = gtk_native_get_for_surface (context_xim->client_surface);
 
   if (new_client_widget != context_xim->client_widget)
     {
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e7d423e4a6..9d2b2a414b 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -132,6 +132,7 @@
 #include "gtkprintbackendprivate.h"
 #include "gtkimmodule.h"
 #include "gtkroot.h"
+#include "gtknative.h"
 
 #include "a11y/gtkaccessibility.h"
 #include "inspector/window.h"
@@ -1329,7 +1330,7 @@ rewrite_event_for_grabs (GdkEvent *event)
     }
 
   event_widget = gtk_get_event_widget (event);
-  grab_widget = gtk_root_get_for_surface (grab_surface);
+  grab_widget = gtk_native_get_for_surface (grab_surface);
 
   if (grab_widget &&
       gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
@@ -2473,7 +2474,7 @@ gtk_get_event_widget (const GdkEvent *event)
   widget = NULL;
   if (event && event->any.surface &&
       (event->any.type == GDK_DESTROY || !gdk_surface_is_destroyed (event->any.surface)))
-    widget = gtk_root_get_for_surface (event->any.surface);
+    widget = gtk_native_get_for_surface (event->any.surface);
 
   return widget;
 }
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index aaf7fab1f5..619d3ace0a 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -429,7 +429,7 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
 
   g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
 
-  event_widget = gtk_root_get_for_surface (surface);
+  event_widget = gtk_native_get_for_surface (surface);
 
   if (!event_widget)
     return NULL;
@@ -500,7 +500,7 @@ gtk_tooltip_set_last_surface (GtkTooltip *tooltip,
                               (gpointer *) &tooltip->last_surface);
 
   if (surface)
-    window_widget = gtk_root_get_for_surface (surface);
+    window_widget = gtk_native_get_for_surface (surface);
 
   if (window_widget)
     window_widget = gtk_widget_get_toplevel (window_widget);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c2f26e170d..f70928217c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -70,6 +70,7 @@
 #include "gtkwidgetpathprivate.h"
 #include "gtkwindowgroup.h"
 #include "gtkwindowprivate.h"
+#include "gtknativeprivate.h"
 
 #include "a11y/gtkwidgetaccessible.h"
 #include "inspector/window.h"
@@ -13050,19 +13051,19 @@ gtk_widget_render (GtkWidget            *widget,
   GskRenderNode *root;
   int x, y;
 
-  if (!GTK_IS_ROOT (widget))
+  if (!GTK_IS_NATIVE (widget))
     return;
 
   /* We only render double buffered on native windows */
   if (!gdk_surface_has_native (surface))
     return;
 
-  renderer = gtk_root_get_renderer (GTK_ROOT (widget));
+  renderer = gtk_native_get_renderer (GTK_NATIVE (widget));
   if (renderer == NULL)
     return;
 
   snapshot = gtk_snapshot_new ();
-  gtk_root_get_surface_transform (GTK_ROOT (widget), &x, &y);
+  gtk_native_get_surface_transform (GTK_NATIVE (widget), &x, &y);
   gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
   gtk_widget_snapshot (widget, snapshot);
   root = gtk_snapshot_free_to_node (snapshot);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6c974394aa..5bae61a080 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2378,12 +2378,6 @@ gtk_window_native_get_renderer (GtkNative *native)
   return priv->renderer;
 }
 
-static GskRenderer *
-gtk_window_root_get_renderer (GtkRoot *root)
-{
-  return gtk_window_native_get_renderer (GTK_NATIVE (root));
-}
-
 static void
 gtk_window_native_get_surface_transform (GtkNative *native,
                                          int       *x,
@@ -2402,14 +2396,6 @@ gtk_window_native_get_surface_transform (GtkNative *native,
   *y = margin.top + border.top + padding.top;
 }
 
-static void
-gtk_window_root_get_surface_transform (GtkRoot *root,
-                                       int     *x,
-                                       int     *y)
-{
-  gtk_window_native_get_surface_transform (GTK_NATIVE (root), x, y);
-}
-
 static void
 gtk_window_native_check_resize (GtkNative *native)
 {
@@ -2420,8 +2406,6 @@ static void
 gtk_window_root_interface_init (GtkRootInterface *iface)
 {
   iface->get_display = gtk_window_root_get_display;
-  iface->get_renderer = gtk_window_root_get_renderer;
-  iface->get_surface_transform = gtk_window_root_get_surface_transform;
 }
 
 static void
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index ee3b3c70a4..0ebb226845 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -35,7 +35,7 @@
 #include "gtkgesturemultipress.h"
 #include "gtkeventcontrollermotion.h"
 #include "gtkeventcontrollerkey.h"
-#include "gtkroot.h"
+#include "gtknative.h"
 
 static GtkWidget *
 find_widget_at_pointer (GdkDevice *device)
@@ -46,7 +46,7 @@ find_widget_at_pointer (GdkDevice *device)
   pointer_surface = gdk_device_get_surface_at_position (device, NULL, NULL);
 
   if (pointer_surface)
-    widget = gtk_root_get_for_surface (pointer_surface);
+    widget = gtk_native_get_for_surface (pointer_surface);
 
   if (widget)
     {
diff --git a/gtk/inspector/logs.c b/gtk/inspector/logs.c
index 1bc73c7629..96add7e292 100644
--- a/gtk/inspector/logs.c
+++ b/gtk/inspector/logs.c
@@ -35,7 +35,7 @@
 #include "gtkprivate.h"
 #include "gtkdebug.h"
 #include "gdkinternals.h"
-#include "gtkrootprivate.h"
+#include "gtknative.h"
 #include "gskdebugprivate.h"
 #include "gskrendererprivate.h"
 
@@ -146,7 +146,7 @@ flag_toggled (GtkWidget        *button,
       if (toplevel == gtk_widget_get_toplevel (button)) /* skip the inspector */
         continue;
 
-      renderer = gtk_root_get_renderer (GTK_ROOT (toplevel));
+      renderer = gtk_native_get_renderer (GTK_NATIVE (toplevel));
       if (!renderer)
         continue;
 
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 683a95f079..71aeec9f69 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -48,7 +48,7 @@
 #include "gtklabel.h"
 #include "gtkmodulesprivate.h"
 #include "gtkprivate.h"
-#include "gtkrootprivate.h"
+#include "gtknative.h"
 #include "gtkstack.h"
 #include "gtktreeviewcolumn.h"
 #include "gtkwindowgroup.h"
@@ -297,7 +297,7 @@ gtk_inspector_window_realize (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (gtk_inspector_window_parent_class)->realize (widget);
 
-  renderer = gtk_root_get_renderer (GTK_ROOT (widget));
+  renderer = gtk_native_get_renderer (GTK_NATIVE (widget));
   gsk_renderer_set_debug_flags (renderer, 0);
 
   provider = gtk_css_provider_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]