aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-04-19 22:48:19 (GMT)
committerfluxgen <fluxgen>2004-04-19 22:48:19 (GMT)
commitbb991a0166fb5aed0f3b49658b7dc38c0fc2765a (patch)
treec9b7ca370a297233e5188d1c55e295bbbd3841b0
parent20659577859fc0fc85aeaa82f7a6e1e41f17e5e7 (diff)
downloadfluxbox-bb991a0166fb5aed0f3b49658b7dc38c0fc2765a.zip
fluxbox-bb991a0166fb5aed0f3b49658b7dc38c0fc2765a.tar.bz2
kde dockapps in systray
-rw-r--r--src/SystemTray.cc28
-rw-r--r--src/SystemTray.hh8
-rw-r--r--src/fluxbox.cc14
-rw-r--r--src/fluxbox.hh6
4 files changed, 43 insertions, 13 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index bf3bc7d..215adce 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -1,5 +1,5 @@
1// SystemTray.cc 1// SystemTray.cc
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) 2// Copyright (c) 2003-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: SystemTray.cc,v 1.7 2004/04/18 21:18:28 fluxgen Exp $ 22// $Id: SystemTray.cc,v 1.8 2004/04/19 22:48:19 fluxgen Exp $
23 23
24#include "SystemTray.hh" 24#include "SystemTray.hh"
25 25
@@ -27,8 +27,11 @@
27 27
28#include "AtomHandler.hh" 28#include "AtomHandler.hh"
29#include "fluxbox.hh" 29#include "fluxbox.hh"
30#include "WinClient.hh"
31#include "Screen.hh"
30 32
31#include <X11/Xutil.h> 33#include <X11/Xutil.h>
34#include <X11/Xatom.h>
32 35
33#include <string> 36#include <string>
34 37
@@ -53,7 +56,18 @@ public:
53 56
54 void initForScreen(BScreen &screen) { }; 57 void initForScreen(BScreen &screen) { };
55 void setupFrame(FluxboxWindow &win) { }; 58 void setupFrame(FluxboxWindow &win) { };
56 void setupClient(WinClient &winclient) { }; 59 void setupClient(WinClient &winclient) {
60 // we dont want a managed window
61 if (winclient.fbwindow() != 0)
62 return;
63 // if not kde dockapp...
64 if (!winclient.screen().isKdeDockapp(winclient.window()))
65 return;
66 winclient.setEventMask(StructureNotifyMask |
67 SubstructureNotifyMask | EnterWindowMask);
68 m_tray.addClient(winclient.window());
69
70 };
57 71
58 void updateWorkarea(BScreen &) { } 72 void updateWorkarea(BScreen &) { }
59 void updateFocusedWindow(BScreen &, Window) { } 73 void updateFocusedWindow(BScreen &, Window) { }
@@ -103,7 +117,7 @@ SystemTray::SystemTray(const FbTk::FbWindow &parent):
103 // set owner 117 // set owner
104 XSetSelectionOwner(disp, tray_atom, m_window.window(), CurrentTime); 118 XSetSelectionOwner(disp, tray_atom, m_window.window(), CurrentTime);
105 m_handler.reset(new SystemTrayHandler(*this)); 119 m_handler.reset(new SystemTrayHandler(*this));
106 Fluxbox::instance()->addAtomHandler(m_handler.get(), "systray"); 120 Fluxbox::instance()->addAtomHandler(m_handler.get(), atom_name);
107 Window root_window = RootWindow(disp, m_window.screenNumber()); 121 Window root_window = RootWindow(disp, m_window.screenNumber());
108 122
109 // send selection owner msg 123 // send selection owner msg
@@ -207,6 +221,7 @@ SystemTray::ClientList::iterator SystemTray::findClient(Window win) {
207void SystemTray::addClient(Window win) { 221void SystemTray::addClient(Window win) {
208 if (win == 0) 222 if (win == 0)
209 return; 223 return;
224 cerr<<"Add client: "<<win<<endl;
210 225
211 ClientList::iterator it = findClient(win); 226 ClientList::iterator it = findClient(win);
212 if (it != m_clients.end()) 227 if (it != m_clients.end())
@@ -258,6 +273,11 @@ void SystemTray::exposeEvent(XExposeEvent &event) {
258void SystemTray::handleEvent(XEvent &event) { 273void SystemTray::handleEvent(XEvent &event) {
259 if (event.type == DestroyNotify) { 274 if (event.type == DestroyNotify) {
260 removeClient(event.xdestroywindow.window); 275 removeClient(event.xdestroywindow.window);
276 } else if (event.type == UnmapNotify && event.xany.send_event) {
277 // we ignore server-generated events, which can occur
278 // on restart. The ICCCM says that a client must send
279 // a synthetic event for the withdrawn state
280 removeClient(event.xunmap.window);
261 } else if (event.type == ConfigureNotify) { 281 } else if (event.type == ConfigureNotify) {
262 // we got configurenotify from an client 282 // we got configurenotify from an client
263 // check and see if we need to update it's size 283 // check and see if we need to update it's size
diff --git a/src/SystemTray.hh b/src/SystemTray.hh
index 84d78fa..556934a 100644
--- a/src/SystemTray.hh
+++ b/src/SystemTray.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: SystemTray.hh,v 1.3 2003/10/31 10:37:09 rathnor Exp $ 22// $Id: SystemTray.hh,v 1.4 2004/04/19 22:48:19 fluxgen Exp $
23 23
24#ifndef SYSTEMTRAY_HH 24#ifndef SYSTEMTRAY_HH
25#define SYSTEMTRAY_HH 25#define SYSTEMTRAY_HH
@@ -55,6 +55,9 @@ public:
55 void exposeEvent(XExposeEvent &event); 55 void exposeEvent(XExposeEvent &event);
56 void handleEvent(XEvent &event); 56 void handleEvent(XEvent &event);
57 57
58 void addClient(Window win);
59 void removeClient(Window win);
60
58 unsigned int width() const; 61 unsigned int width() const;
59 unsigned int height() const; 62 unsigned int height() const;
60 unsigned int borderWidth() const; 63 unsigned int borderWidth() const;
@@ -65,8 +68,7 @@ public:
65private: 68private:
66 typedef std::list<FbTk::FbWindow *> ClientList; 69 typedef std::list<FbTk::FbWindow *> ClientList;
67 ClientList::iterator findClient(Window win); 70 ClientList::iterator findClient(Window win);
68 void addClient(Window win); 71
69 void removeClient(Window win);
70 void renderTheme(); 72 void renderTheme();
71 void rearrangeClients(); 73 void rearrangeClients();
72 void removeAllClients(); 74 void removeAllClients();
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 9bff0e7..05b4ec2 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.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: fluxbox.cc,v 1.238 2004/04/18 21:16:06 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.239 2004/04/19 22:45:44 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -516,6 +516,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
516 delete screen; 516 delete screen;
517 continue; 517 continue;
518 } 518 }
519 // now it's safe to create windows
520 screen->initWindows();
519 521
520#ifdef HAVE_GETPID 522#ifdef HAVE_GETPID
521 pid_t bpid = getpid(); 523 pid_t bpid = getpid();
@@ -543,6 +545,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
543 m_toolbars.push_back(new Toolbar(*screen, 545 m_toolbars.push_back(new Toolbar(*screen,
544 *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer()))); 546 *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer())));
545#endif // USE_TOOLBAR 547#endif // USE_TOOLBAR
548 // must do this after systray is created
549 screen->setupKdeDockapps();
546 550
547 // attach screen signals to this 551 // attach screen signals to this
548 screen->currentWorkspaceSig().attach(this); 552 screen->currentWorkspaceSig().attach(this);
@@ -559,6 +563,10 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
559 } 563 }
560 564
561 revertFocus(*screen); // make sure focus style is correct 565 revertFocus(*screen); // make sure focus style is correct
566#ifdef SLIT
567 if (screen->slit())
568 screen->slit()->show();
569#endif // SLIT
562 570
563 } // end init screens 571 } // end init screens
564 572
@@ -1474,7 +1482,7 @@ BScreen *Fluxbox::searchScreen(Window window) {
1474} 1482}
1475 1483
1476 1484
1477const AtomHandler* Fluxbox::getAtomHandler(std::string name) { 1485AtomHandler* Fluxbox::getAtomHandler(const std::string &name) {
1478 if ( name != "" ) { 1486 if ( name != "" ) {
1479 for (AtomHandlerContainerIt it= m_atomhandler.begin(); 1487 for (AtomHandlerContainerIt it= m_atomhandler.begin();
1480 it != m_atomhandler.end(); it++ ) { 1488 it != m_atomhandler.end(); it++ ) {
@@ -1484,7 +1492,7 @@ const AtomHandler* Fluxbox::getAtomHandler(std::string name) {
1484 } 1492 }
1485 return 0; 1493 return 0;
1486} 1494}
1487void Fluxbox::addAtomHandler(AtomHandler *atomh, std::string name) { 1495void Fluxbox::addAtomHandler(AtomHandler *atomh, const std::string &name) {
1488 m_atomhandler[atomh]= name;; 1496 m_atomhandler[atomh]= name;;
1489} 1497}
1490 1498
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 8c4630f..2625ec0 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.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: fluxbox.hh,v 1.85 2004/04/18 21:16:06 fluxgen Exp $ 25// $Id: fluxbox.hh,v 1.86 2004/04/19 22:45:44 fluxgen Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -101,8 +101,8 @@ public:
101 inline unsigned int getUpdateDelayTime() const { return *m_rc_update_delay_time; } 101 inline unsigned int getUpdateDelayTime() const { return *m_rc_update_delay_time; }
102 inline Time getLastTime() const { return m_last_time; } 102 inline Time getLastTime() const { return m_last_time; }
103 103
104 const AtomHandler* getAtomHandler(std::string name); 104 AtomHandler *getAtomHandler(const std::string &name);
105 void addAtomHandler(AtomHandler *atomh, std::string name= ""); 105 void addAtomHandler(AtomHandler *atomh, const std::string &name);
106 void removeAtomHandler(AtomHandler *atomh); 106 void removeAtomHandler(AtomHandler *atomh);
107 107
108 /// obsolete 108 /// obsolete