[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 05/05: Fix sidebar scrollbar always visible at launch.

noreply at xfce.org noreply at xfce.org
Sat Jan 18 15:11:13 CET 2020


This is an automated email from the git hooks/post-receive script.

g   o   t   t   c   o   d   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-whiskermenu-plugin.

commit d1ead8b49f6e56e97ac34dbc21d7f0fb37924962
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Jan 16 16:48:25 2020 -0500

    Fix sidebar scrollbar always visible at launch.
---
 panel-plugin/window.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index 5379bd2..dccbd9d 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -709,8 +709,6 @@ void WhiskerMenu::Window::set_categories(const std::vector<SectionButton*>& cate
 	}
 
 	show_default_page();
-
-	check_scrollbar_needed();
 }
 
 //-----------------------------------------------------------------------------
@@ -920,8 +918,6 @@ gboolean WhiskerMenu::Window::on_state_flags_changed_event(GtkWidget* widget, Gt
 		gtk_window_present(m_window);
 	}
 
-	check_scrollbar_needed();
-
 	return false;
 }
 
@@ -1000,10 +996,13 @@ gboolean WhiskerMenu::Window::on_draw_event(GtkWidget* widget, cairo_t* cr)
 
 void WhiskerMenu::Window::check_scrollbar_needed()
 {
+	// Find height of sidebar buttons
 	int height = 0;
 	gtk_widget_get_preferred_height(GTK_WIDGET(m_sidebar_buttons), NULL, &height);
 
-	if (gtk_widget_get_allocated_height(GTK_WIDGET(m_sidebar)) > height)
+	// Always show scrollbar if sidebar is shorter than buttons
+	int allocated = gtk_widget_get_allocated_height(GTK_WIDGET(m_sidebar));
+	if ((allocated > height) || (allocated == 1))
 	{
 		gtk_scrolled_window_set_policy(m_sidebar, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 	}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list