wok rev 11297

lxpanel: update patches... (thanks Saipul)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Nov 12 11:24:01 2011 +0100 (2011-11-12)
parents 113cd65675c3
children fafbec11f825
files lxpanel/receipt lxpanel/stuff/battery-plugin.patch lxpanel/stuff/battery.patch lxpanel/stuff/configure_desktop_number.patch lxpanel/stuff/fix_position.patch
line diff
     1.1 --- a/lxpanel/receipt	Fri Nov 11 18:28:17 2011 +0100
     1.2 +++ b/lxpanel/receipt	Sat Nov 12 11:24:01 2011 +0100
     1.3 @@ -20,10 +20,9 @@
     1.4  {
     1.5  	cd $src
     1.6  	#patch -p1 -i $stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch
     1.7 -	# Devnote : this patch shouldn't be necessary in next release of lxpanel (current : 0.5.6).
     1.8 -	patch -p1 -i $stuff/battery-plugin.patch
     1.9 -	# patch to fix 100% battery bug with battery plugin
    1.10 -	patch -p1 -i $stuff/battery.patch
    1.11 +	# Devnote : this patch shouldn't be necessary in next release of lxpanel (current : 0.5.8).
    1.12 +	patch -p1 -i $stuff/configure_desktop_number.patch
    1.13 +	patch -p1 -i $stuff/fix_position.patch
    1.14  	./configure --with-plugins=all &&
    1.15  	make && make install
    1.16  }
     2.1 --- a/lxpanel/stuff/battery-plugin.patch	Fri Nov 11 18:28:17 2011 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,29 +0,0 @@
     2.4 ---- a/src/plugins/batt/batt.c	2010-02-08 07:37:52.000000000 +0100
     2.5 -+++ b/src/plugins/batt/batt.c	2010-09-27 02:24:22.781006054 +0200
     2.6 -@@ -95,7 +95,7 @@
     2.7 - typedef struct {
     2.8 -     char *command;
     2.9 -     sem_t *lock;
    2.10 --} alarm;
    2.11 -+} Alarm;
    2.12 - 
    2.13 - static void destructor(Plugin *p);
    2.14 - static void update_display(lx_battery *lx_b, gboolean repaint);
    2.15 -@@ -103,7 +103,7 @@
    2.16 - /* alarmProcess takes the address of a dynamically allocated alarm struct (which
    2.17 -    it must free). It ensures that alarm commands do not run concurrently. */
    2.18 - static void * alarmProcess(void *arg) {
    2.19 --    alarm *a = (alarm *) arg;
    2.20 -+    Alarm *a = (Alarm *) arg;
    2.21 - 
    2.22 -     sem_wait(a->lock);
    2.23 -     system(a->command);
    2.24 -@@ -157,7 +157,7 @@
    2.25 - 	/* Run the alarm command if it isn't already running */
    2.26 - 	if (alarmCanRun) {
    2.27 - 	    
    2.28 --	    alarm *a = (alarm *) malloc(sizeof(alarm));
    2.29 -+	    Alarm *a = (Alarm *) malloc(sizeof(alarm));
    2.30 - 	    a->command = lx_b->alarmCommand;
    2.31 - 	    a->lock = &(lx_b->alarmProcessLock);
    2.32 - 	    
     3.1 --- a/lxpanel/stuff/battery.patch	Fri Nov 11 18:28:17 2011 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,44 +0,0 @@
     3.4 ---- lxpanel-0.5.5/src/plugins/batt/batt_sys.c	Sat Feb  6 20:45:38 2010
     3.5 -+++ lxpanel-0.5.5-orig/src/plugins/batt/batt_sys.c	Sat Jul 24 18:48:20 2010
     3.6 -@@ -38,6 +38,13 @@
     3.7 - battery* battery_new() {
     3.8 -     static int battery_num = 1;
     3.9 -     battery * b = g_new0 ( battery, 1 );
    3.10 -+	battery_reset(b);
    3.11 -+	b->battery_num = battery_num;
    3.12 -+	battery_num++;
    3.13 -+	return b;
    3.14 -+	}
    3.15 -+
    3.16 -+void battery_reset( battery * b) {
    3.17 -     b->type_battery = TRUE;
    3.18 -     b->capacity_unit = "mAh";
    3.19 -     b->last_capacity_unit = -1;
    3.20 -@@ -49,9 +56,6 @@
    3.21 -     b->remaining_capacity = -1;
    3.22 -     b->present_rate = -1;
    3.23 -     b->state = NULL;
    3.24 --    b->battery_num = battery_num;
    3.25 --    battery_num++;
    3.26 --    return b;
    3.27 - }
    3.28 - 
    3.29 - 
    3.30 -@@ -136,6 +140,8 @@
    3.31 -     };
    3.32 -     const gchar *sys_file;
    3.33 - 
    3.34 -+	battery_reset(b);
    3.35 -+
    3.36 -     while ( (sys_file = sys_list[i]) != NULL ) {
    3.37 -     
    3.38 - 	gchar *file_content;
    3.39 -@@ -150,7 +156,7 @@
    3.40 - 		    b->state = "available";
    3.41 - 	    }
    3.42 - 	    else if ( strcmp("energy_now", sys_file ) == 0 ) {
    3.43 --		b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
    3.44 -+		b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
    3.45 - 		if (!b->state)
    3.46 - 		    b->state = "available";
    3.47 - 	    }
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/lxpanel/stuff/configure_desktop_number.patch	Sat Nov 12 11:24:01 2011 +0100
     4.3 @@ -0,0 +1,95 @@
     4.4 +Description: Add configuration for desktop number for the pager plugin.
     4.5 +Author: Julien Lavergne <gilir@ubuntu.com>
     4.6 +
     4.7 +--- a/src/plugins/pager.c
     4.8 ++++ b/src/plugins/pager.c
     4.9 +@@ -811,6 +811,80 @@
    4.10 +     g_free(pg);
    4.11 + }
    4.12 + 
    4.13 ++/* Callback when the configuration dialog is to be shown. */
    4.14 ++static void deskno_configure(Plugin * p, GtkWindow * parent)
    4.15 ++{
    4.16 ++
    4.17 ++    GdkScreen *screen = gdk_screen_get_default();
    4.18 ++    const char *wm_name = gdk_x11_screen_get_window_manager_name(screen);
    4.19 ++    GError *error = NULL;
    4.20 ++    const gchar *command_line = NULL;
    4.21 ++
    4.22 ++    if(g_strcmp0(wm_name, "Openbox") == 0)
    4.23 ++    {
    4.24 ++        if (g_find_program_in_path("obconf"))
    4.25 ++        {
    4.26 ++            command_line = "obconf --tab 6";
    4.27 ++        }
    4.28 ++    }
    4.29 ++    else if (g_strcmp0(wm_name, "compiz") == 0)
    4.30 ++    {
    4.31 ++         if (g_find_program_in_path("ccsm"))
    4.32 ++         {
    4.33 ++              command_line = "ccsm";
    4.34 ++
    4.35 ++         }
    4.36 ++         else if (g_find_program_in_path("simple-ccsm"))
    4.37 ++         {
    4.38 ++              command_line = "simple-ccsm";
    4.39 ++         }
    4.40 ++    }
    4.41 ++    else
    4.42 ++    {
    4.43 ++    
    4.44 ++        GtkWidget* msg;
    4.45 ++
    4.46 ++        msg = gtk_message_dialog_new( NULL, 
    4.47 ++                                      0, 
    4.48 ++                                      GTK_MESSAGE_ERROR, 
    4.49 ++                                      GTK_BUTTONS_OK, 
    4.50 ++                                      _("Error, only openbox and compiz are supported") );
    4.51 ++        gtk_dialog_run( GTK_DIALOG(msg) );
    4.52 ++        gtk_widget_destroy( msg );
    4.53 ++    
    4.54 ++    }
    4.55 ++
    4.56 ++    if (command_line)
    4.57 ++    {
    4.58 ++        gdk_spawn_command_line_on_screen(screen,
    4.59 ++                                         command_line,
    4.60 ++                                         &error);
    4.61 ++    }
    4.62 ++
    4.63 ++    else
    4.64 ++    {
    4.65 ++    
    4.66 ++        GtkWidget* msg;
    4.67 ++
    4.68 ++        msg = gtk_message_dialog_new( NULL, 
    4.69 ++                                      0, 
    4.70 ++                                      GTK_MESSAGE_ERROR, 
    4.71 ++                                      GTK_BUTTONS_OK, 
    4.72 ++                                      _("Error, you need to install obconf, ccsm of simple-ccsm") );
    4.73 ++        gtk_dialog_run( GTK_DIALOG(msg) );
    4.74 ++        gtk_widget_destroy( msg );
    4.75 ++    
    4.76 ++    }
    4.77 ++
    4.78 ++	if (error)
    4.79 ++	{
    4.80 ++	    g_print("%s\n", error->message);
    4.81 ++		
    4.82 ++		g_free (error);
    4.83 ++    }
    4.84 ++
    4.85 ++}
    4.86 ++
    4.87 + /* Callback when panel configuration changes. */
    4.88 + static void pager_panel_configuration_changed(Plugin * p)
    4.89 + {
    4.90 +@@ -836,7 +910,7 @@
    4.91 + 
    4.92 +     constructor : pager_constructor,
    4.93 +     destructor  : pager_destructor,
    4.94 +-    config : NULL,
    4.95 ++    config : deskno_configure,
    4.96 +     save : NULL,
    4.97 +     panel_configuration_changed : pager_panel_configuration_changed
    4.98 + };
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/lxpanel/stuff/fix_position.patch	Sat Nov 12 11:24:01 2011 +0100
     5.3 @@ -0,0 +1,156 @@
     5.4 +Index: lxpanel-0.5.8/src/plugins/menu.c
     5.5 +===================================================================
     5.6 +--- lxpanel-0.5.8.orig/src/plugins/menu.c	2011-10-05 23:55:47.000000000 +0200
     5.7 ++++ lxpanel-0.5.8/src/plugins/menu.c	2011-10-05 23:55:49.000000000 +0200
     5.8 +@@ -131,8 +131,8 @@
     5.9 +     int ox, oy, w, h;
    5.10 +     Plugin *p;
    5.11 + #if GTK_CHECK_VERSION(2,18,0)
    5.12 +-    GtkAllocation allocation;
    5.13 +-    gtk_widget_set_allocation(widget, &allocation);
    5.14 ++    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
    5.15 ++    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
    5.16 + #endif
    5.17 +     ENTER;
    5.18 +     p = g_object_get_data(G_OBJECT(widget), "plugin");
    5.19 +@@ -155,20 +155,20 @@
    5.20 +         *x = ox;
    5.21 +         if (*x + w > gdk_screen_width())
    5.22 + #if GTK_CHECK_VERSION(2,18,0)
    5.23 +-            *x = ox + allocation.width - w;
    5.24 ++            *x = ox + allocation->width - w;
    5.25 + #else
    5.26 +             *x = ox + widget->allocation.width - w;
    5.27 + #endif
    5.28 +         *y = oy - h;
    5.29 +         if (*y < 0)
    5.30 + #if GTK_CHECK_VERSION(2,18,0)
    5.31 +-            *y = oy + allocation.height;
    5.32 ++            *y = oy + allocation->height;
    5.33 + #else
    5.34 +             *y = oy + widget->allocation.height;
    5.35 + #endif
    5.36 +     } else {
    5.37 + #if GTK_CHECK_VERSION(2,18,0)
    5.38 +-        *x = ox + allocation.width;
    5.39 ++        *x = ox + allocation->width;
    5.40 + #else
    5.41 +         *x = ox + widget->allocation.width;
    5.42 + #endif
    5.43 +@@ -177,19 +177,22 @@
    5.44 +         *y = oy;
    5.45 +         if (*y + h >  gdk_screen_height())
    5.46 + #if GTK_CHECK_VERSION(2,18,0)
    5.47 +-            *y = oy + allocation.height - h;
    5.48 ++            *y = oy + allocation->height - h;
    5.49 + #else
    5.50 +             *y = oy + widget->allocation.height - h;
    5.51 + #endif
    5.52 +     }
    5.53 +     DBG("widget: x,y=%d,%d  w,h=%d,%d\n", ox, oy,
    5.54 + #if GTK_CHECK_VERSION(2,18,0)
    5.55 +-          allocation.width, allocation.height );
    5.56 ++          allocation->width, allocation->height );
    5.57 + #else
    5.58 +           widget->allocation.width, widget->allocation.height );
    5.59 + #endif
    5.60 +     DBG("w-h %d %d\n", w, h);
    5.61 +     *push_in = TRUE;
    5.62 ++#if GTK_CHECK_VERSION(2,18,0)
    5.63 ++    g_free (allocation);
    5.64 ++#endif
    5.65 +     RET();
    5.66 + }
    5.67 + 
    5.68 +@@ -634,8 +637,8 @@
    5.69 + {
    5.70 +     ENTER;
    5.71 + #if GTK_CHECK_VERSION(2,18,0)
    5.72 +-    GtkAllocation allocation;
    5.73 +-    gtk_widget_get_allocation(widget, &allocation);
    5.74 ++    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
    5.75 ++    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
    5.76 + #endif
    5.77 + 
    5.78 +     /* Standard right-click handling. */
    5.79 +@@ -644,14 +647,17 @@
    5.80 + 
    5.81 +     if ((event->type == GDK_BUTTON_PRESS)
    5.82 + #if GTK_CHECK_VERSION(2,18,0)
    5.83 +-          && (event->x >=0 && event->x < allocation.width)
    5.84 +-          && (event->y >=0 && event->y < allocation.height)) {
    5.85 ++          && (event->x >=0 && event->x < allocation->width)
    5.86 ++          && (event->y >=0 && event->y < allocation->height)) {
    5.87 + #else
    5.88 +           && (event->x >=0 && event->x < widget->allocation.width)
    5.89 +           && (event->y >=0 && event->y < widget->allocation.height)) {
    5.90 + #endif
    5.91 +         show_menu( widget, plugin, event->button, event->time );
    5.92 +     }
    5.93 ++#if GTK_CHECK_VERSION(2,18,0)
    5.94 ++    g_free (allocation);
    5.95 ++#endif
    5.96 +     RET(TRUE);
    5.97 + }
    5.98 + 
    5.99 +Index: lxpanel-0.5.8/src/plugins/pager.c
   5.100 +===================================================================
   5.101 +--- lxpanel-0.5.8.orig/src/plugins/pager.c	2011-10-05 23:55:47.000000000 +0200
   5.102 ++++ lxpanel-0.5.8/src/plugins/pager.c	2011-10-05 23:56:29.000000000 +0200
   5.103 +@@ -271,10 +271,10 @@
   5.104 + {
   5.105 +     /* Allocate pixmap and statistics buffer without border pixels. */
   5.106 + #if GTK_CHECK_VERSION(2,18,0)
   5.107 +-    GtkAllocation allocation;
   5.108 +-    gtk_widget_get_allocation(widget, &allocation);
   5.109 +-    int new_pixmap_width = allocation.width;
   5.110 +-    int new_pixmap_height = allocation.height;
   5.111 ++    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
   5.112 ++    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
   5.113 ++    int new_pixmap_width = allocation->width;
   5.114 ++    int new_pixmap_height = allocation->height;
   5.115 + #else
   5.116 +     int new_pixmap_width = widget->allocation.width;
   5.117 +     int new_pixmap_height = widget->allocation.height;
   5.118 +@@ -292,8 +292,8 @@
   5.119 + 
   5.120 +         /* Compute the horizontal and vertical scale factors, and mark the desktop for redraw. */
   5.121 + #if GTK_CHECK_VERSION(2,18,0)
   5.122 +-        d->scale_y = (gfloat) allocation.height / (gfloat) gdk_screen_height();
   5.123 +-        d->scale_x = (gfloat) allocation.width  / (gfloat) gdk_screen_width();
   5.124 ++        d->scale_y = (gfloat) allocation->height / (gfloat) gdk_screen_height();
   5.125 ++        d->scale_x = (gfloat) allocation->width  / (gfloat) gdk_screen_width();
   5.126 + #else
   5.127 +         d->scale_y = (gfloat) allocation->height / (gfloat) gdk_screen_height();
   5.128 +         d->scale_x = (gfloat) allocation->width  / (gfloat) gdk_screen_width();
   5.129 +@@ -305,6 +305,9 @@
   5.130 +     gtk_widget_set_size_request(widget,
   5.131 +         (d->pg->plugin->panel->icon_size - BORDER_WIDTH * 2) * d->pg->aspect_ratio,
   5.132 +         d->pg->plugin->panel->icon_size - BORDER_WIDTH * 2);
   5.133 ++#if GTK_CHECK_VERSION(2,18,0)
   5.134 ++    g_free (allocation);
   5.135 ++#endif
   5.136 +     return FALSE;
   5.137 + }
   5.138 + 
   5.139 +@@ -326,8 +329,8 @@
   5.140 +             {
   5.141 +                 GtkWidget * widget = GTK_WIDGET(d->da);
   5.142 + #if GTK_CHECK_VERSION(2,18,0)
   5.143 +-                GtkAllocation allocation;
   5.144 +-                gtk_widget_get_allocation(widget, &allocation);
   5.145 ++                GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
   5.146 ++                gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
   5.147 + #endif
   5.148 +                 gdk_draw_rectangle(
   5.149 +                     d->pixmap,
   5.150 +@@ -336,7 +339,8 @@
   5.151 +                         : style->dark_gc[GTK_STATE_NORMAL]),
   5.152 +                     TRUE,
   5.153 + #if GTK_CHECK_VERSION(2,18,0)
   5.154 +-                    0, 0, allocation.width, allocation.height);
   5.155 ++                    0, 0, allocation->width, allocation->height);
   5.156 ++                    g_free (allocation);
   5.157 + #else
   5.158 +                     0, 0, widget->allocation.width, widget->allocation.height);
   5.159 + #endif