summaryrefslogtreecommitdiff
path: root/mate-window-picker-applet
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-12-15 14:25:23 +0300
committerMonsta <[email protected]>2015-12-15 14:25:23 +0300
commitcaebecef4000c0e5d7462f5d7f3b9ac80f1e9285 (patch)
tree9eaaf8aa9638166f195be4fc8bb3c87d3df6544b /mate-window-picker-applet
parent9b6c061de5f6f6bd8ead6cde7f751bcf63cf7832 (diff)
downloadmate-netbook-caebecef4000c0e5d7462f5d7f3b9ac80f1e9285.tar.bz2
mate-netbook-caebecef4000c0e5d7462f5d7f3b9ac80f1e9285.tar.xz
window picker: use proper functions with GTK+3, simplify code with GTK+2
Diffstat (limited to 'mate-window-picker-applet')
-rw-r--r--mate-window-picker-applet/task-title.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/mate-window-picker-applet/task-title.c b/mate-window-picker-applet/task-title.c
index 2b77ffc..10d411a 100644
--- a/mate-window-picker-applet/task-title.c
+++ b/mate-window-picker-applet/task-title.c
@@ -388,43 +388,38 @@ on_button_release (GtkWidget *title, GdkEventButton *event)
static gboolean
#if GTK_CHECK_VERSION (3, 0, 0)
-on_draw (GtkWidget *eb, cairo_t *cr)
+on_draw (GtkWidget *w, cairo_t *cr)
#else
-on_expose (GtkWidget *eb, GdkEventExpose *event)
+on_expose (GtkWidget *w, GdkEventExpose *event)
#endif
{
- GtkAllocation *allocation;
- GtkStyle *style;
- GtkStateType state;
-
- gtk_widget_get_allocation (eb, allocation);
- style = gtk_widget_get_style (eb);
- state = gtk_widget_get_state (eb);
-
- if (state == GTK_STATE_ACTIVE && allocation)
- gtk_paint_box (style,
#if GTK_CHECK_VERSION (3, 0, 0)
- cr,
+ if (gtk_widget_get_state_flags (w) == GTK_STATE_FLAG_ACTIVE) {
+ GtkStyleContext *context = gtk_widget_get_style_context (w);
+ gtk_render_frame (context,
+ cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (w),
+ gtk_widget_get_allocated_height (w));
+ }
#else
- eb->window,
-#endif
- state, GTK_SHADOW_NONE,
-#if !GTK_CHECK_VERSION (3, 0, 0)
- NULL,
+ if (w->state == GTK_STATE_ACTIVE) {
+ gtk_paint_box (w->style, w->window,
+ w->state, GTK_SHADOW_NONE,
+ NULL, w, "button",
+ w->allocation.x, w->allocation.y,
+ w->allocation.width, w->allocation.height);
+ }
#endif
- eb, "button",
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
#if GTK_CHECK_VERSION (3, 0, 0)
- gtk_container_propagate_draw (GTK_CONTAINER (eb),
- gtk_bin_get_child (GTK_BIN (eb)),
+ gtk_container_propagate_draw (GTK_CONTAINER (w),
+ gtk_bin_get_child (GTK_BIN (w)),
cr);
#else
- gtk_container_propagate_expose (GTK_CONTAINER (eb),
- gtk_bin_get_child (GTK_BIN (eb)),
+ gtk_container_propagate_expose (GTK_CONTAINER (w),
+ gtk_bin_get_child (GTK_BIN (w)),
event);
#endif
return TRUE;