1 /* vim:tabstop=4:expandtab:shiftwidth=4
3 * Idesk -- XDesktopContainer.h
5 * Copyright (c) 2002, Chris (nikon) (nikon@sc.rr.com)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * Neither the name of the <ORGANIZATION> nor the names of its
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
22 * (See the included file COPYING / BSD )
25 #ifndef XDESKTOP_CONTAINER_CLASS
26 #define XDESKTOP_CONTAINER_CLASS
29 #ifdef HAVE_STARTUP_NOTIFICATION
32 #define G_USEC_PER_SEC 1000000
33 #endif /* HAVE_STARTUP_NOTIFICATION */
46 #include "DesktopContainer.h"
47 #include "DesktopConfig.h"
48 #include "ActionConfig.h"
51 static int error_trap_depth
= 0;
55 class XImlib2Background
;
59 class XDesktopContainer
: public DesktopContainer
63 int x
, y
, width
, height
, depth
;
66 XImlib2Background
* bg
;
72 #ifdef HAVE_STARTUP_NOTIFICATION
73 SnDisplay
*sn_display
;
74 SnLauncherContext
*sn_context
;
75 #endif /* HAVE_STARTUP_NOTIFICATION */
80 unsigned int times
[3];
81 unsigned int numClicks
[3];
82 Imlib_Image bgImage
, blended_bgImage
;
86 XDesktopContainer(AbstractApp
* a
);
100 void setContainerBackground();
101 Imlib_Image
createCropImage(int x
, int y
, int width
, int height
);
110 void addIcon(AbstractIcon
*);
111 void addXIcon(const string
& file
, const string
& pictureFile
,
112 const string
& captionText
, const string
& command
,
113 int xCord
, int yCord
,
114 const string
& fontName
, int fontSize
,
115 const string
& color
,
116 Imlib_Image
* spareRoot
);
119 void parseNonIconEvents();
120 XIcon
* parseIconEvents();
121 void exeCurrentAction(XIcon
* icon
);
123 virtual void setEventState();
124 virtual void translateButtonRelease(int button
);
127 void saveIcon(AbstractIcon
*);
130 Display
* getDisplay() { return display
; }
131 Window
getRootWindow() { return rootWindow
; }
136 XIcon
* findIcon(Window window
);
137 void addIcon( const string
& file
, const string
& pictureFile
,
138 const string
& captionText
, const string
& command
,
139 int xCord
, int yCord
) ;
141 void runCommand(const string
& command
);
143 virtual int widthOfScreen();
144 virtual int heightOfScreen();
146 #ifdef HAVE_STARTUP_NOTIFICATION
147 void startup_timeout(SnLauncherContext
* sn_context
);
149 static void error_trap_push (SnDisplay
*display
, Display
*xdisplay
){ ++error_trap_depth
;}
151 static void error_trap_pop (SnDisplay
*display
, Display
*xdisplay
){
152 if (error_trap_depth
== 0)
154 fprintf (stderr
, "Error trap underflow!\n");
158 XSync (xdisplay
, False
); /* get all errors out of the queue */
161 #endif /* HAVE_STARTUP_NOTIFICATION */