forked from AuroraMiddleware/gtk
root: Move the renderer to the root
This commit is contained in:
parent
446713fb8b
commit
694d7c378b
@ -43,6 +43,12 @@ gtk_root_default_get_display (GtkRoot *self)
|
||||
return gdk_display_get_default ();
|
||||
}
|
||||
|
||||
static GskRenderer *
|
||||
gtk_root_default_get_renderer (GtkRoot *self)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_root_default_get_surface_transform (GtkRoot *self,
|
||||
int *x,
|
||||
@ -56,6 +62,7 @@ static void
|
||||
gtk_root_default_init (GtkRootInterface *iface)
|
||||
{
|
||||
iface->get_display = gtk_root_default_get_display;
|
||||
iface->get_renderer = gtk_root_default_get_renderer;
|
||||
iface->get_surface_transform = gtk_root_default_get_surface_transform;
|
||||
}
|
||||
|
||||
@ -70,6 +77,16 @@ gtk_root_get_display (GtkRoot *self)
|
||||
return iface->get_display (self);
|
||||
}
|
||||
|
||||
GskRenderer *
|
||||
gtk_root_get_renderer (GtkRoot *self)
|
||||
{
|
||||
GtkRootInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ROOT (self), NULL);
|
||||
|
||||
iface = GTK_ROOT_GET_IFACE (self);
|
||||
return iface->get_renderer (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_root_get_surface_transform (GtkRoot *self,
|
||||
|
@ -46,6 +46,7 @@ struct _GtkRootInterface
|
||||
|
||||
/*< public >*/
|
||||
GdkDisplay * (* get_display) (GtkRoot *self);
|
||||
GskRenderer * (* get_renderer) (GtkRoot *self);
|
||||
|
||||
void (* get_surface_transform) (GtkRoot *root,
|
||||
int *x,
|
||||
|
@ -6,6 +6,7 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkDisplay * gtk_root_get_display (GtkRoot *root);
|
||||
GskRenderer * gtk_root_get_renderer (GtkRoot *self);
|
||||
|
||||
void gtk_root_get_surface_transform (GtkRoot *self,
|
||||
int *x,
|
||||
|
@ -5085,18 +5085,6 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GskRenderer *
|
||||
gtk_widget_get_renderer (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = _gtk_widget_get_toplevel (widget);
|
||||
if (_gtk_widget_is_toplevel (toplevel))
|
||||
return gtk_window_get_renderer (GTK_WINDOW (toplevel));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define WIDGET_REALIZED_FOR_EVENT(widget, event) \
|
||||
(event->any.type == GDK_FOCUS_CHANGE || _gtk_widget_get_realized(widget))
|
||||
|
||||
@ -13230,11 +13218,14 @@ gtk_widget_render (GtkWidget *widget,
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *root;
|
||||
|
||||
if (!GTK_IS_ROOT (widget))
|
||||
return;
|
||||
|
||||
/* We only render double buffered on native windows */
|
||||
if (!gdk_surface_has_native (surface))
|
||||
return;
|
||||
|
||||
renderer = gtk_widget_get_renderer (widget);
|
||||
renderer = gtk_root_get_renderer (GTK_ROOT (widget));
|
||||
if (renderer == NULL)
|
||||
return;
|
||||
|
||||
|
@ -2507,6 +2507,15 @@ gtk_window_root_get_display (GtkRoot *root)
|
||||
return priv->display;
|
||||
}
|
||||
|
||||
static GskRenderer *
|
||||
gtk_window_root_get_renderer (GtkRoot *root)
|
||||
{
|
||||
GtkWindow *self = GTK_WINDOW (root);
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (self);
|
||||
|
||||
return priv->renderer;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_root_get_surface_transform (GtkRoot *root,
|
||||
int *x,
|
||||
@ -2520,6 +2529,7 @@ 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;
|
||||
}
|
||||
|
||||
@ -10578,14 +10588,6 @@ gtk_window_unexport_handle (GtkWindow *window)
|
||||
#endif
|
||||
}
|
||||
|
||||
GskRenderer *
|
||||
gtk_window_get_renderer (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
return priv->renderer;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_add_pointer_focus (GtkWindow *window,
|
||||
GtkPointerFocus *focus)
|
||||
|
@ -132,8 +132,6 @@ gboolean gtk_window_export_handle (GtkWindow *window,
|
||||
gpointer user_data);
|
||||
void gtk_window_unexport_handle (GtkWindow *window);
|
||||
|
||||
GskRenderer *gtk_window_get_renderer (GtkWindow *window);
|
||||
|
||||
GtkWidget * gtk_window_lookup_pointer_focus_widget (GtkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
#include "gtkrootprivate.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_window_get_renderer (GTK_WINDOW (toplevel));
|
||||
renderer = gtk_root_get_renderer (GTK_ROOT (toplevel));
|
||||
if (!renderer)
|
||||
continue;
|
||||
|
||||
|
@ -51,10 +51,10 @@
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmodulesprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrootprivate.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtktreeviewcolumn.h"
|
||||
#include "gtkwindowgroup.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW)
|
||||
|
||||
@ -273,7 +273,7 @@ gtk_inspector_window_realize (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_inspector_window_parent_class)->realize (widget);
|
||||
|
||||
renderer = gtk_window_get_renderer (GTK_WINDOW (widget));
|
||||
renderer = gtk_root_get_renderer (GTK_ROOT (widget));
|
||||
gsk_renderer_set_debug_flags (renderer, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user