kde dockapps in systray

This commit is contained in:
fluxgen 2004-04-19 22:48:19 +00:00
parent 2065957785
commit bb991a0166
4 changed files with 43 additions and 13 deletions

View file

@ -1,5 +1,5 @@
// SystemTray.cc // SystemTray.cc
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) // Copyright (c) 2003-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: SystemTray.cc,v 1.7 2004/04/18 21:18:28 fluxgen Exp $ // $Id: SystemTray.cc,v 1.8 2004/04/19 22:48:19 fluxgen Exp $
#include "SystemTray.hh" #include "SystemTray.hh"
@ -27,8 +27,11 @@
#include "AtomHandler.hh" #include "AtomHandler.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
#include "WinClient.hh"
#include "Screen.hh"
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <string> #include <string>
@ -53,7 +56,18 @@ public:
void initForScreen(BScreen &screen) { }; void initForScreen(BScreen &screen) { };
void setupFrame(FluxboxWindow &win) { }; void setupFrame(FluxboxWindow &win) { };
void setupClient(WinClient &winclient) { }; void setupClient(WinClient &winclient) {
// we dont want a managed window
if (winclient.fbwindow() != 0)
return;
// if not kde dockapp...
if (!winclient.screen().isKdeDockapp(winclient.window()))
return;
winclient.setEventMask(StructureNotifyMask |
SubstructureNotifyMask | EnterWindowMask);
m_tray.addClient(winclient.window());
};
void updateWorkarea(BScreen &) { } void updateWorkarea(BScreen &) { }
void updateFocusedWindow(BScreen &, Window) { } void updateFocusedWindow(BScreen &, Window) { }
@ -103,7 +117,7 @@ SystemTray::SystemTray(const FbTk::FbWindow &parent):
// set owner // set owner
XSetSelectionOwner(disp, tray_atom, m_window.window(), CurrentTime); XSetSelectionOwner(disp, tray_atom, m_window.window(), CurrentTime);
m_handler.reset(new SystemTrayHandler(*this)); m_handler.reset(new SystemTrayHandler(*this));
Fluxbox::instance()->addAtomHandler(m_handler.get(), "systray"); Fluxbox::instance()->addAtomHandler(m_handler.get(), atom_name);
Window root_window = RootWindow(disp, m_window.screenNumber()); Window root_window = RootWindow(disp, m_window.screenNumber());
// send selection owner msg // send selection owner msg
@ -207,6 +221,7 @@ SystemTray::ClientList::iterator SystemTray::findClient(Window win) {
void SystemTray::addClient(Window win) { void SystemTray::addClient(Window win) {
if (win == 0) if (win == 0)
return; return;
cerr<<"Add client: "<<win<<endl;
ClientList::iterator it = findClient(win); ClientList::iterator it = findClient(win);
if (it != m_clients.end()) if (it != m_clients.end())
@ -258,6 +273,11 @@ void SystemTray::exposeEvent(XExposeEvent &event) {
void SystemTray::handleEvent(XEvent &event) { void SystemTray::handleEvent(XEvent &event) {
if (event.type == DestroyNotify) { if (event.type == DestroyNotify) {
removeClient(event.xdestroywindow.window); removeClient(event.xdestroywindow.window);
} else if (event.type == UnmapNotify && event.xany.send_event) {
// we ignore server-generated events, which can occur
// on restart. The ICCCM says that a client must send
// a synthetic event for the withdrawn state
removeClient(event.xunmap.window);
} else if (event.type == ConfigureNotify) { } else if (event.type == ConfigureNotify) {
// we got configurenotify from an client // we got configurenotify from an client
// check and see if we need to update it's size // check and see if we need to update it's size

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: SystemTray.hh,v 1.3 2003/10/31 10:37:09 rathnor Exp $ // $Id: SystemTray.hh,v 1.4 2004/04/19 22:48:19 fluxgen Exp $
#ifndef SYSTEMTRAY_HH #ifndef SYSTEMTRAY_HH
#define SYSTEMTRAY_HH #define SYSTEMTRAY_HH
@ -55,6 +55,9 @@ public:
void exposeEvent(XExposeEvent &event); void exposeEvent(XExposeEvent &event);
void handleEvent(XEvent &event); void handleEvent(XEvent &event);
void addClient(Window win);
void removeClient(Window win);
unsigned int width() const; unsigned int width() const;
unsigned int height() const; unsigned int height() const;
unsigned int borderWidth() const; unsigned int borderWidth() const;
@ -65,8 +68,7 @@ public:
private: private:
typedef std::list<FbTk::FbWindow *> ClientList; typedef std::list<FbTk::FbWindow *> ClientList;
ClientList::iterator findClient(Window win); ClientList::iterator findClient(Window win);
void addClient(Window win);
void removeClient(Window win);
void renderTheme(); void renderTheme();
void rearrangeClients(); void rearrangeClients();
void removeAllClients(); void removeAllClients();

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.238 2004/04/18 21:16:06 fluxgen Exp $ // $Id: fluxbox.cc,v 1.239 2004/04/19 22:45:44 fluxgen Exp $
#include "fluxbox.hh" #include "fluxbox.hh"
@ -516,6 +516,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
delete screen; delete screen;
continue; continue;
} }
// now it's safe to create windows
screen->initWindows();
#ifdef HAVE_GETPID #ifdef HAVE_GETPID
pid_t bpid = getpid(); pid_t bpid = getpid();
@ -543,6 +545,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
m_toolbars.push_back(new Toolbar(*screen, m_toolbars.push_back(new Toolbar(*screen,
*screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer()))); *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer())));
#endif // USE_TOOLBAR #endif // USE_TOOLBAR
// must do this after systray is created
screen->setupKdeDockapps();
// attach screen signals to this // attach screen signals to this
screen->currentWorkspaceSig().attach(this); screen->currentWorkspaceSig().attach(this);
@ -559,6 +563,10 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
} }
revertFocus(*screen); // make sure focus style is correct revertFocus(*screen); // make sure focus style is correct
#ifdef SLIT
if (screen->slit())
screen->slit()->show();
#endif // SLIT
} // end init screens } // end init screens
@ -1474,7 +1482,7 @@ BScreen *Fluxbox::searchScreen(Window window) {
} }
const AtomHandler* Fluxbox::getAtomHandler(std::string name) { AtomHandler* Fluxbox::getAtomHandler(const std::string &name) {
if ( name != "" ) { if ( name != "" ) {
for (AtomHandlerContainerIt it= m_atomhandler.begin(); for (AtomHandlerContainerIt it= m_atomhandler.begin();
it != m_atomhandler.end(); it++ ) { it != m_atomhandler.end(); it++ ) {
@ -1484,7 +1492,7 @@ const AtomHandler* Fluxbox::getAtomHandler(std::string name) {
} }
return 0; return 0;
} }
void Fluxbox::addAtomHandler(AtomHandler *atomh, std::string name) { void Fluxbox::addAtomHandler(AtomHandler *atomh, const std::string &name) {
m_atomhandler[atomh]= name;; m_atomhandler[atomh]= name;;
} }

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.hh,v 1.85 2004/04/18 21:16:06 fluxgen Exp $ // $Id: fluxbox.hh,v 1.86 2004/04/19 22:45:44 fluxgen Exp $
#ifndef FLUXBOX_HH #ifndef FLUXBOX_HH
#define FLUXBOX_HH #define FLUXBOX_HH
@ -101,8 +101,8 @@ public:
inline unsigned int getUpdateDelayTime() const { return *m_rc_update_delay_time; } inline unsigned int getUpdateDelayTime() const { return *m_rc_update_delay_time; }
inline Time getLastTime() const { return m_last_time; } inline Time getLastTime() const { return m_last_time; }
const AtomHandler* getAtomHandler(std::string name); AtomHandler *getAtomHandler(const std::string &name);
void addAtomHandler(AtomHandler *atomh, std::string name= ""); void addAtomHandler(AtomHandler *atomh, const std::string &name);
void removeAtomHandler(AtomHandler *atomh); void removeAtomHandler(AtomHandler *atomh);
/// obsolete /// obsolete