From aefcd8adde437f4cfbcb6ce69ed54a696da22527 Mon Sep 17 00:00:00 2001 From: infirit Date: Sun, 23 Nov 2014 10:05:09 +0100 Subject: Gtk3: window-menu: Use gtk_render_focus() instead of gtk_paint_focus() Based on gnome-panel commit: eab5174e71e705331c53482b7eecb56c1dc3ef6c From: Carlos Garcia Campos --- applets/wncklet/window-menu.c | 45 +++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'applets/wncklet') 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) { -- cgit v1.2.1