diff --git a/helpers/DATA/lxpanel/patch_changes/000-MR_46_fix_scrolling_issue_volume_plugin.patch b/helpers/DATA/lxpanel/patch_changes/000-MR_46_fix_scrolling_issue_volume_plugin.patch new file mode 100644 index 0000000..c8d75e2 --- /dev/null +++ b/helpers/DATA/lxpanel/patch_changes/000-MR_46_fix_scrolling_issue_volume_plugin.patch @@ -0,0 +1,72 @@ +From 44df20a33645b4a645b547725c75904cee46dfba Mon Sep 17 00:00:00 2001 +From: Nicolas Salguero +Date: Thu, 21 Jul 2022 12:54:07 +0200 +Subject: [PATCH 1/2] Fix a scrolling issue with the GTK3 volume plugin + +Scrolling with the mouse wheel in the volume plugin window only reduces +the volume, because the GDK_SCROLL_SMOOTH direction is not taken into +account. + +This fixes github issue #27, reported by martenwa, +part of github issue #45, reported by nsalguero, and +part of https://bugs.debian.org/1052050. + +(commit and message amended by committer) +--- + plugins/volumealsa/volumealsa.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/plugins/volumealsa/volumealsa.c b/plugins/volumealsa/volumealsa.c +index 5c410511..74b49f90 100644 +--- a/plugins/volumealsa/volumealsa.c ++++ b/plugins/volumealsa/volumealsa.c +@@ -796,6 +796,17 @@ static void volumealsa_popup_scale_scrolled(GtkScale * scale, GdkEventScroll * e + /* Dispatch on scroll direction to update the value. */ + if ((evt->direction == GDK_SCROLL_UP) || (evt->direction == GDK_SCROLL_LEFT)) + val += 2; ++#if GTK_CHECK_VERSION(3, 4, 0) ++ else if (evt->direction == GDK_SCROLL_SMOOTH) ++ { ++ gdouble delta_x, delta_y; ++ gdk_event_get_scroll_deltas((GdkEvent *) evt, &delta_x, &delta_y); ++ if ((delta_y < 0) || (delta_x < 0)) ++ val += 2; ++ else ++ val -= 2; ++ } ++#endif + else + val -= 2; + + +From a9c1c58558ec066b6e086230abcf70c7793583c8 Mon Sep 17 00:00:00 2001 +From: Nicolas Salguero +Date: Thu, 21 Jul 2022 12:54:07 +0200 +Subject: [PATCH 2/2] Fix a scrolling issue with the GTK3 volume plugin + +Scrolling with the mouse wheel on the volume plugin icon does nothing +because GDK_SCROLL events are missing. To receive these events, widgets +must set either GDK_SCROLL_MASK or GDK_SMOOTH_SCROLL_MASK. + +This fixes part of github issue #45, reported by nsalguero, +and part of https://bugs.debian.org/1052050. + +(commit and message amended by committer) +--- + plugins/volumealsa/volumealsa.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/plugins/volumealsa/volumealsa.c b/plugins/volumealsa/volumealsa.c +index 74b49f90..13693773 100644 +--- a/plugins/volumealsa/volumealsa.c ++++ b/plugins/volumealsa/volumealsa.c +@@ -991,6 +991,9 @@ static GtkWidget *volumealsa_constructor(LXPanel *panel, config_setting_t *setti + vol->tray_icon = lxpanel_image_new_for_icon(panel, "audio-volume-muted-panel", + -1, ICONS_MUTE); + gtk_container_add(GTK_CONTAINER(p), vol->tray_icon); ++#if GTK_CHECK_VERSION(3, 4, 0) ++ gtk_widget_add_events(p, GDK_SCROLL_MASK); ++#endif + + /* Initialize window to appear when icon clicked. */ + volumealsa_build_popup_window(p); diff --git a/helpers/DATA/lxpanel/patch_changes/001-MR_53_handle_not_charging_state_battery.patch b/helpers/DATA/lxpanel/patch_changes/001-MR_53_handle_not_charging_state_battery.patch new file mode 100644 index 0000000..d9f68f9 --- /dev/null +++ b/helpers/DATA/lxpanel/patch_changes/001-MR_53_handle_not_charging_state_battery.patch @@ -0,0 +1,28 @@ +From 0995ca8ee2b7cbd768921b0a4e2f88a98af09c92 Mon Sep 17 00:00:00 2001 +From: Mikau +Date: Mon, 17 Apr 2023 16:37:10 +0200 +Subject: [PATCH] Handle "Not Charging" state in battery indicator + +When the battery has reached the target charge level, some devices +use the status "Not Charging". LXpanel should not interpret this to mean +"Discharging", but rather the same as "Full". + +This is also likely to fix github issue #50, reported by embedeo. + +(commit message amended by committer) +--- + plugins/batt/batt_sys.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/batt/batt_sys.c b/plugins/batt/batt_sys.c +index 5a40273e..eb807a3c 100644 +--- a/plugins/batt/batt_sys.c ++++ b/plugins/batt/batt_sys.c +@@ -396,6 +396,7 @@ gboolean battery_is_charging( battery *b ) + return ( strcasecmp( b->state, "Unknown" ) == 0 + || strcasecmp( b->state, "Full" ) == 0 + || strcasecmp( b->state, "Charging" ) == 0 ++ || strcasecmp( b->state, "Not Charging" ) == 0 + || b->current_now == 0 ); /* bug sf.net, #720 */ + } + diff --git a/helpers/DATA/lxpanel/patch_changes/002-MR_78_do_not_trigger_wincmd_button_clicked.patch b/helpers/DATA/lxpanel/patch_changes/002-MR_78_do_not_trigger_wincmd_button_clicked.patch new file mode 100644 index 0000000..99819b6 --- /dev/null +++ b/helpers/DATA/lxpanel/patch_changes/002-MR_78_do_not_trigger_wincmd_button_clicked.patch @@ -0,0 +1,28 @@ +From 8b2d1ead714529f3abe00fff282607a4f9eb47b7 Mon Sep 17 00:00:00 2001 +From: kurokawachan +Date: Fri, 23 Aug 2024 04:11:55 -0700 +Subject: [PATCH] Do not trigger wincmd_button_clicked() by GDK_2BUTTON_PRESS + events + +If the toggle is clicked too quickly, it is considered a double-click +and three button-press events are generated instead of the usual two, +resulting in unwanted behavior. + +This fixes https://github.com/lxde/lxpanel/issues/77. +--- + plugins/wincmd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugins/wincmd.c b/plugins/wincmd.c +index 9b4ae48e..ae8db997 100644 +--- a/plugins/wincmd.c ++++ b/plugins/wincmd.c +@@ -124,7 +124,7 @@ static gboolean wincmd_button_clicked(GtkWidget * widget, GdkEventButton * event + WinCmdPlugin * wc = lxpanel_plugin_get_data(widget); + + /* Left-click to iconify. */ +- if (event->button == 1) ++ if (event->button == 1 && event->type == GDK_BUTTON_PRESS) + { + GdkScreen* screen = gtk_widget_get_screen(widget); + Screen *xscreen = GDK_SCREEN_XSCREEN(screen); diff --git a/helpers/DATA/lxpanel/patch_changes/003-MR_84_prevent_panel_freeze_pop_down_menu_debofe_detach.patch b/helpers/DATA/lxpanel/patch_changes/003-MR_84_prevent_panel_freeze_pop_down_menu_debofe_detach.patch new file mode 100644 index 0000000..11dab5e --- /dev/null +++ b/helpers/DATA/lxpanel/patch_changes/003-MR_84_prevent_panel_freeze_pop_down_menu_debofe_detach.patch @@ -0,0 +1,27 @@ +From 8b1135b857eb684296013c92487532a903039102 Mon Sep 17 00:00:00 2001 +From: kurokawachan +Date: Sat, 21 Sep 2024 20:16:48 -0700 +Subject: [PATCH] Pop down a menu before detaching it + +If we detach a GtkMenu while it is still being displayed, +it will freeze the entire panel. + +This fixes github issue #83, reported by make-your-soft-better. + +(commit message slightly amended by committer) +--- + plugins/task-button.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/task-button.c b/plugins/task-button.c +index 3744cc79..f90da5c8 100644 +--- a/plugins/task-button.c ++++ b/plugins/task-button.c +@@ -1544,6 +1544,7 @@ void task_button_update_windows_list(TaskButton *button, Window *list, gint n) + for (l = menu_list; l; l = l->next) + { + GtkMenu *menu = GTK_MENU(l->data); ++ gtk_menu_popdown(menu); + gtk_menu_detach(menu); + } + g_list_free(menu_list); diff --git a/helpers/DATA/lxpanel/patch_changes/004-MR_89_1-4_restore_disabled_cpufreq_plugin_functionality.patch b/helpers/DATA/lxpanel/patch_changes/004-MR_89_1-4_restore_disabled_cpufreq_plugin_functionality.patch new file mode 100644 index 0000000..924fccf --- /dev/null +++ b/helpers/DATA/lxpanel/patch_changes/004-MR_89_1-4_restore_disabled_cpufreq_plugin_functionality.patch @@ -0,0 +1,237 @@ +From dfa4708213c65b734b0d724de8290d4da3ba5af4 Mon Sep 17 00:00:00 2001 +From: rofl0r +Date: Wed, 12 Mar 2025 00:35:15 +0000 +Subject: [PATCH 1/4] Restore disabled cpufreq plugin functionality + +According to the comment used, this was apparently disabled because +someone thought that changing CPU governors requires root permissions, +but that can be easily changed using a rc script running on system +start. + +Probably the most sensible setup to modify the governors from a +restricted user account is to add it to a dedicated group with +write access to the corresponding sysfs files. + +For instance: + + for i in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor \ + /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_setspeed ; do + chown root:cpufreq "$i" + chmod 664 "$i" + done +--- + plugins/cpufreq/cpufreq.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/plugins/cpufreq/cpufreq.c b/plugins/cpufreq/cpufreq.c +index 05f41e0d..24e819ea 100644 +--- a/plugins/cpufreq/cpufreq.c ++++ b/plugins/cpufreq/cpufreq.c +@@ -99,7 +99,7 @@ get_cur_freq(cpufreq *cf){ + } + } + +-/*static void ++static void + get_governors(cpufreq *cf){ + FILE *fp; + GList *l; +@@ -189,7 +189,7 @@ frequency_menu(cpufreq *cf){ + + fclose(fp); + return GTK_WIDGET(menu); +-}*/ ++} + + static void + get_cpus(cpufreq *cf) +@@ -228,7 +228,7 @@ get_cpus(cpufreq *cf) + g_dir_close(cpuDirectory); + } + +-/*static void ++static void + cpufreq_set_governor(GtkWidget *widget, Param* p){ + FILE *fp; + char buf[ 100 ], sstmp [ 256 ]; +@@ -291,7 +291,7 @@ cpufreq_menu(cpufreq *cf){ + } + + return GTK_WIDGET (menu); +-}*/ ++} + + + +@@ -303,9 +303,9 @@ clicked(GtkWidget *widget, GdkEventButton *evt, LXPanel *panel) + /* Standard right-click handling. */ + if( evt->button == 1 ) + { +-// Setting governor can't work without root privilege +-// gtk_menu_popup( cpufreq_menu((cpufreq*)plugin->priv), NULL, NULL, NULL, NULL, +-// evt->button, evt->time ); ++ cpufreq *cf = lxpanel_plugin_get_data(widget); ++ gtk_menu_popup( GTK_MENU(cpufreq_menu(cf)), NULL, NULL, NULL, NULL, ++ evt->button, evt->time ); + return TRUE; + } + + +From 6c35362e69030f6e1bd360f1d8d8171135943c85 Mon Sep 17 00:00:00 2001 +From: rofl0r +Date: Wed, 12 Mar 2025 09:57:01 +0000 +Subject: [PATCH 2/4] Factor out identical code in cpufreq_set_gov/frequency + +--- + plugins/cpufreq/cpufreq.c | 36 ++++++++++++++++++++++-------------- + 1 file changed, 22 insertions(+), 14 deletions(-) + +diff --git a/plugins/cpufreq/cpufreq.c b/plugins/cpufreq/cpufreq.c +index 24e819ea..48ff25d0 100644 +--- a/plugins/cpufreq/cpufreq.c ++++ b/plugins/cpufreq/cpufreq.c +@@ -138,19 +138,34 @@ get_governors(cpufreq *cf){ + } + + static void +-cpufreq_set_freq(GtkWidget *widget, Param* p){ ++set_file(const char* cpu, const char* val, const char* file) { + FILE *fp; +- char buf[ 100 ], sstmp [ 256 ]; ++ char path [ 256 ]; + +- if(strcmp(p->cf->cur_governor, "userspace")) return; ++ snprintf(path, sizeof(path), "%s/%s", cpu, file); + +- sprintf(sstmp,"%s/%s",p->cf->cpus->data, SCALING_SETFREQ); +- if ((fp = fopen( sstmp, "w")) != NULL) { +- fprintf(fp,"%s",p->data); ++ if ((fp = fopen( path, "w")) != NULL) { ++ fprintf(fp,"%s",val); + fclose(fp); + } + } + ++static void ++set_freq(const char* cpu, const char* val) { ++ set_file(cpu, val, SCALING_SETFREQ); ++} ++ ++static void ++set_gov(const char* cpu, const char* val) { ++ set_file(cpu, val, SCALING_GOV); ++} ++ ++static void ++cpufreq_set_freq(GtkWidget *widget, Param* p){ ++ if(strcmp(p->cf->cur_governor, "userspace")) return; ++ set_freq(p->cf->cpus->data, p->data); ++} ++ + static GtkWidget * + frequency_menu(cpufreq *cf){ + FILE *fp; +@@ -230,14 +245,7 @@ get_cpus(cpufreq *cf) + + static void + cpufreq_set_governor(GtkWidget *widget, Param* p){ +- FILE *fp; +- char buf[ 100 ], sstmp [ 256 ]; +- +- sprintf(sstmp, "%s/%s", p->cf->cpus->data, SCALING_GOV); +- if ((fp = fopen( sstmp, "w")) != NULL) { +- fprintf(fp,"%s",p->data); +- fclose(fp); +- } ++ set_gov(p->cf->cpus->data, p->data); + } + + static GtkWidget * + +From c0831241f801f321ddfd48f7acc1e61574640a38 Mon Sep 17 00:00:00 2001 +From: rofl0r +Date: Wed, 12 Mar 2025 10:00:20 +0000 +Subject: [PATCH 3/4] Apply chosen governor/frequency to all CPUs + +Previously, governor and frequency were only changed for the +first CPU/core in the system, but all others were left untouched. +A user changing those generally wants the setting applied +to all cores (for example to powersave governor if on battery). +--- + plugins/cpufreq/cpufreq.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/plugins/cpufreq/cpufreq.c b/plugins/cpufreq/cpufreq.c +index 48ff25d0..9c194ca0 100644 +--- a/plugins/cpufreq/cpufreq.c ++++ b/plugins/cpufreq/cpufreq.c +@@ -162,8 +162,12 @@ set_gov(const char* cpu, const char* val) { + + static void + cpufreq_set_freq(GtkWidget *widget, Param* p){ ++ GList *curr; ++ + if(strcmp(p->cf->cur_governor, "userspace")) return; +- set_freq(p->cf->cpus->data, p->data); ++ ++ for(curr = p->cf->cpus; curr; curr = curr->next) ++ set_freq(curr->data, p->data); + } + + static GtkWidget * +@@ -245,7 +249,10 @@ get_cpus(cpufreq *cf) + + static void + cpufreq_set_governor(GtkWidget *widget, Param* p){ +- set_gov(p->cf->cpus->data, p->data); ++ GList *curr; ++ ++ for(curr = p->cf->cpus; curr; curr = curr->next) ++ set_gov(curr->data, p->data); + } + + static GtkWidget * + +From e8db3d47a308e43c44e0b036fa66df448a246e51 Mon Sep 17 00:00:00 2001 +From: rofl0r +Date: Fri, 14 Mar 2025 07:23:20 +0000 +Subject: [PATCH 4/4] Cosmetic change: move cpufreq_set_governor up + +--- + plugins/cpufreq/cpufreq.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/plugins/cpufreq/cpufreq.c b/plugins/cpufreq/cpufreq.c +index 9c194ca0..9e1bb0f1 100644 +--- a/plugins/cpufreq/cpufreq.c ++++ b/plugins/cpufreq/cpufreq.c +@@ -170,6 +170,14 @@ cpufreq_set_freq(GtkWidget *widget, Param* p){ + set_freq(curr->data, p->data); + } + ++static void ++cpufreq_set_governor(GtkWidget *widget, Param* p) { ++ GList *curr; ++ ++ for(curr = p->cf->cpus; curr; curr = curr->next) ++ set_gov(curr->data, p->data); ++} ++ + static GtkWidget * + frequency_menu(cpufreq *cf){ + FILE *fp; +@@ -247,14 +255,6 @@ get_cpus(cpufreq *cf) + g_dir_close(cpuDirectory); + } + +-static void +-cpufreq_set_governor(GtkWidget *widget, Param* p){ +- GList *curr; +- +- for(curr = p->cf->cpus; curr; curr = curr->next) +- set_gov(curr->data, p->data); +-} +- + static GtkWidget * + cpufreq_menu(cpufreq *cf){ + GList *l; diff --git a/helpers/make-lxpanel b/helpers/make-lxpanel new file mode 100644 index 0000000..5377a50 --- /dev/null +++ b/helpers/make-lxpanel @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Copyright (C) 2025 Luis Guzmán +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +VERSION=1 + +. ./config + +apply_patch_changes + +# To use the multi-line change log, the message must be enclosed in quotes. +changelog "Backport patches from upstream lxpanel to improve stability and functionality: + + Fix scrolling issue in volume plugin (MR#46)/(TPH#218). + Handle 'not charging' battery state correctly (MR#53). + Prevent wincmd plugin from triggering button clicks incorrectly (MR#78). + Avoid panel freeze caused by pop-down menu detach (MR#84). + Restore disabled functionality in cpufreq plugin (MR#89, 4 commits). + +These changes improve reliability in power and task management plugins." + +package