_transients.front()->_transient_for = 0;
_transients.pop_front();
}
-
+
// clean up parents reference to this
- if (_modal)
- setModal(false);
if (_transient_for)
_transient_for->_transients.remove(this); // remove from old parent
void Client::setModal(bool modal)
{
+ if (modal == _modal) return;
+
if (modal) {
Client *c = this;
while (c->_transient_for) {
}
+void Client::installColormap(bool install) const
+{
+ XWindowAttributes wa;
+ if (XGetWindowAttributes(**otk::display, _window, &wa)) {
+ printf("%snstalling Window Colormap 0x%lx!\n", install ? "I" : "Uni", _window);
+ if (install)
+ XInstallColormap(**otk::display, wa.colormap);
+ else
+ XUninstallColormap(**otk::display, wa.colormap);
+ }
+}
+
+
bool Client::focus()
{
// if we have a modal child, then focus it, not us
property changes on the window and some client messages
*/
+#include "screen.hh"
#include "widgetbase.hh"
#include "otk/point.hh"
#include "otk/strut.hh"
namespace ob {
class Frame;
+class Screen;
//! The MWM Hints as retrieved from the window property
/*!
//! Attempts to find and return a modal child of this window, recursively.
Client *findModalChild(Client *skip = 0) const;
+ //! Removes or reapplies the client's border to its window
+ /*!
+ Used when managing and unmanaging a window.
+ @param addborder true if adding the border to the client; false if removing
+ from the client
+ */
+ void toggleClientBorder(bool addborder);
+
+ //! Applies the states requested when the window mapped
+ /*!
+ This should be called only once, during the window mapping process. It
+ applies things like maximized, and fullscreen.
+ */
+ void applyStartupState();
+
public:
#ifndef SWIG
//! Constructs a new Client object around a specified window id
*/
const otk::Point &logicalSize() const { return _logical_size; }
- //! Applies the states requested when the window mapped
- /*!
- This should be called only once, during the window mapping process. It
- applies things like maximized, and fullscreen.
- */
- void applyStartupState();
-
- //! Removes or reapplies the client's border to its window
- /*!
- Used when managing and unmanaging a window.
- @param addborder true if adding the border to the client; false if removing
- from the client
- */
- void toggleClientBorder(bool addborder);
-
//! Returns the position and size of the client relative to the root window
inline const otk::Rect &area() const { return _area; }
virtual void mapRequestHandler(const XMapRequestEvent &e);
#if defined(SHAPE)
virtual void shapeHandler(const XShapeEvent &e);
-#endif // SHAPE
+#endif // SHAPE
+
+ friend void Screen::manageWindow(Window);
+ friend void Screen::unmanageWindow(Client *);
};
}
void Openbox::setFocusedClient(Client *c)
{
+ if (c == _focused_client) return;
+ assert(_focused_screen);
+
+ // uninstall the old colormap
+ if (_focused_client)
+ _focused_client->installColormap(false);
+ else
+ _focused_screen->installColormap(false);
+
_focused_client = c;
if (c) {
_focused_screen = _screens[c->screen()];
+
+ // install the client's colormap
+ c->installColormap(true);
} else {
- assert(_focused_screen);
XSetInputFocus(**otk::display, _focused_screen->focuswindow(),
RevertToNone, CurrentTime);
+
+ // install the root window colormap
+ _focused_screen->installColormap(true);
}
// set the NET_ACTIVE_WINDOW hint for all screens
ScreenList::iterator it, end = _screens.end();
{
_strut.left = _strut.right = _strut.top = _strut.bottom = 0;
- Client::List::iterator it, end = clients.end();
+ ClientList::iterator it, end = clients.end();
for (it = clients.begin(); it != end; ++it) {
const otk::Strut &s = (*it)->strut();
_strut.left = std::max(_strut.left, s.left);
if (old_area != _area) {
// the area has changed, adjust all the maximized windows
- Client::List::iterator it, end = clients.end();
+ ClientList::iterator it, end = clients.end();
for (it = clients.begin(); it != end; ++it)
(*it)->remaximize();
}
windows = new Window[size];
win_it = windows;
- Client::List::const_iterator it = clients.begin();
- const Client::List::const_iterator end = clients.end();
+ ClientList::const_iterator it = clients.begin();
+ const ClientList::const_iterator end = clients.end();
for (; it != end; ++it, ++win_it)
*win_it = (*it)->window();
} else
windows = new Window[size];
win_it = windows;
- Client::List::const_reverse_iterator it = _stacking.rbegin();
- const Client::List::const_reverse_iterator end = _stacking.rend();
+ ClientList::const_reverse_iterator it = _stacking.rbegin();
+ const ClientList::const_reverse_iterator end = _stacking.rend();
for (; it != end; ++it, ++win_it)
*win_it = (*it)->window();
} else
// influence
updateStrut();
+ // unset modal before dropping our focus
+ client->setModal(false);
+
// unfocus the client (calls the focus callbacks)
client->unfocus();
assert(!_stacking.empty()); // this would be bad
- Client::List::iterator it = --_stacking.end();
- const Client::List::iterator end = _stacking.begin();
+ ClientList::iterator it = --_stacking.end();
+ const ClientList::iterator end = _stacking.begin();
if (client->modal() && client->transientFor()) {
// don't let a modal window lower below its transient_for
assert(it != _stacking.end());
wins[0] = (it == _stacking.begin() ? _focuswindow :
- ((*(--Client::List::const_iterator(it)))->frame->window()));
+ ((*(--ClientList::const_iterator(it)))->frame->window()));
wins[1] = client->frame->window();
if (wins[0] == wins[1]) return; // already right above the window
// remove the client before looking so we can't run into ourselves
_stacking.remove(client);
- Client::List::iterator it = _stacking.begin();
- const Client::List::iterator end = _stacking.end();
+ ClientList::iterator it = _stacking.begin();
+ const ClientList::iterator end = _stacking.end();
// the stacking list is from highest to lowest
for (; it != end && (*it)->layer() > client->layer(); ++it);
otherwise, we want to stack under the previous window in the stack.
*/
wins[0] = (it == _stacking.begin() ? _focuswindow :
- ((*(--Client::List::const_iterator(it)))->frame->window()));
+ ((*(--ClientList::const_iterator(it)))->frame->window()));
wins[1] = client->frame->window();
_stacking.insert(it, client);
if (old == _desktop) return;
- Client::List::iterator it, end = clients.end();
+ ClientList::iterator it, end = clients.end();
for (it = clients.begin(); it != end; ++it) {
if ((*it)->desktop() == old) {
(*it)->frame->hide();
if (!(num > 0)) return;
// move windows on desktops that will no longer exist!
- Client::List::iterator it, end = clients.end();
+ ClientList::iterator it, end = clients.end();
for (it = clients.begin(); it != end; ++it) {
int d = (*it)->desktop();
if (d >= num && !(d == (signed) 0xffffffff ||
}
+void Screen::installColormap(bool install) const
+{
+ printf("%snstalling Root Colormap!\n", install ? "I" : "Uni");
+ if (install)
+ XInstallColormap(**otk::display, _info->colormap());
+ else
+ XUninstallColormap(**otk::display, _info->colormap());
+}
+
+
void Screen::propertyHandler(const XPropertyEvent &e)
{
otk::EventHandler::propertyHandler(e);