all repos — openbox @ 2dde696a1335ef61bb368c55f4ee52e1dd8610a1

openbox fork - make it a bit more like ryudo

much awesome support for special windows like panels/desktops.
All 'non-normal' windows are treated equally now, with a fe wexceptionms for the desktop for stacking.
Fix some ClicmMousePlacement bugs while we're at it.
Dana Jansens danakj@orodu.net
commit

2dde696a1335ef61bb368c55f4ee52e1dd8610a1

parent

41053a810aa701e4e39f124c725c5bbc20492059

M src/Screen.ccsrc/Screen.cc

@@ -312,9 +312,6 @@ std::for_each(iconList.begin(), iconList.end(), PointerAssassin());

std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin()); - while (! desktopWindowList.empty()) - removeDesktopWindow(desktopWindowList[0]); - while (! systrayWindowList.empty()) removeSystrayWindow(systrayWindowList[0]);

@@ -652,7 +649,7 @@ resource.placement_policy = CascadePlacement;

else if (s == "UnderMousePlacement") resource.placement_policy = UnderMousePlacement; else if (s == "ClickMousePlacement") - resource.placement_policy = UnderMousePlacement; + resource.placement_policy = ClickMousePlacement; else if (s == "ColSmartPlacement") resource.placement_policy = ColSmartPlacement; else //if (s == "RowSmartPlacement")

@@ -1168,49 +1165,33 @@ }

} -void BScreen::addDesktopWindow(Window window) { - desktopWindowList.push_back(window); - XLowerWindow(blackbox->getXDisplay(), window); - XSelectInput(blackbox->getXDisplay(), window, StructureNotifyMask); - blackbox->saveDesktopWindowSearch(window, this); -} +void BScreen::manageWindow(Window w) { + // is the window a KDE systray window? + Window systray; + if (xatom->getValue(w, XAtom::kde_net_wm_system_tray_window_for, + XAtom::window, systray) && systray) { + addSystrayWindow(w); + return; + } - -void BScreen::removeDesktopWindow(Window window) { - WindowList::iterator it = desktopWindowList.begin(); - const WindowList::iterator end = desktopWindowList.end(); - for (; it != end; ++it) - if (*it == window) { - desktopWindowList.erase(it); - XSelectInput(blackbox->getXDisplay(), window, None); - blackbox->removeDesktopWindowSearch(window); - break; - } -} - - -void BScreen::manageWindow(Window w) { new BlackboxWindow(blackbox, w, this); BlackboxWindow *win = blackbox->searchWindow(w); if (! win) return; - if (win->windowType() == BlackboxWindow::Type_Desktop) { - // desktop windows cant do anything, so we remove all the normal window - // stuff from them, they are only kept around so that we can keep them on - // the bottom of the z-order - win->restore(True); - addDesktopWindow(win->getClientWindow()); - delete win; - return; + + + if (win->isNormal()) { + // don't list non-normal windows as managed windows + windowList.push_back(win); + updateClientList(); + } else if (win->isDesktop()) { + desktopWindowList.push_back(win->getFrameWindow()); } - windowList.push_back(win); - updateClientList(); - XMapRequestEvent mre; mre.window = w; - if (blackbox->isStartup()) win->restoreAttributes(); + if (blackbox->isStartup() && win->isNormal()) win->restoreAttributes(); win->mapRequestEvent(&mre); }

@@ -1224,8 +1205,20 @@ getWorkspace(w->getWorkspaceNumber())->removeWindow(w);

else if (w->isIconic()) removeIcon(w); - windowList.remove(w); - updateClientList(); + if (w->isNormal()) { + // we don't list non-normal windows as managed windows + windowList.remove(w); + updateClientList(); + } else if (w->isDesktop()) { + WindowList::iterator it = desktopWindowList.begin(); + const WindowList::iterator end = desktopWindowList.end(); + for (; it != end; ++it) + if (*it == w->getFrameWindow()) { + desktopWindowList.erase(it); + break; + } + assert(it != end); // the window wasnt a desktop window? + } if (blackbox->getFocusedWindow() == w) blackbox->setFocusedWindow((BlackboxWindow *) 0);

@@ -2149,7 +2142,6 @@

void BScreen::propertyNotifyEvent(const XPropertyEvent *pe) { if (pe->atom == xatom->getAtom(XAtom::net_desktop_names)) { // _NET_WM_DESKTOP_NAMES - fprintf(stderr, "UPDATING WORKSPACE NAMES\n"); WorkspaceList::iterator it = workspacesList.begin(); const WorkspaceList::iterator end = workspacesList.end(); for (; it != end; ++it) {
M src/Screen.hhsrc/Screen.hh

@@ -320,9 +320,6 @@

void addNetizen(Netizen *n); void removeNetizen(Window w); - void addDesktopWindow(Window window); - void removeDesktopWindow(Window window); - void addSystrayWindow(Window window); void removeSystrayWindow(Window window);
M src/Window.ccsrc/Window.cc

@@ -152,16 +152,9 @@ */

client.rect.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height); client.old_bw = wattrib.border_width; + timer = 0; windowmenu = 0; lastButtonPressTime = 0; - - timer = new BTimer(blackbox, this); - timer->setTimeout(blackbox->getAutoRaiseDelay()); - - if (! getBlackboxHints()) { - getMWMHints(); - getNetWMHints(); - } // get size, aspect, minimum/maximum size and other hints set by the // client

@@ -175,10 +168,12 @@ delete this;

return; } - if (isKDESystrayWindow()) { - screen->addSystrayWindow(client.window); - delete this; - return; + timer = new BTimer(blackbox, this); + timer->setTimeout(blackbox->getAutoRaiseDelay()); + + if (! getBlackboxHints()) { + getMWMHints(); + getNetWMHints(); } frame.window = createToplevelWindow();

@@ -199,32 +194,16 @@

// adjust the window decorations/behavior based on the window type switch (window_type) { case Type_Desktop: - // desktop windows are not managed by us, we just make sure they stay on the - // bottom. - return; - case Type_Dock: case Type_Menu: - // docks (such as kicker) and menus (as used by kde for the 'desktop menu' - // which mimics apple, cannot be moved, and appear on all workspaces - // also, these have no decorations - functions &= ~(Func_Move); - decorations &= ~Decor_Titlebar; - flags.stuck = True; case Type_Toolbar: case Type_Utility: - // these windows have minimal decorations, only a titlebar, and cannot - // be resized or iconified - decorations &= ~(Decor_Maximize | Decor_Handle | Decor_Border | - Decor_Iconify); - functions &= ~(Func_Resize | Func_Maximize | Func_Iconify); - break; - case Type_Splash: - // splash screens have no functionality or decorations, they are left up - // to the application which created them + // none of these windows are decorated or manipulated by the window manager decorations = 0; functions = 0; + blackbox_attrib.workspace = 0; // we do need to belong to a workspace + flags.stuck = True; // we show up on all workspaces break; case Type_Dialog:

@@ -1441,15 +1420,6 @@ flags.stuck = client.transient_for->flags.stuck;

} -bool BlackboxWindow::isKDESystrayWindow(void) { - Window systray; - if (xatom->getValue(client.window, XAtom::kde_net_wm_system_tray_window_for, - XAtom::window, systray) && systray) - return True; - return False; -} - - BlackboxWindow *BlackboxWindow::getTransientFor(void) const { if (client.transient_for && client.transient_for != (BlackboxWindow*) ~0ul)

@@ -1942,11 +1912,10 @@ flags.stuck = False;

if (! flags.iconic) screen->reassociateWindow(this, BSENTINEL, True); - else - // temporary fix since sticky windows suck. set the hint to what we - // actually hold in our data. - xatom->setValue(client.window, XAtom::net_wm_desktop, XAtom::cardinal, - blackbox_attrib.workspace); + // temporary fix since sticky windows suck. set the hint to what we + // actually hold in our data. + xatom->setValue(client.window, XAtom::net_wm_desktop, XAtom::cardinal, + blackbox_attrib.workspace); setState(current_state); } else {

@@ -2538,16 +2507,22 @@ case ZoomState:

default: show(); screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this); - if (! blackbox->isStartup() && (isTransient() || screen->doFocusNew())) { - XSync(blackbox->getXDisplay(), False); // make sure the frame is mapped.. - setInputFocus(); + if (isNormal()) { + if (! blackbox->isStartup()) { + XSync(blackbox->getXDisplay(), False); // make sure the frame is mapped + if (isTransient() || screen->doFocusNew()) { + setInputFocus(); + } + if (screen->getPlacementPolicy() == BScreen::ClickMousePlacement) { + int x, y, rx, ry; + Window c, r; + unsigned int m; + XQueryPointer(blackbox->getXDisplay(), screen->getRootWindow(), + &r, &c, &rx, &ry, &x, &y, &m); + beginMove(rx, ry); + } + } } - int x, y, rx, ry; - Window c, r; - unsigned int m; - XQueryPointer(screen->getBlackbox()->getXDisplay(), screen->getRootWindow(), - &r, &c, &rx, &ry, &x, &y, &m); - beginMove(rx, ry); break; } }

@@ -2742,7 +2717,7 @@

configure(req.x(), req.y(), req.width(), req.height()); } - if (cr->value_mask & CWStackMode) { + if (cr->value_mask & CWStackMode && !isDesktop()) { switch (cr->detail) { case Below: case BottomIf:
M src/Window.hhsrc/Window.hh

@@ -267,7 +267,6 @@ void getNetWMHints(void);

void getMWMHints(void); bool getBlackboxHints(void); void getTransientInfo(void); - bool isKDESystrayWindow(void); void setNetWMAttributes(void); void associateClientWindow(void); void decorate(void);

@@ -321,8 +320,12 @@ inline bool isIconifiable(void) const { return functions & Func_Iconify; }

inline bool isMaximizable(void) const { return functions & Func_Maximize; } inline bool isResizable(void) const { return functions & Func_Resize; } inline bool isClosable(void) const { return functions & Func_Close; } - inline WindowType windowType(void) const { return window_type; } + // is a 'normal' window? meaning, a standard client application + inline bool isNormal(void) const + { return window_type == Type_Dialog || window_type == Type_Normal; } + inline bool isDesktop(void) const { return window_type == Type_Desktop; } + inline bool hasTitlebar(void) const { return decorations & Decor_Titlebar; } inline const BlackboxWindowList &getTransients(void) const
M src/Workspace.ccsrc/Workspace.cc

@@ -79,22 +79,28 @@ assert(w != 0);

if (place) placeWindow(w); - w->setWorkspace(id); - w->setWindowNumber(windowList.size()); - stackingList.push_front(w); - windowList.push_back(w); + + if (w->isNormal()) { + w->setWorkspace(id); + w->setWindowNumber(windowList.size()); - clientmenu->insert(w->getTitle()); - clientmenu->update(); + windowList.push_back(w); - screen->updateNetizenWindowAdd(w->getClientWindow(), id); + clientmenu->insert(w->getTitle()); + clientmenu->update(); + + screen->updateNetizenWindowAdd(w->getClientWindow(), id); + } - raiseWindow(w); + if (! w->isDesktop()) + raiseWindow(w); + else + lowerWindow(w); } -unsigned int Workspace::removeWindow(BlackboxWindow *w) { +void Workspace::removeWindow(BlackboxWindow *w) { assert(w != 0); stackingList.remove(w);

@@ -113,6 +119,8 @@ screen->getWorkspace(i)->focusFallback(w);

} } + if (! w->isNormal()) return; + windowList.remove(w); clientmenu->remove(w->getWindowNumber()); clientmenu->update();

@@ -127,8 +135,6 @@ (*it)->setWindowNumber(i);

if (i == 0) cascade_x = cascade_y = 32; - - return i; }

@@ -154,10 +160,7 @@ BlackboxWindowList::iterator it = stackingList.begin(),

end = stackingList.end(); for (; it != end; ++it) { BlackboxWindow *tmp = *it; - if (! (tmp->windowType() == BlackboxWindow::Type_Dialog || - tmp->windowType() == BlackboxWindow::Type_Normal)) - continue; // don't fallback to special windows - if (tmp && tmp->setInputFocus()) { + if (tmp && tmp->isNormal() && tmp->setInputFocus()) { // we found our new focus target newfocus = tmp; break;

@@ -281,8 +284,10 @@

void Workspace::raiseWindow(BlackboxWindow *w) { BlackboxWindow *win = w; + if (win->isDesktop()) return; + // walk up the transient_for's to the window that is not a transient - while (win->isTransient()) { + while (win->isTransient() && ! win->isDesktop()) { if (! win->getTransientFor()) break; win = win->getTransientFor(); }

@@ -296,7 +301,7 @@ StackVector::iterator stack = stack_vector.begin();

*(stack++) = win->getFrameWindow(); screen->updateNetizenWindowRaise(win->getClientWindow()); - if (! win->isIconic()) { + if (! (win->isIconic() || win->isDesktop())) { Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); wkspc->stackingList.remove(win); wkspc->stackingList.push_front(win);

@@ -312,7 +317,7 @@ void Workspace::lowerWindow(BlackboxWindow *w) {

BlackboxWindow *win = w; // walk up the transient_for's to the window that is not a transient - while (win->isTransient()) { + while (win->isTransient() && ! win->isDesktop()) { if (! win->getTransientFor()) break; win = win->getTransientFor(); }

@@ -328,7 +333,7 @@ lowerTransients(win, stack);

*(stack++) = win->getFrameWindow(); screen->updateNetizenWindowLower(win->getClientWindow()); - if (! win->isIconic()) { + if (! (win->isIconic() || win->isDesktop())) { Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); wkspc->stackingList.remove(win); wkspc->stackingList.push_back(win);
M src/Workspace.hhsrc/Workspace.hh

@@ -93,7 +93,7 @@ bool isCurrent(void) const;

bool isLastWindow(const BlackboxWindow* w) const; void addWindow(BlackboxWindow *w, bool place = False); - unsigned int removeWindow(BlackboxWindow *w); + void removeWindow(BlackboxWindow *w); unsigned int getCount(void) const; void appendStackOrder(BlackboxWindowList &stack_order) const;
M src/blackbox.ccsrc/blackbox.cc

@@ -384,8 +384,6 @@ } else if ((slit = searchSlit(e->xunmap.window))) {

slit->unmapNotifyEvent(&e->xunmap); } else if ((screen = searchSystrayWindow(e->xunmap.window))) { screen->removeSystrayWindow(e->xunmap.window); - } else if ((screen = searchDesktopWindow(e->xunmap.window))) { - screen->removeDesktopWindow(e->xunmap.window); } break;

@@ -405,8 +403,6 @@ } else if ((group = searchGroup(e->xdestroywindow.window))) {

delete group; } else if ((screen = searchSystrayWindow(e->xunmap.window))) { screen->removeSystrayWindow(e->xunmap.window); - } else if ((screen = searchDesktopWindow(e->xunmap.window))) { - screen->removeDesktopWindow(e->xunmap.window); } break;

@@ -494,7 +490,8 @@ (screen = searchScreen(e->xcrossing.window))) {

screen->getImageControl()->installRootColormap(); } else if ((win = searchWindow(e->xcrossing.window))) { if (win->getScreen()->isSloppyFocus() && - (! win->isFocused()) && (! no_focus)) { + (! win->isFocused()) && (! no_focus) && + win->isNormal()) { // don't focus non-normal windows with mouseover if (((! sa.leave) || sa.inferior) && win->isVisible()) { if (win->setInputFocus()) win->installColormap(True); // XXX: shouldnt we honour no install?

@@ -1038,15 +1035,6 @@ return (BScreen *) 0;

} -BScreen *Blackbox::searchDesktopWindow(Window window) { - WindowScreenLookup::iterator it = desktopSearchList.find(window); - if (it != desktopSearchList.end()) - return it->second; - - return (BScreen*) 0; -} - - BScreen *Blackbox::searchSystrayWindow(Window window) { WindowScreenLookup::iterator it = systraySearchList.find(window); if (it != systraySearchList.end())

@@ -1101,11 +1089,6 @@ return (Slit*) 0;

} -void Blackbox::saveDesktopWindowSearch(Window window, BScreen *screen) { - desktopSearchList.insert(WindowScreenLookupPair(window, screen)); -} - - void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) { systraySearchList.insert(WindowScreenLookupPair(window, screen)); }

@@ -1133,11 +1116,6 @@

void Blackbox::saveSlitSearch(Window window, Slit *data) { slitSearchList.insert(SlitLookupPair(window, data)); -} - - -void Blackbox::removeDesktopWindowSearch(Window window) { - desktopSearchList.erase(window); }
M src/blackbox.hhsrc/blackbox.hh

@@ -123,7 +123,7 @@ WindowLookup windowSearchList;

typedef std::map<Window, BScreen*> WindowScreenLookup; typedef WindowScreenLookup::value_type WindowScreenLookupPair; - WindowScreenLookup systraySearchList, desktopSearchList; + WindowScreenLookup systraySearchList; typedef std::map<Window, BWindowGroup*> GroupLookup; typedef GroupLookup::value_type GroupLookupPair;

@@ -175,7 +175,6 @@ virtual ~Blackbox(void);

Basemenu *searchMenu(Window window); BWindowGroup *searchGroup(Window window); - BScreen *searchDesktopWindow(Window window); BScreen *searchSystrayWindow(Window window); BlackboxWindow *searchWindow(Window window); BScreen *searchScreen(Window window);

@@ -183,14 +182,12 @@ Toolbar *searchToolbar(Window);

Slit *searchSlit(Window); void saveMenuSearch(Window window, Basemenu *data); - void saveDesktopWindowSearch(Window window, BScreen *screen); void saveSystrayWindowSearch(Window window, BScreen *screen); void saveWindowSearch(Window window, BlackboxWindow *data); void saveGroupSearch(Window window, BWindowGroup *data); void saveToolbarSearch(Window window, Toolbar *data); void saveSlitSearch(Window window, Slit *data); void removeMenuSearch(Window window); - void removeDesktopWindowSearch(Window window); void removeSystrayWindowSearch(Window window); void removeWindowSearch(Window window); void removeGroupSearch(Window window);