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.
std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin());
- while (! desktopWindowList.empty())
- removeDesktopWindow(desktopWindowList[0]);
-
while (! systrayWindowList.empty())
removeSystrayWindow(systrayWindowList[0]);
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")
}
-void BScreen::addDesktopWindow(Window window) {
- desktopWindowList.push_back(window);
- XLowerWindow(blackbox->getXDisplay(), window);
- XSelectInput(blackbox->getXDisplay(), window, StructureNotifyMask);
- blackbox->saveDesktopWindowSearch(window, this);
-}
-
-
-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) {
+ // 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;
+ }
+
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;
- }
- windowList.push_back(win);
- updateClientList();
+
+ 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());
+ }
XMapRequestEvent mre;
mre.window = w;
- if (blackbox->isStartup()) win->restoreAttributes();
+ if (blackbox->isStartup() && win->isNormal()) win->restoreAttributes();
win->mapRequestEvent(&mre);
}
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);
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) {
void addNetizen(Netizen *n);
void removeNetizen(Window w);
- void addDesktopWindow(Window window);
- void removeDesktopWindow(Window window);
-
void addSystrayWindow(Window window);
void removeSystrayWindow(Window window);
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
getWMProtocols();
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();
// 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:
}
-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)
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 {
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;
}
}
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:
void getMWMHints(void);
bool getBlackboxHints(void);
void getTransientInfo(void);
- bool isKDESystrayWindow(void);
void setNetWMAttributes(void);
void associateClientWindow(void);
void decorate(void);
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
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);
+
+ clientmenu->insert(w->getTitle());
+ clientmenu->update();
- screen->updateNetizenWindowAdd(w->getClientWindow(), id);
+ 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);
}
}
+ if (! w->isNormal()) return;
+
windowList.remove(w);
clientmenu->remove(w->getWindowNumber());
clientmenu->update();
if (i == 0)
cascade_x = cascade_y = 32;
-
- return i;
}
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;
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();
}
*(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);
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();
}
*(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);
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;
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;
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;
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?
}
-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())
}
-void Blackbox::saveDesktopWindowSearch(Window window, BScreen *screen) {
- desktopSearchList.insert(WindowScreenLookupPair(window, screen));
-}
-
-
void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) {
systraySearchList.insert(WindowScreenLookupPair(window, screen));
}
}
-void Blackbox::removeDesktopWindowSearch(Window window) {
- desktopSearchList.erase(window);
-}
-
-
void Blackbox::removeSystrayWindowSearch(Window window) {
systraySearchList.erase(window);
}
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;
Basemenu *searchMenu(Window window);
BWindowGroup *searchGroup(Window window);
- BScreen *searchDesktopWindow(Window window);
BScreen *searchSystrayWindow(Window window);
BlackboxWindow *searchWindow(Window window);
BScreen *searchScreen(Window 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);