diff options
author | fluxgen <fluxgen> | 2004-04-19 22:44:42 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-04-19 22:44:42 (GMT) |
commit | 94100534be4d09a999ff6d7065e5fcf5364b8e99 (patch) | |
tree | f5419205f1c06f3a5e207419af1de36ae0760e71 | |
parent | 2bef72c390eb0bc968382bc66ce5176e22417ea9 (diff) | |
download | fluxbox-94100534be4d09a999ff6d7065e5fcf5364b8e99.zip fluxbox-94100534be4d09a999ff6d7065e5fcf5364b8e99.tar.bz2 |
kde dockapps in systray and moved resource templates to ScreenResource.cc
-rw-r--r-- | src/Screen.cc | 504 | ||||
-rw-r--r-- | src/Screen.hh | 8 |
2 files changed, 167 insertions, 345 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index d026f12..eef61c4 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.274 2004/04/12 23:05:10 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.275 2004/04/19 22:44:42 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -48,6 +48,7 @@ | |||
48 | #include "SlitTheme.hh" | 48 | #include "SlitTheme.hh" |
49 | #include "CommandParser.hh" | 49 | #include "CommandParser.hh" |
50 | #include "IconMenuItem.hh" | 50 | #include "IconMenuItem.hh" |
51 | #include "AtomHandler.hh" | ||
51 | 52 | ||
52 | #include "FbTk/Subject.hh" | 53 | #include "FbTk/Subject.hh" |
53 | #include "FbTk/Directory.hh" | 54 | #include "FbTk/Directory.hh" |
@@ -57,6 +58,7 @@ | |||
57 | #include "FbTk/MacroCommand.hh" | 58 | #include "FbTk/MacroCommand.hh" |
58 | #include "FbTk/StringUtil.hh" | 59 | #include "FbTk/StringUtil.hh" |
59 | #include "FbTk/ImageControl.hh" | 60 | #include "FbTk/ImageControl.hh" |
61 | #include "FbTk/EventManager.hh" | ||
60 | 62 | ||
61 | //use GNU extensions | 63 | //use GNU extensions |
62 | #ifndef _GNU_SOURCE | 64 | #ifndef _GNU_SOURCE |
@@ -69,6 +71,7 @@ | |||
69 | 71 | ||
70 | #ifdef SLIT | 72 | #ifdef SLIT |
71 | #include "Slit.hh" | 73 | #include "Slit.hh" |
74 | #include "SlitClient.hh" | ||
72 | #else | 75 | #else |
73 | // fill it in | 76 | // fill it in |
74 | class Slit {}; | 77 | class Slit {}; |
@@ -154,265 +157,6 @@ private: | |||
154 | 157 | ||
155 | } // End anonymous namespace | 158 | } // End anonymous namespace |
156 | 159 | ||
157 | template <> | ||
158 | void FbTk::Resource<BScreen::PlacementPolicy>::setDefaultValue() { | ||
159 | *(*this) = BScreen::ROWSMARTPLACEMENT; | ||
160 | } | ||
161 | |||
162 | template <> | ||
163 | void FbTk::Resource<BScreen::PlacementPolicy>::setFromString(const char *str) { | ||
164 | if (strcasecmp("RowSmartPlacement", str) == 0) | ||
165 | *(*this) = BScreen::ROWSMARTPLACEMENT; | ||
166 | else if (strcasecmp("ColSmartPlacement", str) == 0) | ||
167 | *(*this) = BScreen::COLSMARTPLACEMENT; | ||
168 | else if (strcasecmp("UnderMousePlacement", str) == 0) | ||
169 | *(*this) = BScreen::UNDERMOUSEPLACEMENT; | ||
170 | else if (strcasecmp("CascadePlacement", str) == 0) | ||
171 | *(*this) = BScreen::CASCADEPLACEMENT; | ||
172 | else | ||
173 | setDefaultValue(); | ||
174 | |||
175 | } | ||
176 | |||
177 | template <> | ||
178 | string FbTk::Resource<BScreen::PlacementPolicy>::getString() { | ||
179 | switch (*(*this)) { | ||
180 | case BScreen::ROWSMARTPLACEMENT: | ||
181 | return "RowSmartPlacement"; | ||
182 | case BScreen::COLSMARTPLACEMENT: | ||
183 | return "ColSmartPlacement"; | ||
184 | case BScreen::UNDERMOUSEPLACEMENT: | ||
185 | return "UnderMousePlacement"; | ||
186 | case BScreen::CASCADEPLACEMENT: | ||
187 | return "CascadePlacement"; | ||
188 | } | ||
189 | |||
190 | return "RowSmartPlacement"; | ||
191 | } | ||
192 | |||
193 | template <> | ||
194 | void FbTk::Resource<BScreen::RowDirection>::setDefaultValue() { | ||
195 | *(*this) = BScreen::LEFTRIGHT; | ||
196 | } | ||
197 | |||
198 | template <> | ||
199 | void FbTk::Resource<BScreen::RowDirection>::setFromString(const char *str) { | ||
200 | if (strcasecmp("LeftToRight", str) == 0) | ||
201 | *(*this) = BScreen::LEFTRIGHT; | ||
202 | else if (strcasecmp("RightToLeft", str) == 0) | ||
203 | *(*this) = BScreen::RIGHTLEFT; | ||
204 | else | ||
205 | setDefaultValue(); | ||
206 | |||
207 | } | ||
208 | |||
209 | template <> | ||
210 | string FbTk::Resource<BScreen::RowDirection>::getString() { | ||
211 | switch (*(*this)) { | ||
212 | case BScreen::LEFTRIGHT: | ||
213 | return "LeftToRight"; | ||
214 | case BScreen::RIGHTLEFT: | ||
215 | return "RightToLeft"; | ||
216 | } | ||
217 | |||
218 | return "LeftToRight"; | ||
219 | } | ||
220 | |||
221 | |||
222 | template <> | ||
223 | void FbTk::Resource<BScreen::ColumnDirection>::setDefaultValue() { | ||
224 | *(*this) = BScreen::TOPBOTTOM; | ||
225 | } | ||
226 | |||
227 | template <> | ||
228 | void FbTk::Resource<BScreen::ColumnDirection>::setFromString(const char *str) { | ||
229 | if (strcasecmp("TopToBottom", str) == 0) | ||
230 | *(*this) = BScreen::TOPBOTTOM; | ||
231 | else if (strcasecmp("BottomToTop", str) == 0) | ||
232 | *(*this) = BScreen::BOTTOMTOP; | ||
233 | else | ||
234 | setDefaultValue(); | ||
235 | |||
236 | } | ||
237 | |||
238 | template <> | ||
239 | string FbTk::Resource<BScreen::ColumnDirection>::getString() { | ||
240 | switch (*(*this)) { | ||
241 | case BScreen::TOPBOTTOM: | ||
242 | return "TopToBottom"; | ||
243 | case BScreen::BOTTOMTOP: | ||
244 | return "BottomToTop"; | ||
245 | } | ||
246 | |||
247 | return "TopToBottom"; | ||
248 | } | ||
249 | |||
250 | template <> | ||
251 | void FbTk::Resource<FbTk::MenuTheme::MenuMode>::setDefaultValue() { | ||
252 | *(*this) = FbTk::MenuTheme::DELAY_OPEN; | ||
253 | } | ||
254 | |||
255 | template <> | ||
256 | string FbTk::Resource<FbTk::MenuTheme::MenuMode>::getString() { | ||
257 | switch (*(*this)) { | ||
258 | case FbTk::MenuTheme::DELAY_OPEN: | ||
259 | return string("Delay"); | ||
260 | case FbTk::MenuTheme::CLICK_OPEN: | ||
261 | return string("Click"); | ||
262 | } | ||
263 | return string("Delay"); | ||
264 | } | ||
265 | |||
266 | template <> | ||
267 | void FbTk::Resource<FbTk::MenuTheme::MenuMode>::setFromString(const char *str) { | ||
268 | if (strcasecmp(str, "Delay") == 0) | ||
269 | *(*this) = FbTk::MenuTheme::DELAY_OPEN; | ||
270 | else if (strcasecmp(str, "Click") == 0) | ||
271 | *(*this) = FbTk::MenuTheme::CLICK_OPEN; | ||
272 | else | ||
273 | setDefaultValue(); | ||
274 | } | ||
275 | |||
276 | template<> | ||
277 | std::string FbTk::Resource<BScreen::FocusModel>:: | ||
278 | getString() { | ||
279 | switch (m_value) { | ||
280 | case BScreen::SLOPPYFOCUS: | ||
281 | return string("SloppyFocus"); | ||
282 | case BScreen::SEMISLOPPYFOCUS: | ||
283 | return string("SemiSloppyFocus"); | ||
284 | case BScreen::CLICKTOFOCUS: | ||
285 | return string("ClickToFocus"); | ||
286 | } | ||
287 | // default string | ||
288 | return string("ClickToFocus"); | ||
289 | } | ||
290 | |||
291 | template<> | ||
292 | void FbTk::Resource<BScreen::FocusModel>:: | ||
293 | setFromString(char const *strval) { | ||
294 | // auto raise options here for backwards read compatibility | ||
295 | // they are not supported for saving purposes. Nor does the "AutoRaise" | ||
296 | // part actually do anything | ||
297 | if (strcasecmp(strval, "SloppyFocus") == 0 | ||
298 | || strcasecmp(strval, "AutoRaiseSloppyFocus") == 0) | ||
299 | m_value = BScreen::SLOPPYFOCUS; | ||
300 | else if (strcasecmp(strval, "SemiSloppyFocus") == 0 | ||
301 | || strcasecmp(strval, "AutoRaiseSemiSloppyFocus") == 0) | ||
302 | m_value = BScreen::SEMISLOPPYFOCUS; | ||
303 | else if (strcasecmp(strval, "ClickToFocus") == 0) | ||
304 | m_value = BScreen::CLICKTOFOCUS; | ||
305 | else | ||
306 | setDefaultValue(); | ||
307 | } | ||
308 | |||
309 | template<> | ||
310 | void FbTk::Resource<FbTk::GContext::LineStyle>::setDefaultValue() { | ||
311 | *(*this) = FbTk::GContext::LINESOLID; | ||
312 | } | ||
313 | |||
314 | template<> | ||
315 | std::string FbTk::Resource<FbTk::GContext::LineStyle>::getString() { | ||
316 | switch(m_value) { | ||
317 | case FbTk::GContext::LINESOLID: | ||
318 | return "LineSolid"; | ||
319 | break; | ||
320 | case FbTk::GContext::LINEONOFFDASH: | ||
321 | return "LineOnOffDash"; | ||
322 | break; | ||
323 | case FbTk::GContext::LINEDOUBLEDASH: | ||
324 | return "LineDoubleDash"; | ||
325 | break; | ||
326 | }; | ||
327 | } | ||
328 | |||
329 | template<> | ||
330 | void FbTk::Resource<FbTk::GContext::LineStyle> | ||
331 | ::setFromString(char const *strval) { | ||
332 | |||
333 | if (strcasecmp(strval, "LineSolid") == 0 ) | ||
334 | m_value = FbTk::GContext::LINESOLID; | ||
335 | else if (strcasecmp(strval, "LineOnOffDash") == 0 ) | ||
336 | m_value = FbTk::GContext::LINEONOFFDASH; | ||
337 | else if (strcasecmp(strval, "LineDoubleDash") == 0) | ||
338 | m_value = FbTk::GContext::LINEDOUBLEDASH; | ||
339 | else | ||
340 | setDefaultValue(); | ||
341 | } | ||
342 | |||
343 | template<> | ||
344 | void FbTk::Resource<FbTk::GContext::JoinStyle>::setDefaultValue() { | ||
345 | *(*this) = FbTk::GContext::JOINMITER; | ||
346 | } | ||
347 | |||
348 | template<> | ||
349 | std::string FbTk::Resource<FbTk::GContext::JoinStyle>::getString() { | ||
350 | switch(m_value) { | ||
351 | case FbTk::GContext::JOINMITER: | ||
352 | return "JoinMiter"; | ||
353 | break; | ||
354 | case FbTk::GContext::JOINBEVEL: | ||
355 | return "JoinBevel"; | ||
356 | break; | ||
357 | case FbTk::GContext::JOINROUND: | ||
358 | return "JoinRound"; | ||
359 | break; | ||
360 | }; | ||
361 | } | ||
362 | |||
363 | template<> | ||
364 | void FbTk::Resource<FbTk::GContext::JoinStyle> | ||
365 | ::setFromString(char const *strval) { | ||
366 | |||
367 | if (strcasecmp(strval, "JoinRound") == 0 ) | ||
368 | m_value = FbTk::GContext::JOINROUND; | ||
369 | else if (strcasecmp(strval, "JoinMiter") == 0 ) | ||
370 | m_value = FbTk::GContext::JOINMITER; | ||
371 | else if (strcasecmp(strval, "JoinBevel") == 0) | ||
372 | m_value = FbTk::GContext::JOINBEVEL; | ||
373 | else | ||
374 | setDefaultValue(); | ||
375 | } | ||
376 | |||
377 | template<> | ||
378 | void FbTk::Resource<FbTk::GContext::CapStyle>::setDefaultValue() { | ||
379 | *(*this) = FbTk::GContext::CAPNOTLAST; | ||
380 | } | ||
381 | |||
382 | template<> | ||
383 | std::string FbTk::Resource<FbTk::GContext::CapStyle>::getString() { | ||
384 | switch(m_value) { | ||
385 | case FbTk::GContext::CAPNOTLAST: | ||
386 | return "CapNotLast"; | ||
387 | break; | ||
388 | case FbTk::GContext::CAPBUTT: | ||
389 | return "CapButt"; | ||
390 | break; | ||
391 | case FbTk::GContext::CAPROUND: | ||
392 | return "CapRound"; | ||
393 | break; | ||
394 | case FbTk::GContext::CAPPROJECTING: | ||
395 | return "CapProjecting"; | ||
396 | break; | ||
397 | }; | ||
398 | } | ||
399 | |||
400 | template<> | ||
401 | void FbTk::Resource<FbTk::GContext::CapStyle> | ||
402 | ::setFromString(char const *strval) { | ||
403 | |||
404 | if (strcasecmp(strval, "CapNotLast") == 0 ) | ||
405 | m_value = FbTk::GContext::CAPNOTLAST; | ||
406 | else if (strcasecmp(strval, "CapProjecting") == 0 ) | ||
407 | m_value = FbTk::GContext::CAPPROJECTING; | ||
408 | else if (strcasecmp(strval, "CapRound") == 0) | ||
409 | m_value = FbTk::GContext::CAPROUND; | ||
410 | else if (strcasecmp(strval, "CapButt" ) == 0) | ||
411 | m_value = FbTk::GContext::CAPBUTT; | ||
412 | else | ||
413 | setDefaultValue(); | ||
414 | } | ||
415 | |||
416 | namespace { | 160 | namespace { |
417 | 161 | ||
418 | class StyleMenuItem: public FbTk::MenuItem { | 162 | class StyleMenuItem: public FbTk::MenuItem { |
@@ -710,18 +454,59 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
710 | *resource.gc_cap_style, | 454 | *resource.gc_cap_style, |
711 | *resource.gc_join_style); | 455 | *resource.gc_join_style); |
712 | 456 | ||
713 | int i; | 457 | rm.unlock(); |
458 | |||
459 | |||
460 | XFlush(disp); | ||
461 | } | ||
462 | |||
463 | template <typename A> | ||
464 | void destroyAndClearList(A &a) { | ||
465 | typedef typename A::iterator iterator; | ||
466 | iterator it = a.begin(); | ||
467 | iterator it_end = a.end(); | ||
468 | for (; it != it_end; ++it) | ||
469 | delete (*it); | ||
470 | |||
471 | a.clear(); | ||
472 | } | ||
473 | |||
474 | BScreen::~BScreen() { | ||
475 | if (! managed) | ||
476 | return; | ||
477 | |||
478 | if (m_rootmenu.get() != 0) | ||
479 | m_rootmenu->removeAll(); | ||
480 | |||
481 | if (geom_pixmap != None) | ||
482 | imageControl().removeImage(geom_pixmap); | ||
483 | |||
484 | if (pos_pixmap != None) | ||
485 | imageControl().removeImage(pos_pixmap); | ||
486 | |||
487 | removeWorkspaceNames(); | ||
488 | |||
489 | destroyAndClearList(m_workspaces_list); | ||
490 | destroyAndClearList(m_icon_list); | ||
491 | destroyAndClearList(m_netizen_list); | ||
492 | |||
493 | if (hasXinerama() && m_xinerama_headinfo) { | ||
494 | delete [] m_xinerama_headinfo; | ||
495 | } | ||
496 | } | ||
497 | |||
498 | void BScreen::initWindows() { | ||
714 | unsigned int nchild; | 499 | unsigned int nchild; |
715 | Window r, p, *children; | 500 | Window r, p, *children; |
501 | Display *disp = FbTk::App::instance()->display(); | ||
716 | XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild); | 502 | XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild); |
717 | 503 | ||
718 | // preen the window list of all icon windows... for better dockapp support | 504 | // preen the window list of all icon windows... for better dockapp support |
719 | for (i = 0; i < (int) nchild; i++) { | 505 | for (int i = 0; i < (int) nchild; i++) { |
720 | 506 | ||
721 | if (children[i] == None) continue; | 507 | if (children[i] == None) continue; |
722 | 508 | ||
723 | XWMHints *wmhints = XGetWMHints(FbTk::App::instance()->display(), | 509 | XWMHints *wmhints = XGetWMHints(disp, children[i]); |
724 | children[i]); | ||
725 | 510 | ||
726 | if (wmhints) { | 511 | if (wmhints) { |
727 | if ((wmhints->flags & IconWindowHint) && | 512 | if ((wmhints->flags & IconWindowHint) && |
@@ -737,7 +522,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
737 | } | 522 | } |
738 | 523 | ||
739 | // manage shown windows | 524 | // manage shown windows |
740 | for (i = 0; i < (int) nchild; ++i) { | 525 | Fluxbox *fluxbox = Fluxbox::instance(); |
526 | for (int i = 0; i < (int) nchild; ++i) { | ||
741 | if (children[i] == None || (! fluxbox->validateWindow(children[i]))) | 527 | if (children[i] == None || (! fluxbox->validateWindow(children[i]))) |
742 | continue; | 528 | continue; |
743 | 529 | ||
@@ -759,46 +545,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
759 | } | 545 | } |
760 | } | 546 | } |
761 | 547 | ||
762 | rm.unlock(); | ||
763 | |||
764 | XFree(children); | 548 | XFree(children); |
765 | 549 | ||
766 | XFlush(disp); | ||
767 | } | ||
768 | |||
769 | template <typename A> | ||
770 | void destroyAndClearList(A &a) { | ||
771 | typedef typename A::iterator iterator; | ||
772 | iterator it = a.begin(); | ||
773 | iterator it_end = a.end(); | ||
774 | for (; it != it_end; ++it) | ||
775 | delete (*it); | ||
776 | |||
777 | a.clear(); | ||
778 | } | ||
779 | |||
780 | BScreen::~BScreen() { | ||
781 | if (! managed) | ||
782 | return; | ||
783 | |||
784 | if (m_rootmenu.get() != 0) | ||
785 | m_rootmenu->removeAll(); | ||
786 | |||
787 | if (geom_pixmap != None) | ||
788 | imageControl().removeImage(geom_pixmap); | ||
789 | |||
790 | if (pos_pixmap != None) | ||
791 | imageControl().removeImage(pos_pixmap); | ||
792 | |||
793 | removeWorkspaceNames(); | ||
794 | |||
795 | destroyAndClearList(m_workspaces_list); | ||
796 | destroyAndClearList(m_icon_list); | ||
797 | destroyAndClearList(m_netizen_list); | ||
798 | |||
799 | if (hasXinerama() && m_xinerama_headinfo) { | ||
800 | delete [] m_xinerama_headinfo; | ||
801 | } | ||
802 | } | 550 | } |
803 | 551 | ||
804 | unsigned int BScreen::currentWorkspaceID() const { | 552 | unsigned int BScreen::currentWorkspaceID() const { |
@@ -1371,63 +1119,114 @@ void BScreen::updateNetizenConfigNotify(XEvent &e) { | |||
1371 | (*it)->sendConfigNotify(e); | 1119 | (*it)->sendConfigNotify(e); |
1372 | } | 1120 | } |
1373 | 1121 | ||
1374 | FluxboxWindow *BScreen::createWindow(Window client) { | 1122 | bool BScreen::isKdeDockapp(Window client) const { |
1375 | FbTk::App::instance()->sync(false); | 1123 | //Check and see if client is KDE dock applet. |
1124 | //If so add to Slit | ||
1125 | bool iskdedockapp = false; | ||
1126 | Atom ajunk; | ||
1127 | int ijunk; | ||
1128 | unsigned long *data = 0, uljunk; | ||
1129 | Display *disp = FbTk::App::instance()->display(); | ||
1130 | // Check if KDE v2.x dock applet | ||
1131 | if (XGetWindowProperty(disp, client, | ||
1132 | XInternAtom(FbTk::App::instance()->display(), | ||
1133 | "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False), | ||
1134 | 0l, 1l, False, | ||
1135 | XA_WINDOW, &ajunk, &ijunk, &uljunk, | ||
1136 | &uljunk, (unsigned char **) &data) == Success) { | ||
1137 | |||
1138 | if (data) | ||
1139 | iskdedockapp = true; | ||
1140 | XFree((void *) data); | ||
1141 | data = 0; | ||
1142 | } | ||
1376 | 1143 | ||
1377 | #ifdef SLIT | 1144 | // Check if KDE v1.x dock applet |
1378 | #ifdef KDE | 1145 | if (!iskdedockapp) { |
1379 | //Check and see if client is KDE dock applet. | 1146 | Atom kwm1 = XInternAtom(FbTk::App::instance()->display(), |
1380 | //If so add to Slit | 1147 | "KWM_DOCKWINDOW", False); |
1381 | bool iskdedockapp = false; | ||
1382 | Atom ajunk; | ||
1383 | int ijunk; | ||
1384 | unsigned long *data = 0, uljunk; | ||
1385 | Display *disp = FbTk::App::instance()->display(); | ||
1386 | // Check if KDE v2.x dock applet | ||
1387 | if (XGetWindowProperty(disp, client, | 1148 | if (XGetWindowProperty(disp, client, |
1388 | XInternAtom(FbTk::App::instance()->display(), | 1149 | kwm1, 0l, 1l, False, |
1389 | "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False), | 1150 | kwm1, &ajunk, &ijunk, &uljunk, |
1390 | 0l, 1l, False, | 1151 | &uljunk, (unsigned char **) &data) == Success && data) { |
1391 | XA_WINDOW, &ajunk, &ijunk, &uljunk, | 1152 | iskdedockapp = (data && data[0] != 0); |
1392 | &uljunk, (unsigned char **) &data) == Success) { | ||
1393 | |||
1394 | if (data) | ||
1395 | iskdedockapp = True; | ||
1396 | XFree((void *) data); | 1153 | XFree((void *) data); |
1397 | data = 0; | 1154 | data = 0; |
1398 | } | 1155 | } |
1156 | } | ||
1399 | 1157 | ||
1400 | // Check if KDE v1.x dock applet | 1158 | return iskdedockapp; |
1401 | if (!iskdedockapp) { | 1159 | } |
1402 | Atom kwm1 = XInternAtom(FbTk::App::instance()->display(), | 1160 | |
1403 | "KWM_DOCKWINDOW", False); | 1161 | bool BScreen::addKdeDockapp(Window client) { |
1404 | if (XGetWindowProperty(disp, client, | 1162 | |
1405 | kwm1, 0l, 1l, False, | 1163 | XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask); |
1406 | kwm1, &ajunk, &ijunk, &uljunk, | 1164 | char intbuff[16]; |
1407 | &uljunk, (unsigned char **) &data) == Success && data) { | 1165 | sprintf(intbuff, "%d", screenNumber()); |
1408 | iskdedockapp = (data && data[0] != 0); | 1166 | std::string atom_name("_NET_SYSTEM_TRAY_S"); |
1409 | XFree((void *) data); | 1167 | atom_name += intbuff; // append number |
1410 | data = 0; | 1168 | AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name); |
1411 | } | 1169 | FbTk::EventHandler *evh = 0; |
1170 | FbTk::EventManager *evm = FbTk::EventManager::instance(); | ||
1171 | if (handler == 0) { | ||
1172 | #ifdef SLIT | ||
1173 | if (slit() != 0) | ||
1174 | slit()->addClient(client); | ||
1175 | else | ||
1176 | #endif // SLIT | ||
1177 | return false; | ||
1178 | } else { | ||
1179 | WinClient winclient(client, *this); | ||
1180 | handler->setupClient(winclient); | ||
1181 | // we need to save old handler and re-add it later | ||
1182 | evh = evm->find(client); | ||
1183 | } | ||
1184 | |||
1185 | if (evh != 0) // re-add handler | ||
1186 | evm->add(*evh, client); | ||
1187 | |||
1188 | return true; | ||
1189 | } | ||
1190 | |||
1191 | void BScreen::setupKdeDockapps() { | ||
1192 | #ifdef SLIT | ||
1193 | if (slit() == 0) | ||
1194 | return; | ||
1195 | // kde dockapps end up in the slit at start | ||
1196 | Slit::SlitClients::iterator it = slit()->clients().begin(); | ||
1197 | Slit::SlitClients::iterator it_end = slit()->clients().end(); | ||
1198 | std::list<Window> winlist; | ||
1199 | for (; it != it_end; ++it) { | ||
1200 | if (isKdeDockapp((*it)->window())) { | ||
1201 | winlist.push_back((*it)->window()); | ||
1202 | slit()->removeClient((*it)->window()); | ||
1412 | } | 1203 | } |
1204 | } | ||
1205 | std::list<Window>::iterator win_it = winlist.begin(); | ||
1206 | std::list<Window>::iterator win_it_end = winlist.end(); | ||
1207 | for (; win_it != win_it_end; ++win_it) { | ||
1208 | createWindow(*win_it); | ||
1209 | } | ||
1210 | #endif // SLIT | ||
1211 | } | ||
1413 | 1212 | ||
1414 | if (iskdedockapp) { | 1213 | FluxboxWindow *BScreen::createWindow(Window client) { |
1415 | XSelectInput(disp, client, StructureNotifyMask); | 1214 | FbTk::App::instance()->sync(false); |
1416 | 1215 | ||
1417 | if (slit()) | ||
1418 | slit()->addClient(client); | ||
1419 | 1216 | ||
1217 | if (isKdeDockapp(client)) { | ||
1218 | if (addKdeDockapp(client)) { | ||
1420 | return 0; // dont create a FluxboxWindow for this one | 1219 | return 0; // dont create a FluxboxWindow for this one |
1421 | } | 1220 | } |
1422 | #endif // KDE | 1221 | } |
1423 | #endif // SLIT | ||
1424 | 1222 | ||
1425 | WinClient *winclient = new WinClient(client, *this); | 1223 | WinClient *winclient = new WinClient(client, *this); |
1426 | 1224 | ||
1427 | if (winclient->initial_state == WithdrawnState) { | 1225 | if (winclient->initial_state == WithdrawnState) { |
1428 | delete winclient; | 1226 | delete winclient; |
1429 | #ifdef SLIT | 1227 | #ifdef SLIT |
1430 | slit()->addClient(client); | 1228 | if (slit()) |
1229 | slit()->addClient(client); | ||
1431 | #endif // SLIT | 1230 | #endif // SLIT |
1432 | return 0; | 1231 | return 0; |
1433 | } | 1232 | } |
@@ -1487,14 +1286,31 @@ FluxboxWindow *BScreen::createWindow(Window client) { | |||
1487 | return win; | 1286 | return win; |
1488 | } | 1287 | } |
1489 | 1288 | ||
1289 | |||
1490 | FluxboxWindow *BScreen::createWindow(WinClient &client) { | 1290 | FluxboxWindow *BScreen::createWindow(WinClient &client) { |
1491 | FluxboxWindow *win = new FluxboxWindow(client, | 1291 | FluxboxWindow *win = new FluxboxWindow(client, |
1492 | winFrameTheme(), | 1292 | winFrameTheme(), |
1493 | *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); | 1293 | *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); |
1294 | |||
1295 | if (isKdeDockapp(client.window())) { | ||
1296 | if (addKdeDockapp(client.window())) { | ||
1297 | // we need to save old handler and readd it later | ||
1298 | FbTk::EventManager *evm = FbTk::EventManager::instance(); | ||
1299 | FbTk::EventHandler *evh = evm->find(client.window()); | ||
1300 | delete win; | ||
1301 | evm->add(*evh, client.window()); | ||
1302 | return 0; | ||
1303 | } | ||
1304 | } else { | ||
1305 | |||
1494 | #ifdef SLIT | 1306 | #ifdef SLIT |
1495 | if (win->initialState() == WithdrawnState) | 1307 | if (win->initialState() == WithdrawnState && slit() != 0) { |
1496 | slit()->addClient(win->clientWindow()); | 1308 | slit()->addClient(win->clientWindow()); |
1309 | } | ||
1497 | #endif // SLIT | 1310 | #endif // SLIT |
1311 | } | ||
1312 | |||
1313 | |||
1498 | if (!win->isManaged()) { | 1314 | if (!win->isManaged()) { |
1499 | delete win; | 1315 | delete win; |
1500 | return 0; | 1316 | return 0; |
diff --git a/src/Screen.hh b/src/Screen.hh index 6731d14..cb08d06 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.hh,v 1.138 2004/04/12 23:05:10 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.139 2004/04/19 22:44:42 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -88,6 +88,7 @@ public: | |||
88 | int scrn, int number_of_layers); | 88 | int scrn, int number_of_layers); |
89 | ~BScreen(); | 89 | ~BScreen(); |
90 | 90 | ||
91 | void initWindows(); | ||
91 | inline bool isSloppyFocus() const { return (*resource.focus_model == SLOPPYFOCUS); } | 92 | inline bool isSloppyFocus() const { return (*resource.focus_model == SLOPPYFOCUS); } |
92 | inline bool isSemiSloppyFocus() const { return (*resource.focus_model == SEMISLOPPYFOCUS); } | 93 | inline bool isSemiSloppyFocus() const { return (*resource.focus_model == SEMISLOPPYFOCUS); } |
93 | inline bool isRootColormapInstalled() const { return root_colormap_installed; } | 94 | inline bool isRootColormapInstalled() const { return root_colormap_installed; } |
@@ -134,6 +135,11 @@ public: | |||
134 | unsigned int maxRight(int head) const; | 135 | unsigned int maxRight(int head) const; |
135 | unsigned int maxTop(int head) const; | 136 | unsigned int maxTop(int head) const; |
136 | unsigned int maxBottom(int head) const; | 137 | unsigned int maxBottom(int head) const; |
138 | /// @return true if window is kde dock app | ||
139 | bool isKdeDockapp(Window win) const; | ||
140 | /// @return true if dock app was added, else false | ||
141 | bool addKdeDockapp(Window win); | ||
142 | void setupKdeDockapps(); | ||
137 | 143 | ||
138 | inline unsigned int width() const { return rootWindow().width(); } | 144 | inline unsigned int width() const { return rootWindow().width(); } |
139 | inline unsigned int height() const { return rootWindow().height(); } | 145 | inline unsigned int height() const { return rootWindow().height(); } |