mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-30 15:31:34 +00:00
widget: Store the expose event in the cairo_t, not just the window
This way we can grab it for propagating expose events. Not sure if we need to do this once we're all Cairo, but for now we do.
This commit is contained in:
parent
fb4ba51d44
commit
90379ed68a
@ -5070,14 +5070,21 @@ gtk_widget_real_mnemonic_activate (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const cairo_user_data_key_t window_key;
|
||||
static const cairo_user_data_key_t event_key;
|
||||
|
||||
static GdkWindow *
|
||||
gtk_cairo_get_window (cairo_t *cr)
|
||||
GdkEventExpose *
|
||||
_gtk_cairo_get_event (cairo_t *cr)
|
||||
{
|
||||
g_return_val_if_fail (cr != NULL, NULL);
|
||||
|
||||
return cairo_get_user_data (cr, &window_key);
|
||||
return cairo_get_user_data (cr, &event_key);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cairo_set_event (cairo_t *cr,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
cairo_set_user_data (cr, &event_key, event, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5101,23 +5108,17 @@ gboolean
|
||||
gtk_cairo_should_draw_window (cairo_t *cr,
|
||||
GdkWindow *window)
|
||||
{
|
||||
GdkWindow *cairo_window;
|
||||
GdkEventExpose *event;
|
||||
|
||||
g_return_val_if_fail (cr != NULL, FALSE);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
cairo_window = gtk_cairo_get_window (cr);
|
||||
event = _gtk_cairo_get_event (cr);
|
||||
|
||||
return cairo_window == NULL ||
|
||||
cairo_window == window;
|
||||
return event == NULL ||
|
||||
event->window == window;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cairo_set_window (cairo_t *cr,
|
||||
GdkWindow *window)
|
||||
{
|
||||
cairo_set_user_data (cr, &window_key, window, NULL);
|
||||
}
|
||||
static gboolean
|
||||
gtk_widget_real_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *expose)
|
||||
@ -5130,7 +5131,7 @@ gtk_widget_real_expose_event (GtkWidget *widget,
|
||||
return FALSE;
|
||||
|
||||
cr = gdk_cairo_create (expose->window);
|
||||
gtk_cairo_set_window (cr, expose->window);
|
||||
gtk_cairo_set_event (cr, expose);
|
||||
|
||||
gdk_cairo_region (cr, expose->region);
|
||||
cairo_clip (cr);
|
||||
@ -5171,7 +5172,7 @@ gtk_widget_real_expose_event (GtkWidget *widget,
|
||||
|
||||
/* unset here, so if someone keeps a reference to cr we
|
||||
* don't leak the window. */
|
||||
gtk_cairo_set_window (cr, NULL);
|
||||
gtk_cairo_set_event (cr, NULL);
|
||||
cairo_destroy (cr);
|
||||
|
||||
return result;
|
||||
|
@ -947,6 +947,8 @@ GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
|
||||
GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
|
||||
void gtk_requisition_free (GtkRequisition *requisition);
|
||||
|
||||
GdkEventExpose * _gtk_cairo_get_event (cairo_t *cr);
|
||||
|
||||
void _gtk_widget_set_has_default (GtkWidget *widget,
|
||||
gboolean has_default);
|
||||
void _gtk_widget_set_has_grab (GtkWidget *widget,
|
||||
|
Loading…
Reference in New Issue
Block a user