1 diff -urNad icewm-1.2.32~/src/yxtray.cc icewm-1.2.32/src/yxtray.cc
2 --- icewm-1.2.32~/src/yxtray.cc 2007-08-07 07:12:03.000000000 +0200
3 +++ icewm-1.2.32/src/yxtray.cc 2007-09-11 19:52:02.000000000 +0200
8 -YXTrayEmbedder::YXTrayEmbedder(YXTray *tray, Window win): YXEmbed(tray) {
10 - setStyle(wsManager);
11 - fDocked = new YXEmbedClient(this, this, win);
13 - XSetWindowBorderWidth(xapp->display(),
17 - XAddToSaveSet(xapp->display(), client_handle());
19 - client()->reparent(this, 0, 0);
24 -YXTrayEmbedder::~YXTrayEmbedder() {
26 - fDocked->reparent(desktop, 0, 0);
31 -void YXTrayEmbedder::detach() {
32 - XAddToSaveSet(xapp->display(), fDocked->handle());
34 - fDocked->reparent(desktop, 0, 0);
36 - XRemoveFromSaveSet(xapp->display(), fDocked->handle());
39 -void YXTrayEmbedder::destroyedClient(Window win) {
40 - fTray->destroyedClient(win);
43 -void YXTrayEmbedder::paint(Graphics &g, const YRect &/*r*/) {
44 -#ifdef CONFIG_TASKBAR
46 - g.setColor(taskBarBg);
48 - g.fillRect(0, 0, width(), height());
51 -void YXTrayEmbedder::configure(const YRect &r, const bool resized) {
52 - YXEmbed::configure(r, resized);
53 - fDocked->setGeometry(r);
56 -void YXTrayEmbedder::handleConfigureRequest(const XConfigureRequestEvent &configureRequest)
58 - fTray->handleConfigureRequest(configureRequest);
61 YXTray::YXTray(YXTrayNotifier *notifier,
68 + setStyle(wsManager);
71 taskBarBg = new YColor(clrDefaultTaskBar);
75 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
77 + YXEmbedClient *ec = fDocked[i];
80 + ec->reparent(desktop, 0, 0);
82 delete fTrayProxy; fTrayProxy = 0;
85 MSG(("trayRequestDock"));
88 - YXTrayEmbedder *embed= new YXTrayEmbedder(this, win);
89 + YXEmbedClient *client = new YXEmbedClient(this, this, win);
91 - MSG(("size %d %d", embed->client()->width(), embed->client()->height()));
92 + MSG(("size %d %d", client->width(), client->height()));
94 + XSetWindowBorderWidth(xapp->display(),
99 - int ww = embed->client()->width();
100 - int hh = embed->client()->height();
101 + int ww = client->width();
102 + int hh = client->height();
105 if (ww < 16 || ww > 8 * TICON_W_MAX)
106 @@ -187,21 +142,24 @@
107 if (hh < 16 || hh > TICON_H_MAX)
110 - embed->setSize(ww, hh);
111 + client->setSize(ww, hh);
114 + XAddToSaveSet(xapp->display(), client->handle());
116 + client->reparent(this, 0, 0);
119 - fDocked.append(embed);
120 + fDocked.append(client);
124 void YXTray::destroyedClient(Window win) {
125 /// MSG(("undock %d", fDocked.getCount()));
126 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
127 - YXTrayEmbedder *ec = fDocked[i];
128 + YXEmbedClient *ec = fDocked[i];
129 /// msg("win %lX %lX", ec->handle(), win);
130 - if (ec->client_handle() == win) {
131 + if (ec->handle() == win) {
132 /// msg("removing %d %lX", i, win);
136 MSG(("tray configureRequest w=%d h=%d", configureRequest.width, configureRequest.height));
137 bool changed = false;
138 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
139 - YXTrayEmbedder *ec = fDocked[i];
140 - if (ec->client_handle() == configureRequest.window) {
141 + YXEmbedClient *ec = fDocked[i];
142 + if (ec->handle() == configureRequest.window) {
143 int w = configureRequest.width;
144 int h = configureRequest.height;
145 if (h != TICON_H_MAX) {
146 @@ -234,10 +192,14 @@
148 void YXTray::detachTray() {
149 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
150 - YXTrayEmbedder *ec = fDocked[i];
152 + YXEmbedClient *ec = fDocked[i];
155 + XAddToSaveSet(xapp->display(), ec->handle());
157 + ec->reparent(desktop, 0, 0);
159 + XRemoveFromSaveSet(xapp->display(), ec->handle());
167 void YXTray::configure(const YRect &r, const bool resized) {
168 - YWindow::configure(r, resized);
169 + YXEmbed::configure(r, resized);
174 XSetWindowBackground(xapp->display(),handle(), taskBarBg->pixel());
176 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
177 - YXTrayEmbedder *ec = fDocked[i];
178 + YXEmbedClient *ec = fDocked[i];
179 #ifdef CONFIG_TASKBAR
180 XSetWindowBackground(xapp->display(), ec->handle(), taskBarBg->pixel());
181 - XSetWindowBackground(xapp->display(), ec->client_handle(), taskBarBg->pixel());
188 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
189 - YXTrayEmbedder *ec = fDocked[i];
190 + YXEmbedClient *ec = fDocked[i];
191 int eh(h), ew=ec->width(), ay(0);
193 ew=min(TICON_W_MAX,ec->width());
195 fNotifier->trayChanged();
197 for (unsigned int i = 0; i < fDocked.getCount(); i++) {
198 - YXTrayEmbedder *ec = fDocked[i];
199 + YXEmbedClient *ec = fDocked[i];
203 diff -urNad icewm-1.2.32~/src/yxtray.h icewm-1.2.32/src/yxtray.h
204 --- icewm-1.2.32~/src/yxtray.h 2007-08-07 07:12:03.000000000 +0200
205 +++ icewm-1.2.32/src/yxtray.h 2007-09-11 19:51:51.000000000 +0200
207 #define SYSTEM_TRAY_CANCEL_MESSAGE 2
212 class YXTrayNotifier {
215 virtual ~YXTrayNotifier() {};
218 -class YXTrayEmbedder: public YXEmbed {
220 - YXTrayEmbedder(YXTray *tray, Window win);
222 - virtual void paint(Graphics &g, const YRect &r);
223 - virtual void handleConfigureRequest(const XConfigureRequestEvent &configureRequest);
224 - virtual void destroyedClient(Window win);
226 - virtual void configure(const YRect &r, const bool resized);
228 - Window client_handle() { return fDocked->handle(); }
229 - YXEmbedClient *client() { return fDocked; }
232 - YXEmbedClient *fDocked;
235 -class YXTray: public YWindow {
236 +class YXTray: public YXEmbed {
238 YXTray(YXTrayNotifier *notifier, bool internal, const char *atom, YWindow *aParent = 0);
243 void trayRequestDock(Window win);
244 + virtual void destroyedClient(Window win);
247 bool kdeRequestDock(Window win);
249 - void destroyedClient(Window win);
251 YXTrayProxy *fTrayProxy;
252 - YObjectArray<YXTrayEmbedder> fDocked;
253 + YObjectArray<YXEmbedClient> fDocked;
254 YXTrayNotifier *fNotifier;