// this makes sure that these windows appear on all desktops
if (/*_type == Type_Dock ||*/ _type == Type_Desktop)
// this makes sure that these windows appear on all desktops
if (/*_type == Type_Dock ||*/ _type == Type_Desktop)
if (otk::Property::get(_window, otk::Property::atoms.net_wm_desktop,
otk::Property::atoms.cardinal,
if (otk::Property::get(_window, otk::Property::atoms.net_wm_desktop,
otk::Property::atoms.cardinal,
if (otk::Property::get(_window, otk::Property::atoms.net_wm_window_type,
otk::Property::atoms.atom, &num, &val)) {
// use the first value that we know about in the array
if (otk::Property::get(_window, otk::Property::atoms.net_wm_window_type,
otk::Property::atoms.atom, &num, &val)) {
// use the first value that we know about in the array
if (otk::Property::get(_window, otk::Property::atoms.net_wm_state,
otk::Property::atoms.atom, &num, &state)) {
if (otk::Property::get(_window, otk::Property::atoms.net_wm_state,
otk::Property::atoms.atom, &num, &state)) {
+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;
+}
+ // 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 && _fullscreen) {
+ // is one of our transients focused?
+ c = searchFocusTree(this, this);
+ if (c) fs = true;
+ }
+
else if (_type == Type_Desktop) l = Layer_Desktop;
else if (_type == Type_Dock) {
if (!_below) l = Layer_Top;
else if (_type == Type_Desktop) l = Layer_Desktop;
else if (_type == Type_Dock) {
if (!_below) l = Layer_Top;
+ if (hints->flags & IconPixmapHint) {
+ updateKwmIcon(); // try get the kwm icon first, this is a fallback only
+ if (_pixmap_icon == None) {
+ _pixmap_icon = hints->icon_pixmap;
+ if (hints->flags & IconMaskHint)
+ _pixmap_icon_mask = hints->icon_mask;
+ else
+ _pixmap_icon_mask = None;
+ }
+ }
+
(long)_window, _urgent ? "ON" : "OFF");
#endif
// fire the urgent callback if we're mapped, otherwise, wait until after
(long)_window, _urgent ? "ON" : "OFF");
#endif
// fire the urgent callback if we're mapped, otherwise, wait until after
+void Client::updateKwmIcon()
+{
+ _pixmap_icon = _pixmap_icon_mask = None;
+
+ unsigned long num = 2;
+ Pixmap *data;
+ if (otk::Property::get(_window, otk::Property::atoms.kwm_win_icon,
+ otk::Property::atoms.kwm_win_icon, &num, &data)) {
+ if (num == 2) {
+ _pixmap_icon = data[0];
+ _pixmap_icon_mask = data[1];
+ }
+ delete [] data;
+ }
+}
- if (!(action == State_Add || action == State_Remove ||
- action == State_Toggle))
+ if (!(action == otk::Property::atoms.net_wm_state_add ||
+ action == otk::Property::atoms.net_wm_state_remove ||
+ action == otk::Property::atoms.net_wm_state_toggle))
return; // an invalid action was passed to the client message, ignore it
for (int i = 0; i < 2; ++i) {
return; // an invalid action was passed to the client message, ignore it
for (int i = 0; i < 2; ++i) {
void Client::toggleClientBorder(bool addborder)
{
// adjust our idea of where the client is, based on its border. When the
void Client::toggleClientBorder(bool addborder)
{
// adjust our idea of where the client is, based on its border. When the
void Client::clientMessageHandler(const XClientMessageEvent &e)
{
otk::EventHandler::clientMessageHandler(e);
void Client::clientMessageHandler(const XClientMessageEvent &e)
{
otk::EventHandler::clientMessageHandler(e);
e.data.l[0] == 2 ? "Toggle" : "INVALID"),
e.data.l[1], e.data.l[2], _window);
#endif
e.data.l[0] == 2 ? "Toggle" : "INVALID"),
e.data.l[1], e.data.l[2], _window);
#endif
} else if (e.message_type == otk::Property::atoms.net_close_window) {
#ifdef DEBUG
printf("net_close_window for 0x%lx\n", _window);
} else if (e.message_type == otk::Property::atoms.net_close_window) {
#ifdef DEBUG
printf("net_close_window for 0x%lx\n", _window);
+ } else if (e.message_type == otk::Property::atoms.openbox_restack_window) {
+#ifdef DEBUG
+ printf("openbox_restack_window for 0x%lx\n", _window);
+#endif
+ if (e.data.l[0] == 0)
+ openbox->screen(_screen)->raiseWindow(this);
+ else if (e.data.l[0] == 1)
+ openbox->screen(_screen)->lowerWindow(this);
void Client::resize(Corner anchor, int w, int h)
{
if (!(_functions & Func_Resize)) return;
internal_resize(anchor, w, h);
}
void Client::resize(Corner anchor, int w, int h)
{
if (!(_functions & Func_Resize)) return;
internal_resize(anchor, w, h);
}
void Client::internal_resize(Corner anchor, int w, int h,
bool user, int x, int y)
{
void Client::internal_resize(Corner anchor, int w, int h,
bool user, int x, int y)
{
{
if (!(_functions & Func_Move)) return;
frame->frameGravity(x, y); // get the client's position based on x,y for the
// frame
{
if (!(_functions & Func_Move)) return;
frame->frameGravity(x, y); // get the client's position based on x,y for the
// frame
- XEvent event;
- event.type = ConfigureNotify;
- event.xconfigure.display = **otk::display;
- event.xconfigure.event = _window;
- event.xconfigure.window = _window;
+ if (final) {
+ XEvent event;
+ event.type = ConfigureNotify;
+ event.xconfigure.display = **otk::display;
+ event.xconfigure.event = _window;
+ event.xconfigure.window = _window;
- // root window coords with border in mind
- event.xconfigure.x = x - _border_width + frame->size().left;
- event.xconfigure.y = y - _border_width + frame->size().top;
+ // root window coords with border in mind
+ event.xconfigure.x = x - _border_width + frame->size().left;
+ event.xconfigure.y = y - _border_width + frame->size().top;
- event.xconfigure.width = _area.width();
- event.xconfigure.height = _area.height();
- event.xconfigure.border_width = _border_width;
- event.xconfigure.above = frame->plate();
- event.xconfigure.override_redirect = False;
- XSendEvent(event.xconfigure.display, event.xconfigure.window, False,
- StructureNotifyMask, &event);
+ event.xconfigure.width = _area.width();
+ event.xconfigure.height = _area.height();
+ event.xconfigure.border_width = _border_width;
+ event.xconfigure.above = frame->plate();
+ event.xconfigure.override_redirect = False;
+ XSendEvent(event.xconfigure.display, event.xconfigure.window, False,
+ StructureNotifyMask, &event);
- printf("Sent synthetic ConfigureNotify %d,%d %d,%d to 0x%lx\n",
- event.xconfigure.x, event.xconfigure.y, event.xconfigure.width,
- event.xconfigure.height, event.xconfigure.window);
+ printf("Sent synthetic ConfigureNotify %d,%d %d,%d to 0x%lx\n",
+ event.xconfigure.x, event.xconfigure.y, event.xconfigure.width,
+ event.xconfigure.height, event.xconfigure.window);
XSendEvent(**otk::display, _window, false, NoEventMask, &ce);
}
XSendEvent(**otk::display, _window, false, NoEventMask, &ce);
}
void Client::maximize(bool max, int dir, bool savearea)
{
assert(dir == 0 || dir == 1 || dir == 2);
void Client::maximize(bool max, int dir, bool savearea)
{
assert(dir == 0 || dir == 1 || dir == 2);
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &readdim)) {
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &readdim)) {
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &dimensions)) {
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &dimensions)) {
if (dir == 0 || dir == 1) { // horz
x = (signed int)dimensions[0];
w = (signed int)dimensions[2];
if (dir == 0 || dir == 1) { // horz
x = (signed int)dimensions[0];
w = (signed int)dimensions[2];
internal_resize(TopLeft, w, h, true, x, y);
}
internal_resize(TopLeft, w, h, true, x, y);
}
void Client::fullscreen(bool fs, bool savearea)
{
static FunctionFlags saved_func;
void Client::fullscreen(bool fs, bool savearea)
{
static FunctionFlags saved_func;
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &dimensions)) {
if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
otk::Property::atoms.cardinal, &n,
(long unsigned**) &dimensions)) {
void Client::iconify(bool iconic, bool curdesk)
{
if (_iconic == iconic) return; // nothing to do
void Client::iconify(bool iconic, bool curdesk)
{
if (_iconic == iconic) return; // nothing to do
void Client::disableDecorations(DecorationFlags flags)
{
_disabled_decorations = flags;
setupDecorAndFunctions();
}
void Client::disableDecorations(DecorationFlags flags)
{
_disabled_decorations = flags;
setupDecorAndFunctions();
}
Client *Client::searchModalTree(Client *node, Client *skip)
{
List::const_iterator it, end = node->_transients.end();
Client *Client::searchModalTree(Client *node, Client *skip)
{
List::const_iterator it, end = node->_transients.end();
// do a check to see if the window has already been unmapped or destroyed
// do this intelligently while watching out for unmaps we've generated
// (ignore_unmaps > 0)
// do a check to see if the window has already been unmapped or destroyed
// do this intelligently while watching out for unmaps we've generated
// (ignore_unmaps > 0)