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.
This commit is contained in:
Dana Jansens 2002-07-16 08:00:59 +00:00
parent 41053a810a
commit 2dde696a13
8 changed files with 95 additions and 148 deletions

View file

@ -312,9 +312,6 @@ BScreen::~BScreen(void) {
std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin()); std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin());
while (! desktopWindowList.empty())
removeDesktopWindow(desktopWindowList[0]);
while (! systrayWindowList.empty()) while (! systrayWindowList.empty())
removeSystrayWindow(systrayWindowList[0]); removeSystrayWindow(systrayWindowList[0]);
@ -652,7 +649,7 @@ void BScreen::load_rc(void) {
else if (s == "UnderMousePlacement") else if (s == "UnderMousePlacement")
resource.placement_policy = UnderMousePlacement; resource.placement_policy = UnderMousePlacement;
else if (s == "ClickMousePlacement") else if (s == "ClickMousePlacement")
resource.placement_policy = UnderMousePlacement; resource.placement_policy = ClickMousePlacement;
else if (s == "ColSmartPlacement") else if (s == "ColSmartPlacement")
resource.placement_policy = ColSmartPlacement; resource.placement_policy = ColSmartPlacement;
else //if (s == "RowSmartPlacement") else //if (s == "RowSmartPlacement")
@ -1168,49 +1165,33 @@ void BScreen::removeSystrayWindow(Window window) {
} }
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) { 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); new BlackboxWindow(blackbox, w, this);
BlackboxWindow *win = blackbox->searchWindow(w); BlackboxWindow *win = blackbox->searchWindow(w);
if (! win) if (! win)
return; 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); windowList.push_back(win);
updateClientList(); updateClientList();
} else if (win->isDesktop()) {
desktopWindowList.push_back(win->getFrameWindow());
}
XMapRequestEvent mre; XMapRequestEvent mre;
mre.window = w; mre.window = w;
if (blackbox->isStartup()) win->restoreAttributes(); if (blackbox->isStartup() && win->isNormal()) win->restoreAttributes();
win->mapRequestEvent(&mre); win->mapRequestEvent(&mre);
} }
@ -1224,8 +1205,20 @@ void BScreen::unmanageWindow(BlackboxWindow *w, bool remap) {
else if (w->isIconic()) else if (w->isIconic())
removeIcon(w); removeIcon(w);
if (w->isNormal()) {
// we don't list non-normal windows as managed windows
windowList.remove(w); windowList.remove(w);
updateClientList(); 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) if (blackbox->getFocusedWindow() == w)
blackbox->setFocusedWindow((BlackboxWindow *) 0); blackbox->setFocusedWindow((BlackboxWindow *) 0);
@ -2149,7 +2142,6 @@ void BScreen::buttonPressEvent(const XButtonEvent *xbutton) {
void BScreen::propertyNotifyEvent(const XPropertyEvent *pe) { void BScreen::propertyNotifyEvent(const XPropertyEvent *pe) {
if (pe->atom == xatom->getAtom(XAtom::net_desktop_names)) { if (pe->atom == xatom->getAtom(XAtom::net_desktop_names)) {
// _NET_WM_DESKTOP_NAMES // _NET_WM_DESKTOP_NAMES
fprintf(stderr, "UPDATING WORKSPACE NAMES\n");
WorkspaceList::iterator it = workspacesList.begin(); WorkspaceList::iterator it = workspacesList.begin();
const WorkspaceList::iterator end = workspacesList.end(); const WorkspaceList::iterator end = workspacesList.end();
for (; it != end; ++it) { for (; it != end; ++it) {

View file

@ -320,9 +320,6 @@ public:
void addNetizen(Netizen *n); void addNetizen(Netizen *n);
void removeNetizen(Window w); void removeNetizen(Window w);
void addDesktopWindow(Window window);
void removeDesktopWindow(Window window);
void addSystrayWindow(Window window); void addSystrayWindow(Window window);
void removeSystrayWindow(Window window); void removeSystrayWindow(Window window);

View file

@ -152,17 +152,10 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
client.rect.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height); client.rect.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height);
client.old_bw = wattrib.border_width; client.old_bw = wattrib.border_width;
timer = 0;
windowmenu = 0; windowmenu = 0;
lastButtonPressTime = 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 // get size, aspect, minimum/maximum size and other hints set by the
// client // client
getWMProtocols(); getWMProtocols();
@ -175,10 +168,12 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
return; return;
} }
if (isKDESystrayWindow()) { timer = new BTimer(blackbox, this);
screen->addSystrayWindow(client.window); timer->setTimeout(blackbox->getAutoRaiseDelay());
delete this;
return; if (! getBlackboxHints()) {
getMWMHints();
getNetWMHints();
} }
frame.window = createToplevelWindow(); frame.window = createToplevelWindow();
@ -199,32 +194,16 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
// adjust the window decorations/behavior based on the window type // adjust the window decorations/behavior based on the window type
switch (window_type) { switch (window_type) {
case Type_Desktop: 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_Dock:
case Type_Menu: 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_Toolbar:
case Type_Utility: 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: case Type_Splash:
// splash screens have no functionality or decorations, they are left up // none of these windows are decorated or manipulated by the window manager
// to the application which created them
decorations = 0; decorations = 0;
functions = 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; break;
case Type_Dialog: case Type_Dialog:
@ -1441,15 +1420,6 @@ void BlackboxWindow::getTransientInfo(void) {
} }
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 { BlackboxWindow *BlackboxWindow::getTransientFor(void) const {
if (client.transient_for && if (client.transient_for &&
client.transient_for != (BlackboxWindow*) ~0ul) client.transient_for != (BlackboxWindow*) ~0ul)
@ -1942,7 +1912,6 @@ void BlackboxWindow::stick(void) {
if (! flags.iconic) if (! flags.iconic)
screen->reassociateWindow(this, BSENTINEL, True); screen->reassociateWindow(this, BSENTINEL, True);
else
// temporary fix since sticky windows suck. set the hint to what we // temporary fix since sticky windows suck. set the hint to what we
// actually hold in our data. // actually hold in our data.
xatom->setValue(client.window, XAtom::net_wm_desktop, XAtom::cardinal, xatom->setValue(client.window, XAtom::net_wm_desktop, XAtom::cardinal,
@ -2538,16 +2507,22 @@ void BlackboxWindow::mapRequestEvent(const XMapRequestEvent *re) {
default: default:
show(); show();
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this); screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
if (! blackbox->isStartup() && (isTransient() || screen->doFocusNew())) { if (isNormal()) {
XSync(blackbox->getXDisplay(), False); // make sure the frame is mapped.. if (! blackbox->isStartup()) {
XSync(blackbox->getXDisplay(), False); // make sure the frame is mapped
if (isTransient() || screen->doFocusNew()) {
setInputFocus(); setInputFocus();
} }
if (screen->getPlacementPolicy() == BScreen::ClickMousePlacement) {
int x, y, rx, ry; int x, y, rx, ry;
Window c, r; Window c, r;
unsigned int m; unsigned int m;
XQueryPointer(screen->getBlackbox()->getXDisplay(), screen->getRootWindow(), XQueryPointer(blackbox->getXDisplay(), screen->getRootWindow(),
&r, &c, &rx, &ry, &x, &y, &m); &r, &c, &rx, &ry, &x, &y, &m);
beginMove(rx, ry); beginMove(rx, ry);
}
}
}
break; break;
} }
} }
@ -2742,7 +2717,7 @@ void BlackboxWindow::configureRequestEvent(const XConfigureRequestEvent *cr) {
configure(req.x(), req.y(), req.width(), req.height()); configure(req.x(), req.y(), req.width(), req.height());
} }
if (cr->value_mask & CWStackMode) { if (cr->value_mask & CWStackMode && !isDesktop()) {
switch (cr->detail) { switch (cr->detail) {
case Below: case Below:
case BottomIf: case BottomIf:

View file

@ -267,7 +267,6 @@ private:
void getMWMHints(void); void getMWMHints(void);
bool getBlackboxHints(void); bool getBlackboxHints(void);
void getTransientInfo(void); void getTransientInfo(void);
bool isKDESystrayWindow(void);
void setNetWMAttributes(void); void setNetWMAttributes(void);
void associateClientWindow(void); void associateClientWindow(void);
void decorate(void); void decorate(void);
@ -321,7 +320,11 @@ public:
inline bool isMaximizable(void) const { return functions & Func_Maximize; } inline bool isMaximizable(void) const { return functions & Func_Maximize; }
inline bool isResizable(void) const { return functions & Func_Resize; } inline bool isResizable(void) const { return functions & Func_Resize; }
inline bool isClosable(void) const { return functions & Func_Close; } 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 bool hasTitlebar(void) const { return decorations & Decor_Titlebar; }

View file

@ -79,22 +79,28 @@ void Workspace::addWindow(BlackboxWindow *w, bool place) {
if (place) placeWindow(w); if (place) placeWindow(w);
stackingList.push_front(w);
if (w->isNormal()) {
w->setWorkspace(id); w->setWorkspace(id);
w->setWindowNumber(windowList.size()); w->setWindowNumber(windowList.size());
stackingList.push_front(w);
windowList.push_back(w); windowList.push_back(w);
clientmenu->insert(w->getTitle()); clientmenu->insert(w->getTitle());
clientmenu->update(); clientmenu->update();
screen->updateNetizenWindowAdd(w->getClientWindow(), id); screen->updateNetizenWindowAdd(w->getClientWindow(), id);
}
if (! w->isDesktop())
raiseWindow(w); raiseWindow(w);
else
lowerWindow(w);
} }
unsigned int Workspace::removeWindow(BlackboxWindow *w) { void Workspace::removeWindow(BlackboxWindow *w) {
assert(w != 0); assert(w != 0);
stackingList.remove(w); stackingList.remove(w);
@ -113,6 +119,8 @@ unsigned int Workspace::removeWindow(BlackboxWindow *w) {
} }
} }
if (! w->isNormal()) return;
windowList.remove(w); windowList.remove(w);
clientmenu->remove(w->getWindowNumber()); clientmenu->remove(w->getWindowNumber());
clientmenu->update(); clientmenu->update();
@ -127,8 +135,6 @@ unsigned int Workspace::removeWindow(BlackboxWindow *w) {
if (i == 0) if (i == 0)
cascade_x = cascade_y = 32; cascade_x = cascade_y = 32;
return i;
} }
@ -154,10 +160,7 @@ void Workspace::focusFallback(const BlackboxWindow *old_window) {
end = stackingList.end(); end = stackingList.end();
for (; it != end; ++it) { for (; it != end; ++it) {
BlackboxWindow *tmp = *it; BlackboxWindow *tmp = *it;
if (! (tmp->windowType() == BlackboxWindow::Type_Dialog || if (tmp && tmp->isNormal() && tmp->setInputFocus()) {
tmp->windowType() == BlackboxWindow::Type_Normal))
continue; // don't fallback to special windows
if (tmp && tmp->setInputFocus()) {
// we found our new focus target // we found our new focus target
newfocus = tmp; newfocus = tmp;
break; break;
@ -281,8 +284,10 @@ void Workspace::lowerTransients(const BlackboxWindow * const win,
void Workspace::raiseWindow(BlackboxWindow *w) { void Workspace::raiseWindow(BlackboxWindow *w) {
BlackboxWindow *win = w; BlackboxWindow *win = w;
if (win->isDesktop()) return;
// walk up the transient_for's to the window that is not a transient // 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; if (! win->getTransientFor()) break;
win = win->getTransientFor(); win = win->getTransientFor();
} }
@ -296,7 +301,7 @@ void Workspace::raiseWindow(BlackboxWindow *w) {
*(stack++) = win->getFrameWindow(); *(stack++) = win->getFrameWindow();
screen->updateNetizenWindowRaise(win->getClientWindow()); screen->updateNetizenWindowRaise(win->getClientWindow());
if (! win->isIconic()) { if (! (win->isIconic() || win->isDesktop())) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win); wkspc->stackingList.remove(win);
wkspc->stackingList.push_front(win); wkspc->stackingList.push_front(win);
@ -312,7 +317,7 @@ void Workspace::lowerWindow(BlackboxWindow *w) {
BlackboxWindow *win = w; BlackboxWindow *win = w;
// walk up the transient_for's to the window that is not a transient // 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; if (! win->getTransientFor()) break;
win = win->getTransientFor(); win = win->getTransientFor();
} }
@ -328,7 +333,7 @@ void Workspace::lowerWindow(BlackboxWindow *w) {
*(stack++) = win->getFrameWindow(); *(stack++) = win->getFrameWindow();
screen->updateNetizenWindowLower(win->getClientWindow()); screen->updateNetizenWindowLower(win->getClientWindow());
if (! win->isIconic()) { if (! (win->isIconic() || win->isDesktop())) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win); wkspc->stackingList.remove(win);
wkspc->stackingList.push_back(win); wkspc->stackingList.push_back(win);

View file

@ -93,7 +93,7 @@ public:
bool isLastWindow(const BlackboxWindow* w) const; bool isLastWindow(const BlackboxWindow* w) const;
void addWindow(BlackboxWindow *w, bool place = False); void addWindow(BlackboxWindow *w, bool place = False);
unsigned int removeWindow(BlackboxWindow *w); void removeWindow(BlackboxWindow *w);
unsigned int getCount(void) const; unsigned int getCount(void) const;
void appendStackOrder(BlackboxWindowList &stack_order) const; void appendStackOrder(BlackboxWindowList &stack_order) const;

View file

@ -384,8 +384,6 @@ void Blackbox::process_event(XEvent *e) {
slit->unmapNotifyEvent(&e->xunmap); slit->unmapNotifyEvent(&e->xunmap);
} else if ((screen = searchSystrayWindow(e->xunmap.window))) { } else if ((screen = searchSystrayWindow(e->xunmap.window))) {
screen->removeSystrayWindow(e->xunmap.window); screen->removeSystrayWindow(e->xunmap.window);
} else if ((screen = searchDesktopWindow(e->xunmap.window))) {
screen->removeDesktopWindow(e->xunmap.window);
} }
break; break;
@ -405,8 +403,6 @@ void Blackbox::process_event(XEvent *e) {
delete group; delete group;
} else if ((screen = searchSystrayWindow(e->xunmap.window))) { } else if ((screen = searchSystrayWindow(e->xunmap.window))) {
screen->removeSystrayWindow(e->xunmap.window); screen->removeSystrayWindow(e->xunmap.window);
} else if ((screen = searchDesktopWindow(e->xunmap.window))) {
screen->removeDesktopWindow(e->xunmap.window);
} }
break; break;
@ -494,7 +490,8 @@ void Blackbox::process_event(XEvent *e) {
screen->getImageControl()->installRootColormap(); screen->getImageControl()->installRootColormap();
} else if ((win = searchWindow(e->xcrossing.window))) { } else if ((win = searchWindow(e->xcrossing.window))) {
if (win->getScreen()->isSloppyFocus() && 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 (((! sa.leave) || sa.inferior) && win->isVisible()) {
if (win->setInputFocus()) if (win->setInputFocus())
win->installColormap(True); // XXX: shouldnt we honour no install? win->installColormap(True); // XXX: shouldnt we honour no install?
@ -1038,15 +1035,6 @@ BScreen *Blackbox::searchScreen(Window window) {
} }
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) { BScreen *Blackbox::searchSystrayWindow(Window window) {
WindowScreenLookup::iterator it = systraySearchList.find(window); WindowScreenLookup::iterator it = systraySearchList.find(window);
if (it != systraySearchList.end()) if (it != systraySearchList.end())
@ -1101,11 +1089,6 @@ Slit *Blackbox::searchSlit(Window window) {
} }
void Blackbox::saveDesktopWindowSearch(Window window, BScreen *screen) {
desktopSearchList.insert(WindowScreenLookupPair(window, screen));
}
void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) { void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) {
systraySearchList.insert(WindowScreenLookupPair(window, screen)); systraySearchList.insert(WindowScreenLookupPair(window, screen));
} }
@ -1136,11 +1119,6 @@ void Blackbox::saveSlitSearch(Window window, Slit *data) {
} }
void Blackbox::removeDesktopWindowSearch(Window window) {
desktopSearchList.erase(window);
}
void Blackbox::removeSystrayWindowSearch(Window window) { void Blackbox::removeSystrayWindowSearch(Window window) {
systraySearchList.erase(window); systraySearchList.erase(window);
} }

View file

@ -123,7 +123,7 @@ private:
typedef std::map<Window, BScreen*> WindowScreenLookup; typedef std::map<Window, BScreen*> WindowScreenLookup;
typedef WindowScreenLookup::value_type WindowScreenLookupPair; typedef WindowScreenLookup::value_type WindowScreenLookupPair;
WindowScreenLookup systraySearchList, desktopSearchList; WindowScreenLookup systraySearchList;
typedef std::map<Window, BWindowGroup*> GroupLookup; typedef std::map<Window, BWindowGroup*> GroupLookup;
typedef GroupLookup::value_type GroupLookupPair; typedef GroupLookup::value_type GroupLookupPair;
@ -175,7 +175,6 @@ public:
Basemenu *searchMenu(Window window); Basemenu *searchMenu(Window window);
BWindowGroup *searchGroup(Window window); BWindowGroup *searchGroup(Window window);
BScreen *searchDesktopWindow(Window window);
BScreen *searchSystrayWindow(Window window); BScreen *searchSystrayWindow(Window window);
BlackboxWindow *searchWindow(Window window); BlackboxWindow *searchWindow(Window window);
BScreen *searchScreen(Window window); BScreen *searchScreen(Window window);
@ -183,14 +182,12 @@ public:
Slit *searchSlit(Window); Slit *searchSlit(Window);
void saveMenuSearch(Window window, Basemenu *data); void saveMenuSearch(Window window, Basemenu *data);
void saveDesktopWindowSearch(Window window, BScreen *screen);
void saveSystrayWindowSearch(Window window, BScreen *screen); void saveSystrayWindowSearch(Window window, BScreen *screen);
void saveWindowSearch(Window window, BlackboxWindow *data); void saveWindowSearch(Window window, BlackboxWindow *data);
void saveGroupSearch(Window window, BWindowGroup *data); void saveGroupSearch(Window window, BWindowGroup *data);
void saveToolbarSearch(Window window, Toolbar *data); void saveToolbarSearch(Window window, Toolbar *data);
void saveSlitSearch(Window window, Slit *data); void saveSlitSearch(Window window, Slit *data);
void removeMenuSearch(Window window); void removeMenuSearch(Window window);
void removeDesktopWindowSearch(Window window);
void removeSystrayWindowSearch(Window window); void removeSystrayWindowSearch(Window window);
void removeWindowSearch(Window window); void removeWindowSearch(Window window);
void removeGroupSearch(Window window); void removeGroupSearch(Window window);