~cairo-dock-team/ubuntu/precise/cairo-dock/3.0.0.0beta1

« back to all changes in this revision

Viewing changes to src/cairo-dock-application-factory.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2008-09-14 16:26:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080914162612-t6aa8pr2o0qry48o
Tags: 1.6.2.3-0ubuntu1
* New upstream release.
* debian/control
 - Update to 3.8.0 (no change needed).
 - Add libxtst-dev as Build-Depends.
* debian/cairo-dock-data.install
 - Add usr/share/cairo-dock/emblems directory.
* debian/watch
 - Update location.
* debian/rules
 - Add a get-orig-source rule.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
1
2
/******************************************************************************
2
3
 
3
4
This file is a part of the cairo-dock program,
4
5
released under the terms of the GNU General Public License.
5
6
 
6
 
Written by Fabrice Rey (for any bug report, please mail me to fabounet_03@yahoo.fr)
 
7
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
7
8
 
8
9
******************************************************************************/
9
10
#include <math.h>
15
16
#include <X11/Xatom.h>
16
17
#include <X11/Xutil.h>
17
18
#include <gdk/gdkx.h>
 
19
#ifdef HAVE_XEXTEND
 
20
#include <X11/extensions/Xcomposite.h>
 
21
//#include <X11/extensions/Xdamage.h>
 
22
#endif
18
23
 
19
24
#include "cairo-dock-load.h"
20
25
#include "cairo-dock-icons.h"
27
32
#include "cairo-dock-log.h"
28
33
#include "cairo-dock-dock-manager.h"
29
34
#include "cairo-dock-class-manager.h"
 
35
#include "cairo-dock-X-utilities.h"
30
36
#include "cairo-dock-application-factory.h"
31
37
 
32
38
extern double g_fAmplitude;
33
 
extern int g_iLabelSize;
34
 
extern gchar *g_cLabelPolice;
 
39
extern CairoDockLabelDescription g_iconTextDescription;
35
40
extern gboolean g_bTextAlwaysHorizontal;
36
41
 
37
42
extern int g_tIconAuthorizedWidth[CAIRO_DOCK_NB_TYPES];
42
47
extern gboolean g_bDemandsAttentionWithDialog;
43
48
extern gboolean g_bDemandsAttentionWithAnimation;
44
49
extern gboolean g_bOverWriteXIcons;
 
50
extern gboolean g_bShowThumbnail;
 
51
extern gboolean g_bTesting;
45
52
 
46
53
static GHashTable *s_hAppliTable = NULL;  // table des PID connus de cairo-dock (affichees ou non dans le dock).
47
54
static Display *s_XDisplay = NULL;
59
66
static Atom s_aString;
60
67
static Atom s_aWmHints;
61
68
static Atom s_aNetWmHidden;
 
69
static Atom s_aNetWmFullScreen;
 
70
static Atom s_aNetWmMaximizedHoriz;
 
71
static Atom s_aNetWmMaximizedVert;
62
72
 
63
73
 
64
74
void cairo_dock_initialize_application_factory (Display *pXDisplay)
90
100
        s_aString = XInternAtom (s_XDisplay, "STRING", False);
91
101
 
92
102
        s_aWmHints = XInternAtom (s_XDisplay, "WM_HINTS", False);
 
103
        
 
104
        s_aNetWmFullScreen = XInternAtom (s_XDisplay, "_NET_WM_STATE_FULLSCREEN", False);
 
105
        s_aNetWmMaximizedHoriz = XInternAtom (s_XDisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
 
106
        s_aNetWmMaximizedVert = XInternAtom (s_XDisplay, "_NET_WM_STATE_MAXIMIZED_VERT", False);
93
107
}
94
108
 
95
109
void cairo_dock_unregister_pid (Icon *icon)
100
114
        }
101
115
}
102
116
 
103
 
 
104
 
static GdkPixbuf *_cairo_dock_get_pixbuf_from_pixmap (int XPixmapID, gboolean bAddAlpha)  // cette fonction est inspiree par celle de libwnck.
 
117
cairo_surface_t *cairo_dock_create_surface_from_xpixmap (Pixmap Xid, cairo_t *pSourceContext, double fMaxScale, double *fWidth, double *fHeight)
105
118
{
106
 
        Window root;  // inutile.
107
 
        int x, y;  // inutile.
108
 
        guint border_width;  // inutile.
109
 
        guint iWidth, iHeight, iDepth;
110
 
        XGetGeometry (s_XDisplay,
111
 
                XPixmapID, &root, &x, &y,
112
 
                &iWidth, &iHeight, &border_width, &iDepth);
113
 
        cd_message ("%s (%d) : %dx%dx%d pixels (%d;%d)\n", __func__, XPixmapID, iWidth, iHeight, iDepth, x, y);
114
 
 
115
 
        //\__________________ On recupere le drawable associe.
116
 
        GdkDrawable *pGdkDrawable = gdk_xid_table_lookup (XPixmapID);
117
 
        if (pGdkDrawable)
118
 
                g_object_ref (G_OBJECT (pGdkDrawable));
119
 
        else
120
 
                pGdkDrawable = gdk_pixmap_foreign_new (XPixmapID);
121
 
 
122
 
        //\__________________ On recupere la colormap.
123
 
        GdkColormap* pColormap = gdk_drawable_get_colormap (pGdkDrawable);
124
 
        if (pColormap == NULL && gdk_drawable_get_depth (pGdkDrawable) > 1)  // pour les bitmaps, on laisse la colormap a NULL, ils n'en ont pas besoin.
125
 
        {
126
 
                GdkScreen* pScreen = gdk_drawable_get_screen (GDK_DRAWABLE (pGdkDrawable));
127
 
                pColormap = gdk_screen_get_system_colormap (pScreen);  // au pire on a un colormap nul.
128
 
        }
129
 
 
130
 
        //\__________________ On recupere le buffer dans un GdkPixbuf.
131
 
        GdkPixbuf *pIconPixbuf = gdk_pixbuf_get_from_drawable (NULL,
132
 
                pGdkDrawable,
133
 
                pColormap,
134
 
                0,
135
 
                0,
136
 
                0,
137
 
                0,
138
 
                iWidth,
139
 
                iHeight);
140
 
        g_object_unref (G_OBJECT (pGdkDrawable));
141
 
        g_return_val_if_fail (pIconPixbuf != NULL, NULL);
142
 
 
143
 
        //\__________________ On lui ajoute un canal alpha si necessaire.
144
 
        if (! gdk_pixbuf_get_has_alpha (pIconPixbuf) && bAddAlpha)
145
 
        {
146
 
                GdkPixbuf *tmp_pixbuf = gdk_pixbuf_add_alpha (pIconPixbuf, TRUE, 255, 255, 255);
147
 
                g_object_unref (pIconPixbuf);
148
 
                pIconPixbuf = tmp_pixbuf;
149
 
        }
150
 
        return pIconPixbuf;
 
119
        g_return_val_if_fail (cairo_status (pSourceContext) == CAIRO_STATUS_SUCCESS && Xid > 0, NULL);
 
120
        GdkPixbuf *pPixbuf = cairo_dock_get_pixbuf_from_pixmap (Xid, TRUE);
 
121
        if (pPixbuf == NULL)
 
122
        {
 
123
                cd_warning ("This pixmap is undefined. It can happen for exemple for a window that is in a minimized state when the dock is launching.");
 
124
                return NULL;
 
125
        }
 
126
        g_print ("window pixmap : %dx%d\n", gdk_pixbuf_get_width (pPixbuf), gdk_pixbuf_get_height (pPixbuf));
 
127
        cairo_surface_t *pSurface = cairo_dock_create_surface_from_pixbuf (pPixbuf,
 
128
                pSourceContext,
 
129
                fMaxScale,
 
130
                g_tIconAuthorizedWidth[CAIRO_DOCK_APPLI],
 
131
                g_tIconAuthorizedHeight[CAIRO_DOCK_APPLI],
 
132
                FALSE,
 
133
                fWidth,
 
134
                fHeight,
 
135
                NULL, NULL);
 
136
        g_object_unref (pPixbuf);
 
137
        return pSurface;
151
138
}
152
139
 
153
140
cairo_surface_t *cairo_dock_create_surface_from_xwindow (Window Xid, cairo_t *pSourceContext, double fMaxScale, double *fWidth, double *fHeight)
178
165
                GdkPixbuf *pIconPixbuf = NULL;
179
166
                if (pWMHints->flags & IconWindowHint)
180
167
                {
181
 
                        cd_debug ("  pas de _NET_WM_ICON, mais une fenetre");
182
168
                        Window XIconID = pWMHints->icon_window;
183
 
                        pIconPixbuf = _cairo_dock_get_pixbuf_from_pixmap (XIconID, TRUE);  // pas teste.
 
169
                        cd_debug ("  pas de _NET_WM_ICON, mais une fenetre (ID:%d)", XIconID);
 
170
                        Pixmap iPixmap = cairo_dock_get_window_background_pixmap (XIconID);
 
171
                        pIconPixbuf = cairo_dock_get_pixbuf_from_pixmap (iPixmap, TRUE);  /// A valider ...
184
172
                }
185
173
                else if (pWMHints->flags & IconPixmapHint)
186
174
                {
187
175
                        cd_debug ("  pas de _NET_WM_ICON, mais un pixmap");
188
176
                        Pixmap XPixmapID = pWMHints->icon_pixmap;
189
 
                        pIconPixbuf = _cairo_dock_get_pixbuf_from_pixmap (XPixmapID, TRUE);
 
177
                        pIconPixbuf = cairo_dock_get_pixbuf_from_pixmap (XPixmapID, TRUE);
190
178
 
191
179
                        //\____________________ On lui applique le masque de transparence s'il existe.
192
180
                        if (pWMHints->flags & IconMaskHint)
193
181
                        {
194
182
                                Pixmap XPixmapMaskID = pWMHints->icon_mask;
195
 
                                GdkPixbuf *pMaskPixbuf = _cairo_dock_get_pixbuf_from_pixmap (XPixmapMaskID, FALSE);
 
183
                                GdkPixbuf *pMaskPixbuf = cairo_dock_get_pixbuf_from_pixmap (XPixmapMaskID, FALSE);
196
184
 
197
185
                                int iNbChannels = gdk_pixbuf_get_n_channels (pIconPixbuf);
198
186
                                int iRowstride = gdk_pixbuf_get_rowstride (pIconPixbuf);
233
221
                                g_tIconAuthorizedHeight[CAIRO_DOCK_APPLI],
234
222
                                FALSE,
235
223
                                fWidth,
236
 
                                fHeight);
 
224
                                fHeight,
 
225
                                NULL, NULL);
237
226
 
238
227
                        g_object_unref (pIconPixbuf);
239
228
                        return pNewSurface;
250
239
        g_free (icon->cParentDockName);
251
240
        if (CAIRO_DOCK_IS_APPLI (icon) && g_bGroupAppliByClass && icon->cClass != NULL)
252
241
        {
253
 
                Icon *pSameClassIcon = cairo_dock_get_icon_with_class (pMainDock->icons, icon->cClass);
254
 
                if (pSameClassIcon == NULL || pSameClassIcon == icon)
 
242
                Icon *pSameClassIcon = cairo_dock_get_classmate (icon);
 
243
                //if (pSameClassIcon != NULL)
 
244
                //      g_print ("class-mate : %s (%s)\n", pSameClassIcon->acName, pSameClassIcon->cParentDockName);
 
245
                //pSameClassIcon = cairo_dock_get_icon_with_class (pMainDock->icons, icon->cClass);
 
246
                if (pSameClassIcon == NULL/** || pSameClassIcon == icon || pSameClassIcon->cParentDockName == NULL*/)  // aucun classmate => elle va dans le main dock.
255
247
                {
256
248
                        cd_message ("  classe %s encore vide", icon->cClass);
257
249
                        icon->cParentDockName = g_strdup (CAIRO_DOCK_MAIN_DOCK_NAME);
 
250
                        CairoDock *pClassDock = cairo_dock_search_dock_from_name (icon->cClass);
 
251
                        if (pClassDock != NULL)
 
252
                        {
 
253
                                if (icon->pSubDock == NULL)
 
254
                                {
 
255
                                        ///icon->pSubDock = pClassDock;
 
256
                                        ///cd_warning ("on lie de force le sous-dock de la classe %s a l'icone %s", icon->cClass, icon->acName);
 
257
                                }
 
258
                                else if (pClassDock != icon->pSubDock)
 
259
                                        cd_warning ("le sous-dock de la classe %s est orphelin  (%s a deja un sous-dock) !", icon->cClass, icon->acName);
 
260
                        }
258
261
                }
259
 
                else
 
262
                else  // on la met dans le sous-dock de sa classe.
260
263
                {
261
264
                        icon->cParentDockName = g_strdup (icon->cClass);
262
265
 
 
266
                        //\____________ On cree ce sous-dock si necessaire.
263
267
                        pParentDock = cairo_dock_search_dock_from_name (icon->cClass);
264
268
                        if (pParentDock == NULL)  // alors il faut creer le sous-dock, et on decide de l'associer a pSameClassIcon.
265
269
                        {
266
270
                                cd_message ("  creation du dock pour la classe %s", icon->cClass);
267
 
                                pParentDock = cairo_dock_create_subdock_for_class_appli (icon->cClass);
268
 
                                pSameClassIcon->pSubDock = pParentDock;
 
271
                                pParentDock = cairo_dock_create_subdock_for_class_appli (icon->cClass, pMainDock);
269
272
                        }
270
273
                        else
271
274
                        {
272
275
                                cd_message ("  sous-dock de la classe %s existant", icon->cClass);
273
 
                                if (pSameClassIcon->pSubDock == NULL)
 
276
                        }
 
277
                        
 
278
                        if (! g_bTesting)
 
279
                        {
 
280
                                //\____________ On l'associe au classmate.
 
281
                                if (pSameClassIcon->pSubDock != NULL && pSameClassIcon->pSubDock != pParentDock)
 
282
                                {
 
283
                                        cd_warning ("this appli (%s) already has a subdock, but it is not the class's subdock => we'll add its classmate in the main dock");
 
284
                                        
 
285
                                }
 
286
                                else if (pSameClassIcon->pSubDock == NULL)
274
287
                                        pSameClassIcon->pSubDock = pParentDock;
275
288
                        }
 
289
                        else
 
290
                        {
 
291
                                if (CAIRO_DOCK_IS_LAUNCHER (pSameClassIcon) || CAIRO_DOCK_IS_APPLET (pSameClassIcon))  // c'est un inhibiteur; on place juste l'icone dans le sous-dock de sa classe.
 
292
                                {
 
293
                                        if (pSameClassIcon->pSubDock != NULL && pSameClassIcon->pSubDock != pParentDock)
 
294
                                        {
 
295
                                                cd_warning ("icon %s alreay owns a subdock, it can't owns the class subdock '%s'", pSameClassIcon->acName, icon->cClass);
 
296
                                                if (pParentDock->icons == NULL)
 
297
                                                        cairo_dock_destroy_dock (pParentDock, icon->cClass, NULL, NULL);
 
298
                                                pParentDock = pMainDock;
 
299
                                                icon->cParentDockName = g_strdup (CAIRO_DOCK_MAIN_DOCK_NAME);
 
300
                                        }
 
301
                                        else
 
302
                                        {
 
303
                                                pSameClassIcon->pSubDock = pParentDock;
 
304
                                                Icon *pInhibatedIcon = cairo_dock_get_icon_with_Xid (pSameClassIcon->Xid);
 
305
                                                pSameClassIcon->Xid = 0;
 
306
                                                if (pInhibatedIcon != NULL)
 
307
                                                {
 
308
                                                        cairo_dock_insert_icon_in_dock (pInhibatedIcon, pParentDock, CAIRO_DOCK_UPDATE_DOCK_SIZE, ! CAIRO_DOCK_ANIMATE_ICON, CAIRO_DOCK_APPLY_RATIO, FALSE);
 
309
                                                }
 
310
                                        }
 
311
                                }
 
312
                                else if (pParentDock->icons == NULL)  // le sous-dock de cette classe est nouveau, on deplace le classmate dans le sous-dock, et on met un fake a sa place pour pointer dessus.
 
313
                                {
 
314
                                        g_print ("nouveau sous-dock de la classe %s\n", pSameClassIcon->cClass);
 
315
                                        Icon *pFakeClassIcon = g_new0 (Icon, 1);
 
316
                                        pFakeClassIcon->acName = g_strdup (pSameClassIcon->cClass);
 
317
                                        pFakeClassIcon->cClass = g_strdup (pSameClassIcon->cClass);
 
318
                                        pFakeClassIcon->iType = pSameClassIcon->iType;
 
319
                                        pFakeClassIcon->fOrder = pSameClassIcon->fOrder;
 
320
                                        pFakeClassIcon->cParentDockName = g_strdup (pSameClassIcon->cParentDockName);
 
321
                                        pFakeClassIcon->fWidth = pSameClassIcon->fWidth;
 
322
                                        pFakeClassIcon->fHeight = pSameClassIcon->fHeight;
 
323
                                        pFakeClassIcon->fXMax = pSameClassIcon->fXMax;
 
324
                                        pFakeClassIcon->fXMin = pSameClassIcon->fXMin;
 
325
                                        pFakeClassIcon->fXAtRest = pSameClassIcon->fXAtRest;
 
326
                                        pFakeClassIcon->pSubDock = pParentDock;  // grace a cela ce sera un lanceur.
 
327
                                        
 
328
                                        CairoDock *pClassMateParentDock = cairo_dock_search_dock_from_name (pSameClassIcon->cParentDockName);
 
329
                                        pFakeClassIcon->Xid = pSameClassIcon->Xid;
 
330
                                        cairo_dock_load_one_icon_from_scratch (pFakeClassIcon, CAIRO_CONTAINER (pClassMateParentDock));  // iBackingPixmap est nul donc on n'aura pas de miniature.
 
331
                                        pFakeClassIcon->Xid = 0;
 
332
                                        /// dessiner une embleme ?...
 
333
                                        
 
334
                                        g_print ("on detache %s pour la passer dans le sous-dock de sa classe\n", pSameClassIcon->acName);
 
335
                                        cairo_dock_detach_icon_from_dock (pSameClassIcon, pClassMateParentDock, FALSE);
 
336
                                        g_free (pSameClassIcon->cParentDockName);
 
337
                                        pSameClassIcon->cParentDockName = g_strdup (pSameClassIcon->cClass);
 
338
                                        cairo_dock_insert_icon_in_dock (pSameClassIcon, pParentDock, CAIRO_DOCK_UPDATE_DOCK_SIZE, ! CAIRO_DOCK_ANIMATE_ICON, CAIRO_DOCK_APPLY_RATIO, FALSE);
 
339
                                }
 
340
                        }
276
341
                }
277
342
        }
278
343
        else
294
359
        double fWidth, fHeight;
295
360
 
296
361
        //\__________________ On regarde si on doit l'afficher ou la sauter.
297
 
        gboolean bSkip = FALSE, bIsHidden = FALSE;
 
362
        gboolean bSkip = FALSE, bIsHidden = FALSE, bIsFullScreen = FALSE, bIsMaximized = FALSE;
298
363
        gulong *pXStateBuffer = NULL;
299
364
        iBufferNbElements = 0;
300
365
        XGetWindowProperty (s_XDisplay, Xid, s_aNetWmState, 0, G_MAXULONG, False, XA_ATOM, &aReturnedType, &aReturnedFormat, &iBufferNbElements, &iLeftBytes, (guchar **)&pXStateBuffer);
301
366
        if (iBufferNbElements > 0)
302
367
        {
303
 
                int i;
 
368
                int i, iNbMaximizedDimensions = 0;
304
369
                for (i = 0; i < iBufferNbElements && ! bSkip; i ++)
305
370
                {
306
371
                        if (pXStateBuffer[i] == s_aNetWmSkipTaskbar)
307
372
                                bSkip = TRUE;
308
373
                        else if (pXStateBuffer[i] == s_aNetWmHidden)
309
374
                                bIsHidden = TRUE;
 
375
                        else if (pXStateBuffer[i] == s_aNetWmMaximizedVert)
 
376
                                iNbMaximizedDimensions ++;
 
377
                        else if (pXStateBuffer[i] == s_aNetWmMaximizedHoriz)
 
378
                                iNbMaximizedDimensions ++;
 
379
                        else if (pXStateBuffer[i] == s_aNetWmFullScreen)
 
380
                                bIsFullScreen = TRUE;
310
381
                        //else if (pXStateBuffer[i] == s_aNetWmSkipPager)  // contestable ...
311
382
                        //      bSkip = TRUE;
312
383
                }
 
384
                bIsMaximized = (iNbMaximizedDimensions == 2);
313
385
                //g_print (" -------- bSkip : %d\n",  bSkip);
314
386
                XFree (pXStateBuffer);
315
387
        }
317
389
        //      cd_message ("pas d'etat defini, donc on continue\n");
318
390
        if (bSkip)
319
391
        {
320
 
                //g_print ("  cette fenetre est timide\n");
 
392
                cd_debug ("  cette fenetre est timide");
321
393
                return NULL;
322
394
        }
323
395
 
429
501
        icon->fOrder = (pLastAppli != NULL ? pLastAppli->fOrder + 1 : 1);
430
502
        icon->iType = CAIRO_DOCK_APPLI;
431
503
        icon->bIsHidden = bIsHidden;
432
 
 
433
 
        ///cairo_dock_fill_one_icon_buffer (icon, pSourceContext, 1 + g_fAmplitude, pDock->bHorizontalDock, TRUE);
434
 
        ///cairo_dock_fill_one_text_buffer (icon, pSourceContext, g_iLabelSize, g_cLabelPolice, (g_bTextAlwaysHorizontal ? CAIRO_DOCK_HORIZONTAL : pDock->bHorizontalDock), pDock->bDirectionUp);
 
504
        icon->bIsMaximized = bIsMaximized;
 
505
        icon->bIsFullScreen = bIsFullScreen;
 
506
        
 
507
        cairo_dock_get_window_geometry (Xid,
 
508
                &icon->windowGeometry.x,
 
509
                &icon->windowGeometry.y,
 
510
                &icon->windowGeometry.width,
 
511
                &icon->windowGeometry.height);
 
512
        #ifdef HAVE_XEXTEND
 
513
        if (g_bShowThumbnail)
 
514
        {
 
515
                icon->iBackingPixmap = XCompositeNameWindowPixmap (s_XDisplay, Xid);
 
516
                /*icon->iDamageHandle = XDamageCreate (s_XDisplay, Xid, XDamageReportNonEmpty);  // XDamageReportRawRectangles
 
517
                g_print ("backing pixmap : %d ; iDamageHandle : %d\n", icon->iBackingPixmap, icon->iDamageHandle);*/
 
518
        }
 
519
        #endif
 
520
        
435
521
        cairo_dock_fill_icon_buffers_for_dock (icon, pSourceContext, pDock);
436
 
 
 
522
        
437
523
        if (g_bUniquePid)
438
524
                g_hash_table_insert (s_hAppliTable, pPidBuffer, icon);
439
525
        cairo_dock_register_appli (icon);
440
526
        XFree (pNameBuffer);
441
 
 
 
527
        
442
528
        cairo_dock_set_window_mask (Xid, PropertyChangeMask | StructureNotifyMask);
443
529
 
444
530
        return icon;
471
557
                                XFree (pNameBuffer);
472
558
 
473
559
                                pCairoContext = cairo_dock_create_context_from_window (CAIRO_CONTAINER (pDock));
474
 
                                cairo_dock_fill_one_text_buffer (icon, pCairoContext, g_iLabelSize, g_cLabelPolice, (g_bTextAlwaysHorizontal ? CAIRO_DOCK_HORIZONTAL : pDock->bHorizontalDock), pDock->bDirectionUp);
 
560
                                cairo_dock_fill_one_text_buffer (icon, pCairoContext, &g_iconTextDescription, (g_bTextAlwaysHorizontal ? CAIRO_DOCK_HORIZONTAL : pDock->bHorizontalDock), pDock->bDirectionUp);
475
561
                                cairo_destroy (pCairoContext);
476
562
                        }
477
563
                }
538
624
                }
539
625
        }
540
626
}
541
 
 
542
 
 
543
 
gchar *cairo_dock_get_property_name_on_xwindow (Window Xid, Atom xPropertyAtom)
544
 
{
545
 
        guchar *pNameBuffer = NULL;
546
 
        Atom aReturnedType = 0;
547
 
        int aReturnedFormat = 0;
548
 
        unsigned long iLeftBytes, iBufferNbElements;
549
 
        
550
 
        XGetWindowProperty (s_XDisplay, Xid, xPropertyAtom, 0, G_MAXULONG, False, s_aUtf8String, &aReturnedType, &aReturnedFormat, &iBufferNbElements, &iLeftBytes, &pNameBuffer);
551
 
        if (iBufferNbElements == 0)
552
 
        {
553
 
                XGetWindowProperty (s_XDisplay, Xid, xPropertyAtom, 0, G_MAXULONG, False, s_aString, &aReturnedType, &aReturnedFormat, &iBufferNbElements, &iLeftBytes, &pNameBuffer);
554
 
        }
555
 
        g_print ("iBufferNbElements : %d\n", iBufferNbElements);
556
 
        if (iBufferNbElements == 0)
557
 
        {
558
 
                g_print ("dommage !\n");
559
 
                return NULL;
560
 
        }
561
 
        else return pNameBuffer;
562
 
}