summaryrefslogtreecommitdiff
path: root/recipes-lxde
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2016-11-30 09:37:32 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-01-11 17:40:24 +0100
commita8a1e1f03f72ac2847f4b62ee6d25e00409efdd9 (patch)
tree1807dd9be9e3bee4ec37e5337a22f193906d37ff /recipes-lxde
parent8404d01f279827219264fef536988d8b64c74756 (diff)
lxpanel: fix gtk3 geometry issues
When the wnck pager is displayed the panel's width was set to the sum of all widgets, not the screen width. The with of a single task in the task bar was not reduced when all task's did no longer fit in the allocated taskbar width resulting in a panel which extended past the right side of the screen. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'recipes-lxde')
-rw-r--r--recipes-lxde/lxpanel/lxpanel/0001-panel.c-gtk3-set-minimum-geometry.patch47
-rw-r--r--recipes-lxde/lxpanel/lxpanel/0002-taskbar-gtk3-calculate-task-width-in-code.patch153
-rw-r--r--recipes-lxde/lxpanel/lxpanel/remove_desktop_pager.patch20
-rw-r--r--recipes-lxde/lxpanel/lxpanel_0.8.2.bb3
4 files changed, 202 insertions, 21 deletions
diff --git a/recipes-lxde/lxpanel/lxpanel/0001-panel.c-gtk3-set-minimum-geometry.patch b/recipes-lxde/lxpanel/lxpanel/0001-panel.c-gtk3-set-minimum-geometry.patch
new file mode 100644
index 0000000..fdae675
--- /dev/null
+++ b/recipes-lxde/lxpanel/lxpanel/0001-panel.c-gtk3-set-minimum-geometry.patch
@@ -0,0 +1,47 @@
+From 75959d778aa0f0608c08d80494b4cf98a88e6979 Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.krummenacher@toradex.com>
+Date: Sun, 6 Nov 2016 15:55:18 +0100
+Subject: [PATCH 1/2] panel.c: gtk3: set minimum geometry
+
+This prevents, that the pager plugin changes the with (or height) to the
+minimum width (or height) needed for what is displayed.
+---
+ src/panel.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/panel.c b/src/panel.c
+index b5daf37..741a085 100644
+--- a/src/panel.c
++++ b/src/panel.c
+@@ -293,6 +293,9 @@ static void lxpanel_size_allocate(GtkWidget *widget, GtkAllocation *a)
+ {
+ LXPanel *panel = LXPANEL(widget);
+ Panel *p = panel->priv;
++#if GTK_CHECK_VERSION(3, 0, 0)
++ GdkGeometry geometry;
++#endif
+ GdkRectangle rect;
+ gint x, y;
+
+@@ -327,6 +330,18 @@ static void lxpanel_size_allocate(GtkWidget *widget, GtkAllocation *a)
+ _panel_queue_update_background(panel);
+ }
+
++#if GTK_CHECK_VERSION(3, 0, 0)
++ memset(&geometry, 0, sizeof(geometry));
++/* geometry.max_height = requisition.height;
++ geometry.max_width = requisition.width;
++ geometry.min_height = requisition.height;
++ geometry.min_width = requisition.width;
++*/
++ geometry.max_height = geometry.min_height = a->height;
++ geometry.max_width = geometry.min_width = a->width;
++ gtk_window_set_geometry_hints (GTK_WINDOW (widget), NULL, &geometry, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
++#endif
++
+ if (gtk_widget_get_mapped(widget))
+ _panel_establish_autohide(panel);
+ }
+--
+2.6.6
+
diff --git a/recipes-lxde/lxpanel/lxpanel/0002-taskbar-gtk3-calculate-task-width-in-code.patch b/recipes-lxde/lxpanel/lxpanel/0002-taskbar-gtk3-calculate-task-width-in-code.patch
new file mode 100644
index 0000000..5196180
--- /dev/null
+++ b/recipes-lxde/lxpanel/lxpanel/0002-taskbar-gtk3-calculate-task-width-in-code.patch
@@ -0,0 +1,153 @@
+From 666c041de5a82daadc510ab31eae80dddbb8f669 Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.krummenacher@toradex.com>
+Date: Sun, 6 Nov 2016 15:20:31 +0100
+Subject: [PATCH 2/2] taskbar: gtk3: calculate task width in code
+
+On Gtk+3, if the individual task buttons need more space than allocated for the
+taskbar, the taskbar gets expanded rather than decrease the task button size.
+
+Calculating the task button size in code rather than delegating this to the
+widgets works around the issue.
+---
+ plugins/launchtaskbar.c | 29 +++++++++++++++++++++++++++--
+ src/icon-grid.c | 12 ++++++++++++
+ src/icon-grid.h | 4 +++-
+ 3 files changed, 42 insertions(+), 3 deletions(-)
+
+diff --git a/plugins/launchtaskbar.c b/plugins/launchtaskbar.c
+index 22d197f..6e51c64 100644
+--- a/plugins/launchtaskbar.c
++++ b/plugins/launchtaskbar.c
+@@ -184,6 +184,7 @@ struct LaunchTaskBarPlugin {
+ gboolean same_monitor_only; /* User preference: only show windows that are in the same monitor as the taskbar */
+ gboolean disable_taskbar_upscale; /* User preference: don't upscale taskbar icons */
+ int task_width_max; /* Maximum width of a taskbar button in horizontal orientation */
++ int task_width; /* Current width of a taskbar button in horizontal orientation */
+ int spacing; /* Spacing between taskbar buttons */
+ gboolean use_net_active; /* NET_WM_ACTIVE_WINDOW is supported by the window manager */
+ gboolean net_active_checked; /* True if use_net_active is valid */
+@@ -729,6 +730,7 @@ static void launchtaskbar_constructor_task(LaunchTaskBarPlugin *ltbp)
+ if (config_setting_lookup_int(s, "DisableUpscale", &tmp_int))
+ ltbp->disable_taskbar_upscale = (tmp_int != 0);
+ config_setting_lookup_int(s, "MaxTaskWidth", &ltbp->task_width_max);
++ ltbp->task_width = ltbp->task_width_max;
+ config_setting_lookup_int(s, "spacing", &ltbp->spacing);
+ if (config_setting_lookup_int(s, "UseMouseWheel", &tmp_int))
+ ltbp->use_mouse_wheel = (tmp_int != 0);
+@@ -741,7 +743,7 @@ static void launchtaskbar_constructor_task(LaunchTaskBarPlugin *ltbp)
+
+ /* Make container for task buttons as a child of top level widget. */
+ ltbp->tb_icon_grid = panel_icon_grid_new(panel_get_orientation(ltbp->panel),
+- ltbp->task_width_max,
++ ltbp->task_width,
+ ltbp->icon_size, ltbp->spacing, 0,
+ panel_get_height(ltbp->panel));
+ panel_icon_grid_set_constrain_width(PANEL_ICON_GRID(ltbp->tb_icon_grid), TRUE);
+@@ -796,6 +798,7 @@ static GtkWidget *_launchtaskbar_constructor(LXPanel *panel, config_setting_t *s
+ ltbp->icons_only = FALSE;
+ ltbp->show_all_desks = TRUE;
+ ltbp->task_width_max = TASK_WIDTH_MAX;
++ ltbp->task_width = TASK_WIDTH_MAX;
+ ltbp->spacing = 1;
+ ltbp->use_mouse_wheel = TRUE;
+ ltbp->use_urgency_hint = TRUE;
+@@ -1252,6 +1255,11 @@ static void on_spinbutton_max_width_value_changed(GtkSpinButton *p_spinbutton, g
+ {
+ LaunchTaskBarPlugin *ltbp = (LaunchTaskBarPlugin *)p_data;
+ ltbp->task_width_max = gtk_spin_button_get_value(p_spinbutton);
++#if GTK_CHECK_VERSION(3, 0, 0)
++ ltbp->task_width = MIN(ltbp->task_width, ltbp->task_width_max);
++#else
++ ltbp->task_width = ltbp->task_width_max;
++#endif
+ //g_print("\ntb->task_width_max upd\n");
+ config_group_set_int(ltbp->settings, "MaxTaskWidth", ltbp->task_width_max);
+ taskbar_apply_configuration(ltbp);
+@@ -1648,6 +1656,23 @@ static void task_button_redraw(Task * tk, LaunchTaskBarPlugin * tb)
+ static void taskbar_redraw(LaunchTaskBarPlugin * tb)
+ {
+ Task * tk;
++#if GTK_CHECK_VERSION(3, 0, 0)
++/* in GTK3 the taskbar widget extendeds its width to (task_count * task_width)
++ rather than shrinking the individual task width.
++ so limit task_width here */
++
++ gint count = 0;
++ gint spacing, width;
++
++ panel_icon_grid_get_width(tb->tb_icon_grid, &width, &spacing);
++ for (tk = tb->p_task_list; tk != NULL; tk = tk->p_task_flink_xwid)
++ if (task_is_visible(tb, tk))
++ count++;
++ if (count)
++ tb->task_width = count ? MIN(tb->task_width_max, ((width - spacing) / count) - spacing) :
++ tb->task_width_max;
++ taskbar_update_style(tb);
++#endif
+ for (tk = tb->p_task_list; tk != NULL; tk = tk->p_task_flink_xwid)
+ task_button_redraw(tk, tb);
+ }
+@@ -2805,7 +2830,7 @@ static void taskbar_update_style(LaunchTaskBarPlugin * tb)
+ {
+ panel_icon_grid_set_geometry(PANEL_ICON_GRID(tb->tb_icon_grid),
+ panel_get_orientation(tb->panel),
+- ((tb->icons_only) ? tb->icon_size + ICON_ONLY_EXTRA : tb->task_width_max),
++ ((tb->icons_only) ? tb->icon_size + ICON_ONLY_EXTRA : tb->task_width),
+ tb->icon_size, tb->spacing, 0, panel_get_height(tb->panel));
+ }
+
+diff --git a/src/icon-grid.c b/src/icon-grid.c
+index e5096a9..ab71594 100644
+--- a/src/icon-grid.c
++++ b/src/icon-grid.c
+@@ -43,6 +43,7 @@ struct _PanelIconGrid
+ GList * children; /* List of icon grid elements */
+ GtkOrientation orientation; /* Desired orientation */
+ gint child_width; /* Desired child width */
++ gint child_full_width; /* Total assigned width */
+ gint child_height; /* Desired child height */
+ gint spacing; /* Desired spacing between grid elements */
+ gint target_dimension; /* Desired dimension perpendicular to orientation */
+@@ -137,6 +138,7 @@ static void panel_icon_grid_size_allocate(GtkWidget *widget,
+
+ /* Get the constrained child geometry if the allocated geometry is insufficient.
+ * All children are still the same size and share equally in the deficit. */
++ ig->child_full_width = child_allocation.width;
+ if ((ig->columns != 0) && (ig->rows != 0) && (child_allocation.width > 0))
+ {
+ if (ig->constrain_width &&
+@@ -318,6 +320,16 @@ static void panel_icon_grid_size_request(GtkWidget *widget,
+ }
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
++void panel_icon_grid_get_width(GtkWidget *widget, gint *width, gint *spacing)
++{
++ PanelIconGrid *ig = PANEL_ICON_GRID(widget);
++
++ if(width)
++ *width = ig->child_full_width;
++ if(spacing)
++ *spacing = ig->spacing;
++}
++
+ static void panel_icon_grid_get_preferred_width(GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+diff --git a/src/icon-grid.h b/src/icon-grid.h
+index d0004a8..d382067 100644
+--- a/src/icon-grid.h
++++ b/src/icon-grid.h
+@@ -73,7 +73,9 @@ extern gint panel_icon_grid_get_child_position(PanelIconGrid * ig, GtkWidget * c
+ /* Get the index of an icon grid element. */
+ extern void panel_icon_grid_reorder_child(PanelIconGrid * ig, GtkWidget * child, gint position);
+ /* Reorder the position of a child in the icon grid */
+-
++#if GTK_CHECK_VERSION(3, 0, 0)
++extern void panel_icon_grid_get_width(GtkWidget *widget, gint *width, gint *border);
++#endif
+ G_END_DECLS
+
+ #endif
+--
+2.6.6
+
diff --git a/recipes-lxde/lxpanel/lxpanel/remove_desktop_pager.patch b/recipes-lxde/lxpanel/lxpanel/remove_desktop_pager.patch
deleted file mode 100644
index 2b4241d..0000000
--- a/recipes-lxde/lxpanel/lxpanel/remove_desktop_pager.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-With gtk3 the desktop pager does confuse the constant width of the panel,
-it is drawn to a constant width depending on what is currently active resulting
-in its width being smaller or wider than fullscreen.
-
-Remove it from the default configuration.
-
-diff -Naur lxpanel-0.8.2.orig/data/default/panels/panel.in lxpanel-0.8.2/data/default/panels/panel.in
---- lxpanel-0.8.2.orig/data/default/panels/panel.in 2016-06-18 14:33:25.398929460 +0200
-+++ lxpanel-0.8.2/data/default/panels/panel.in 2016-06-18 14:40:09.486171468 +0200
-@@ -80,10 +80,6 @@
- }
-
- Plugin {
-- type = pager
--}
--
--Plugin {
- type = space
- Config {
- Size=4
diff --git a/recipes-lxde/lxpanel/lxpanel_0.8.2.bb b/recipes-lxde/lxpanel/lxpanel_0.8.2.bb
index 4a324ef..bb20392 100644
--- a/recipes-lxde/lxpanel/lxpanel_0.8.2.bb
+++ b/recipes-lxde/lxpanel/lxpanel_0.8.2.bb
@@ -9,9 +9,10 @@ DEPENDS = "gtk+3 intltool-native menu-cache lxmenu-data libxmu libxpm alsa-lib l
SRC_URI = "${SOURCEFORGE_MIRROR}/lxde/lxpanel-${PV}.tar.xz \
file://lxpanel-broken-apps.patch \
- file://remove_desktop_pager.patch \
file://gtk3.patch \
file://create_target_dir.patch \
+ file://0001-panel.c-gtk3-set-minimum-geometry.patch \
+ file://0002-taskbar-gtk3-calculate-task-width-in-code.patch \
"
SRC_URI[md5sum] = "8d7c93c4ebb4af8bf436ef6d3aee4ea9"
SRC_URI[sha256sum] = "516ac4c83494ee99b2a0d2466458519a9a2668272eeff6d2162af3683b634104"