From 1b4adb02f594d8453f753f14173744d28f780f15 Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 13 Dec 2014 13:22:22 +0100 Subject: Gtk3: Fixup draw-event handling Missing bits taken from GSD commit: 0d114cf6f19f3ae0d3e73e2b38c5bd1fd495e390 From: William Jon McCann --- plugins/common/msd-osd-window.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/common/msd-osd-window.c b/plugins/common/msd-osd-window.c index 46dfebd..d0e0cf3 100644 --- a/plugins/common/msd-osd-window.c +++ b/plugins/common/msd-osd-window.c @@ -55,7 +55,11 @@ struct MsdOsdWindowPrivate }; enum { +#if GTK_CHECK_VERSION (3, 0, 0) + DRAW_WHEN_COMPOSITED, +#else EXPOSE_WHEN_COMPOSITED, +#endif LAST_SIGNAL }; @@ -221,7 +225,7 @@ msd_osd_window_color_reverse (const GdkColor *a, b->blue = blue * 65535.0; } -/* This is our expose-event handler when the window is in a compositing manager. +/* This is our expose/draw-event handler when the window is in a compositing manager. * We draw everything by hand, using Cairo, so that we can have a nice * transparent/rounded look. */ @@ -288,7 +292,11 @@ expose_when_composited (GtkWidget *widget, GdkEventExpose *event) cairo_set_line_width (cr, 1); cairo_stroke (cr); +#if GTK_CHECK_VERSION (3, 0, 0) + g_signal_emit (window, signals[DRAW_WHEN_COMPOSITED], 0, cr); +#else g_signal_emit (window, signals[EXPOSE_WHEN_COMPOSITED], 0, cr); +#endif cairo_destroy (cr); @@ -309,7 +317,7 @@ expose_when_composited (GtkWidget *widget, GdkEventExpose *event) #endif } -/* This is our expose-event handler when the window is *not* in a compositing manager. +/* This is our expose/draw-event handler when the window is *not* in a compositing manager. * We just draw a rectangular frame by hand. We do this with hardcoded drawing code, * instead of GtkFrame, to avoid changing the window's internal widget hierarchy: in * either case (composited or non-composited), callers can assume that this works @@ -494,7 +502,7 @@ msd_osd_window_style_set (GtkWidget *widget, GTK_WIDGET_CLASS (msd_osd_window_parent_class)->style_set (widget, previous_style); /* We set our border width to 12 (per the MATE standard), plus the - * thickness of the frame that we draw in our expose handler. This will + * thickness of the frame that we draw in our expose/draw handler. This will * make our child be 12 pixels away from the frame. */ @@ -596,7 +604,7 @@ msd_osd_window_class_init (MsdOsdWindowClass *klass) #endif #if GTK_CHECK_VERSION (3, 0, 0) - signals[EXPOSE_WHEN_COMPOSITED] = g_signal_new ("draw-when-composited", + signals[DRAW_WHEN_COMPOSITED] = g_signal_new ("draw-when-composited", #else signals[EXPOSE_WHEN_COMPOSITED] = g_signal_new ("expose-when-composited", #endif -- cgit v1.2.1