From 54d855ee5947d6575d04d2a26cf5132df1f003ec Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 7 Sep 2002 20:16:43 +0000 Subject: removed gnome stuff --- src/Window.cc | 303 ++++------------------------------------------------------ src/Window.hh | 94 ++++-------------- 2 files changed, 37 insertions(+), 360 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index 2c6499e..2df8f30 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.78 2002/09/07 10:41:26 fluxgen Exp $ +// $Id: Window.cc,v 1.79 2002/09/07 20:16:43 fluxgen Exp $ #include "Window.hh" @@ -57,6 +57,9 @@ using namespace std; FluxboxWindow::FluxboxWindow(Window w, BScreen *s): +m_hintsig(*this), +m_statesig(*this), +m_workspacesig(*this), image_ctrl(0), moving(false), resizing(false), shaded(false), maximized(false), visible(false), iconic(false), transient(false), focused(false), @@ -67,11 +70,7 @@ display(0), lastButtonPressTime(0), windowmenu(0), m_layer(LAYER_NORMAL), -tab(0) -#ifdef GNOME -,gnome_hints(0) -#endif -{ +tab(0) { lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0; #ifdef DEBUG @@ -324,9 +323,6 @@ tab(0) setFocusFlag(false); -#ifdef GNOME - updateGnomeAtoms(); -#endif // GNOME #ifdef DEBUG fprintf(stderr, "%s(%d): FluxboxWindow(this=%p)\n", __FILE__, __LINE__, this); @@ -447,33 +443,6 @@ FluxboxWindow::~FluxboxWindow() { #endif } -void FluxboxWindow::showError(FluxboxWindow::Error error) { - -#ifdef DEBUG - switch (error) { - case NOERROR: - break; - case XGETWINDOWATTRIB: - fprintf(stderr, - I18n::instance()-> - getMessage( - FBNLS::WindowSet, FBNLS::WindowXGetWindowAttributesFail, - "FluxboxWindow::FluxboxWindow(): XGetWindowAttributes " - "failed\n") - ); - break; - case CANTFINDSCREEN: - fprintf(stderr, - I18n::instance()-> - getMessage( - FBNLS::WindowSet, FBNLS::WindowCannotFindScreen, - "FluxboxWindow::FluxboxWindow(): can't find screen\n" - " for root window")); - break; - }; -#endif // DEBUG -} - Window FluxboxWindow::createToplevelWindow( int x, int y, unsigned int width, unsigned int height, @@ -791,232 +760,6 @@ void FluxboxWindow::createButton(int type, ButtonEventProc pressed, ButtonEventP buttonlist.push_back(b); } -#ifdef GNOME -//TODO -void FluxboxWindow::updateGnomeAtoms() const { - updateGnomeStateAtom(); - updateGnomeLayerAtom(); - updateGnomeWorkspaceAtom(); -} - -void FluxboxWindow::updateGnomeStateAtom() const { - int val = getGnomeWindowState(); - XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeStateAtom(), - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); -} - -void FluxboxWindow::updateGnomeLayerAtom() const { - int val = getGnomeLayer(); - XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeLayerAtom(), - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); -} - -void FluxboxWindow::updateGnomeWorkspaceAtom() const { - int val = workspace_number; - XChangeProperty(display, client.window, FbAtoms::instance()->getGnomeWorkspaceAtom(), - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); -} - -//TODO -int FluxboxWindow::getGnomeWindowState() const { - int state=0; - if (isStuck()) - state |= WIN_STATE_STICKY; - if (isIconic()) - state |= WIN_STATE_MINIMIZED; - if (isShaded()) - state |= WIN_STATE_SHADED; - /*TODO: states: - WIN_STATE_MAXIMIZED_VERT // window in maximized V state - WIN_STATE_MAXIMIZED_HORIZ // window in maximized H state - WIN_STATE_HIDDEN // not on taskbar but window visible - WIN_STATE_HID_WORKSPACE // not on current desktop - WIN_STATE_HID_TRANSIENT // owner of transient is hidden - WIN_STATE_FIXED_POSITION // window is fixed in position even - WIN_STATE_ARRANGE_IGNORE // ignore for auto arranging - */ - return state; -} - -//TODO -int FluxboxWindow::getGnomeLayer() const { - switch (m_layer) { - case LAYER_NORMAL: - return WIN_LAYER_NORMAL; - case LAYER_BOTTOM: - return WIN_LAYER_BELOW; - case LAYER_TOP: - return WIN_LAYER_ONTOP; - case LAYER_BELOW: - return WIN_LAYER_BELOW; - default: - break; - } - return WIN_LAYER_NORMAL; -} - -bool FluxboxWindow::handleGnomePropertyNotify(Atom atom) { - FbAtoms *fba = FbAtoms::instance(); - - if (atom == fba->getGnomeStateAtom()) { - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome state"<getGnomeWorkspaceAtom()) { - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome workspace"<getGnomeHintsAtom()) { - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints"<getGnomeLayerAtom()){ - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome layer"<getGnomeStateAtom(), 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { - flags = *data; - setGnomeState(flags); - XFree (data); - } -} - -//--------- loadGnomeHintsAtom --------- -// Gets the gnome hint from the atom -//---------------------------------------- -void FluxboxWindow::loadGnomeHintsAtom() { - Atom ret_type; - int fmt; - unsigned long nitems, bytes_after; - long *data = 0; - - if (XGetWindowProperty (display, getClientWindow(), - FbAtoms::instance()->getGnomeHintsAtom(), 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { - gnome_hints = static_cast(*data); - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints:0x"<getGnomeLayerAtom(), 0, 1, False, XA_CARDINAL, - &ret_type, &fmt, &nitems, &bytes_after, - (unsigned char **) &data) == Success && data) { - setGnomeLayer(static_cast(*data)); - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): gnome hints:0x"<getBorderWidth(), screen->getBorderWidth(), @@ -1889,10 +1629,6 @@ void FluxboxWindow::iconify() { client.transient->iconify(); } -#ifdef GNOME - updateGnomeStateAtom(); -#endif // GNOME - } @@ -2285,9 +2021,12 @@ void FluxboxWindow::setWorkspace(int n) { blackbox_attrib.flags |= BaseDisplay::ATTRIB_WORKSPACE; blackbox_attrib.workspace = workspace_number; - #ifdef GNOME - updateGnomeWorkspaceAtom(); - #endif + + // notify workspace change +#ifdef DEBUG + cerr<getFluxboxAttributesAtom(), fluxbox->getFluxboxAttributesAtom(), 32, PropModeReplace, (unsigned char *) &blackbox_attrib, PropBlackboxAttributesElements); + + //notify state changed + m_statesig.notify(); } //TODO: why ungrab in if-statement? @@ -2809,10 +2545,6 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) { void FluxboxWindow::mapNotifyEvent(XMapEvent *ne) { -#ifdef GNOME - loadGnomeAtoms(); -#endif // GNOME - if ((ne->window == client.window) && (! ne->override_redirect) && (visible)) { Fluxbox *fluxbox = Fluxbox::instance(); fluxbox->grab(); @@ -2979,9 +2711,6 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { } } else { bool val = false; - #ifdef GNOME - val = handleGnomePropertyNotify(atom); - #endif #ifdef NEWWMSPEC if (!val) handleNETWMPropertyNotify(atom); diff --git a/src/Window.hh b/src/Window.hh index 6090d71..c01372f 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.29 2002/08/30 14:06:40 fluxgen Exp $ +// $Id: Window.hh,v 1.30 2002/09/07 20:13:55 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -30,6 +30,7 @@ #include "BaseDisplay.hh" #include "Timer.hh" #include "Windowmenu.hh" +#include "Subject.hh" #include #include @@ -51,41 +52,6 @@ class Tab; */ class FluxboxWindow : public TimeoutHandler { public: - /// obsolete - enum Error{NOERROR=0, XGETWINDOWATTRIB, CANTFINDSCREEN}; - -#ifdef GNOME - enum GnomeLayer { - WIN_LAYER_DESKTOP = 0, - WIN_LAYER_BELOW = 2, - WIN_LAYER_NORMAL = 4, - WIN_LAYER_ONTOP = 6, - WIN_LAYER_DOCK = 8, - WIN_LAYER_ABOVE_DOCK = 10, - WIN_LAYER_MENU = 12 - }; - - enum GnomeState { - WIN_STATE_STICKY = (1<<0), // everyone knows sticky - WIN_STATE_MINIMIZED = (1<<1), // Reserved - definition is unclear - WIN_STATE_MAXIMIZED_VERT = (1<<2), // window in maximized V state - WIN_STATE_MAXIMIZED_HORIZ = (1<<3), // window in maximized H state - WIN_STATE_HIDDEN = (1<<4), // not on taskbar but window visible - WIN_STATE_SHADED = (1<<5), // shaded (MacOS / Afterstep style) - WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop - WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden - WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even - WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging - }; - - enum GnomeHints { - WIN_HINTS_SKIP_FOCUS = (1<<0), // "alt-tab" skips this win - WIN_HINTS_SKIP_WINLIST = (1<<1), // do not show in window list - WIN_HINTS_SKIP_TASKBAR = (1<<2), // do not show on taskbar - WIN_HINTS_GROUP_TRANSIENT = (1<<3), // Reserved - definition is unclear - WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked - }; -#endif // GNOME enum WinLayer { LAYER_BOTTOM = 0x01, @@ -176,6 +142,13 @@ public: const std::string className() const { return m_class_name; } const std::string instanceName() const { return m_instance_name; } bool isLowerTab() const; + // signals + FbTk::Subject &stateSig() { return m_statesig; } + const FbTk::Subject &stateSig() const { return m_statesig; } + FbTk::Subject &hintSig() { return m_hintsig; } + const FbTk::Subject &hintSig() const { return m_hintsig; } + FbTk::Subject &workspaceSig() { return m_workspacesig; } + const FbTk::Subject &workspaceSig() const { return m_workspacesig; } //@} inline void setWindowNumber(int n) { window_number = n; } @@ -218,8 +191,6 @@ public: void setDecoration(Decoration decoration); void toggleDecoration(); - - static void showError(FluxboxWindow::Error error); #ifdef SHAPE void shapeEvent(XShapeEvent *); @@ -235,13 +206,19 @@ public: unsigned long decorations; // Motif wm decorations } MwmHints; -#ifdef GNOME - void setGnomeState(int state); - inline int getGnomeHints() const { return gnome_hints; } -#endif //GNOME - + class WinSubject: public FbTk::Subject { + public: + WinSubject(FluxboxWindow &w):m_win(w) { } + FluxboxWindow &win() { return m_win; } + const FluxboxWindow &win() const { return m_win; } + private: + FluxboxWindow &m_win; + }; + private: - + // state and hint signals + WinSubject m_hintsig, m_statesig, m_workspacesig; + BImageControl *image_ctrl; //image control for rendering // got from WM_CLASS @@ -350,35 +327,6 @@ private: void destroyHandle(); void checkTransient(); -#ifdef GNOME - - void updateGnomeAtoms() const; - void updateGnomeStateAtom() const; - void updateGnomeHintsAtom() const; - void updateGnomeLayerAtom() const; - void updateGnomeWorkspaceAtom() const; - - void setGnomeLayer(int layer); - - int getGnomeWindowState() const; - bool handleGnomePropertyNotify(Atom atom); - int getGnomeLayer() const; - void loadGnomeAtoms(); - void loadGnomeStateAtom(); - void loadGnomeHintsAtom(); - void loadGnomeLayerAtom(); - - int gnome_hints; -#endif //GNOME - -#ifdef NEWWMSPEC - - void updateNETWMAtoms(); - void handleNETWMProperyNotify(Atom atom); - int getNETWMWindowState(); - -#endif //NEWWMSPEC - Window findTitleButton(int type); private: //event callbacks -- cgit v0.11.2