only keep fullscreen windows in the top layer when they or a relative is focused

This commit is contained in:
Dana Jansens 2003-02-13 23:44:32 +00:00
parent 8446eaedc7
commit 54e85b2599
2 changed files with 37 additions and 37 deletions

View file

@ -402,7 +402,6 @@ void Client::getState()
} }
} }
void Client::getShaped() void Client::getShaped()
{ {
_shaped = false; _shaped = false;
@ -421,12 +420,40 @@ void Client::getShaped()
#endif // SHAPE #endif // SHAPE
} }
Client *Client::searchFocusTree(Client *node, Client *skip)
{
List::const_iterator it, end = node->_transients.end();
Client *ret;
for (it = node->_transients.begin(); it != end; ++it) {
if (*it == skip) continue; // circular?
if ((ret = searchModalTree(*it, skip))) return ret; // got one
if ((*it)->_focused) return *it; // got one
}
return 0;
}
void Client::calcLayer() { void Client::calcLayer() {
StackLayer l; StackLayer l;
bool fs = false;
// are we fullscreen, or do we have a fullscreen transient parent?
Client *c = this;
while (c) {
if (c->_fullscreen) {
fs =true;
break;
}
c = c->_transient_for;
}
if (!fs) {
// is one of our transients focused?
c = searchFocusTree(this, this);
if (c) fs = true;
}
if (_iconic) l = Layer_Icon; if (_iconic) l = Layer_Icon;
else if (_fullscreen) l = Layer_Fullscreen; else if (fs) l = Layer_Fullscreen;
else if (_type == Type_Desktop) l = Layer_Desktop; else if (_type == Type_Desktop) l = Layer_Desktop;
else if (_type == Type_Dock) { else if (_type == Type_Dock) {
if (!_below) l = Layer_Top; if (!_below) l = Layer_Top;
@ -448,7 +475,6 @@ void Client::calcLayer() {
} }
} }
void Client::updateProtocols() void Client::updateProtocols()
{ {
Atom *proto; Atom *proto;
@ -471,7 +497,6 @@ void Client::updateProtocols()
} }
} }
void Client::updateNormalHints() void Client::updateNormalHints()
{ {
XSizeHints size; XSizeHints size;
@ -522,7 +547,6 @@ void Client::updateNormalHints()
} }
} }
void Client::updateWMHints(bool initstate) void Client::updateWMHints(bool initstate)
{ {
XWMHints *hints; XWMHints *hints;
@ -567,7 +591,6 @@ void Client::updateWMHints(bool initstate)
} }
} }
void Client::updateTitle() void Client::updateTitle()
{ {
_title = ""; _title = "";
@ -587,7 +610,6 @@ void Client::updateTitle()
frame->adjustTitle(); frame->adjustTitle();
} }
void Client::updateIconTitle() void Client::updateIconTitle()
{ {
_icon_title = ""; _icon_title = "";
@ -604,7 +626,6 @@ void Client::updateIconTitle()
_icon_title = _("Unnamed Window"); _icon_title = _("Unnamed Window");
} }
void Client::updateClass() void Client::updateClass()
{ {
// set the defaults // set the defaults
@ -627,7 +648,6 @@ void Client::updateClass()
} }
} }
void Client::updateStrut() void Client::updateStrut()
{ {
unsigned long num = 4; unsigned long num = 4;
@ -651,7 +671,6 @@ void Client::updateStrut()
delete [] data; delete [] data;
} }
void Client::updateTransientFor() void Client::updateTransientFor()
{ {
Window t = 0; Window t = 0;
@ -684,7 +703,6 @@ void Client::updateTransientFor()
} }
} }
void Client::updateIcons() void Client::updateIcons()
{ {
unsigned long num = (unsigned) -1; unsigned long num = (unsigned) -1;
@ -740,7 +758,6 @@ void Client::updateIcons()
if (frame) frame->adjustIcon(); if (frame) frame->adjustIcon();
} }
void Client::propertyHandler(const XPropertyEvent &e) void Client::propertyHandler(const XPropertyEvent &e)
{ {
otk::EventHandler::propertyHandler(e); otk::EventHandler::propertyHandler(e);
@ -788,7 +805,6 @@ void Client::propertyHandler(const XPropertyEvent &e)
updateIcons(); updateIcons();
} }
void Client::setWMState(long state) void Client::setWMState(long state)
{ {
if (state == _wmstate) return; // no change if (state == _wmstate) return; // no change
@ -803,7 +819,6 @@ void Client::setWMState(long state)
} }
} }
void Client::setDesktop(unsigned int target) void Client::setDesktop(unsigned int target)
{ {
if (target == _desktop) return; if (target == _desktop) return;
@ -824,7 +839,6 @@ void Client::setDesktop(unsigned int target)
openbox->screen(_screen)->updateStruts(); openbox->screen(_screen)->updateStruts();
} }
void Client::showhide() void Client::showhide()
{ {
bool show; bool show;
@ -840,7 +854,6 @@ void Client::showhide()
else frame->hide(); else frame->hide();
} }
void Client::setState(StateAction action, long data1, long data2) void Client::setState(StateAction action, long data1, long data2)
{ {
bool shadestate = _shaded; bool shadestate = _shaded;
@ -954,7 +967,6 @@ void Client::setState(StateAction action, long data1, long data2)
changeState(); // change the hint to relect these changes changeState(); // change the hint to relect these changes
} }
void Client::toggleClientBorder(bool addborder) void Client::toggleClientBorder(bool addborder)
{ {
// adjust our idea of where the client is, based on its border. When the // adjust our idea of where the client is, based on its border. When the
@ -1018,7 +1030,6 @@ void Client::toggleClientBorder(bool addborder)
XSetWindowBorderWidth(**otk::display, _window, 0); XSetWindowBorderWidth(**otk::display, _window, 0);
} }
void Client::clientMessageHandler(const XClientMessageEvent &e) void Client::clientMessageHandler(const XClientMessageEvent &e)
{ {
otk::EventHandler::clientMessageHandler(e); otk::EventHandler::clientMessageHandler(e);
@ -1105,7 +1116,6 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
} }
} }
#if defined(SHAPE) #if defined(SHAPE)
void Client::shapeHandler(const XShapeEvent &e) void Client::shapeHandler(const XShapeEvent &e)
{ {
@ -1118,14 +1128,12 @@ void Client::shapeHandler(const XShapeEvent &e)
} }
#endif #endif
void Client::resize(Corner anchor, int w, int h) void Client::resize(Corner anchor, int w, int h)
{ {
if (!(_functions & Func_Resize)) return; if (!(_functions & Func_Resize)) return;
internal_resize(anchor, w, h); internal_resize(anchor, w, h);
} }
void Client::internal_resize(Corner anchor, int w, int h, void Client::internal_resize(Corner anchor, int w, int h,
bool user, int x, int y) bool user, int x, int y)
{ {
@ -1238,7 +1246,6 @@ void Client::move(int x, int y)
internal_move(x, y); internal_move(x, y);
} }
void Client::internal_move(int x, int y) void Client::internal_move(int x, int y)
{ {
_area = otk::Rect(otk::Point(x, y), _area.size()); _area = otk::Rect(otk::Point(x, y), _area.size());
@ -1274,7 +1281,6 @@ void Client::internal_move(int x, int y)
} }
} }
void Client::close() void Client::close()
{ {
XEvent ce; XEvent ce;
@ -1300,7 +1306,6 @@ void Client::close()
XSendEvent(**otk::display, _window, false, NoEventMask, &ce); XSendEvent(**otk::display, _window, false, NoEventMask, &ce);
} }
void Client::changeState() void Client::changeState()
{ {
unsigned long state[2]; unsigned long state[2];
@ -1340,7 +1345,6 @@ void Client::changeState()
frame->adjustState(); frame->adjustState();
} }
void Client::changeAllowedActions(void) void Client::changeAllowedActions(void)
{ {
Atom actions[9]; Atom actions[9];
@ -1384,7 +1388,6 @@ void Client::changeAllowedActions(void)
else _max_vert = _max_horz = false; else _max_vert = _max_horz = false;
} }
void Client::remaximize() void Client::remaximize()
{ {
int dir; int dir;
@ -1400,7 +1403,6 @@ void Client::remaximize()
maximize(true, dir, false); maximize(true, dir, false);
} }
void Client::applyStartupState() void Client::applyStartupState()
{ {
// these are in a carefully crafted order.. // these are in a carefully crafted order..
@ -1438,7 +1440,6 @@ void Client::applyStartupState()
if (_below); // nothing to do for this if (_below); // nothing to do for this
} }
void Client::fireUrgent() void Client::fireUrgent()
{ {
// call the python UrgentWindow callbacks // call the python UrgentWindow callbacks
@ -1446,7 +1447,6 @@ void Client::fireUrgent()
openbox->bindings()->fireEvent(&data); openbox->bindings()->fireEvent(&data);
} }
void Client::shade(bool shade) void Client::shade(bool shade)
{ {
if (!(_functions & Func_Shade) || // can't if (!(_functions & Func_Shade) || // can't
@ -1460,7 +1460,6 @@ void Client::shade(bool shade)
frame->adjustSize(); frame->adjustSize();
} }
void Client::maximize(bool max, int dir, bool savearea) void Client::maximize(bool max, int dir, bool savearea)
{ {
assert(dir == 0 || dir == 1 || dir == 2); assert(dir == 0 || dir == 1 || dir == 2);
@ -1567,7 +1566,6 @@ void Client::maximize(bool max, int dir, bool savearea)
internal_resize(TopLeft, w, h, true, x, y); internal_resize(TopLeft, w, h, true, x, y);
} }
void Client::fullscreen(bool fs, bool savearea) void Client::fullscreen(bool fs, bool savearea)
{ {
static FunctionFlags saved_func; static FunctionFlags saved_func;
@ -1642,7 +1640,6 @@ void Client::fullscreen(bool fs, bool savearea)
if (fs) focus(); if (fs) focus();
} }
void Client::iconify(bool iconic, bool curdesk) void Client::iconify(bool iconic, bool curdesk)
{ {
if (_iconic == iconic) return; // nothing to do if (_iconic == iconic) return; // nothing to do
@ -1670,14 +1667,12 @@ void Client::iconify(bool iconic, bool curdesk)
openbox->screen(_screen)->updateStruts(); openbox->screen(_screen)->updateStruts();
} }
void Client::disableDecorations(DecorationFlags flags) void Client::disableDecorations(DecorationFlags flags)
{ {
_disabled_decorations = flags; _disabled_decorations = flags;
setupDecorAndFunctions(); setupDecorAndFunctions();
} }
void Client::installColormap(bool install) const void Client::installColormap(bool install) const
{ {
XWindowAttributes wa; XWindowAttributes wa;
@ -1689,9 +1684,6 @@ void Client::installColormap(bool install) const
} }
} }
// recursively searches the client 'tree' for a modal client, always skips the
// topmost node (the window you're starting with)
Client *Client::searchModalTree(Client *node, Client *skip) Client *Client::searchModalTree(Client *node, Client *skip)
{ {
List::const_iterator it, end = node->_transients.end(); List::const_iterator it, end = node->_transients.end();
@ -1784,6 +1776,8 @@ void Client::focusHandler(const XFocusChangeEvent &e)
_focused = true; _focused = true;
frame->adjustFocus(); frame->adjustFocus();
calcLayer(); // focus state can affect the stacking layer
openbox->setFocusedClient(this); openbox->setFocusedClient(this);
} }
@ -1799,6 +1793,8 @@ void Client::unfocusHandler(const XFocusChangeEvent &e)
_focused = false; _focused = false;
frame->adjustFocus(); frame->adjustFocus();
calcLayer(); // focus state can affect the stacking layer
if (openbox->focusedClient() == this) if (openbox->focusedClient() == this)
openbox->setFocusedClient(0); openbox->setFocusedClient(0);
} }

View file

@ -434,6 +434,10 @@ private:
//! the topmost node (the window you're starting with). //! the topmost node (the window you're starting with).
Client *Client::searchModalTree(Client *node, Client *skip); Client *Client::searchModalTree(Client *node, Client *skip);
//! Recursively searches the client 'tree' for a focused client, always skips
//! the topmost node (the window you're starting with).
Client *Client::searchFocusTree(Client *node, Client *skip);
//! Fires the urgent callbacks which lets the user do what they want with //! Fires the urgent callbacks which lets the user do what they want with
//! urgent windows //! urgent windows
void fireUrgent(); void fireUrgent();