# HG changeset patch # User Pascal Bellard # Date 1321093441 -3600 # Node ID c4a1554d1721e59bd7cf8a452928f0d297c36dc2 # Parent 113cd65675c3ab7ad9b18bfcf0ed78b71656fe77 lxpanel: update patches... (thanks Saipul) diff -r 113cd65675c3 -r c4a1554d1721 lxpanel/receipt --- a/lxpanel/receipt Fri Nov 11 18:28:17 2011 +0100 +++ b/lxpanel/receipt Sat Nov 12 11:24:01 2011 +0100 @@ -20,10 +20,9 @@ { cd $src #patch -p1 -i $stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch - # Devnote : this patch shouldn't be necessary in next release of lxpanel (current : 0.5.6). - patch -p1 -i $stuff/battery-plugin.patch - # patch to fix 100% battery bug with battery plugin - patch -p1 -i $stuff/battery.patch + # Devnote : this patch shouldn't be necessary in next release of lxpanel (current : 0.5.8). + patch -p1 -i $stuff/configure_desktop_number.patch + patch -p1 -i $stuff/fix_position.patch ./configure --with-plugins=all && make && make install } diff -r 113cd65675c3 -r c4a1554d1721 lxpanel/stuff/battery-plugin.patch --- a/lxpanel/stuff/battery-plugin.patch Fri Nov 11 18:28:17 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ ---- a/src/plugins/batt/batt.c 2010-02-08 07:37:52.000000000 +0100 -+++ b/src/plugins/batt/batt.c 2010-09-27 02:24:22.781006054 +0200 -@@ -95,7 +95,7 @@ - typedef struct { - char *command; - sem_t *lock; --} alarm; -+} Alarm; - - static void destructor(Plugin *p); - static void update_display(lx_battery *lx_b, gboolean repaint); -@@ -103,7 +103,7 @@ - /* alarmProcess takes the address of a dynamically allocated alarm struct (which - it must free). It ensures that alarm commands do not run concurrently. */ - static void * alarmProcess(void *arg) { -- alarm *a = (alarm *) arg; -+ Alarm *a = (Alarm *) arg; - - sem_wait(a->lock); - system(a->command); -@@ -157,7 +157,7 @@ - /* Run the alarm command if it isn't already running */ - if (alarmCanRun) { - -- alarm *a = (alarm *) malloc(sizeof(alarm)); -+ Alarm *a = (Alarm *) malloc(sizeof(alarm)); - a->command = lx_b->alarmCommand; - a->lock = &(lx_b->alarmProcessLock); - diff -r 113cd65675c3 -r c4a1554d1721 lxpanel/stuff/battery.patch --- a/lxpanel/stuff/battery.patch Fri Nov 11 18:28:17 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ ---- lxpanel-0.5.5/src/plugins/batt/batt_sys.c Sat Feb 6 20:45:38 2010 -+++ lxpanel-0.5.5-orig/src/plugins/batt/batt_sys.c Sat Jul 24 18:48:20 2010 -@@ -38,6 +38,13 @@ - battery* battery_new() { - static int battery_num = 1; - battery * b = g_new0 ( battery, 1 ); -+ battery_reset(b); -+ b->battery_num = battery_num; -+ battery_num++; -+ return b; -+ } -+ -+void battery_reset( battery * b) { - b->type_battery = TRUE; - b->capacity_unit = "mAh"; - b->last_capacity_unit = -1; -@@ -49,9 +56,6 @@ - b->remaining_capacity = -1; - b->present_rate = -1; - b->state = NULL; -- b->battery_num = battery_num; -- battery_num++; -- return b; - } - - -@@ -136,6 +140,8 @@ - }; - const gchar *sys_file; - -+ battery_reset(b); -+ - while ( (sys_file = sys_list[i]) != NULL ) { - - gchar *file_content; -@@ -150,7 +156,7 @@ - b->state = "available"; - } - else if ( strcmp("energy_now", sys_file ) == 0 ) { -- b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000; -+ b->remaining_energy = get_unit_value((gchar*) file_content) / 1000; - if (!b->state) - b->state = "available"; - } diff -r 113cd65675c3 -r c4a1554d1721 lxpanel/stuff/configure_desktop_number.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lxpanel/stuff/configure_desktop_number.patch Sat Nov 12 11:24:01 2011 +0100 @@ -0,0 +1,95 @@ +Description: Add configuration for desktop number for the pager plugin. +Author: Julien Lavergne + +--- a/src/plugins/pager.c ++++ b/src/plugins/pager.c +@@ -811,6 +811,80 @@ + g_free(pg); + } + ++/* Callback when the configuration dialog is to be shown. */ ++static void deskno_configure(Plugin * p, GtkWindow * parent) ++{ ++ ++ GdkScreen *screen = gdk_screen_get_default(); ++ const char *wm_name = gdk_x11_screen_get_window_manager_name(screen); ++ GError *error = NULL; ++ const gchar *command_line = NULL; ++ ++ if(g_strcmp0(wm_name, "Openbox") == 0) ++ { ++ if (g_find_program_in_path("obconf")) ++ { ++ command_line = "obconf --tab 6"; ++ } ++ } ++ else if (g_strcmp0(wm_name, "compiz") == 0) ++ { ++ if (g_find_program_in_path("ccsm")) ++ { ++ command_line = "ccsm"; ++ ++ } ++ else if (g_find_program_in_path("simple-ccsm")) ++ { ++ command_line = "simple-ccsm"; ++ } ++ } ++ else ++ { ++ ++ GtkWidget* msg; ++ ++ msg = gtk_message_dialog_new( NULL, ++ 0, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_OK, ++ _("Error, only openbox and compiz are supported") ); ++ gtk_dialog_run( GTK_DIALOG(msg) ); ++ gtk_widget_destroy( msg ); ++ ++ } ++ ++ if (command_line) ++ { ++ gdk_spawn_command_line_on_screen(screen, ++ command_line, ++ &error); ++ } ++ ++ else ++ { ++ ++ GtkWidget* msg; ++ ++ msg = gtk_message_dialog_new( NULL, ++ 0, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_OK, ++ _("Error, you need to install obconf, ccsm of simple-ccsm") ); ++ gtk_dialog_run( GTK_DIALOG(msg) ); ++ gtk_widget_destroy( msg ); ++ ++ } ++ ++ if (error) ++ { ++ g_print("%s\n", error->message); ++ ++ g_free (error); ++ } ++ ++} ++ + /* Callback when panel configuration changes. */ + static void pager_panel_configuration_changed(Plugin * p) + { +@@ -836,7 +910,7 @@ + + constructor : pager_constructor, + destructor : pager_destructor, +- config : NULL, ++ config : deskno_configure, + save : NULL, + panel_configuration_changed : pager_panel_configuration_changed + }; diff -r 113cd65675c3 -r c4a1554d1721 lxpanel/stuff/fix_position.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lxpanel/stuff/fix_position.patch Sat Nov 12 11:24:01 2011 +0100 @@ -0,0 +1,156 @@ +Index: lxpanel-0.5.8/src/plugins/menu.c +=================================================================== +--- lxpanel-0.5.8.orig/src/plugins/menu.c 2011-10-05 23:55:47.000000000 +0200 ++++ lxpanel-0.5.8/src/plugins/menu.c 2011-10-05 23:55:49.000000000 +0200 +@@ -131,8 +131,8 @@ + int ox, oy, w, h; + Plugin *p; + #if GTK_CHECK_VERSION(2,18,0) +- GtkAllocation allocation; +- gtk_widget_set_allocation(widget, &allocation); ++ GtkAllocation *allocation = g_new0 (GtkAllocation, 1); ++ gtk_widget_get_allocation(GTK_WIDGET(widget), allocation); + #endif + ENTER; + p = g_object_get_data(G_OBJECT(widget), "plugin"); +@@ -155,20 +155,20 @@ + *x = ox; + if (*x + w > gdk_screen_width()) + #if GTK_CHECK_VERSION(2,18,0) +- *x = ox + allocation.width - w; ++ *x = ox + allocation->width - w; + #else + *x = ox + widget->allocation.width - w; + #endif + *y = oy - h; + if (*y < 0) + #if GTK_CHECK_VERSION(2,18,0) +- *y = oy + allocation.height; ++ *y = oy + allocation->height; + #else + *y = oy + widget->allocation.height; + #endif + } else { + #if GTK_CHECK_VERSION(2,18,0) +- *x = ox + allocation.width; ++ *x = ox + allocation->width; + #else + *x = ox + widget->allocation.width; + #endif +@@ -177,19 +177,22 @@ + *y = oy; + if (*y + h > gdk_screen_height()) + #if GTK_CHECK_VERSION(2,18,0) +- *y = oy + allocation.height - h; ++ *y = oy + allocation->height - h; + #else + *y = oy + widget->allocation.height - h; + #endif + } + DBG("widget: x,y=%d,%d w,h=%d,%d\n", ox, oy, + #if GTK_CHECK_VERSION(2,18,0) +- allocation.width, allocation.height ); ++ allocation->width, allocation->height ); + #else + widget->allocation.width, widget->allocation.height ); + #endif + DBG("w-h %d %d\n", w, h); + *push_in = TRUE; ++#if GTK_CHECK_VERSION(2,18,0) ++ g_free (allocation); ++#endif + RET(); + } + +@@ -634,8 +637,8 @@ + { + ENTER; + #if GTK_CHECK_VERSION(2,18,0) +- GtkAllocation allocation; +- gtk_widget_get_allocation(widget, &allocation); ++ GtkAllocation *allocation = g_new0 (GtkAllocation, 1); ++ gtk_widget_get_allocation(GTK_WIDGET(widget), allocation); + #endif + + /* Standard right-click handling. */ +@@ -644,14 +647,17 @@ + + if ((event->type == GDK_BUTTON_PRESS) + #if GTK_CHECK_VERSION(2,18,0) +- && (event->x >=0 && event->x < allocation.width) +- && (event->y >=0 && event->y < allocation.height)) { ++ && (event->x >=0 && event->x < allocation->width) ++ && (event->y >=0 && event->y < allocation->height)) { + #else + && (event->x >=0 && event->x < widget->allocation.width) + && (event->y >=0 && event->y < widget->allocation.height)) { + #endif + show_menu( widget, plugin, event->button, event->time ); + } ++#if GTK_CHECK_VERSION(2,18,0) ++ g_free (allocation); ++#endif + RET(TRUE); + } + +Index: lxpanel-0.5.8/src/plugins/pager.c +=================================================================== +--- lxpanel-0.5.8.orig/src/plugins/pager.c 2011-10-05 23:55:47.000000000 +0200 ++++ lxpanel-0.5.8/src/plugins/pager.c 2011-10-05 23:56:29.000000000 +0200 +@@ -271,10 +271,10 @@ + { + /* Allocate pixmap and statistics buffer without border pixels. */ + #if GTK_CHECK_VERSION(2,18,0) +- GtkAllocation allocation; +- gtk_widget_get_allocation(widget, &allocation); +- int new_pixmap_width = allocation.width; +- int new_pixmap_height = allocation.height; ++ GtkAllocation *allocation = g_new0 (GtkAllocation, 1); ++ gtk_widget_get_allocation(GTK_WIDGET(widget), allocation); ++ int new_pixmap_width = allocation->width; ++ int new_pixmap_height = allocation->height; + #else + int new_pixmap_width = widget->allocation.width; + int new_pixmap_height = widget->allocation.height; +@@ -292,8 +292,8 @@ + + /* Compute the horizontal and vertical scale factors, and mark the desktop for redraw. */ + #if GTK_CHECK_VERSION(2,18,0) +- d->scale_y = (gfloat) allocation.height / (gfloat) gdk_screen_height(); +- d->scale_x = (gfloat) allocation.width / (gfloat) gdk_screen_width(); ++ d->scale_y = (gfloat) allocation->height / (gfloat) gdk_screen_height(); ++ d->scale_x = (gfloat) allocation->width / (gfloat) gdk_screen_width(); + #else + d->scale_y = (gfloat) allocation->height / (gfloat) gdk_screen_height(); + d->scale_x = (gfloat) allocation->width / (gfloat) gdk_screen_width(); +@@ -305,6 +305,9 @@ + gtk_widget_set_size_request(widget, + (d->pg->plugin->panel->icon_size - BORDER_WIDTH * 2) * d->pg->aspect_ratio, + d->pg->plugin->panel->icon_size - BORDER_WIDTH * 2); ++#if GTK_CHECK_VERSION(2,18,0) ++ g_free (allocation); ++#endif + return FALSE; + } + +@@ -326,8 +329,8 @@ + { + GtkWidget * widget = GTK_WIDGET(d->da); + #if GTK_CHECK_VERSION(2,18,0) +- GtkAllocation allocation; +- gtk_widget_get_allocation(widget, &allocation); ++ GtkAllocation *allocation = g_new0 (GtkAllocation, 1); ++ gtk_widget_get_allocation(GTK_WIDGET(widget), allocation); + #endif + gdk_draw_rectangle( + d->pixmap, +@@ -336,7 +339,8 @@ + : style->dark_gc[GTK_STATE_NORMAL]), + TRUE, + #if GTK_CHECK_VERSION(2,18,0) +- 0, 0, allocation.width, allocation.height); ++ 0, 0, allocation->width, allocation->height); ++ g_free (allocation); + #else + 0, 0, widget->allocation.width, widget->allocation.height); + #endif