From a2558a2b14054058342d9946deefd7c72dc2d887 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Mon, 17 Oct 2011 17:07:00 +0200 Subject: removed obsolete handler for the gnome-window manager hints nowadays every app should use the extended window manager hints exclusively. --- configure.in | 19 --- src/Gnome.cc | 466 -------------------------------------------------------- src/Gnome.hh | 104 ------------- src/Makefile.am | 5 +- src/fluxbox.cc | 6 - src/main.cc | 5 - 6 files changed, 1 insertion(+), 604 deletions(-) delete mode 100644 src/Gnome.cc delete mode 100644 src/Gnome.hh diff --git a/configure.in b/configure.in index 1d69f34..e75e51f 100644 --- a/configure.in +++ b/configure.in @@ -359,25 +359,6 @@ AC_ARG_ENABLE( AC_DEFINE(TIMEDCACHE, 1, "timed cache") ) -dnl Check GNOME - -AC_MSG_CHECKING([whether to have GNOME support]) -AC_ARG_ENABLE( - gnome, -[ --enable-gnome GNOME support ([default=yes])], - if test x$enableval = "xyes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE(USE_GNOME, 1, "Gnome 1 support") - GNOME=true - else - AC_MSG_RESULT([no]) - GNOME=false - fi, - AC_MSG_RESULT([yes]) - AC_DEFINE(USE_GNOME, 1, "Gnome 1 support") - GNOME=true -) -AM_CONDITIONAL(GNOME, test x$GNOME = xtrue) AC_MSG_CHECKING([whether to have Xft support]) AM_PATH_XFT(yes, diff --git a/src/Gnome.cc b/src/Gnome.cc deleted file mode 100644 index 0c3b6f1..0000000 --- a/src/Gnome.cc +++ /dev/null @@ -1,466 +0,0 @@ -// Gnome.cc for fluxbox -// Copyright (c) 2002 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -#include "Gnome.hh" - -#include "FbTk/App.hh" -#include "FbTk/I18n.hh" -#include "Window.hh" -#include "Screen.hh" -#include "WinClient.hh" -#include "Workspace.hh" -#include "Layer.hh" -#include "Debug.hh" - -#include -#ifdef HAVE_CSTRING - #include -#else - #include -#endif - -using std::cerr; -using std::endl; -using std::list; -using std::hex; -using std::dec; - -Gnome::Gnome() { - setName("gnome"); - createAtoms(); - enableUpdate(); -} - -Gnome::~Gnome() { - // destroy gnome windows - while (!m_gnomewindows.empty()) { - XDestroyWindow(FbTk::App::instance()->display(), m_gnomewindows.back()); - m_gnomewindows.pop_back(); - } -} - - -void Gnome::initForScreen(BScreen &screen) { - Display *disp = FbTk::App::instance()->display(); - // create the GNOME window - Window gnome_win = XCreateSimpleWindow(disp, - screen.rootWindow().window(), 0, 0, 5, 5, 0, 0, 0); - // supported WM check - screen.rootWindow().changeProperty(m_gnome_wm_supporting_wm_check, - XA_WINDOW, 32, - PropModeReplace, (unsigned char *) &gnome_win, 1); - - XChangeProperty(disp, gnome_win, - m_gnome_wm_supporting_wm_check, - XA_WINDOW, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); - - // supported gnome atoms - Atom gnomeatomlist[] = { - m_gnome_wm_supporting_wm_check, - m_gnome_wm_win_workspace_names, - m_gnome_wm_win_client_list, - m_gnome_wm_win_state, - m_gnome_wm_win_hints, - m_gnome_wm_win_layer - }; - //list atoms that we support - screen.rootWindow().changeProperty(m_gnome_wm_prot, - XA_ATOM, 32, PropModeReplace, - (unsigned char *)gnomeatomlist, - (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); - - m_gnomewindows.push_back(gnome_win); - - updateClientList(screen); - updateWorkspaceNames(screen); - updateWorkspaceCount(screen); - updateCurrentWorkspace(screen); - -} - -void Gnome::setupFrame(FluxboxWindow &win) { - // load gnome state (take queues from the main window of the frame) - long flags; - bool exists; - flags=win.winClient().cardinalProperty(m_gnome_wm_win_state,&exists); - if (exists) { - setState(&win, flags); - } else { - updateState(win); - } - - // load gnome layer atom - flags=win.winClient().cardinalProperty(m_gnome_wm_win_layer,&exists); - if (exists) { - setLayer(&win, flags); - } else { - updateLayer(win); - } - - // load gnome workspace atom - flags=win.winClient().cardinalProperty(m_gnome_wm_win_workspace,&exists); - if (exists) - { - unsigned int workspace_num = flags; - if (win.workspaceNumber() != workspace_num) - win.setWorkspace(workspace_num); - } else { - updateWorkspace(win); - } - -} - - -bool Gnome::propertyNotify(WinClient &winclient, Atom the_property) { - if (the_property == m_gnome_wm_win_state) { - fbdbg<<"("<<__FUNCTION__<<"): _WIN_STATE"<windowList().begin(); - Workspace::Windows::iterator win_it_end = - (*workspace_it)->windowList().end(); - for (; win_it != win_it_end; ++win_it) - num += (*win_it)->numClients(); - } - - Window *wl = new Window[num]; - if (wl == 0) { - _FB_USES_NLS; - cerr<<_FB_CONSOLETEXT(Gnome, OutOfMemoryClientList, "Fatal: Out of memory, can't allocate for GNOME client list", "")<windowList().begin(); - Workspace::Windows::const_iterator it_end = - (*workspace_it)->windowList().end(); - for (; it != it_end; ++it) { - // TODO! - //check if the window don't want to be visible in the list - //if (! ( (*it)->getGnomeHints() & WIN_STATE_HIDDEN) ) { - list::iterator client_it = - (*it)->clientList().begin(); - list::iterator client_it_end = - (*it)->clientList().end(); - for (; client_it != client_it_end; ++client_it) - wl[win++] = (*client_it)->window(); - - } - } - //number of windows to show in client list - num = win; - screen.rootWindow().changeProperty(m_gnome_wm_win_client_list, - XA_WINDOW, 32, - PropModeReplace, (unsigned char *)wl, num); - - delete[] wl; -} - -void Gnome::updateClientClose(WinClient &client) { - if (!client.screen().isShuttingdown()) { - XDeleteProperty(FbTk::App::instance()->display(), client.window(), - m_gnome_wm_win_workspace); - XDeleteProperty(FbTk::App::instance()->display(), client.window(), - m_gnome_wm_win_layer); - XDeleteProperty(FbTk::App::instance()->display(), client.window(), - m_gnome_wm_win_state); - } -} - -void Gnome::updateWorkspaceNames(BScreen &screen) { - - size_t number_of_desks = screen.getWorkspaceNames().size(); - const BScreen::WorkspaceNames &workspace_names = screen.getWorkspaceNames(); - // convert our desktop names to a char * so we can send it - char** names = new char*[number_of_desks]; - - for (size_t i = 0; i < number_of_desks; i++) { - names[i] = new char[workspace_names[i].size() + 1]; - strcpy(names[i], workspace_names[i].c_str()); - } - - XTextProperty text; - if (XStringListToTextProperty(names, number_of_desks, &text)) { - XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), - &text, m_gnome_wm_win_workspace_names); - XFree(text.value); - } - - // destroy name buffers - for (size_t i = 0; i < number_of_desks; i++) - delete[] names[i]; - - delete[] names; -} - -void Gnome::updateCurrentWorkspace(BScreen &screen) { - long workspace = screen.currentWorkspaceID(); - screen.rootWindow().changeProperty(m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&workspace, 1); - - updateClientList(screen); // make sure the client list is updated too -} - -void Gnome::updateWorkspaceCount(BScreen &screen) { - long numworkspaces = screen.numberOfWorkspaces(); - screen.rootWindow().changeProperty(m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&numworkspaces, 1); -} - -void Gnome::updateWorkspace(FluxboxWindow &win) { - long val = win.workspaceNumber(); - if (win.isStuck()) { - val = -1; - } - - fbdbg<<"setting workspace("<changeProperty(m_gnome_wm_win_workspace, - XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&val, 1); -} - -void Gnome::updateState(FluxboxWindow &win) { - //translate to gnome win state - long state=0; - if (win.isStuck()) - state |= WIN_STATE_STICKY; - if (win.isIconic()) - state |= WIN_STATE_MINIMIZED; - if (win.isShaded()) - state |= WIN_STATE_SHADED; - - FluxboxWindow::ClientList::iterator client_it = win.clientList().begin(); - FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end(); - for (; client_it != client_it_end; ++client_it) { - (*client_it)->changeProperty(m_gnome_wm_win_state, - XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)&state, 1); - } -} - -void Gnome::updateLayer(FluxboxWindow &win) { - //TODO - map from flux layers to gnome ones - // our layers are in the opposite direction to GNOME - long layernum = ResourceLayer::DESKTOP - win.layerNum(); - - FluxboxWindow::ClientList::iterator client_it = win.clientList().begin(); - FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end(); - for (; client_it != client_it_end; ++client_it) - (*client_it)->changeProperty(m_gnome_wm_win_layer, - XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&layernum, 1); - -} - -void Gnome::updateHints(FluxboxWindow &win) { - //TODO - -} - -bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient) { - if (ce.message_type == m_gnome_wm_win_workspace) { - - fbdbg<<"Got workspace atom="<= 0 && - ce.data.l[0] < (signed)winclient->screen().numberOfWorkspaces()) { - winclient->screen().changeWorkspaceID(ce.data.l[0]); - - } else if (screen!=0 && //the message sent to root window? - ce.data.l[0] >= 0 && - ce.data.l[0] < (signed)screen->numberOfWorkspaces()) - screen->changeWorkspaceID(ce.data.l[0]); - return true; - } else if (winclient == 0) - return false; - - - if (ce.message_type == m_gnome_wm_win_state) { - - fbdbg<<"_WIN_STATE"<fbwindow()) { - //get new states - int flag = ce.data.l[0] & ce.data.l[1]; - //don't update this when when we set new state - disableUpdate(); - // convert to Fluxbox state - setState(winclient->fbwindow(), flag); - // enable update of atom states - enableUpdate(); - } - } else if (ce.message_type == m_gnome_wm_win_hints) { - fbdbg<<"_WIN_HINTS"<fbwindow()) - setLayer(winclient->fbwindow(), ce.data.l[0]); - } else - return false; //the gnome atom wasn't found or not supported - - return true; // we handled the atom -} - -void Gnome::setState(FluxboxWindow *win, int state) { - fbdbg<<"Gnome: state=0x"<isStuck()) - win->stick(); - } else if (win->isStuck()) - win->stick(); - - if (state & WIN_STATE_MINIMIZED) { - fbdbg<<"Gnome state: Minimized"<isIconic()) - win->iconify(); - } else if (win->isIconic()) - win->deiconify(true); - - if (state & WIN_STATE_SHADED) { - - fbdbg<<"Gnome state: Shade"<isShaded()) - win->shade(); - } else if (win->isShaded()) - win->shade(); - - if (state & WIN_STATE_HIDDEN) - { - win->setFocusHidden(! win->isFocusHidden()); - win->setIconHidden(! win->isIconHidden()); - } - - - /* - if (state & WIN_STATE_MAXIMIZED_VERT) - cerr<<"Maximize Vert"<title().logical(); - switch (layer) { - case WIN_LAYER_DESKTOP: - fbdbg<<"Gnome::setLayer("<title().logical()<<", "<moveToLayer(layer); - -} - -void Gnome::createAtoms() { - Display *disp = FbTk::App::instance()->display(); - m_gnome_wm_win_layer = XInternAtom(disp, "_WIN_LAYER", False); - m_gnome_wm_win_state = XInternAtom(disp, "_WIN_STATE", False); - m_gnome_wm_win_hints = XInternAtom(disp, "_WIN_HINTS", False); - m_gnome_wm_win_app_state = XInternAtom(disp, "_WIN_APP_STATE", False); - m_gnome_wm_win_expanded_size = XInternAtom(disp, "_WIN_EXPANDED_SIZE", False); - m_gnome_wm_win_icons = XInternAtom(disp, "_WIN_ICONS", False); - m_gnome_wm_win_workspace = XInternAtom(disp, "_WIN_WORKSPACE", False); - m_gnome_wm_win_workspace_count = XInternAtom(disp, "_WIN_WORKSPACE_COUNT", False); - m_gnome_wm_win_workspace_names = XInternAtom(disp, "_WIN_WORKSPACE_NAMES", False); - m_gnome_wm_win_client_list = XInternAtom(disp, "_WIN_CLIENT_LIST", False); - m_gnome_wm_prot = XInternAtom(disp, "_WIN_PROTOCOLS", False); - m_gnome_wm_supporting_wm_check = XInternAtom(disp, "_WIN_SUPPORTING_WM_CHECK", False); -} diff --git a/src/Gnome.hh b/src/Gnome.hh deleted file mode 100644 index 89de38a..0000000 --- a/src/Gnome.hh +++ /dev/null @@ -1,104 +0,0 @@ -// Gnome.hh for fluxbox -// Copyright (c) 2002 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -#ifndef GNOME_HH -#define GNOME_HH - -#include "AtomHandler.hh" - -#include -#include - -// Implementes Gnome Window Manager Hints (http://developer.gnome.org/doc/standards/wm/book1.html) -class Gnome:public AtomHandler { -public: - 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), // skip this window - 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 - }; - - Gnome(); - ~Gnome(); - void initForScreen(BScreen &screen); - void setupFrame(FluxboxWindow &win); - void setupClient(WinClient &winclient) {} - - void updateWorkarea(BScreen &) { } - void updateFocusedWindow(BScreen &, Window) { } - void updateClientList(BScreen &screen); - void updateClientClose(WinClient &winclient); - void updateWorkspaceNames(BScreen &screen); - void updateCurrentWorkspace(BScreen &screen); - void updateWorkspaceCount(BScreen &screen); - - void updateState(FluxboxWindow &win); - void updateLayer(FluxboxWindow &win); - void updateHints(FluxboxWindow &win); - void updateWorkspace(FluxboxWindow &win); - - bool checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, WinClient * const winclient); - - // ignore these ones - void updateFrameClose(FluxboxWindow &win) {} - bool propertyNotify(WinClient &winclient, Atom the_property); - -private: - void setLayer(FluxboxWindow *win, int layer); - void setState(FluxboxWindow *win, int state); - void setLayer(int layer); - void createAtoms(); - Atom m_gnome_wm_win_layer, m_gnome_wm_win_state, m_gnome_wm_win_hints, - m_gnome_wm_win_app_state, m_gnome_wm_win_expanded_size, - m_gnome_wm_win_icons, m_gnome_wm_win_workspace, - m_gnome_wm_win_workspace_count, m_gnome_wm_win_workspace_names, - m_gnome_wm_win_client_list; - Atom m_gnome_wm_prot; - Atom m_gnome_wm_supporting_wm_check; - std::vector m_gnomewindows; -}; - -#endif // GNOME_HH diff --git a/src/Makefile.am b/src/Makefile.am index cfb249a..8c204db 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,9 +85,6 @@ fluxbox.$(OBJEXT): defaults.hh if NEWWMSPEC newwmspec_SOURCE= Ewmh.hh Ewmh.cc endif -if GNOME -gnome_SOURCE= Gnome.hh Gnome.cc -endif if REMEMBER_SRC REMEMBER_SOURCE= Remember.hh Remember.cc endif @@ -158,7 +155,7 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \ WindowMenuAccessor.hh \ RectangleUtil.hh \ Debug.hh \ - ${newwmspec_SOURCE} ${gnome_SOURCE} \ + ${newwmspec_SOURCE} \ ${REMEMBER_SOURCE} ${TOOLBAR_SOURCE} diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 69a2a23..2e5e373 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -66,9 +66,6 @@ #include "config.h" #endif // HAVE_CONFIG_H -#ifdef USE_GNOME -#include "Gnome.hh" -#endif // USE_GNOME #ifdef USE_NEWWMSPEC #include "Ewmh.hh" #endif // USE_NEWWMSPEC @@ -420,9 +417,6 @@ Fluxbox::Fluxbox(int argc, char **argv, #ifdef USE_NEWWMSPEC addAtomHandler(new Ewmh()); // for Extended window manager atom support #endif // USE_NEWWMSPEC -#ifdef USE_GNOME - addAtomHandler(new Gnome()); // for gnome 1 atom support -#endif //USE_GNOME // parse apps file after creating screens (so we can tell if it's a restart // for [startup] items) but before creating windows // this needs to be after ewmh and gnome, so state atoms don't get diff --git a/src/main.cc b/src/main.cc index 26070dc..c47e1d8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -156,11 +156,6 @@ static void showInfo(ostream &ostr) { #endif // USE_NEWWMSPEC "EWMH" << endl << -#ifndef USE_GNOME - NOT << -#endif // USE_GNOME - "GNOME" << endl << - #ifndef HAVE_IMLIB2 NOT<< #endif // HAVE_IMLIB2 -- cgit v0.11.2