summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-23 10:05:09 +0100
committerinfirit <[email protected]>2014-11-23 10:05:09 +0100
commitaefcd8adde437f4cfbcb6ce69ed54a696da22527 (patch)
tree8ad45e8ed117dedfa7e251c2ac70721f7d5a940f /applets
parentaacf27bff567db88eea7ca965cb3cdaa2fde1397 (diff)
downloadmate-panel-aefcd8adde437f4cfbcb6ce69ed54a696da22527.tar.bz2
mate-panel-aefcd8adde437f4cfbcb6ce69ed54a696da22527.tar.xz
Gtk3: window-menu: Use gtk_render_focus() instead of gtk_paint_focus()
Based on gnome-panel commit: eab5174e71e705331c53482b7eecb56c1dc3ef6c From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'applets')
-rw-r--r--applets/wncklet/window-menu.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index 46e63d18..f19add48 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -122,36 +122,53 @@ static void window_menu_destroy(GtkWidget* widget, WindowMenu* window_menu)
}
#if GTK_CHECK_VERSION (3, 0, 0)
-static gboolean window_menu_on_draw(GtkWidget* widget, cairo_t* cr, gpointer data)
+static gboolean window_menu_on_draw (GtkWidget* widget,
+ cairo_t* cr,
+ gpointer data)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ WindowMenu *window_menu = data;
+
+ if (!gtk_widget_has_focus (window_menu->applet))
+ return FALSE;
+
+ state = gtk_widget_get_state_flags (widget);
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+
+ cairo_save (cr);
+ gtk_render_focus (context, cr,
+ 0., 0.,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+ cairo_restore (cr);
+
+ gtk_style_context_restore (context);
+
+ return FALSE;
+}
#else
-static gboolean window_menu_on_expose(GtkWidget* widget, GdkEventExpose* event, gpointer data)
-#endif
+static gboolean window_menu_on_expose (GtkWidget* widget,
+ GdkEventExpose* event,
+ gpointer data)
{
WindowMenu* window_menu = data;
if (gtk_widget_has_focus(window_menu->applet))
gtk_paint_focus(gtk_widget_get_style(widget),
-#if GTK_CHECK_VERSION (3, 0, 0)
- cr,
-#else
gtk_widget_get_window(widget),
-#endif
gtk_widget_get_state(widget),
-#if !GTK_CHECK_VERSION (3, 0, 0)
NULL,
-#endif
widget,
"menu-applet",
0, 0,
-#if GTK_CHECK_VERSION (3, 0, 0)
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
-#else
-1, -1);
-#endif
return FALSE;
}
+#endif
static inline void force_no_focus_padding(GtkWidget* widget)
{