summaryrefslogtreecommitdiff
path: root/src/themes
diff options
context:
space:
mode:
Diffstat (limited to 'src/themes')
-rw-r--r--src/themes/coco/coco-theme.c22
-rw-r--r--src/themes/nodoka/nodoka-theme.c87
-rw-r--r--src/themes/slider/theme.c47
-rw-r--r--src/themes/standard/theme.c82
4 files changed, 23 insertions, 215 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index d4747f2..3d13f14 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -171,11 +171,7 @@ paint_window(GtkWidget *widget,
#endif
if (windata->width == 0) {
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_allocation(windata->win, &allocation);
-#else
- allocation = windata->win->allocation;
-#endif
windata->width = allocation.width;
windata->height = allocation.height;
}
@@ -221,25 +217,17 @@ paint_window(GtkWidget *widget,
#endif
}
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(widget));
-#else
- context = gdk_cairo_create(widget->window);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = cairo_surface_create_similar(cairo_get_target(context),
CAIRO_CONTENT_COLOR_ALPHA,
windata->width,
windata->height);
+#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_surface (cr, surface, 0, 0);
#else
- surface = cairo_surface_create_similar(cairo_get_target(context),
- CAIRO_CONTENT_COLOR_ALPHA,
- widget->allocation.width,
- widget->allocation.height);
cr = cairo_create(surface);
#endif
@@ -287,11 +275,7 @@ countdown_expose_cb(GtkWidget *pie,
cairo_t *cr;
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(pie));
-#else
- context = gdk_cairo_create(pie->window);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -622,11 +606,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
buf = g_strdup_printf("stock_%s", key);
pixbuf = gtk_icon_theme_load_icon(
gtk_icon_theme_get_for_screen(
-#if GTK_CHECK_VERSION(3, 0, 0)
gdk_window_get_screen(gtk_widget_get_window(GTK_WIDGET(nw)))),
-#else
- gdk_drawable_get_screen(GTK_WIDGET(nw)->window)),
-#endif
buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
g_free(buf);
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index 64f8811..906cdd6 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -117,13 +117,8 @@ get_notification_arrow_type(GtkWidget *nw)
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
int screen_height;
-#if GTK_CHECK_VERSION(3, 0, 0)
screen_height = gdk_screen_get_height(
gdk_window_get_screen(gtk_widget_get_window(nw)));
-#else
- screen_height = gdk_screen_get_height(
- gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)));
-#endif
if (windata->arrow.position.y + windata->height + DEFAULT_ARROW_HEIGHT >
screen_height)
@@ -145,41 +140,23 @@ set_arrow_parameters (WindowData *windata)
int x,y;
GtkArrowType arrow_type;
-#if GTK_CHECK_VERSION(3, 0, 0)
screen_height = gdk_screen_get_height(
gdk_window_get_screen(gtk_widget_get_window(windata->win)));
screen_width = gdk_screen_get_width(
gdk_window_get_screen(gtk_widget_get_window(windata->win)));
-#else
- screen_height = gdk_screen_get_height(
- gdk_window_get_screen(GDK_DRAWABLE(windata->win->window)));
- screen_width = gdk_screen_get_width(
- gdk_window_get_screen(GDK_DRAWABLE(windata->win->window)));
-#endif
-
/* Set arrow offset */
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation alloc;
gtk_widget_get_allocation(windata->win, &alloc);
-#endif
if ((windata->arrow.position.x - DEFAULT_ARROW_SKEW -
-#if GTK_CHECK_VERSION(3, 0, 0)
DEFAULT_ARROW_OFFSET + alloc.width) >
-#else
- DEFAULT_ARROW_OFFSET + windata->win->allocation.width) >
-#endif
screen_width)
{
windata->arrow.offset = windata->arrow.position.x -
DEFAULT_ARROW_SKEW -
(screen_width -
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.width);
-#else
- windata->win->allocation.width);
-#endif
}
else if ((windata->arrow.position.x - DEFAULT_ARROW_SKEW -
DEFAULT_ARROW_OFFSET < 0))
@@ -198,19 +175,10 @@ set_arrow_parameters (WindowData *windata)
windata->arrow.position.x += 6;
}
else if (windata->arrow.offset + DEFAULT_ARROW_WIDTH + 6 >
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.width)
-#else
- windata->win->allocation.width)
-#endif
{
-#if GTK_CHECK_VERSION(3, 0, 0)
windata->arrow.offset = alloc.width - 6 -
DEFAULT_ARROW_WIDTH;
-#else
- windata->arrow.offset = windata->win->allocation.width - 6 -
- DEFAULT_ARROW_WIDTH;
-#endif
windata->arrow.position.x -= 6;
}
@@ -235,30 +203,14 @@ set_arrow_parameters (WindowData *windata)
break;
case GTK_ARROW_DOWN:
windata->arrow.point_begin.y =
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.height -
-#else
- windata->win->allocation.height -
-#endif
DEFAULT_ARROW_HEIGHT;
windata->arrow.point_middle.y =
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.height;
-#else
- windata->win->allocation.height;
-#endif
windata->arrow.point_end.y =
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.height -
-#else
- windata->win->allocation.height -
-#endif
DEFAULT_ARROW_HEIGHT;
-#if GTK_CHECK_VERSION(3, 0, 0)
y = windata->arrow.position.y - alloc.height;
-#else
- y = windata->arrow.position.y - windata->win->allocation.height;
-#endif
break;
default:
g_assert_not_reached();
@@ -550,23 +502,17 @@ paint_window(GtkWidget *widget,
{
cairo_t *context;
cairo_surface_t *surface;
-#if GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr2;
GtkAllocation alloc;
-
gtk_widget_get_allocation(windata->win, &alloc);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_t *cr2;
#else
cairo_t *cr;
#endif
if (windata->width == 0) {
-#if GTK_CHECK_VERSION(3, 0, 0)
windata->width = alloc.width;
windata->height = alloc.height;
-#else
- windata->width = windata->win->allocation.width;
- windata->height = windata->win->allocation.height;
-#endif
}
if (windata->arrow.has_arrow)
@@ -582,7 +528,7 @@ paint_window(GtkWidget *widget,
/*
cr2 = cairo_create (surface);
- /* transparent background * /
+ / * 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);
@@ -623,23 +569,17 @@ paint_window(GtkWidget *widget,
#endif
}
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(widget));
gtk_widget_get_allocation(widget, &alloc);
-#else
- context = gdk_cairo_create(widget->window);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
surface = cairo_surface_create_similar(cairo_get_target(context),
CAIRO_CONTENT_COLOR_ALPHA,
-#if GTK_CHECK_VERSION(3, 0, 0)
alloc.width,
alloc.height);
+#if GTK_CHECK_VERSION(3, 0, 0)
cairo_set_source_surface (cr, surface, 0, 0);
#else
- widget->allocation.width,
- widget->allocation.height);
cr = cairo_create(surface);
#endif
@@ -685,25 +625,18 @@ countdown_expose_cb(GtkWidget *pie,
cairo_t *context;
cairo_surface_t *surface;
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(pie));
GtkAllocation alloc;
gtk_widget_get_allocation(pie, &alloc);
-#else
- context = gdk_cairo_create(pie->window);
+#if !GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr;
#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
surface = cairo_surface_create_similar(cairo_get_target(context),
CAIRO_CONTENT_COLOR_ALPHA,
- #if GTK_CHECK_VERSION(3, 0, 0)
alloc.width,
alloc.height);
- #else
- pie->allocation.width,
- pie->allocation.height);
- #endif
#if GTK_CHECK_VERSION(3, 0, 0)
cairo_set_source_surface (cr, surface, 0, 0);
#else
@@ -711,15 +644,9 @@ countdown_expose_cb(GtkWidget *pie,
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
cairo_translate (cr, -alloc.x, -alloc.y);
fill_background (pie, windata, cr);
cairo_translate (cr, alloc.x, alloc.y);
-#else
- cairo_translate (cr, -pie->allocation.x, -pie->allocation.y);
- fill_background (pie, windata, cr);
- cairo_translate (cr, pie->allocation.x, pie->allocation.y);
-#endif
draw_pie (pie, windata, cr);
@@ -1074,11 +1001,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
buf = g_strdup_printf("stock_%s", key);
pixbuf = gtk_icon_theme_load_icon(
gtk_icon_theme_get_for_screen(
-#if GTK_CHECK_VERSION(3, 0, 0)
gdk_window_get_screen(gtk_widget_get_window(GTK_WIDGET(nw)))),
-#else
- gdk_drawable_get_screen(GTK_WIDGET(nw)->window)),
-#endif
buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
g_free(buf);
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index c254739..7335760 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -110,8 +110,8 @@ static void draw_round_rect(cairo_t* cr, gdouble aspect, gdouble x, gdouble y, g
static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation allocation;
+#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
GdkRGBA color;
GdkRGBA fg_color;
@@ -121,11 +121,11 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
#endif
double r, g, b;
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_allocation(widget, &allocation);
- context = gtk_widget_get_style_context(widget);
draw_round_rect(cr, 1.0f, DEFAULT_X0 + 1, DEFAULT_Y0 + 1, DEFAULT_RADIUS, allocation.width - 2, allocation.height - 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ context = gtk_widget_get_style_context(widget);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color);
r = bg_color.red;
@@ -152,9 +152,6 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
cairo_stroke(cr);
#else
-
- draw_round_rect(cr, 1.0f, DEFAULT_X0 + 1, DEFAULT_Y0 + 1, DEFAULT_RADIUS, widget->allocation.width - 2, widget->allocation.height - 2);
-
color = widget->style->bg[GTK_STATE_NORMAL];
r = (float) color.red / 65535.0;
g = (float) color.green / 65535.0;
@@ -192,17 +189,12 @@ static void update_shape(WindowData* windata)
if (windata->width == 0 || windata->height == 0)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation allocation;
gtk_widget_get_allocation(windata->win, &allocation);
windata->width = MAX(allocation.width, 1);
windata->height = MAX(allocation.height, 1);
-#else
- windata->width = MAX(windata->win->allocation.width, 1);
- windata->height = MAX(windata->win->allocation.height, 1);
-#endif
}
if (windata->composited)
@@ -265,40 +257,24 @@ static void paint_window(GtkWidget* widget, WindowData* windata)
if (windata->width == 0 || windata->height == 0)
{
- #if GTK_CHECK_VERSION(3, 0, 0)
-
GtkAllocation allocation;
gtk_widget_get_allocation(windata->win, &allocation);
windata->width = MAX(allocation.width, 1);
windata->height = MAX(allocation.height, 1);
- #else
- windata->width = MAX(windata->win->allocation.width, 1);
- windata->height = MAX(windata->win->allocation.height, 1);
- #endif
}
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(widget));
-#else
- context = gdk_cairo_create(widget->window);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
- #if GTK_CHECK_VERSION(3, 0, 0)
-
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
- #else
-
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, widget->allocation.width, widget->allocation.height);
- #endif
cr = cairo_create(surface);
@@ -909,8 +885,8 @@ static gboolean on_countdown_draw(GtkWidget* pie, cairo_t* cr, WindowData* winda
static gboolean on_countdown_expose(GtkWidget* pie, GdkEventExpose* event, WindowData* windata)
#endif
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkAllocation allocation;
+#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext* style;
GdkRGBA color;
GdkRGBA fg_color;
@@ -923,22 +899,20 @@ static gboolean on_countdown_expose(GtkWidget* pie, GdkEventExpose* event, Windo
cairo_surface_t* surface;
double r, g, b;
+ context = gdk_cairo_create(gtk_widget_get_window(GDK_WINDOW(windata->pie_countdown)));
#if GTK_CHECK_VERSION(3, 0, 0)
style = gtk_widget_get_style_context(windata->win);
- context = gdk_cairo_create(gtk_widget_get_window(GDK_WINDOW(windata->pie_countdown)));
#else
style = gtk_widget_get_style(windata->win);
- context = gdk_cairo_create(GDK_DRAWABLE(windata->pie_countdown->window));
#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_allocation(pie, &allocation);
surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
+#if GTK_CHECK_VERSION(3, 0, 0)
cairo_set_source_surface (cr, surface, 0, 0);
#else
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, pie->allocation.width, pie->allocation.height);
cr = cairo_create(surface);
#endif
@@ -1047,13 +1021,8 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
/* Try to be smart and find a suitable icon. */
buf = g_strdup_printf("stock_%s", key);
-#if GTK_CHECK_VERSION(3, 0, 0)
pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gdk_window_get_screen(gtk_widget_get_window(GTK_WIDGET(nw)))),
buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-#else
- pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gdk_drawable_get_screen(GTK_WIDGET(nw)->window)),
- buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-#endif
g_free(buf);
if (pixbuf != NULL)
@@ -1094,11 +1063,7 @@ void clear_notification_actions(GtkWindow* nw)
windata->pie_countdown = NULL;
gtk_widget_hide(windata->actions_box);
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_container_foreach(GTK_CONTAINER(windata->actions_box), (GtkCallback) g_object_unref, NULL);
-#else
- gtk_container_foreach(GTK_CONTAINER(windata->actions_box), (GtkCallback) gtk_object_destroy, NULL);
-#endif
}
void move_notification(GtkWidget* widget, int x, int y)
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index 022a6cc..3c52a92 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -108,22 +108,16 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
GtkStyle* style;
GdkColor* background_color;
- #if GTK_CHECK_VERSION(3, 0, 0)
- GtkAllocation allocation;
+ GtkAllocation allocation;
- gtk_widget_get_allocation(widget, &allocation);
- #endif
+ gtk_widget_get_allocation(widget, &allocation);
#ifdef ENABLE_GRADIENT_LOOK
cairo_pattern_t *gradient;
int gradient_y;
- #if GTK_CHECK_VERSION(3, 0, 0)
- gradient_y = allocation.height - BOTTOM_GRADIENT_HEIGHT;
- #else
- gradient_y = widget->allocation.height - BOTTOM_GRADIENT_HEIGHT;
- #endif
+ gradient_y = allocation.height - BOTTOM_GRADIENT_HEIGHT;
#endif
@@ -139,27 +133,16 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
gdk_cairo_set_source_color(cr, background_color);
}
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
- #else
- cairo_rectangle(cr, 0, 0, widget->allocation.width, widget->allocation.height);
- #endif
cairo_fill(cr);
#ifdef ENABLE_GRADIENT_LOOK
/* Add a very subtle gradient to the bottom of the notification */
- #if GTK_CHECK_VERSION(3, 0, 0)
- gradient = cairo_pattern_create_linear(0, gradient_y, 0, allocation.height);
- cairo_pattern_add_color_stop_rgba(gradient, 0, 0, 0, 0, 0);
- cairo_pattern_add_color_stop_rgba(gradient, 1, 0, 0, 0, 0.15);
- cairo_rectangle(cr, 0, gradient_y, allocation.width, BOTTOM_GRADIENT_HEIGHT);
- #else
- gradient = cairo_pattern_create_linear(0, gradient_y, 0, widget->allocation.height);
- cairo_pattern_add_color_stop_rgba(gradient, 0, 0, 0, 0, 0);
- cairo_pattern_add_color_stop_rgba(gradient, 1, 0, 0, 0, 0.15);
- cairo_rectangle(cr, 0, gradient_y, widget->allocation.width, BOTTOM_GRADIENT_HEIGHT);
- #endif
+ gradient = cairo_pattern_create_linear(0, gradient_y, 0, allocation.height);
+ cairo_pattern_add_color_stop_rgba(gradient, 0, 0, 0, 0, 0);
+ cairo_pattern_add_color_stop_rgba(gradient, 1, 0, 0, 0, 0.15);
+ cairo_rectangle(cr, 0, gradient_y, allocation.width, BOTTOM_GRADIENT_HEIGHT);
cairo_set_source(cr, gradient);
cairo_fill(cr);
@@ -181,29 +164,18 @@ static void draw_stripe(GtkWidget* widget, WindowData* windata, cairo_t* cr)
style = gtk_widget_get_style(widget);
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation alloc;
gtk_widget_get_allocation(windata->main_hbox, &alloc);
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
stripe_x = alloc.x + 1;
-#else
- stripe_x = windata->main_hbox->allocation.x + 1;
-#endif
if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
{
stripe_x = windata->width - STRIPE_WIDTH - stripe_x;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
stripe_y = alloc.y + 1;
stripe_height = alloc.height - 2;
-#else
- stripe_y = windata->main_hbox->allocation.y + 1;
- stripe_height = windata->main_hbox->allocation.height - 2;
-#endif
switch (windata->urgency)
{
@@ -249,11 +221,7 @@ static GtkArrowType get_notification_arrow_type(GtkWidget* nw)
windata = g_object_get_data(G_OBJECT(nw), "windata");
-#if GTK_CHECK_VERSION(3, 0, 0)
screen = gdk_window_get_screen(GDK_WINDOW( gtk_widget_get_window(nw)));
-#else
- screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window));
-#endif
monitor = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y);
gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry);
@@ -296,11 +264,7 @@ static void create_border_with_arrow(GtkWidget* nw, WindowData* windata)
width = windata->width;
height = windata->height;
-#if GTK_CHECK_VERSION(3, 0, 0)
screen = gdk_window_get_screen(GDK_WINDOW(gtk_widget_get_window(nw)));
-#else
- screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window));
-#endif
monitor = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y);
gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry);
@@ -513,42 +477,26 @@ static gboolean paint_window(GtkWidget* widget, GdkEventExpose* event, WindowDat
{
cairo_t* context;
cairo_surface_t* surface;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation allocation;
-#else
+#if !GTK_CHECK_VERSION(3, 0, 0)
cairo_t* cr;
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_allocation(windata->win, &allocation);
-#endif
if (windata->width == 0)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
windata->width = allocation.width;
windata->height = allocation.height;
-#else
- windata->width = windata->win->allocation.width;
- windata->height = windata->win->allocation.height;
-#endif
}
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(gtk_widget_get_window(widget));
-#else
- context = gdk_cairo_create(widget->window);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
- #if GTK_CHECK_VERSION(3, 0, 0)
- gtk_widget_get_allocation(widget, &allocation);
+ gtk_widget_get_allocation(widget, &allocation);
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
- #else
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, widget->allocation.width, widget->allocation.height);
- #endif
+ surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_surface(cr, surface, 0, 0);
@@ -981,17 +929,14 @@ static gboolean countdown_expose_cb(GtkWidget* pie, GdkEventExpose* event, Windo
#endif
style = gtk_widget_get_style(windata->win);
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gdk_cairo_create(GTK_WINDOW(gtk_widget_get_window(windata->pie_countdown)));
GtkAllocation alloc;
gtk_widget_get_allocation(pie, &alloc);
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, alloc.width, alloc.height);
+#if GTK_CHECK_VERSION(3, 0, 0)
cairo_set_source_surface(cr, surface, 0, 0);
#else
- context = gdk_cairo_create(GDK_DRAWABLE(windata->pie_countdown->window));
- cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
- surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, pie->allocation.width, pie->allocation.height);
cr = cairo_create(surface);
#endif
@@ -1074,13 +1019,8 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
/* Try to be smart and find a suitable icon. */
buf = g_strdup_printf("stock_%s", key);
-#if GTK_CHECK_VERSION(3, 0, 0)
pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gdk_window_get_screen(gtk_widget_get_window(GTK_WIDGET(nw)))),
buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-#else
- pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gdk_drawable_get_screen(GTK_WIDGET(nw)->window)),
- buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-#endif
g_free(buf);
if (pixbuf != NULL)