summaryrefslogtreecommitdiff
path: root/src/themes
diff options
context:
space:
mode:
Diffstat (limited to 'src/themes')
-rw-r--r--src/themes/slider/theme.c75
1 files changed, 47 insertions, 28 deletions
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index ad7a314..213263c 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -268,49 +268,53 @@ update_shape_mask (WindowData* windata)
g_object_unref (mask);
}
#endif
-static void paint_window(GtkWidget* widget, WindowData* windata)
+static void paint_window (GtkWidget *widget,
+ cairo_t *cr,
+ WindowData *windata)
{
- cairo_t* context;
- cairo_surface_t* surface;
- cairo_t* cr;
+ cairo_surface_t *surface;
+ cairo_t *cr2;
if (windata->width == 0 || windata->height == 0)
{
- GtkAllocation allocation;
+ GtkAllocation allocation;
- gtk_widget_get_allocation(windata->win, &allocation);
+ gtk_widget_get_allocation (windata->win, &allocation);
- windata->width = MAX(allocation.width, 1);
- windata->height = MAX(allocation.height, 1);
+ windata->width = MAX (allocation.width, 1);
+ windata->height = MAX (allocation.height, 1);
}
- context = gdk_cairo_create(gtk_widget_get_window(widget));
-
- cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- GtkAllocation allocation;
+ surface = cairo_surface_create_similar (cairo_get_target (cr),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ windata->width,
+ windata->height);
- gtk_widget_get_allocation(widget, &allocation);
+ cr2 = cairo_create (surface);
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
+ /* transparent background */
+ cairo_rectangle (cr2, 0, 0, windata->width, windata->height);
+ cairo_set_source_rgba (cr2, 0.0, 0.0, 0.0, 0.0);
+ cairo_fill (cr2);
- cr = cairo_create(surface);
+ fill_background (widget, windata, cr2);
- fill_background(widget, windata, cr);
-
- cairo_destroy(cr);
- cairo_set_source_surface(context, surface, 0, 0);
- cairo_paint(context);
- cairo_surface_destroy(surface);
- cairo_destroy(context);
+ cairo_destroy(cr2);
+ cairo_save (cr);
+ cairo_set_source_surface(cr, surface, 0, 0);
+ cairo_paint(cr);
#if GTK_CHECK_VERSION (3, 0, 0)
update_shape_region (surface, windata);
#else
update_shape_mask (windata);
#endif
+ cairo_restore (cr);
+ cairo_surface_destroy(surface);
}
static gboolean on_window_map(GtkWidget* widget, GdkEvent* event, WindowData* windata)
@@ -319,15 +323,30 @@ static gboolean on_window_map(GtkWidget* widget, GdkEvent* event, WindowData* wi
}
#if GTK_CHECK_VERSION (3, 0, 0)
-static gboolean on_window_draw(GtkWidget* widget, cairo_t* cr, WindowData* windata)
+static gboolean
+on_draw (GtkWidget *widget,
+ cairo_t *cr,
+ WindowData *windata)
+{
+ paint_window (widget, cr, windata);
+
+ return FALSE;
+}
#else
-static gboolean on_window_expose(GtkWidget* widget, GdkEventExpose* event, WindowData* windata)
-#endif
+static gboolean
+on_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ WindowData *windata)
{
- paint_window(widget, windata);
+ cairo_t *cr = gdk_cairo_create (event->window);
+
+ paint_window (widget, cr, windata);
+
+ cairo_destroy (cr);
return FALSE;
}
+#endif
static void destroy_windata(WindowData* windata)
{
@@ -578,9 +597,9 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
#endif
g_signal_connect(G_OBJECT(win), "map-event", G_CALLBACK(on_window_map), windata);
#if GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(win), "draw", G_CALLBACK(on_window_draw), windata);
+ g_signal_connect(G_OBJECT(win), "draw", G_CALLBACK(on_draw), windata);
#else
- g_signal_connect(G_OBJECT(win), "expose-event", G_CALLBACK(on_window_expose), windata);
+ g_signal_connect(G_OBJECT(win), "expose-event", G_CALLBACK(on_expose_event), windata);
#endif
g_signal_connect(G_OBJECT(win), "realize", G_CALLBACK(on_window_realize), windata);