]>
Commit | Line | Data |
---|---|---|
e4d5bbaf | 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 | |
4 | @@ -88,65 +88,13 @@ | |
5 | } | |
6 | } | |
7 | ||
8 | -YXTrayEmbedder::YXTrayEmbedder(YXTray *tray, Window win): YXEmbed(tray) { | |
9 | - fTray = tray; | |
10 | - setStyle(wsManager); | |
11 | - fDocked = new YXEmbedClient(this, this, win); | |
12 | - | |
13 | - XSetWindowBorderWidth(xapp->display(), | |
14 | - client_handle(), | |
15 | - 0); | |
16 | - | |
17 | - XAddToSaveSet(xapp->display(), client_handle()); | |
18 | - | |
19 | - client()->reparent(this, 0, 0); | |
20 | - | |
21 | - fDocked->show(); | |
22 | -} | |
23 | - | |
24 | -YXTrayEmbedder::~YXTrayEmbedder() { | |
25 | - fDocked->hide(); | |
26 | - fDocked->reparent(desktop, 0, 0); | |
27 | - delete fDocked; | |
28 | - fDocked = 0; | |
29 | -} | |
30 | - | |
31 | -void YXTrayEmbedder::detach() { | |
32 | - XAddToSaveSet(xapp->display(), fDocked->handle()); | |
33 | - | |
34 | - fDocked->reparent(desktop, 0, 0); | |
35 | - fDocked->hide(); | |
36 | - XRemoveFromSaveSet(xapp->display(), fDocked->handle()); | |
37 | -} | |
38 | - | |
39 | -void YXTrayEmbedder::destroyedClient(Window win) { | |
40 | - fTray->destroyedClient(win); | |
41 | -} | |
42 | - | |
43 | -void YXTrayEmbedder::paint(Graphics &g, const YRect &/*r*/) { | |
44 | -#ifdef CONFIG_TASKBAR | |
45 | - if (taskBarBg) | |
46 | - g.setColor(taskBarBg); | |
47 | -#endif | |
48 | - g.fillRect(0, 0, width(), height()); | |
49 | -} | |
50 | - | |
51 | -void YXTrayEmbedder::configure(const YRect &r, const bool resized) { | |
52 | - YXEmbed::configure(r, resized); | |
53 | - fDocked->setGeometry(r); | |
54 | -} | |
55 | - | |
56 | -void YXTrayEmbedder::handleConfigureRequest(const XConfigureRequestEvent &configureRequest) | |
57 | -{ | |
58 | - fTray->handleConfigureRequest(configureRequest); | |
59 | -} | |
60 | - | |
61 | YXTray::YXTray(YXTrayNotifier *notifier, | |
62 | bool internal, | |
63 | const char *atom, | |
64 | YWindow *aParent): | |
65 | - YWindow(aParent) | |
66 | + YXEmbed(aParent) | |
67 | { | |
68 | + setStyle(wsManager); | |
69 | #ifndef LITE | |
70 | if (taskBarBg == 0) { | |
71 | taskBarBg = new YColor(clrDefaultTaskBar); | |
72 | @@ -164,7 +112,10 @@ | |
73 | ||
74 | YXTray::~YXTray() { | |
75 | for (unsigned int i = 0; i < fDocked.getCount(); i++) { | |
76 | - delete fDocked[i]; | |
77 | + YXEmbedClient *ec = fDocked[i]; | |
78 | + | |
79 | + ec->hide(); | |
80 | + ec->reparent(desktop, 0, 0); | |
81 | } | |
82 | delete fTrayProxy; fTrayProxy = 0; | |
83 | } | |
84 | @@ -173,13 +124,17 @@ | |
85 | MSG(("trayRequestDock")); | |
86 | ||
87 | destroyedClient(win); | |
88 | - YXTrayEmbedder *embed= new YXTrayEmbedder(this, win); | |
89 | + YXEmbedClient *client = new YXEmbedClient(this, this, win); | |
90 | ||
91 | - MSG(("size %d %d", embed->client()->width(), embed->client()->height())); | |
92 | + MSG(("size %d %d", client->width(), client->height())); | |
93 | + | |
94 | + XSetWindowBorderWidth(xapp->display(), | |
95 | + client->handle(), | |
96 | + 0); | |
97 | ||
98 | if (!fInternal) { | |
99 | - int ww = embed->client()->width(); | |
100 | - int hh = embed->client()->height(); | |
101 | + int ww = client->width(); | |
102 | + int hh = client->height(); | |
103 | ||
104 | // !!! hack, hack | |
105 | if (ww < 16 || ww > 8 * TICON_W_MAX) | |
106 | @@ -187,21 +142,24 @@ | |
107 | if (hh < 16 || hh > TICON_H_MAX) | |
108 | hh = TICON_H_MAX; | |
109 | ||
110 | - embed->setSize(ww, hh); | |
111 | + client->setSize(ww, hh); | |
112 | } | |
113 | ||
114 | + XAddToSaveSet(xapp->display(), client->handle()); | |
115 | + | |
116 | + client->reparent(this, 0, 0); | |
117 | // client->show(); | |
118 | ||
119 | - fDocked.append(embed); | |
120 | + fDocked.append(client); | |
121 | relayout(); | |
122 | } | |
123 | ||
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); | |
133 | fDocked.remove(i); | |
134 | break; | |
135 | @@ -215,8 +173,8 @@ | |
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 @@ | |
147 | ||
148 | void YXTray::detachTray() { | |
149 | for (unsigned int i = 0; i < fDocked.getCount(); i++) { | |
150 | - YXTrayEmbedder *ec = fDocked[i]; | |
151 | - ec->detach(); | |
152 | + YXEmbedClient *ec = fDocked[i]; | |
153 | ||
154 | - } | |
155 | + XAddToSaveSet(xapp->display(), ec->handle()); | |
156 | + | |
157 | + ec->reparent(desktop, 0, 0); | |
158 | + ec->hide(); | |
159 | + XRemoveFromSaveSet(xapp->display(), ec->handle()); | |
160 | + } | |
161 | fDocked.clear(); | |
162 | } | |
163 | ||
164 | @@ -255,7 +217,7 @@ | |
165 | } | |
166 | ||
167 | void YXTray::configure(const YRect &r, const bool resized) { | |
168 | - YWindow::configure(r, resized); | |
169 | + YXEmbed::configure(r, resized); | |
170 | if (resized) | |
171 | relayout(); | |
172 | } | |
173 | @@ -266,10 +228,9 @@ | |
174 | XSetWindowBackground(xapp->display(),handle(), taskBarBg->pixel()); | |
175 | #endif | |
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()); | |
182 | #endif | |
183 | ec->repaint(); | |
184 | } | |
185 | @@ -284,7 +245,7 @@ | |
186 | aw+=1; | |
187 | ||
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); | |
192 | if (!fInternal) { | |
193 | ew=min(TICON_W_MAX,ec->width()); | |
194 | @@ -315,7 +276,7 @@ | |
195 | fNotifier->trayChanged(); | |
196 | } | |
197 | for (unsigned int i = 0; i < fDocked.getCount(); i++) { | |
198 | - YXTrayEmbedder *ec = fDocked[i]; | |
199 | + YXEmbedClient *ec = fDocked[i]; | |
200 | ec->show(); | |
201 | } | |
202 | ||
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 | |
206 | @@ -8,7 +8,6 @@ | |
207 | #define SYSTEM_TRAY_CANCEL_MESSAGE 2 | |
208 | ||
209 | class YXTrayProxy; | |
210 | -class YXTray; | |
211 | ||
212 | class YXTrayNotifier { | |
213 | public: | |
214 | @@ -17,24 +16,7 @@ | |
215 | virtual ~YXTrayNotifier() {}; | |
216 | }; | |
217 | ||
218 | -class YXTrayEmbedder: public YXEmbed { | |
219 | -public: | |
220 | - YXTrayEmbedder(YXTray *tray, Window win); | |
221 | - ~YXTrayEmbedder(); | |
222 | - virtual void paint(Graphics &g, const YRect &r); | |
223 | - virtual void handleConfigureRequest(const XConfigureRequestEvent &configureRequest); | |
224 | - virtual void destroyedClient(Window win); | |
225 | - void detach(); | |
226 | - virtual void configure(const YRect &r, const bool resized); | |
227 | - | |
228 | - Window client_handle() { return fDocked->handle(); } | |
229 | - YXEmbedClient *client() { return fDocked; } | |
230 | -private: | |
231 | - YXTray *fTray; | |
232 | - YXEmbedClient *fDocked; | |
233 | -}; | |
234 | - | |
235 | -class YXTray: public YWindow { | |
236 | +class YXTray: public YXEmbed { | |
237 | public: | |
238 | YXTray(YXTrayNotifier *notifier, bool internal, const char *atom, YWindow *aParent = 0); | |
239 | virtual ~YXTray(); | |
240 | @@ -47,14 +29,13 @@ | |
241 | void relayout(); | |
242 | ||
243 | void trayRequestDock(Window win); | |
244 | + virtual void destroyedClient(Window win); | |
245 | void detachTray(); | |
246 | ||
247 | bool kdeRequestDock(Window win); | |
248 | - | |
249 | - void destroyedClient(Window win); | |
250 | private: | |
251 | YXTrayProxy *fTrayProxy; | |
252 | - YObjectArray<YXTrayEmbedder> fDocked; | |
253 | + YObjectArray<YXEmbedClient> fDocked; | |
254 | YXTrayNotifier *fNotifier; | |
255 | bool fInternal; | |
256 | }; |