diff options
author | Markos Chandras <hwoarang@gentoo.org> | 2012-05-07 10:14:24 +0000 |
---|---|---|
committer | Markos Chandras <hwoarang@gentoo.org> | 2012-05-07 10:14:24 +0000 |
commit | 708738731d79aa22974042bd22e7341e1de693d3 (patch) | |
tree | 794966f40066bfa18a2102b9aceb2cd46fdd61a8 /lxde-base/lxpanel/files | |
parent | Drop old. (diff) | |
download | historical-708738731d79aa22974042bd22e7341e1de693d3.tar.gz historical-708738731d79aa22974042bd22e7341e1de693d3.tar.bz2 historical-708738731d79aa22974042bd22e7341e1de693d3.zip |
Fixes for bug #408541 and #400855
Package-Manager: portage-2.1.10.57/cvs/Linux x86_64
Diffstat (limited to 'lxde-base/lxpanel/files')
-rw-r--r-- | lxde-base/lxpanel/files/lxpanel-0.5.8-dynamic-width.patch | 40 | ||||
-rw-r--r-- | lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch | 246 |
2 files changed, 251 insertions, 35 deletions
diff --git a/lxde-base/lxpanel/files/lxpanel-0.5.8-dynamic-width.patch b/lxde-base/lxpanel/files/lxpanel-0.5.8-dynamic-width.patch new file mode 100644 index 000000000000..0aea7b1a0d67 --- /dev/null +++ b/lxde-base/lxpanel/files/lxpanel-0.5.8-dynamic-width.patch @@ -0,0 +1,40 @@ +# See https://bugs.gentoo.org/show_bug.cgi?id=408541 +diff -urN lxpanel-0.5.8.bak/src/panel.c lxpanel-0.5.8/src/panel.c +--- lxpanel-0.5.8.bak/src/panel.c 2012-03-16 18:09:33.000000000 +0800 ++++ lxpanel-0.5.8/src/panel.c 2012-03-16 22:38:58.000000000 +0800 +@@ -484,13 +484,29 @@ + { + ENTER; + +- if (p->widthtype == WIDTH_REQUEST) +- p->width = (p->orientation == ORIENT_HORIZ) ? req->width : req->height; +- if (p->heighttype == HEIGHT_REQUEST) +- p->height = (p->orientation == ORIENT_HORIZ) ? req->height : req->width; ++ if (p->autohide && !p->visible) ++ { ++ /* When the panel is in invisible state, the content box also got hidden, thus always ++ * report 0 size. Ask the content box instead for its size. */ ++ GtkRequisition req_box; ++ gtk_widget_size_request(p->box, &req_box); ++ if (p->widthtype == WIDTH_REQUEST) ++ p->width = (p->orientation == ORIENT_HORIZ) ? req_box.width : req_box.height; ++ if (p->heighttype == HEIGHT_REQUEST) ++ p->height = (p->orientation == ORIENT_HORIZ) ? req_box.height : req_box.width; ++ } ++ else ++ { ++ if (p->widthtype == WIDTH_REQUEST) ++ p->width = (p->orientation == ORIENT_HORIZ) ? req->width : req->height; ++ if (p->heighttype == HEIGHT_REQUEST) ++ p->height = (p->orientation == ORIENT_HORIZ) ? req->height : req->width; ++ } + calculate_position(p); +- req->width = p->aw; +- req->height = p->ah; ++ ++ gtk_widget_set_size_request( widget, p->aw, p->ah ); ++// req->width = p->aw; ++// req->height = p->ah; + + RET( TRUE ); + } diff --git a/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch b/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch index 0db90b7a19e3..0d9a1e7ecf99 100644 --- a/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch +++ b/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch @@ -1,17 +1,10 @@ -From 266c072d1e954266157989891eec069006772e97 Mon Sep 17 00:00:00 2001 -From: Henry Gebhardt <hsggebhardt@googlemail.com> -Date: Fri, 23 Dec 2011 21:02:53 +0100 -Subject: [PATCH] plugins/thermal: support both /proc and sysfs interfaces - ---- - src/plugins/thermal/thermal.c | 108 +++++++++++++++++++++++++++++++++++------ - 1 files changed, 93 insertions(+), 15 deletions(-) +X-Git-Url: http://lxde.git.sourceforge.net/git/gitweb.cgi?p=lxde%2Flxpanel;a=blobdiff_plain;f=src%2Fplugins%2Fthermal%2Fthermal.c;h=1ac80939630e4c26b376a45dc7474ddca8246189;hp=afe5e89135fa28d72f7aa625f70214c3adb3239e;hb=HEAD;hpb=8e33d60b30bb9236d7a16c06e8f079936c8dd9b0 diff --git a/src/plugins/thermal/thermal.c b/src/plugins/thermal/thermal.c -index afe5e89..616c4a0 100644 +index afe5e89..1ac8093 100644 --- a/src/plugins/thermal/thermal.c +++ b/src/plugins/thermal/thermal.c -@@ -32,12 +32,17 @@ +@@ -32,12 +32,18 @@ #include "dbg.h" @@ -25,7 +18,8 @@ index afe5e89..616c4a0 100644 +#define PROC_TRIP_CRITICAL "critical (S5):" -typedef struct { -+#define SYSFS_THERMAL_DIRECTORY "/sys/class/thermal/thermal_zone0/" /* must be slash-terminated */ ++#define SYSFS_THERMAL_DIRECTORY "/sys/class/thermal/" /* must be slash-terminated */ ++#define SYSFS_THERMAL_SUBDIR_PREFIX "thermal_zone" +#define SYSFS_THERMAL_TEMPF "temp" +#define SYSFS_THERMAL_TRIP "trip_point_0_temp" + @@ -34,7 +28,16 @@ index afe5e89..616c4a0 100644 Plugin * plugin; GtkWidget *main; GtkWidget *namew; -@@ -54,17 +59,20 @@ typedef struct { +@@ -45,7 +51,7 @@ typedef struct { + int critical; + int warning1; + int warning2; +- int custom_levels, auto_sensor; ++ int not_custom_levels, auto_sensor; + char *sensor, + *str_cl_normal, + *str_cl_warning1, +@@ -54,17 +60,20 @@ typedef struct { GdkColor cl_normal, cl_warning1, cl_warning2; @@ -57,7 +60,7 @@ index afe5e89..616c4a0 100644 if (!(state = fopen( sstmp, "r"))) { //printf("cannot open %s\n",sstmp); -@@ -72,10 +80,10 @@ get_critical(thermal *th){ +@@ -72,15 +81,15 @@ get_critical(thermal *th){ } while( fgets(buf, 256, state) && @@ -70,7 +73,13 @@ index afe5e89..616c4a0 100644 while( *pstr && *pstr == ' ' ) ++pstr; -@@ -90,14 +98,14 @@ get_critical(thermal *th){ + pstr[strlen(pstr)-3] = '\0'; +- printf("Critical: [%s]\n",pstr); ++ //printf("Critical: [%s]\n",pstr); + fclose(state); + return atoi(pstr); + } +@@ -90,14 +99,14 @@ get_critical(thermal *th){ } static gint @@ -87,7 +96,7 @@ index afe5e89..616c4a0 100644 if (!(state = fopen( sstmp, "r"))) { //printf("cannot open %s\n",sstmp); -@@ -122,11 +130,79 @@ get_temperature(thermal *th){ +@@ -122,11 +131,77 @@ get_temperature(thermal *th){ } static gint @@ -109,7 +118,6 @@ index afe5e89..616c4a0 100644 + ! ( pstr = buf ) ); + if( pstr ) + { -+ printf("Critical: [%s]\n",pstr); + fclose(state); + return atoi(pstr)/1000; + } @@ -149,7 +157,7 @@ index afe5e89..616c4a0 100644 +static void +set_get_functions(thermal *th) +{ -+ if (strncmp(th->sensor, "/sys/", 5) == 0){ ++ if (th->sensor && strncmp(th->sensor, "/sys/", 5) == 0){ + th->get_temperature = sysfs_get_temperature; + th->get_critical = sysfs_get_critical; + } else { @@ -162,41 +170,209 @@ index afe5e89..616c4a0 100644 update_display(thermal *th) { char buffer [60]; - int n; +- int n; - int temp = get_temperature(th); + int temp = th->get_temperature(th); GdkColor color; if(temp >= th->warning2) -@@ -155,7 +231,7 @@ check_sensors( thermal* th ) +@@ -141,42 +216,92 @@ update_display(thermal *th) + panel_draw_label_text(th->plugin->panel, th->namew, "NA", TRUE, TRUE); + else + { +- n = sprintf(buffer, "<span color=\"#%06x\"><b>%02d</b></span>", gcolor2rgb24(&color), temp); ++ sprintf(buffer, "<span color=\"#%06x\"><b>%02d</b></span>", gcolor2rgb24(&color), temp); + gtk_label_set_markup (GTK_LABEL(th->namew), buffer) ; + } + + RET(TRUE); + } + ++ ++/* get_sensor(): ++ * - Get the sensor directory, and store it in '*sensor'. ++ * - It is searched for in 'directory'. ++ * - Only the subdirectories starting with 'subdir_prefix' are accepted as sensors. ++ * - 'subdir_prefix' may be NULL, in which case any subdir is considered a sensor. */ + static void +-check_sensors( thermal* th ) ++get_sensor(char** sensor, char const* directory, char const* subdir_prefix) + { + GDir *sensorsDirectory; const char *sensor_name; char sensor_path[100]; - if (! (sensorsDirectory = g_dir_open(THERMAL_DIRECTORY, 0, NULL))) -+ if (! (sensorsDirectory = g_dir_open(PROC_THERMAL_DIRECTORY, 0, NULL))) ++ if (! (sensorsDirectory = g_dir_open(directory, 0, NULL))) { - th->sensor = NULL; +- th->sensor = NULL; ++ *sensor = NULL; return; -@@ -164,7 +240,7 @@ check_sensors( thermal* th ) + } + /* Scan the thermal_zone directory for available sensors */ while ((sensor_name = g_dir_read_name(sensorsDirectory))) { if (sensor_name[0] != '.') { - sprintf(sensor_path,"%s%s/",THERMAL_DIRECTORY, sensor_name); -+ sprintf(sensor_path,"%s%s/",PROC_THERMAL_DIRECTORY, sensor_name); - if(th->sensor) { - g_free(th->sensor); - th->sensor = NULL; -@@ -254,7 +330,9 @@ thermal_constructor(Plugin *p, char** fp) - if(th->sensor == NULL) th->auto_sensor = TRUE; - if(th->auto_sensor) check_sensors(th); +- if(th->sensor) { +- g_free(th->sensor); +- th->sensor = NULL; ++ if (subdir_prefix) { ++ if (strncmp(sensor_name, subdir_prefix, strlen(subdir_prefix)) != 0) ++ continue; + } +- th->sensor = strdup(sensor_path); +- //printf("sensor: %s\n", b->sensor); ++ sprintf(sensor_path,"%s%s/", directory, sensor_name); ++ if(*sensor) { ++ g_free(*sensor); ++ *sensor = NULL; ++ } ++ *sensor = strdup(sensor_path); + break; + } + } + g_dir_close(sensorsDirectory); + } -- th->critical = get_critical(th); ++static void ++check_sensors( thermal *th ) ++{ ++ if(th->sensor) { ++ g_free(th->sensor); ++ th->sensor = NULL; ++ } ++ ++ get_sensor(&th->sensor, PROC_THERMAL_DIRECTORY, NULL); ++ ++ if (!th->sensor) ++ get_sensor(&th->sensor, SYSFS_THERMAL_DIRECTORY, SYSFS_THERMAL_SUBDIR_PREFIX); ++ ++ //printf("thermal sensor: %s\n", th->sensor); ++} ++ ++ ++static void applyConfig(Plugin* p) ++{ ++ thermal *th = p->priv; ++ ENTER; ++ ++ if (th->str_cl_normal) gdk_color_parse(th->str_cl_normal, &th->cl_normal); ++ if (th->str_cl_warning1) gdk_color_parse(th->str_cl_warning1, &th->cl_warning1); ++ if (th->str_cl_warning2) gdk_color_parse(th->str_cl_warning2, &th->cl_warning2); ++ ++ if(th->sensor == NULL) th->auto_sensor = TRUE; ++ if(th->auto_sensor) check_sensors(th); ++ + set_get_functions(th); + + th->critical = th->get_critical(th); ++ ++ if(th->not_custom_levels){ ++ th->warning1 = th->critical - 10; ++ th->warning2 = th->critical - 5; ++ } ++ ++ RET(); ++} ++ + static int + thermal_constructor(Plugin *p, char** fp) + { +@@ -197,6 +322,11 @@ thermal_constructor(Plugin *p, char** fp) + th->main = p->pwid; + th->tip = gtk_tooltips_new(); - if(!th->custom_levels){ - th->warning1 = th->critical - 10; --- -1.7.4.1 - ++ /* By default, use automatic, that is, "not custom" temperature levels. If ++ * we were using custom levels, they would be 0°C at startup, so we would ++ * display in warning colors by default. */ ++ th->not_custom_levels = TRUE; ++ + g_signal_connect (G_OBJECT (p->pwid), "button_press_event", + G_CALLBACK (plugin_button_press_event), (gpointer) p); + +@@ -220,7 +350,7 @@ thermal_constructor(Plugin *p, char** fp) + }else if (!g_ascii_strcasecmp(s.t[0], "AutomaticSensor")){ + th->auto_sensor= atoi(s.t[1]); + }else if (!g_ascii_strcasecmp(s.t[0], "CustomLevels")){ +- th->custom_levels= atoi(s.t[1]); ++ th->not_custom_levels= atoi(s.t[1]); + }else if (!g_ascii_strcasecmp(s.t[0], "Sensor")){ + th->sensor= g_strdup(s.t[1]); + }else if (!g_ascii_strcasecmp(s.t[0], "Warning1Temp")){ +@@ -236,7 +366,6 @@ thermal_constructor(Plugin *p, char** fp) + goto error; + } + } +- + } + + if(!th->str_cl_normal) +@@ -246,20 +375,7 @@ thermal_constructor(Plugin *p, char** fp) + if(!th->str_cl_warning2) + th->str_cl_warning2 = g_strdup("#ff0000"); + +- gdk_color_parse(th->str_cl_normal, &(th->cl_normal)); +- gdk_color_parse(th->str_cl_warning1, &(th->cl_warning1)); +- gdk_color_parse(th->str_cl_warning2, &(th->cl_warning2)); +- +- +- if(th->sensor == NULL) th->auto_sensor = TRUE; +- if(th->auto_sensor) check_sensors(th); +- +- th->critical = get_critical(th); +- +- if(!th->custom_levels){ +- th->warning1 = th->critical - 10; +- th->warning2 = th->critical - 5; +- } ++ applyConfig(p); + + gtk_widget_show(th->namew); + +@@ -272,27 +388,6 @@ error: + RET(FALSE); + } + +-static void applyConfig(Plugin* p) +-{ +- +- thermal *th = (thermal *)p->priv; +- +- ENTER; +- +- if (th->str_cl_normal) gdk_color_parse(th->str_cl_normal, &th->cl_normal); +- if (th->str_cl_warning1) gdk_color_parse(th->str_cl_warning1, &th->cl_warning1); +- if (th->str_cl_warning2) gdk_color_parse(th->str_cl_warning2, &th->cl_warning2); +- +- if(th->auto_sensor) check_sensors(th); +- +- if(th->custom_levels){ +- th->warning1 = th->critical - 10; +- th->warning2 = th->critical - 5; +- } +- +- RET(); +-} +- + static void config(Plugin *p, GtkWindow* parent) { + ENTER; + +@@ -306,7 +401,7 @@ static void config(Plugin *p, GtkWindow* parent) { + _("Warning2"), &th->str_cl_warning2, CONF_TYPE_STR, + _("Automatic sensor location"), &th->auto_sensor, CONF_TYPE_BOOL, + _("Sensor"), &th->sensor, CONF_TYPE_STR, +- _("Automatic temperature levels"), &th->custom_levels, CONF_TYPE_BOOL, ++ _("Automatic temperature levels"), &th->not_custom_levels, CONF_TYPE_BOOL, + _("Warning1 Temperature"), &th->warning1, CONF_TYPE_INT, + _("Warning2 Temperature"), &th->warning2, CONF_TYPE_INT, + NULL); +@@ -338,7 +433,7 @@ static void save_config( Plugin* p, FILE* fp ) + lxpanel_put_str( fp, "NormalColor", th->str_cl_normal ); + lxpanel_put_str( fp, "Warning1Color", th->str_cl_warning1 ); + lxpanel_put_str( fp, "Warning2Color", th->str_cl_warning2 ); +- lxpanel_put_int( fp, "CustomLevels", th->custom_levels ); ++ lxpanel_put_int( fp, "CustomLevels", th->not_custom_levels ); + lxpanel_put_int( fp, "Warning1Temp", th->warning1 ); + lxpanel_put_int( fp, "Warning2Temp", th->warning2 ); + lxpanel_put_int( fp, "AutomaticSensor", th->auto_sensor ); |