forked from AuroraMiddleware/gtk
window: Add private API to hardcode the main GdkWindow for a GtkWindow
This must be called while the window is not realized yet, and sets the GdkWindow that will be used for the next GtkWindow's realize/unrealize cycle. The GtkWindow takes ownership on the GdkWindow, and as such it will be destroyed when the widget is unrealized. https://bugzilla.gnome.org/show_bug.cgi?id=697855
This commit is contained in:
parent
8504890867
commit
ee93db1659
@ -232,6 +232,8 @@ struct _GtkWindowPrivate
|
||||
guint use_subsurface : 1;
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
|
||||
GdkWindow *hardcoded_window;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -6326,6 +6328,14 @@ gtk_window_realize (GtkWidget *widget)
|
||||
g_return_if_fail (!gtk_widget_get_realized (widget));
|
||||
}
|
||||
|
||||
if (priv->hardcoded_window)
|
||||
{
|
||||
gdk_window = priv->hardcoded_window;
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gdk_window_resize (gdk_window, allocation.width, allocation.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (priv->type)
|
||||
{
|
||||
case GTK_WINDOW_TOPLEVEL:
|
||||
@ -6380,6 +6390,8 @@ gtk_window_realize (GtkWidget *widget)
|
||||
attributes_mask |= (priv->wmclass_name ? GDK_WA_WMCLASS : 0);
|
||||
|
||||
gdk_window = gdk_window_new (parent_window, &attributes, attributes_mask);
|
||||
}
|
||||
|
||||
gtk_widget_set_window (widget, gdk_window);
|
||||
gtk_widget_register_window (widget, gdk_window);
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
@ -6579,6 +6591,8 @@ gtk_window_unrealize (GtkWidget *widget)
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
|
||||
|
||||
priv->hardcoded_window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -11717,3 +11731,21 @@ gtk_window_set_use_subsurface (GtkWindow *window,
|
||||
|
||||
priv->use_subsurface = use_subsurface;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_window_set_hardcoded_window (GtkWindow *window,
|
||||
GdkWindow *gdk_window)
|
||||
{
|
||||
GtkWindowPrivate *priv = window->priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
|
||||
|
||||
if (priv->hardcoded_window)
|
||||
g_object_unref (priv->hardcoded_window);
|
||||
|
||||
priv->hardcoded_window = gdk_window;
|
||||
|
||||
if (gdk_window)
|
||||
g_object_ref (gdk_window);
|
||||
}
|
||||
|
@ -121,6 +121,8 @@ GdkPixbuf *gtk_window_get_icon_for_size (GtkWindow *window,
|
||||
|
||||
void gtk_window_set_use_subsurface (GtkWindow *window,
|
||||
gboolean use_subsurface);
|
||||
void gtk_window_set_hardcoded_window (GtkWindow *window,
|
||||
GdkWindow *gdk_window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user