[gtk/wip/matthiasc/popup5: 10/115] widget: Use GtkNative
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup5: 10/115] widget: Use GtkNative
- Date: Sun, 19 May 2019 04:45:14 +0000 (UTC)
commit 5ff3e276b8cd6c88797e193d23102c8977227ebb
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 29 13:47:40 2019 -0400
widget: Use GtkNative
gtk/gtkwidget.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 342e93f384..5ede997e4b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -56,6 +56,8 @@
#include "gtkprivate.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
+#include "gtkrootprivate.h"
+#include "gtknativeprivate.h"
#include "gtkscrollable.h"
#include "gtkselection.h"
#include "gtksettingsprivate.h"
@@ -3635,7 +3637,7 @@ sync_widget_surface_transform (GtkWidget *widget)
was_valid = surface_transform_data->cached_surface_transform_valid;
prev_transform = surface_transform_data->cached_surface_transform;
- if (GTK_IS_ROOT (widget))
+ if (GTK_IS_NATIVE (widget))
{
gsk_transform_to_matrix (priv->transform,
&surface_transform_data->cached_surface_transform);
@@ -3645,15 +3647,20 @@ sync_widget_surface_transform (GtkWidget *widget)
{
surface_transform_data->cached_surface_transform_valid = FALSE;
}
- else if (gtk_widget_compute_transform (widget, GTK_WIDGET (priv->root),
- &surface_transform_data->cached_surface_transform))
- {
- surface_transform_data->cached_surface_transform_valid = TRUE;
- }
else
{
- g_warning ("Could not compute surface transform");
- surface_transform_data->cached_surface_transform_valid = FALSE;
+ GtkWidget *native = gtk_widget_get_ancestor (widget, GTK_TYPE_NATIVE);
+
+ if (gtk_widget_compute_transform (widget, native,
+ &surface_transform_data->cached_surface_transform))
+ {
+ surface_transform_data->cached_surface_transform_valid = TRUE;
+ }
+ else
+ {
+ g_warning ("Could not compute surface transform");
+ surface_transform_data->cached_surface_transform_valid = FALSE;
+ }
}
if (was_valid != surface_transform_data->cached_surface_transform_valid ||
@@ -11416,7 +11423,7 @@ gtk_widget_unregister_surface (GtkWidget *widget,
*
* Returns: (transfer none) (nullable): @widget’s surface.
*/
-GdkSurface*
+GdkSurface *
gtk_widget_get_surface (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
@@ -13023,19 +13030,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);
@@ -13442,7 +13449,7 @@ gtk_widget_set_cursor (GtkWidget *widget,
root = _gtk_widget_get_root (widget);
if (root)
- gtk_root_maybe_update_cursor (root, widget, NULL);
+ gtk_window_maybe_update_cursor (GTK_WINDOW (root), widget, NULL);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CURSOR]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]