summaryrefslogtreecommitdiff
path: root/src/themes/standard
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-07-27 23:17:39 +0200
committerinfirit <[email protected]>2015-07-28 20:02:12 +0200
commitf0bcfaeca30ae5a7992007bbc47406144851cf26 (patch)
treecd894aa0ed7c78138906660c729ec58feea6bbf8 /src/themes/standard
parent1dba07c1777dc93b8a79e99140b63a12239b57ca (diff)
downloadmate-notification-daemon-f0bcfaeca30ae5a7992007bbc47406144851cf26.tar.bz2
mate-notification-daemon-f0bcfaeca30ae5a7992007bbc47406144851cf26.tar.xz
standard: 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/standard')
-rw-r--r--src/themes/standard/theme.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index a61a0d9..b91fe3e 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -474,18 +474,14 @@ static void draw_border(GtkWidget* widget, WindowData *windata, cairo_t* cr)
cairo_stroke(cr);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
-static gboolean paint_window(GtkWidget* widget, cairo_t* cr, WindowData* windata)
-#else
-static gboolean paint_window(GtkWidget* widget, GdkEventExpose* event, WindowData* windata)
-#endif
+static void
+paint_window (GtkWidget *widget,
+ cairo_t *cr,
+ WindowData *windata)
{
cairo_t* cr2;
cairo_surface_t* surface;
GtkAllocation allocation;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_t* cr = gdk_cairo_create (event->window);
-#endif
gtk_widget_get_allocation(windata->win, &allocation);
@@ -515,12 +511,28 @@ static gboolean paint_window(GtkWidget* widget, GdkEventExpose* event, WindowDat
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint(cr);
cairo_surface_destroy(surface);
+}
+
+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);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy(cr);
-#endif
return FALSE;
}
+#endif
static void destroy_windata(WindowData* windata)
{
@@ -675,9 +687,9 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
#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
windata->top_spacer = gtk_image_new();