scrolledwindow: set GDK_EXPOSURE_MASK on the overshoot window

Currently we use gtk_style_context_set_background() when the state flags
change in order to propagate the background color to the overshoot
window, but this is actually only needed because the window doesn't get
expose events, since we always draw a full background in draw().
This also fixes some problems when the GdkWindow of the scrolled
window's child is composited, as seen in oxygen-gtk3.

https://bugzilla.gnome.org/show_bug.cgi?id=686265
This commit is contained in:
Cosimo Cecchi 2012-10-17 00:59:59 -04:00
parent 5e55bf1d53
commit 4c9db15212

View File

@ -274,9 +274,6 @@ static void gtk_scrolled_window_realize (GtkWidget *wid
static void gtk_scrolled_window_unrealize (GtkWidget *widget);
static void gtk_scrolled_window_map (GtkWidget *widget);
static void gtk_scrolled_window_unmap (GtkWidget *widget);
static void gtk_scrolled_window_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_scrolled_window_style_updated (GtkWidget *widget);
static void gtk_scrolled_window_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
@ -352,8 +349,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
widget_class->unrealize = gtk_scrolled_window_unrealize;
widget_class->map = gtk_scrolled_window_map;
widget_class->unmap = gtk_scrolled_window_unmap;
widget_class->state_flags_changed = gtk_scrolled_window_state_flags_changed;
widget_class->style_updated = gtk_scrolled_window_style_updated;
widget_class->grab_notify = gtk_scrolled_window_grab_notify;
container_class->add = gtk_scrolled_window_add;
@ -3379,14 +3374,13 @@ gtk_scrolled_window_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK |
GDK_BUTTON_MOTION_MASK | GDK_TOUCH_MASK;
GDK_BUTTON_MOTION_MASK | GDK_TOUCH_MASK | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
scrolled_window->priv->overshoot_window =
gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (scrolled_window->priv->overshoot_window, widget);
child_widget = gtk_bin_get_child (GTK_BIN (widget));
@ -3432,37 +3426,6 @@ gtk_scrolled_window_unmap (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unmap (widget);
}
static void
_gtk_scrolled_window_update_background (GtkScrolledWindow *scrolled_window)
{
GtkWidget *widget = GTK_WIDGET (scrolled_window);
if (gtk_widget_get_realized (widget))
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, scrolled_window->priv->overshoot_window);
}
}
static void
gtk_scrolled_window_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
_gtk_scrolled_window_update_background (GTK_SCROLLED_WINDOW (widget));
gtk_widget_queue_draw (widget);
}
static void
gtk_scrolled_window_style_updated (GtkWidget *widget)
{
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->style_updated (widget);
_gtk_scrolled_window_update_background (GTK_SCROLLED_WINDOW (widget));
gtk_widget_queue_draw (widget);
}
static void
gtk_scrolled_window_grab_notify (GtkWidget *widget,
gboolean was_grabbed)