[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 01/05: Fix sidebar scrollbar covering buttons. (bug #14730)
noreply at xfce.org
noreply at xfce.org
Tue Jan 7 17:52:01 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 4042c592fda301af56149bf03d701975516e3613
Author: Graeme Gott <graeme at gottcode.org>
Date: Mon Jan 6 09:57:51 2020 -0500
Fix sidebar scrollbar covering buttons. (bug #14730)
---
panel-plugin/window.cpp | 22 ++++++++++++++++++++++
panel-plugin/window.h | 3 ++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index 14c0c94..72dc7d7 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -698,6 +698,8 @@ void WhiskerMenu::Window::set_categories(const std::vector<SectionButton*>& cate
}
show_default_page();
+
+ check_scrollbar_needed();
}
//-----------------------------------------------------------------------------
@@ -922,6 +924,9 @@ gboolean WhiskerMenu::Window::on_configure_event(GtkWidget*, GdkEvent* event)
m_geometry.width = configure_event->width;
m_geometry.height = configure_event->height;
}
+
+ check_scrollbar_needed();
+
return false;
}
@@ -980,6 +985,23 @@ gboolean WhiskerMenu::Window::on_draw_event(GtkWidget* widget, cairo_t* cr)
//-----------------------------------------------------------------------------
+void WhiskerMenu::Window::check_scrollbar_needed()
+{
+ 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)
+ {
+ gtk_scrolled_window_set_policy(m_sidebar, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ }
+ else
+ {
+ gtk_scrolled_window_set_policy(m_sidebar, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+ }
+}
+
+//-----------------------------------------------------------------------------
+
void WhiskerMenu::Window::favorites_toggled()
{
m_favorites->reset_selection();
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index d66de8d..99a5d50 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014, 2015, 2016, 2018 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2014, 2015, 2016, 2018, 2020 Graeme Gott <graeme at gottcode.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -94,6 +94,7 @@ private:
gboolean on_configure_event(GtkWidget*, GdkEvent* event);
void on_screen_changed_event(GtkWidget* widget, GdkScreen* old_screen);
gboolean on_draw_event(GtkWidget* widget, cairo_t* cr);
+ void check_scrollbar_needed();
void favorites_toggled();
void recent_toggled();
void category_toggled();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list