summaryrefslogtreecommitdiff
path: root/src/themes/coco
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-07-26 12:29:28 +0200
committerinfirit <[email protected]>2015-07-28 12:44:04 +0200
commit6de22307224c124f1283381a383fc97506d0c2f2 (patch)
tree0db0d8732d49f2f81bce736c3f8e1b71faf17381 /src/themes/coco
parentfe992fa646e9ed9aede105261b297204bad74491 (diff)
downloadmate-notification-daemon-6de22307224c124f1283381a383fc97506d0c2f2.tar.bz2
mate-notification-daemon-6de22307224c124f1283381a383fc97506d0c2f2.tar.xz
coco: Move the draw and expose-event handling from paint_window
No functional change but this makes the code a bit cleaner and easier to read.
Diffstat (limited to 'src/themes/coco')
-rw-r--r--src/themes/coco/coco-theme.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index 1ffbc2f..805177e 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -256,23 +256,17 @@ update_shape_mask (WindowData* windata)
}
#endif
-static gboolean
-paint_window(GtkWidget *widget,
-#if GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr,
-#else
- GdkEventExpose *event,
-#endif
- WindowData *windata)
+static void
+paint_window (GtkWidget *widget,
+ cairo_t *cr,
+ WindowData *windata)
{
cairo_surface_t *surface;
cairo_t *cr2;
- GtkAllocation allocation;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (event->window);
-#endif
if (windata->width == 0 || windata->height == 0) {
+ GtkAllocation allocation;
+
gtk_widget_get_allocation(windata->win, &allocation);
windata->width = allocation.width;
windata->height = allocation.height;
@@ -309,11 +303,28 @@ paint_window(GtkWidget *widget,
#endif
cairo_surface_destroy (surface);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy(cr);
-#endif
+}
+
+static gboolean
+#if GTK_CHECK_VERSION (3, 0, 0)
+on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata)
+{
+ paint_window (widget, cr, windata);
+
+ return FALSE;
+}
+#else
+on_expose_event (GtkWidget *widget, GdkEventExpose *event, WindowData *windata)
+{
+ cairo_t *cr = gdk_cairo_create (event->window);
+
+ paint_window (widget, cr, windata);
+
+ cairo_destroy (cr);
+
return FALSE;
}
+#endif
/* Event handlers */
static gboolean
@@ -506,11 +517,11 @@ create_notification(UrlClickedCb url_clicked)
gtk_container_add(GTK_CONTAINER(drawbox), main_vbox);
#if GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(main_vbox), "draw",
- G_CALLBACK(paint_window), windata);
+ g_signal_connect (G_OBJECT (main_vbox), "draw",
+ G_CALLBACK (on_draw), windata);
#else
- g_signal_connect(G_OBJECT(main_vbox), "expose_event",
- G_CALLBACK(paint_window), windata);
+ g_signal_connect (G_OBJECT (main_vbox), "expose_event",
+ G_CALLBACK (on_expose_event), windata);
#endif
g_signal_connect (G_OBJECT (win), "configure-event", G_CALLBACK (on_configure_event), windata);