← Back to team overview

cairo-dock-team team mailing list archive

lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1 into lp:ubuntu/cairo-dock-plug-ins

 

Matthieu Baerts has proposed merging lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1 into lp:ubuntu/cairo-dock-plug-ins.

Requested reviews:
  Ubuntu Sponsors Team (ubuntu-sponsors)
Related bugs:
  Bug #886676 in cairo-dock-plugins (Ubuntu): "Please update Cairo-Dock Plug-Ins to 2.4.0~2.1 version (bugs fixed version)"
  https://bugs.launchpad.net/ubuntu/+source/cairo-dock-plugins/+bug/886676

For more details, see:
https://code.launchpad.net/~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1/+merge/81376

ChangeLog:
   - Desklet-rendering - viewport: fixed a crash when the desklet is empty
   - Status-Notifier: patch to work around strange bugs
      in the Ubuntu's indicator-application
   - Switcher: fixed a crash in expanded+desklet mode, a wrong loading
      of the icons and a small drawing bug with the non-compact view.
   - GMenu: look for *-applications.menu file in the xdg path
      (if common file names are not found, e.g. with KDE env in Oneiric)
-- 
https://code.launchpad.net/~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1/+merge/81376
Your team Cairo-Dock Team is subscribed to branch lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1.
=== removed directory '.pc'
=== removed file '.pc/.version'
--- .pc/.version	2011-10-09 00:19:16 +0000
+++ .pc/.version	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-2

=== removed directory '.pc/01-switcher-force-compact-view.patch'
=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher'
=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher/data'
=== removed file '.pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in'
--- .pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in	2011-10-09 00:19:16 +0000
+++ .pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in	1970-01-01 00:00:00 +0000
@@ -1,177 +0,0 @@
-#@VERSION_SWITCHER@
-
-#[gtk-about]
-[Icon]
-
-#F[Icon]
-frame_maininfo=
-
-#d Name of the dock it belongs to:
-dock name =
-
-#s Name of the icon as it will appear in its caption in the dock:
-name = 
- #v
-sep_display=
-
-#S+ Image filename:
-#{Leave empty to use the default one.}
-icon = 
-
-#j+[0;400] Desired icon size for this applet
-#{Set to 0 to use the default applet size}
-icon size = 0;0
-
-order=
-
-#F[Applet's Handbook]
-frame_hand=
-#A
-handbook=switcher
-
-#[gtk-convert]
-[Desklet]
-
-#X[Position]
-frame_pos =
-
-#b Lock position?
-#{If locked, the desklet cannot be moved by simply dragging it with the left mouse button. It can still be moved with ALT + left-click.}
-locked = false
-
-#j+[24;512] Desklet dimensions (width x height):
-#{Depending on your WindowManager, you may be able to resize this with ALT + middle-click or ALT + left-click.}
-size = 96;96
-
-#i[-2048;2048] Desklet position (x, y):
-x position=10
-#i[-2048;2048] ...
-y position=10
-
-#X[Visibility]
-frame_visi =
-
-#b Is detached from the dock
-initially detached=false
-#l[Normal;Keep above;Keep below;Keep on widget layer;Reserve space] Visibility:
-accessibility=0
-#b Should be visible on all desktops?
-sticky=true
-
-
-
-
-#F[Decorations;gtk-orientation-portrait]
-frame_deco=
-
-#o+ Choose a decoration theme for this desklet:
-#{Choose 'Custom decorations' to define your own decorations below.}
-decorations = default
-
-#v
-sep_deco =
-
-#S+ Background image:
-#{Image to be displayed below drawings, e.g. a frame. Leave empty for no image.}
-bg desklet =
-#e+[0;1] Background transparency:
-bg alpha = 1
-#i+[0;256] Left offset:
-#{in pixels. Use this to adjust the left position of drawings.}
-left offset = 0
-#i+[0;256] Top offset:
-#{in pixels. Use this to adjust the top position of drawings.}
-top offset = 0
-#i+[0;256] Right offset:
-#{in pixels. Use this to adjust the right position of drawings.}
-right offset = 0
-#i+[0;256] Bottom offset:
-#{in pixels. Use this to adjust the bottom position of drawings.}
-bottom offset = 0
-#S+ Foreground image:
-#{Image to be displayed above the drawings, e.g. a reflection. Leave empty for no image.}
-fg desklet =
-#e+[0;1] Foreground tansparency:
-fg alpha = 1
-
-
-#[gtk-preferences]
-[Configuration]
-
-#F[Configuration]
-frame_conf =
-
-#B Use the compact mode?
-#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
-Vue Simple = true
-
-#b Preserve the ratio of the screen ?
-preserve ratio = true
-
-#b Map wallpaper to icons?
-Map Wallpaper = true
-
-#b Show desktop number on icons?
-display numero desktop = true
-
-#B Draw windows on icons?
-Draw Windows = true
-
-#b Draw hidden windows?
-Draw hidden Windows = false
-
-#v
-sep_conf =
-
-#l[Show windows' list;Show desktop;Expose all the desktops;Expose all the windows] Action on middle-click:
-action on click = 0
-
-#U Workspace names :
-desktop names = 
-
-
-#F[Display options]
-frame_disp =
-
-#i+[0;8] Size of the inside lines :
-inlinesize = 3
-
-#C+ Internal line colour:
-#{r, g, b, a}
-rgbinlinecolor = 0.0; 0.0; 0.5; 1.
-
-#i+[0;8] External line size:
-linesize = 3
-
-#C+ External line colour:
-#{r, g, b, a}
-rgblinecolor = 0.0; 0.0; 0.5; 1.
-
-#C+ Window line colour:
-#{r, g, b, a}
-rgbwlinecolor = 0.0; 0.0; 0.5; 1.
-
-#v
-sep_cur =
-
-#C+ Current desktop colour:
-#{r, g, b, a}
-rgbindcolor = 0.0; 0.0; 0.5; 0.5
-
-#l+[draw a frame;fill;fill others] How to draw the current desktop:
-fill current = 1
-
-#v
-sep_other =
-
-#S+ Icon to use in expanded mode if wallpaper is not mapped:
-#{Leave empty to use the default one.}
-default icon = 
-
-
-#n+ Sub-dock view name:
-#{Leave empty to use default sub-dock view.}/
-renderer = 
-
-#b+ In expanded mode, render the desklet in 3D?
-3D desklet = true

=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher/src'
=== removed file '.pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c'
--- .pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c	2011-10-09 00:19:16 +0000
+++ .pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c	1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
-/**
-* This file is a part of the Cairo-Dock project
-*
-* Copyright : (C) see the 'copyright' file.
-* E-mail    : see the 'copyright' file.
-*
-* 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 3
-* 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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <string.h>
-
-#include "applet-struct.h"
-#include "applet-config.h"
-#include "applet-load-icons.h"
-
-
-CD_APPLET_GET_CONFIG_BEGIN
-	//\_________________ On recupere toutes les valeurs de notre fichier de conf.
-	myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
-	myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
-	myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
-	myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
-	myConfig.bDrawWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw Windows", TRUE);
-	myConfig.bDisplayHiddenWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw hidden Windows", TRUE);
-	myConfig.iActionOnMiddleClick = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "action on click", 0);
-	
-	// couleur des lignes interieures
-	myConfig.iInLineSize = CD_CONFIG_GET_INTEGER("Configuration", "inlinesize");
-	double inlinecouleur[4] = {0., 0., 0.5, 1.};
-	CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbinlinecolor",myConfig.RGBInLineColors, inlinecouleur);
-	
-	// couleur du bureau courant.
-	double indcouleur[4] = {0., 0., 0.5, 1.};
-	CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbindcolor",myConfig.RGBIndColors, indcouleur);
-	myConfig.iDrawCurrentDesktopMode = CD_CONFIG_GET_INTEGER ("Configuration", "fill current");
-	
-	// couleur des lignes exterieures.
-	myConfig.iLineSize = CD_CONFIG_GET_INTEGER("Configuration", "linesize");
-	double linecouleur[4] = {0., 0., 0.5, 1.};
-	CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgblinecolor",myConfig.RGBLineColors, linecouleur);
-	
-	// couleur des traits des fenetres.
-	double wlinecouleur[4] = {0., 0., 0.5, 1.};
-	CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbwlinecolor",myConfig.RGBWLineColors, wlinecouleur);
-
-	myConfig.cDefaultIcon = CD_CONFIG_GET_FILE_PATH ("Configuration", "default icon", "default.svg");
-	myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer");
-	myConfig.bDesklet3D = CD_CONFIG_GET_BOOLEAN ("Configuration", "3D desklet");
-	
-	gsize iNbNamesSize;
-	myConfig.cDesktopNames = CD_CONFIG_GET_STRING_LIST_WITH_DEFAULT ("Configuration", "desktop names", &iNbNamesSize, "Work;Game;Video;Chat");
-	myConfig.iNbNames = (gint) iNbNamesSize;
-CD_APPLET_GET_CONFIG_END
-
-
-CD_APPLET_RESET_CONFIG_BEGIN
-	g_free (myConfig.cRenderer);
-	g_free (myConfig.cDefaultIcon);
-	if (myConfig.cDesktopNames != NULL)
-		g_strfreev (myConfig.cDesktopNames);
-CD_APPLET_RESET_CONFIG_END
-
-
-CD_APPLET_RESET_DATA_BEGIN
-	CD_APPLET_DELETE_MY_ICONS_LIST;
-	cairo_surface_destroy (myData.pDefaultMapSurface);
-	cairo_surface_destroy (myData.pDesktopBgMapSurface);
-CD_APPLET_RESET_DATA_END

=== removed file '.pc/applied-patches'
--- .pc/applied-patches	2011-10-09 00:19:16 +0000
+++ .pc/applied-patches	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-01-switcher-force-compact-view.patch

=== modified file 'GMenu/src/applet-menu.c'
--- GMenu/src/applet-menu.c	2011-08-09 18:08:08 +0000
+++ GMenu/src/applet-menu.c	2011-11-05 21:30:29 +0000
@@ -699,19 +699,37 @@
 	return menu;
 }
 
+#define XDG_MENUS_PATH "/etc/xdg/menus"
 GtkWidget * create_main_menu (CairoDockModuleInstance *myApplet)
 {
 	GtkWidget *main_menu;
 	
 	// workaround pour KDE, qui ne loupe pas une occasion de se distinguer.
 	const gchar *cMenuFileName = NULL;
-	if (! g_file_test ("/etc/xdg/menus/applications.menu", G_FILE_TEST_EXISTS))  // on pourrait aussi aller lire le start-here.menu, mais je suis pas sur que ce soit standard.
+	if (g_file_test (XDG_MENUS_PATH"/applications.menu", G_FILE_TEST_EXISTS))  // first check 
+		cMenuFileName = "applications.menu";
+	else if (g_file_test (XDG_MENUS_PATH"/kde-applications.menu", G_FILE_TEST_EXISTS))
+		cMenuFileName = "kde-applications.menu";
+	else if (g_file_test (XDG_MENUS_PATH"/xfce-applications.menu", G_FILE_TEST_EXISTS))
+		cMenuFileName = "xfce-applications.menu";
+	else  // kde4-applications.menu, lxde-applications.menu, ...; let's check any *-applications.menu
 	{
-		if (g_file_test ("/etc/xdg/menus/kde-applications.menu", G_FILE_TEST_EXISTS))
-			cMenuFileName = "kde-applications.menu";
-		else if (g_file_test ("/etc/xdg/menus/xfce-applications.menu", G_FILE_TEST_EXISTS))
-			cMenuFileName = "xfce-applications.menu";
+		const gchar *cFileName;
+		GDir *dir = g_dir_open (XDG_MENUS_PATH, 0, NULL);
+		if (dir)
+		{
+			while (cFileName = g_dir_read_name (dir))
+			{
+				if (g_str_has_suffix (cFileName, "-applications.menu"))
+				{
+					cMenuFileName = cFileName;
+					break;
+				}
+			}
+			g_dir_close (dir);
+		}
 	}
+	
 	if (cMenuFileName == NULL)
 		cMenuFileName = "applications.menu";
 	

=== modified file 'Status-Notifier/src/applet-draw.c'
--- Status-Notifier/src/applet-draw.c	2011-08-09 18:08:08 +0000
+++ Status-Notifier/src/applet-draw.c	2011-11-05 21:30:29 +0000
@@ -197,7 +197,7 @@
 	else
 		cd_satus_notifier_compute_grid ();
 	
-	// reload surfaces if their size has changed.
+	// load surfaces, or reload them if their size has changed.
 	cd_debug ("===  item size: %d -> %d, icon size: %dx%d (%p)", iPrevSize, myData.iItemSize, myIcon->iImageWidth, myIcon->iImageHeight, myIcon->pIconBuffer);
 	CDStatusNotifierItem *pItem;
 	GList *it;

=== modified file 'Status-Notifier/src/applet-host-ias.c'
--- Status-Notifier/src/applet-host-ias.c	2011-09-26 12:56:12 +0000
+++ Status-Notifier/src/applet-host-ias.c	2011-11-05 21:30:29 +0000
@@ -180,7 +180,7 @@
 #if (INDICATOR_OLD_NAMES == 0)  // Natty
 const gchar *cAccessbleDesc,  // WTF is this new param ??
 #if (INDICATOR_APPLICATIONADDED_HAS_HINT == 1)
-const gchar *cHint,
+const gchar *cHint,  // <irony> is this a hint to work around a clumsy API ? </irony>
 #endif
 #endif
 CairoDockModuleInstance *myApplet)
@@ -207,7 +207,14 @@
 		}
 	}
 	
-	cd_satus_notifier_add_new_item (cAdress, cObjectPath, iPosition);
+	cd_satus_notifier_add_new_item_with_default (cAdress, cObjectPath, iPosition,
+		#if (INDICATOR_APPLICATIONADDED_HAS_HINT == 1)
+		cIconName ? cIconName : cHint,
+		#else
+		cIconName,
+		#endif
+		cIconThemePath,
+		cLabel);
 	
 	CD_APPLET_LEAVE ();
 }

=== modified file 'Status-Notifier/src/applet-host.c'
--- Status-Notifier/src/applet-host.c	2011-08-09 18:08:08 +0000
+++ Status-Notifier/src/applet-host.c	2011-11-05 21:30:29 +0000
@@ -65,7 +65,7 @@
  /// Add/remove item ///
 ///////////////////////
 
-void cd_satus_notifier_add_new_item (const gchar *cService, const gchar *cObjectPath, int iPosition)
+void cd_satus_notifier_add_new_item_with_default (const gchar *cService, const gchar *cObjectPath, int iPosition, const gchar *cIconName, const gchar *cIconThemePath, const gchar *cLabel)
 {
 	CDStatusNotifierItem *pItem = _cd_satus_notifier_find_item_from_service (cService);
 	g_return_if_fail (pItem == NULL);  // on evite d'ajouter 2 fois le meme service.
@@ -73,6 +73,25 @@
 	pItem = cd_satus_notifier_create_item (cService, cObjectPath);
 	g_return_if_fail (pItem != NULL);
 	
+	// the Ubuntu IAS is buggy, it doesn't return all the properties of the item; so we may have to complete with the properties that are given in the 'ApplicationAdded' callback.
+	if (pItem->cIconName == NULL)
+		pItem->cIconName = g_strdup (cIconName);
+	
+	if (pItem->cIconThemePath == NULL)
+	{
+		pItem->cIconThemePath = g_strdup (cIconThemePath);
+		if (pItem->cIconThemePath)
+		{
+			cd_satus_notifier_add_theme_path (pItem->cIconThemePath);
+		}
+	}
+	
+	if (pItem->cLabel == NULL)
+		pItem->cLabel = g_strdup (cLabel);
+	
+	if (pItem->cMenuPath == NULL)
+		pItem->cMenuPath = g_strdup (cObjectPath);
+	
 	pItem->iPosition = iPosition;
 	if (pItem->cLabel == NULL && pItem->cTitle == NULL)
 		pItem->cLabel = g_strdup (pItem->cId);  // cService is often a dbus name like :1.355

=== modified file 'Status-Notifier/src/applet-host.h'
--- Status-Notifier/src/applet-host.h	2011-08-09 18:08:08 +0000
+++ Status-Notifier/src/applet-host.h	2011-11-05 21:30:29 +0000
@@ -23,7 +23,9 @@
 #include <cairo-dock.h>
 
 
-void cd_satus_notifier_add_new_item (const gchar *cService, const gchar *cObjectPath, int iPosition);
+void cd_satus_notifier_add_new_item_with_default (const gchar *cService, const gchar *cObjectPath, int iPosition, const gchar *cIconName, const gchar *cIconThemePath, const gchar *cLabel);
+
+#define cd_satus_notifier_add_new_item(cService, cObjectPath, iPosition) cd_satus_notifier_add_new_item_with_default (cService, cObjectPath, iPosition, NULL, NULL, NULL)
 
 void cd_satus_notifier_remove_item (const gchar *cService, int iPosition);
 

=== modified file 'Status-Notifier/src/applet-item.c'
--- Status-Notifier/src/applet-item.c	2011-09-26 12:56:12 +0000
+++ Status-Notifier/src/applet-item.c	2011-11-05 21:30:29 +0000
@@ -360,12 +360,13 @@
 		*str = '\0';
 	
 	// special case for Ubuntu indicators: we don't know their object path.
+	gchar *cRealObjectPath = NULL;
 	if (cObjectPath != NULL && strncmp (cObjectPath, CD_INDICATOR_APPLICATION_ITEM_OBJ, strlen (CD_INDICATOR_APPLICATION_ITEM_OBJ)) == 0)
 	{
 		// I think this is because this path is actually the menu path, and fortunately it's just under the item object's path.
-		gchar *str = strrchr (cObjectPath, '/');
+		const gchar *str = strrchr (cObjectPath, '/');
 		if (str)
-			*str = '\0';
+			cRealObjectPath = g_strndup (cObjectPath, str - cObjectPath);
 	}
 	else if (cObjectPath == NULL || *cObjectPath == '\0')  // no path, let's assume it's the common one.
 	{
@@ -377,7 +378,7 @@
 	//\_________________ get the properties of the item.
 	DBusGProxy *pProxyItemProp = cairo_dock_create_new_session_proxy (
 		cService,
-		cObjectPath,
+		cRealObjectPath ? cRealObjectPath : cObjectPath,
 		DBUS_INTERFACE_PROPERTIES);
 	if (pProxyItemProp == NULL)
 		return NULL;
@@ -422,7 +423,7 @@
 	{
 		cIconName = g_value_get_string (v);
 	}
-	//g_print ("===   IconName '%s'\n", cIconName);
+	cd_debug ("===   IconName '%s'", cIconName);
 	
 	const gchar *cIconThemePath = NULL;
 	v = g_hash_table_lookup (hProps, "IconThemePath");
@@ -430,7 +431,7 @@
 	{
 		cIconThemePath = g_value_get_string (v);
 	}
-	//g_print ("===   IconThemePath '%s'\n", cIconThemePath);
+	cd_debug ("===   IconThemePath '%s'", cIconThemePath);
 	
 	const gchar *cAttentionIconName = NULL;
 	v = g_hash_table_lookup (hProps, "AttentionIconName");  // -> keep for demands of attention
@@ -446,7 +447,7 @@
 	{
 		cMenuPath = (gchar*) g_value_get_boxed (v);
 	}
-	//g_print ("===   cMenuPath '%s'\n", cMenuPath);
+	cd_debug ("===   cMenuPath '%s'", cMenuPath);
 	
 	// properties supported by Ubuntu.
 	gint iPosition = -1;
@@ -517,7 +518,7 @@
 	
 	DBusGProxy *pProxyItem = cairo_dock_create_new_session_proxy (
 		cService,
-		cObjectPath,
+		cRealObjectPath ? cRealObjectPath : cObjectPath,
 		CD_STATUS_NOTIFIER_ITEM_IFACE);
 	if (pProxyItem == NULL)
 		return NULL;
@@ -532,7 +533,7 @@
 	pItem->cTitle = g_strdup (cTitle);
 	pItem->cLabel = g_strdup (cLabel);
 	pItem->cLabelGuide = g_strdup (cLabelGuide);
-	pItem->cMenuPath = g_strdup (cMenuPath);
+	pItem->cMenuPath = (cMenuPath ? g_strdup (cMenuPath) : g_strdup (cObjectPath));
 	pItem->iWindowId = iWindowId;
 	pItem->iCategory = _find_category (cCategory);
 	pItem->iStatus = _find_status (cStatus);
@@ -600,6 +601,7 @@
 	g_signal_connect (G_OBJECT(pProxyItem), "destroy", G_CALLBACK (_on_item_proxy_destroyed), pItem);  // attention, dangereux car on va etre appele lorsqu'on detruit un item.
 	
 	g_hash_table_destroy (hProps);
+	g_free (cRealObjectPath);
 	return pItem;
 }
 

=== modified file 'debian/changelog'
--- debian/changelog	2011-10-09 00:19:16 +0000
+++ debian/changelog	2011-11-05 21:30:29 +0000
@@ -1,3 +1,21 @@
+cairo-dock-plug-ins (2.4.0~2.1-0ubuntu1) UNRELEASED; urgency=low
+
+  * New upstream bug fix release. (LP: #886676)
+  * Upstream ChangeLog:
+   - Desklet-rendering - viewport: fixed a crash when the desklet is empty
+   - Status-Notifier: patch to work around strange bugs
+      in the Ubuntu's indicator-application
+   - Switcher: fixed a crash in expanded+desklet mode, a wrong loading
+      of the icons and a small drawing bug with the non-compact view.
+   - GMenu: look for *-applications.menu file in the xdg path
+      (if common file names are not found, e.g. with KDE env in Oneiric)
+  * debian/patches/01-switcher-force-compact-view.patch:
+   - Deleted (now in upstream)
+  * debian/patches/01-removed-useless-g_print.patch:
+   - Removed useless output messages
+
+ -- Matthieu Baerts (matttbe) <matttbe@xxxxxxxxx>  Sat, 05 Nov 2011 21:55:39 +0100
+
 cairo-dock-plug-ins (2.4.0~2-0ubuntu1) oneiric; urgency=low
 
   [ Matthieu Baerts (matttbe) ]

=== added file 'debian/patches/01-removed-useless-g_print.patch'
--- debian/patches/01-removed-useless-g_print.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/01-removed-useless-g_print.patch	2011-11-05 21:30:29 +0000
@@ -0,0 +1,37 @@
+## Description: Removed useless output messages
+## Origin/Author: Matthieu Baerts (matttbe)
+Index: cairo-dock-plug-ins/switcher/src/applet-draw.c
+===================================================================
+--- cairo-dock-plug-ins.orig/switcher/src/applet-draw.c	2011-11-05 21:29:03.647635000 +0100
++++ cairo-dock-plug-ins/switcher/src/applet-draw.c	2011-11-05 21:35:54.324276301 +0100
+@@ -638,7 +638,7 @@
+ 			g_object_set (pMenuItem, "height-request", 3, NULL);
+ 			
+ 			// on ajoute les fenetres du viewport au menu.
+-			g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
++			// g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
+ 			cd_switcher_foreach_window_on_viewport (iNumDesktop,
+ 				iNumViewportX,
+ 				iNumViewportY,
+Index: cairo-dock-plug-ins/switcher/src/applet-load-icons.c
+===================================================================
+--- cairo-dock-plug-ins.orig/switcher/src/applet-load-icons.c	2011-11-05 21:29:03.647635000 +0100
++++ cairo-dock-plug-ins/switcher/src/applet-load-icons.c	2011-11-05 21:36:33.992275747 +0100
+@@ -209,7 +209,7 @@
+ 		myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
+ 		myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
+ 	}
+-	g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
++	// g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
+ 	
+ 	myData.pDesktopBgMapSurface = cairo_dock_duplicate_surface (pBgSurface,
+ 		g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL], g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL],
+@@ -231,7 +231,7 @@
+ 		myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
+ 		myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
+ 	}
+-	g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
++	// g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
+ 	myData.pDefaultMapSurface = cairo_dock_create_surface_from_image_simple (myConfig.cDefaultIcon,
+ 		myData.iSurfaceWidth,
+ 		myData.iSurfaceHeight);

=== removed file 'debian/patches/01-switcher-force-compact-view.patch'
--- debian/patches/01-switcher-force-compact-view.patch	2011-10-09 00:19:16 +0000
+++ debian/patches/01-switcher-force-compact-view.patch	1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-## From: Matthieu Baerts (matttbe) <matttbe@xxxxxxxxx>
-## Description: Forced the compact view because the other doesn't work
-## Forwarded: yes
-Index: cairo-dock-plug-ins/switcher/src/applet-config.c
-===================================================================
---- cairo-dock-plug-ins.orig/switcher/src/applet-config.c	2011-10-08 23:26:53.222924952 +0200
-+++ cairo-dock-plug-ins/switcher/src/applet-config.c	2011-10-08 23:26:53.306924951 +0200
-@@ -26,7 +26,7 @@
- 
- CD_APPLET_GET_CONFIG_BEGIN
- 	//\_________________ On recupere toutes les valeurs de notre fichier de conf.
--	myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
-+	myConfig.bCompactView = TRUE; // CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
- 	myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
- 	myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
- 	myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
-Index: cairo-dock-plug-ins/.bzr/checkout/dirstate
-===================================================================
-Binary files cairo-dock-plug-ins.orig/.bzr/checkout/dirstate	2011-10-08 23:28:01.502925141 +0200 and cairo-dock-plug-ins/.bzr/checkout/dirstate	2011-10-08 23:27:09.198924995 +0200 differ
-Index: cairo-dock-plug-ins/switcher/data/switcher.conf.in
-===================================================================
---- cairo-dock-plug-ins.orig/switcher/data/switcher.conf.in	2011-10-08 23:28:00.542925138 +0200
-+++ cairo-dock-plug-ins/switcher/data/switcher.conf.in	2011-10-08 23:27:55.810925124 +0200
-@@ -101,10 +101,6 @@
- #F[Configuration]
- frame_conf =
- 
--#B Use the compact mode?
--#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
--Vue Simple = true
--
- #b Preserve the ratio of the screen ?
- preserve ratio = true
- 

=== modified file 'debian/patches/series'
--- debian/patches/series	2011-10-09 00:19:16 +0000
+++ debian/patches/series	2011-11-05 21:30:29 +0000
@@ -1,1 +1,1 @@
-01-switcher-force-compact-view.patch
+01-removed-useless-g_print.patch

=== modified file 'desklet-rendering/src/rendering-desklet-viewport.c'
--- desklet-rendering/src/rendering-desklet-viewport.c	2011-04-20 20:46:51 +0000
+++ desklet-rendering/src/rendering-desklet-viewport.c	2011-11-05 21:30:29 +0000
@@ -87,6 +87,8 @@
 
 static void _compute_icons_position (CairoDesklet *pDesklet, CDViewportParameters *pViewport)
 {
+	if (pViewport->nRowsX == 0)  // either the grid has not yet been calculated, or there is no icon => nothing to do.
+		return;
 	double fScrollOffset = - pViewport->iScrollOffset;
 	int iOffsetY = myIconsParam.iLabelSize +  // le texte des icones de la 1ere ligne
 		fScrollOffset;

=== modified file 'switcher/data/switcher.conf.in'
--- switcher/data/switcher.conf.in	2011-10-09 00:19:16 +0000
+++ switcher/data/switcher.conf.in	2011-11-05 21:30:29 +0000
@@ -101,6 +101,10 @@
 #F[Configuration]
 frame_conf =
 
+#B Use the compact mode?
+#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
+Vue Simple = true
+
 #b Preserve the ratio of the screen ?
 preserve ratio = true
 

=== modified file 'switcher/src/applet-config.c'
--- switcher/src/applet-config.c	2011-10-09 00:19:16 +0000
+++ switcher/src/applet-config.c	2011-11-05 21:30:29 +0000
@@ -26,7 +26,7 @@
 
 CD_APPLET_GET_CONFIG_BEGIN
 	//\_________________ On recupere toutes les valeurs de notre fichier de conf.
-	myConfig.bCompactView = TRUE; // CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
+	myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
 	myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
 	myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
 	myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);

=== modified file 'switcher/src/applet-desktops.c'
--- switcher/src/applet-desktops.c	2011-10-09 00:19:16 +0000
+++ switcher/src/applet-desktops.c	2011-11-05 21:30:29 +0000
@@ -45,9 +45,16 @@
 	//g_print ("%s (%d)\n", __func__, iNbViewports);
 	
 	int w, h;
-	CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
-	if (w == 0 || h == 0)  // may happen in desklet mode on startup, until the desklet's window reaches its definite size.
-		return;
+	if (myConfig.bCompactView)
+	{
+		CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
+		if (w == 0 || h == 0)  // may happen in desklet mode on startup, until the desklet's window reaches its definite size.
+			return;
+	}
+	else  // in expanded mode, we don't use the grid, except for computing an index, so any size will be ok.
+	{
+		w = h = 48;
+	}
 	//cd_debug ("%d; %dx%d", iNbViewports, w, h);
 	
 	double fZoomX, fZoomY;

=== modified file 'switcher/src/applet-draw.c'
--- switcher/src/applet-draw.c	2011-10-09 00:19:16 +0000
+++ switcher/src/applet-draw.c	2011-11-05 21:30:29 +0000
@@ -134,8 +134,6 @@
 	cairo_dock_erase_cairo_context (myDrawContext);
 	
 	// definition des parametres de dessin.
-	//double fRatio = (myDock ? myDock->container.fRatio : 1.);
-	//double fMaxScale = cairo_dock_get_max_scale (myContainer); //coefficient Max icone Width
 	int iWidth, iHeight;
 	CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
 	
@@ -171,15 +169,13 @@
 	if (myConfig.bMapWallpaper)
 	{
 		pSurface = myData.pDesktopBgMapSurface;
-		fZoomX = (double) myData.switcher.fOneViewportWidth / iWidth;
-		fZoomY= (double) myData.switcher.fOneViewportHeight / iHeight;
 	}
 	if (pSurface == NULL)
 	{
 		pSurface = myData.pDefaultMapSurface;
-		fZoomX = (double) myData.switcher.fOneViewportWidth / iWidth;
-		fZoomY = (double) myData.switcher.fOneViewportHeight / iHeight;
 	}
+	fZoomX = (double) myData.switcher.fOneViewportWidth / myData.iSurfaceWidth;  // both surfaces are loaded at the same size.
+	fZoomY= (double) myData.switcher.fOneViewportHeight / myData.iSurfaceHeight;
 	
 	// cadre exterieur.
 	cairo_set_line_width (myDrawContext,myConfig.iLineSize);
@@ -332,55 +328,55 @@
 
 void cd_switcher_draw_main_icon_expanded_mode (void)
 {
-	// definition des parametres de dessin.
+	// apply the desktop bg or the user image on the main icon, in dock mode
 	int iWidth, iHeight;
-	CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
-	//double fRatio = (myDock ? myDock->container.fRatio : 1.);
-	//double fMaxScale = cairo_dock_get_max_scale (myContainer); //coefficient Max icone Width
-	myData.switcher.fOneViewportHeight = (iHeight - 2 * myConfig.iLineSize - (myData.switcher.iNbLines - 1) * myConfig.iInLineSize) / myData.switcher.iNbLines; //hauteur d'un bureau/viewport sans compter les lignes exterieures et interieures.
-	myData.switcher.fOneViewportWidth = (iWidth - 2 * myConfig.iLineSize - (myData.switcher.iNbColumns - 1) * myConfig.iInLineSize) / myData.switcher.iNbColumns; //largeur d'un bureau/viewport sans compter les lignes exterieures et interieures.
-
-	cairo_surface_t *pSurface = NULL;
-	double fZoomX, fZoomY;
-	if (myConfig.bMapWallpaper)
+	
+	if (myDock)
 	{
-		cairo_dock_erase_cairo_context (myDrawContext);
-		
-		pSurface = myData.pDesktopBgMapSurface;
-		fZoomX = 1. * iWidth / iWidth;
-		fZoomY= 1. * iHeight / iHeight;
-		cairo_translate (myDrawContext,
-			0.,
-			0.);
-
-		cairo_save (myDrawContext);
-		cairo_scale (myDrawContext,
-			fZoomX ,
-			fZoomY );
-		cairo_set_source_surface (myDrawContext,
-			pSurface,
-			0.,
-			0.);
-		cairo_paint(myDrawContext);
-		cairo_restore (myDrawContext);
-		
-		if (CD_APPLET_MY_CONTAINER_IS_OPENGL)
-			cairo_dock_update_icon_texture (myIcon);
+		CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
+		myData.switcher.fOneViewportHeight = (iHeight - 2 * myConfig.iLineSize - (myData.switcher.iNbLines - 1) * myConfig.iInLineSize) / myData.switcher.iNbLines; //hauteur d'un bureau/viewport sans compter les lignes exterieures et interieures.
+		myData.switcher.fOneViewportWidth = (iWidth - 2 * myConfig.iLineSize - (myData.switcher.iNbColumns - 1) * myConfig.iInLineSize) / myData.switcher.iNbColumns; //largeur d'un bureau/viewport sans compter les lignes exterieures et interieures.
+
+		cairo_surface_t *pSurface = NULL;
+		double fZoomX, fZoomY;
+		if (myConfig.bMapWallpaper)
+		{
+			cairo_dock_erase_cairo_context (myDrawContext);
+
+			pSurface = myData.pDesktopBgMapSurface;
+			fZoomX = 1. * iWidth / myData.iSurfaceWidth;
+			fZoomY= 1. * iHeight / myData.iSurfaceHeight;
+			cairo_translate (myDrawContext,
+				0.,
+				0.);
+
+			cairo_save (myDrawContext);
+			cairo_scale (myDrawContext,
+				fZoomX ,
+				fZoomY );
+			cairo_set_source_surface (myDrawContext,
+				pSurface,
+				0.,
+				0.);
+			cairo_paint(myDrawContext);
+			cairo_restore (myDrawContext);
+
+			if (CD_APPLET_MY_CONTAINER_IS_OPENGL)
+				cairo_dock_update_icon_texture (myIcon);
+			else
+				CD_APPLET_UPDATE_REFLECT_ON_MY_ICON;
+		}
 		else
-			CD_APPLET_UPDATE_REFLECT_ON_MY_ICON;
-	}
-	else
-	{
-		CD_APPLET_SET_IMAGE_ON_MY_ICON (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
-	}
-
+		{
+			CD_APPLET_SET_IMAGE_ON_MY_ICON (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
+		}
+	}
+	
 	if (myConfig.bDrawWindows)
 	{
 		GList *pWindowList = cairo_dock_get_current_applis_list ();
 		pWindowList = g_list_sort (pWindowList, (GCompareFunc) _compare_icons_stack_order);
 		
-		//fMaxScale = (myIcon->pSubDock != NULL ? cairo_dock_get_max_scale (myIcon->pSubDock) : 1);
-		//fRatio = (myIcon->pSubDock != NULL ? myIcon->pSubDock->container.fRatio : 1);
 		CDSwitcherDesktop data;
 		int iNumDesktop=0, iNumViewportX=0, iNumViewportY=0;
 		cairo_t *pCairoContext;
@@ -642,7 +638,7 @@
 			g_object_set (pMenuItem, "height-request", 3, NULL);
 			
 			// on ajoute les fenetres du viewport au menu.
-			//g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
+			g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
 			cd_switcher_foreach_window_on_viewport (iNumDesktop,
 				iNumViewportX,
 				iNumViewportY,

=== modified file 'switcher/src/applet-init.c'
--- switcher/src/applet-init.c	2011-08-09 18:08:08 +0000
+++ switcher/src/applet-init.c	2011-11-05 21:30:29 +0000
@@ -46,6 +46,7 @@
 
 
 CD_APPLET_INIT_BEGIN
+	//\_______________ Rregister the notifications we'll need
 	CD_APPLET_SET_STATIC_ICON;
 	CD_APPLET_REGISTER_FOR_CLICK_EVENT;
 	CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
@@ -67,13 +68,13 @@
 		NOTIFICATION_WINDOW_ACTIVATED,
 		(CairoDockNotificationFunc) on_change_active_window,
 		CAIRO_DOCK_RUN_AFTER, myApplet);
-	if (myConfig.bCompactView)
+	if (myConfig.bCompactView)  // in this mode we need to monitor the cursor
 	{
 		cairo_dock_register_notification_on_object (myContainer,
 			NOTIFICATION_MOUSE_MOVED,
 			(CairoDockNotificationFunc) on_mouse_moved,
 			CAIRO_DOCK_RUN_AFTER, myApplet);
-		if (myDesklet)
+		if (myDesklet)  // in this mode we draw the name of the pointed desktop
 		{
 			cairo_dock_register_notification_on_object (myContainer,
 				NOTIFICATION_RENDER_DESKLET,
@@ -90,15 +91,6 @@
 		}
 	}
 	
-	///cd_switcher_update_from_screen_geometry ();
-	
-	//\___________________ On affiche le numero du bureau courant.
-	/**if (myConfig.bDisplayNumDesk)
-	{
-		int iIndex = cd_switcher_compute_index (myData.switcher.iCurrentDesktop, myData.switcher.iCurrentViewportX, myData.switcher.iCurrentViewportY);
-		CD_APPLET_SET_QUICK_INFO_ON_MY_ICON_PRINTF ("%d", iIndex+1);
-	}*/
-	
 	//\___________________ load the desktops with a delay (because it's quite heavy and because the desktop may not be up-to-date at the very beginning of the session).
 	if (myDesklet)
 		CD_APPLET_SET_DESKLET_RENDERER ("Simple");
@@ -107,7 +99,7 @@
 
 
 CD_APPLET_STOP_BEGIN
-	//\_______________ On se desabonne de nos notifications.
+	//\_______________ Discard the pending drawings.
 	if (myData.iSidRedrawMainIconIdle != 0)
 	{
 		g_source_remove (myData.iSidRedrawMainIconIdle);
@@ -116,8 +108,10 @@
 	{
 		g_source_remove (myData.iSidUpdateIdle);
 	}
-	if (myData.iSidPainIcons != 0)
-		g_source_remove (myData.iSidPainIcons);
+	///if (myData.iSidPainIcons != 0)
+	///	g_source_remove (myData.iSidPainIcons);
+	
+	//\_______________ Unregister notifications
 	CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
 	CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
 	CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
@@ -156,6 +150,7 @@
 		myData.iSidRedrawMainIconIdle = 0;
 	}
 	
+	// if our size has changed, re-compute the grid.
 	if (myData.iSidUpdateIdle == 0)
 	{
 		cd_switcher_compute_nb_lines_and_columns ();
@@ -177,6 +172,7 @@
 			}
 		}
 		
+		// in case our container or our mode has changed (desklet <-> dock, compact <-> expanded), register to the needed notifications.
 		cairo_dock_remove_notification_func_on_object (CD_APPLET_MY_OLD_CONTAINER,
 			NOTIFICATION_MOUSE_MOVED,
 			(CairoDockNotificationFunc) on_mouse_moved, myApplet);
@@ -226,7 +222,7 @@
 			cd_switcher_load_icons ();
 		}
 	}
-	else if (myData.iSidUpdateIdle == 0)
+	else if (myData.iSidUpdateIdle == 0)  // if only our size has changed, re-load the images.
 	{
 		if (myConfig.bMapWallpaper)  // on recharge le wallpaper a la taille de l'applet.
 		{
@@ -234,10 +230,11 @@
 		}
 		if (myData.pDesktopBgMapSurface == NULL)
 			cd_switcher_load_default_map_surface ();
-		if (! myConfig.bCompactView)
-			cd_switcher_trigger_paint_icons ();
+		///if (! myConfig.bCompactView)
+		///	cd_switcher_trigger_paint_icons ();
 	}
 	
+	// redraw.
 	if (myData.iSidUpdateIdle == 0)
 		cd_switcher_draw_main_icon ();
 CD_APPLET_RELOAD_END

=== modified file 'switcher/src/applet-load-icons.c'
--- switcher/src/applet-load-icons.c	2011-09-26 12:56:12 +0000
+++ switcher/src/applet-load-icons.c	2011-11-05 21:30:29 +0000
@@ -25,6 +25,16 @@
 #include "applet-load-icons.h"
 
 
+static void _load_desktop_icon (Icon *pIcon)
+{
+	int iWidth = pIcon->iImageWidth;
+	int iHeight = pIcon->iImageHeight;
+	
+	pIcon->pIconBuffer = cairo_dock_duplicate_surface (myData.pDesktopBgMapSurface,
+		myData.iSurfaceWidth, myData.iSurfaceHeight,
+		iWidth, iHeight);
+}
+
 static GList * _load_icons (void)
 {
 	GList *pIconList = NULL;
@@ -52,6 +62,11 @@
 		}
 		pIcon->cParentDockName = g_strdup (myIcon->cName);
 		
+		if (myConfig.bMapWallpaper)
+		{
+			pIcon->iface.load_image = _load_desktop_icon;
+		}
+		
 		pIconList = g_list_append (pIconList, pIcon);
 	}
 	
@@ -96,15 +111,14 @@
 		GList *pIconList = _load_icons ();
 		
 		//\_______________________ On charge la nouvelle liste.
-		///gpointer pConfig[2] = {GINT_TO_POINTER (myConfig.bDesklet3D), GINT_TO_POINTER (FALSE)};
 		CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Slide", NULL);
 		
 		//\_______________________ On peint les icones.
-		cd_switcher_trigger_paint_icons ();
+		///cd_switcher_trigger_paint_icons ();
 	}
 }
 
-void cd_switcher_paint_icons (void)
+/**void cd_switcher_paint_icons (void)
 {
 	//\_______________________ On applique la surface.
 	CairoContainer *pContainer = CD_APPLET_MY_ICONS_LIST_CONTAINER;
@@ -153,11 +167,10 @@
 	}
 }
 
-
 static gboolean _paint_icons (gpointer data)
 {
 	CD_APPLET_ENTER;
-	if (myConfig.bCompactView)
+	if (! myConfig.bCompactView)
 		cd_switcher_paint_icons ();
 	myData.iSidPainIcons = 0;
 	CD_APPLET_LEAVE (FALSE);
@@ -167,14 +180,14 @@
 	if (myData.iSidPainIcons != 0)  // on la lance en idle, car les icones sont chargees en idle.
 		g_source_remove (myData.iSidPainIcons);
 	myData.iSidPainIcons = g_idle_add ((GSourceFunc)_paint_icons, NULL);
-}
+}*/
 
 
 void cd_switcher_load_desktop_bg_map_surface (void)
 {
+	// get the background surface
 	CairoDockDesktopBackground *db = cairo_dock_get_desktop_background (FALSE);  // FALSE <=> sans texture.
 	cairo_surface_t *pBgSurface = cairo_dock_get_desktop_bg_surface (db);
-	cd_debug ("on a recupere le fond d'ecran (%x)", pBgSurface);
 	
 	if (myData.pDesktopBgMapSurface != NULL)
 		cairo_surface_destroy (myData.pDesktopBgMapSurface);
@@ -185,16 +198,23 @@
 		cairo_dock_destroy_desktop_background (db);
 		return ;
 	}
-	int iWidth, iHeight;
-	CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
-	cd_debug ("%s (%dx%d)", __func__, iWidth, iHeight);
-	
-	cairo_t *pCairoContext = cairo_dock_create_context_from_container (myContainer);
+	
+	// load it at a decent size.
+	if (myDock)
+	{
+		CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
+	}
+	else
+	{
+		myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
+		myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
+	}
+	g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
+	
 	myData.pDesktopBgMapSurface = cairo_dock_duplicate_surface (pBgSurface,
 		g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL], g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL],
-		iWidth, iHeight);
+		myData.iSurfaceWidth, myData.iSurfaceHeight);
 	
-	cairo_destroy (pCairoContext);
 	cairo_dock_destroy_desktop_background (db);
 }
 
@@ -202,6 +222,17 @@
 {
 	if (myData.pDefaultMapSurface != NULL)
 		cairo_surface_destroy (myData.pDefaultMapSurface);
-	cd_debug ("%s (%.2fx%.2f)", __func__, myIcon->fWidth, myIcon->fHeight);
-	myData.pDefaultMapSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (myConfig.cDefaultIcon);
+	if (myDock)
+	{
+		CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
+	}
+	else
+	{
+		myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
+		myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
+	}
+	g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
+	myData.pDefaultMapSurface = cairo_dock_create_surface_from_image_simple (myConfig.cDefaultIcon,
+		myData.iSurfaceWidth,
+		myData.iSurfaceHeight);
 }

=== modified file 'switcher/src/applet-load-icons.h'
--- switcher/src/applet-load-icons.h	2010-08-10 00:05:57 +0000
+++ switcher/src/applet-load-icons.h	2011-11-05 21:30:29 +0000
@@ -28,8 +28,8 @@
 
 void cd_switcher_load_icons (void);
 
-void cd_switcher_paint_icons (void);
-void cd_switcher_trigger_paint_icons (void);
+///void cd_switcher_paint_icons (void);
+///void cd_switcher_trigger_paint_icons (void);
 
 void cd_switcher_load_desktop_bg_map_surface (void);
 void cd_switcher_load_default_map_surface (void);

=== modified file 'switcher/src/applet-struct.h'
--- switcher/src/applet-struct.h	2011-10-03 15:13:15 +0000
+++ switcher/src/applet-struct.h	2011-11-05 21:30:29 +0000
@@ -82,10 +82,12 @@
 	SwitcherApplet switcher;
 	cairo_surface_t *pDefaultMapSurface;
 	cairo_surface_t *pDesktopBgMapSurface;
+	gint iSurfaceWidth;
+	gint iSurfaceHeight;
 	gint iSidRedrawMainIconIdle;
 	gint iSidUpdateIdle;
 	gint iPrevIndexHovered;
 	gdouble fDesktopNameAlpha;
-	guint iSidPainIcons;
+	///guint iSidPainIcons;
 } ;
 #endif


Follow ups