eventbox: Remove window

This commit is contained in:
Timm Bäder 2017-07-01 18:16:24 +02:00 committed by Matthias Clasen
parent 82eafb8a2c
commit 2c958df789

View File

@ -30,6 +30,7 @@
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtkrender.h" #include "gtkrender.h"
#include "gtksizerequest.h" #include "gtksizerequest.h"
#include "gtkwidgetprivate.h"
/** /**
@ -106,7 +107,7 @@ gtk_event_box_class_init (GtkEventBoxClass *class)
static void static void
gtk_event_box_init (GtkEventBox *event_box) gtk_event_box_init (GtkEventBox *event_box)
{ {
gtk_widget_set_has_window (GTK_WIDGET (event_box), TRUE); gtk_widget_set_has_window (GTK_WIDGET (event_box), FALSE);
event_box->priv = gtk_event_box_get_instance_private (event_box); event_box->priv = gtk_event_box_get_instance_private (event_box);
event_box->priv->above_child = FALSE; event_box->priv->above_child = FALSE;
@ -370,40 +371,16 @@ gtk_event_box_realize (GtkWidget *widget)
{ {
GtkEventBoxPrivate *priv; GtkEventBoxPrivate *priv;
GtkAllocation allocation; GtkAllocation allocation;
GdkWindow *window;
gboolean visible_window;
priv = GTK_EVENT_BOX (widget)->priv; priv = GTK_EVENT_BOX (widget)->priv;
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_window_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE); GTK_WIDGET_CLASS (gtk_event_box_parent_class)->realize (widget);
visible_window = gtk_widget_get_has_window (widget); if (priv->above_child)
if (visible_window)
{ {
window = gdk_window_new_child (gtk_widget_get_parent_window (widget), priv->event_window = gdk_window_new_input (gtk_widget_get_window (widget),
GDK_ALL_EVENTS_MASK,
&allocation);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);
}
else
{
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
}
if (!visible_window || priv->above_child)
{
if (visible_window)
{
allocation.x = 0;
allocation.y = 0;
}
priv->event_window = gdk_window_new_input (window,
GDK_ALL_EVENTS_MASK, GDK_ALL_EVENTS_MASK,
&allocation); &allocation);
gtk_widget_register_window (widget, priv->event_window); gtk_widget_register_window (widget, priv->event_window);
@ -485,13 +462,6 @@ gtk_event_box_size_allocate (GtkWidget *widget,
child_allocation.y, child_allocation.y,
child_allocation.width, child_allocation.width,
child_allocation.height); child_allocation.height);
if (gtk_widget_get_has_window (widget))
gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x,
allocation->y,
child_allocation.width,
child_allocation.height);
} }
baseline = gtk_widget_get_allocated_baseline (widget); baseline = gtk_widget_get_allocated_baseline (widget);