[Xfce4-commits] <xfce4-panel:nick/gtk3> Workaround for PanelImage and GtkButton conflict (image size growing on click/hover)

Andrzej noreply at xfce.org
Mon Apr 15 02:20:05 CEST 2013


Updating branch refs/heads/nick/gtk3
         to a6b01d8b5dda51c8eedae4aa2c35627037719117 (commit)
       from b26e203d1f8b3d00e5cd0cdd389e58ec0d346199 (commit)

commit a6b01d8b5dda51c8eedae4aa2c35627037719117
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Mon Apr 15 01:18:40 2013 +0100

    Workaround for PanelImage and GtkButton conflict (image size growing on click/hover)
    
    GtkButton allocates different size than requested (a bug?) when the button
    has a _can_focus flag set to FALSE. Since PanelImage uses its allocated
    size when requesting new size, this mismatch leads to infinite growth
    of the widget on every size request/allocate cycle.
    
    This workaround enables _can_focus to make GtkButton allocate the same
    size as requested by the PanelImage. There are several issues with this
    workaround:
    - It would have to be applied to all GtkButton instances holding
      a PanelImage widget
    - Buttons with can_focus set to TRUE have more padding resulting
      in smaller icons in the panel.
    - This change sets can_focus in the button (any problems with keyboard
      handling?)

 libxfce4panel/xfce-panel-convenience.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c
index 43a3c08..ae55ccb 100644
--- a/libxfce4panel/xfce-panel-convenience.c
+++ b/libxfce4panel/xfce-panel-convenience.c
@@ -58,7 +58,7 @@ xfce_panel_create_button (void)
   GtkWidget *button = gtk_button_new ();
 
   gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
-  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), TRUE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_set_name (button, "xfce-panel-button");
@@ -82,7 +82,7 @@ xfce_panel_create_toggle_button (void)
   GtkWidget *button = gtk_toggle_button_new ();
 
   gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
-  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), TRUE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_set_name (button, "xfce-panel-toggle-button");


More information about the Xfce4-commits mailing list