[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 03/09: Fix sidebar scrollbar covering buttons.
noreply at xfce.org
noreply at xfce.org
Sat Jan 18 16:26:25 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 a n n o t a t e d t a g v 2 . 3 . 5
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit e17ec1c8db1c86d8cf7811496a2538311f7e5010
Author: Graeme Gott <graeme at gottcode.org>
Date: Mon Jan 6 09:57:51 2020 -0500
Fix sidebar scrollbar covering buttons.
---
panel-plugin/window.cpp | 25 ++++++++++++++++++++++++-
panel-plugin/window.h | 3 ++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index d7fe6c8..67de030 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2014, 2015, 2016, 2017, 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
@@ -909,6 +909,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;
}
@@ -967,6 +970,26 @@ 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);
+
+ // 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);
+ }
+ 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