#include "focus.h"
#include "stacking.h"
#include "openbox.h"
-#include "hooks.h"
#include "group.h"
#include "config.h"
#include "menuframe.h"
static void client_get_desktop(ObClient *self);
static void client_get_state(ObClient *self);
static void client_get_shaped(ObClient *self);
-static void client_get_mwm_hints(ObClient *self);
static void client_get_colormap(ObClient *self);
static void client_set_desktop_recursive(ObClient *self,
guint target,
ob_debug("Window type: %d", self->type);
ob_debug("Window group: 0x%x", self->group?self->group->leader:0);
- ob_debug("Window name: %s class: %s", self->name, self->class);
+ ob_debug("Window name: %s class: %s role: %s", self->name, self->class, self->role);
+
+ /* per-app settings override stuff from client_get_all, and return the
+ settings for other uses too. the returned settings is a shallow copy,
+ that needs to be freed with g_free(). */
+ settings = client_get_settings_state(self);
/* now we have all of the window's information so we can set this up.
do this before creating the frame, so it can tell that we are still
time now */
grab_server(FALSE);
- /* per-app settings override stuff from client_get_all, and return the
- settings for other uses too. the returned settings is a shallow copy,
- that needs to be freed with g_free(). */
- settings = client_get_settings_state(self);
/* the session should get the last say though */
client_restore_session_state(self);
ob_debug("Managed window 0x%lx plate 0x%x (%s)",
window, self->frame->window, self->class);
-
- hooks_queue(OB_HOOK_WIN_NEW, self);
}
ObClient *client_fake_manage(Window window)
if (!self->prompt)
XChangeSaveSet(obt_display, self->window, SetModeDelete);
- /* this can't be queued to run later */
- hooks_run(OB_HOOK_WIN_CLOSE, self);
-
/* update the focus lists */
focus_order_remove(self);
if (client_focused(self)) {
}
}
-static void client_get_mwm_hints(ObClient *self)
+void client_get_mwm_hints(ObClient *self)
{
guint num;
guint32 *hints;
/* finally, the user can have requested no decorations, which overrides
everything (but doesnt give it a border if it doesnt have one) */
if (self->undecorated)
- self->decorations = 0;
+ self->decorations &= (config_theme_keepborder ?
+ OB_FRAME_DECOR_BORDER : 0);
/* if we don't have a titlebar, then we cannot shade! */
if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
for (it = self->parents; it; it = g_slist_next(it)) {
ObClient *c = it->data;
- if ((c = client_search_focus_tree_full(it->data))) return c;
+ if ((c = client_search_focus_tree_full(c))) return c;
}
return NULL;
desktop!
*/
client_change_wm_state(self);
-
- hooks_queue(OB_HOOK_WIN_VISIBLE, self);
}
return show;
}
desktop!
*/
client_change_wm_state(self);
-
- hooks_queue(OB_HOOK_WIN_INVISIBLE, self);
}
return hide;
}
frame_begin_iconify_animation(self->frame, iconic);
/* do this after starting the animation so it doesn't flash */
client_showhide(self);
-
- hooks_queue((iconic ? OB_HOOK_WIN_ICONIC : OB_HOOK_WIN_UNICONIC),
- self);
}
/* iconify all direct transients, and deiconify all transients
client_setup_decor_and_functions(self, FALSE);
client_move_resize(self, x, y, w, h);
-
- hooks_queue((max ? OB_HOOK_WIN_MAX : OB_HOOK_WIN_UNMAX), self);
}
void client_shade(ObClient *self, gboolean shade)
client_change_wm_state(self); /* the window is being hidden/shown */
/* resize the frame to just the titlebar */
frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
-
- hooks_queue((shade ? OB_HOOK_WIN_SHADE : OB_HOOK_WIN_UNSHADE), self);
}
static void client_ping_event(ObClient *self, gboolean dead)
/* the new desktop's geometry may be different, so we may need to
resize, for example if we are maximized */
client_reconfigure(self, FALSE);
-
- if (old != self->desktop)
- hooks_queue(OB_HOOK_WIN_DESK_CHANGE, self);
}
/* move all transients */
return NULL;
}
+static gboolean client_validate_unmap(ObClient *self, int n)
+{
+ XEvent e;
+ gboolean ret = TRUE;
+
+ if (XCheckTypedWindowEvent(obt_display, self->window, UnmapNotify, &e)) {
+ if (n < self->ignore_unmaps) // ignore this one, but look for more
+ ret = client_validate_unmap(self, n+1);
+ else
+ ret = FALSE; // the window is going to become unmanaged
+
+ /* put them back on the event stack so they end up in the same order */
+ XPutBackEvent(obt_display, &e);
+ }
+
+ return ret;
+}
+
gboolean client_validate(ObClient *self)
{
XEvent e;
XSync(obt_display, FALSE); /* get all events on the server */
- if (XCheckTypedWindowEvent(obt_display, self->window, DestroyNotify, &e) ||
- XCheckTypedWindowEvent(obt_display, self->window, UnmapNotify, &e))
- {
+ if (XCheckTypedWindowEvent(obt_display, self->window, DestroyNotify, &e)) {
XPutBackEvent(obt_display, &e);
return FALSE;
}
+ if (!client_validate_unmap(self, 0))
+ return FALSE;
+
return TRUE;
}
value = self->demands_attention;
else if (state == OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED))
value = undecorated;
+ else
+ g_assert_not_reached();
action = value ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
OBT_PROP_ATOM(NET_WM_STATE_ADD);
}
self->undecorated = undecorated;
client_setup_decor_and_functions(self, TRUE);
client_change_state(self); /* reflect this in the state hints */
-
- hooks_queue((undecorated ?
- OB_HOOK_WIN_UNDECORATED : OB_HOOK_WIN_DECORATED), self);
}
}