static void client_get_all(ObClient *self, gboolean real);
static void client_get_startup_id(ObClient *self);
static void client_get_session_ids(ObClient *self);
+static void client_save_session_ids(ObClient *self);
static void client_get_area(ObClient *self);
static void client_get_desktop(ObClient *self);
static void client_get_state(ObClient *self);
self->obwin.type = Window_Client;
self->window = window;
self->prompt = prompt;
+ self->managed = TRUE;
/* non-zero defaults */
self->wmstate = WithdrawnState; /* make sure it gets updated first time */
(user_time != 0) &&
/* this checks for focus=false for the window */
(!settings || settings->focus != 0) &&
- focus_valid_target(self, FALSE, FALSE, TRUE, FALSE, FALSE))
+ focus_valid_target(self, FALSE, FALSE, TRUE, FALSE, FALSE,
+ settings->focus == 1))
{
activate = TRUE;
}
if (!activate) {
/* if the client isn't stealing focus, then hilite it so the user
- knows it is there */
- /* XXX don't do this if we're restoring from a session */
- client_hilite(self, TRUE);
+ knows it is there, but don't do this if we're restoring from a
+ session */
+ if (!client_restore_session_stacking(self))
+ client_hilite(self, TRUE);
}
}
else {
mouse_grab_for_client(self, FALSE);
+ self->managed = FALSE;
+
/* remove the window from our save set, unless we are managing an internal
ObPrompt window */
if (!self->prompt)
/* get the session related properties, these can change decorations
from per-app settings */
client_get_session_ids(self);
+ client_save_session_ids(self);
/* now we got everything that can affect the decorations */
if (!real)
STRUT_PARTIAL_SET(strut, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0);
- if (!STRUT_EQUAL(strut, self->strut)) {
+ if (!PARTIAL_STRUT_EQUAL(strut, self->strut)) {
self->strut = strut;
/* updating here is pointless while we're being mapped cuz we're not in
}
}
+/*! Save the session IDs as seen by Openbox when the window mapped, so that
+ users can still access them later if the app changes them */
+static void client_save_session_ids(ObClient *self)
+{
+ PROP_SETS(self->window, ob_role, self->role);
+ PROP_SETS(self->window, ob_name, self->name);
+ PROP_SETS(self->window, ob_class, self->class);
+}
+
static void client_change_wm_state(ObClient *self)
{
gulong state[2];
gboolean hide = FALSE;
if (!client_should_show(self)) {
- if (self == focus_client) {
- event_cancel_all_key_grabs();
- }
-
/* We don't need to ignore enter events here.
The window can hide/iconify in 3 different ways:
1 - through an x message. in this case we ignore all enter events
go moving on us */
event_halt_focus_delay();
- event_cancel_all_key_grabs();
-
xerror_set_ignore(TRUE);
xerror_occured = FALSE;
}
/* this function exists to map to the net_active_window message in the ewmh */
-void client_activate(ObClient *self, gboolean here, gboolean raise,
+void client_activate(ObClient *self, gboolean desktop,
+ gboolean here, gboolean raise,
gboolean unshade, gboolean user)
{
- if ((user && (self->desktop == DESKTOP_ALL ||
+ if ((user && (desktop ||
+ self->desktop == DESKTOP_ALL ||
self->desktop == screen_desktop)) ||
client_can_steal_focus(self, event_curtime, CurrentTime))
{
gint *dest, gboolean *near_edge)
{
GList *it;
- Rect *a, *mon;
+ Rect *a;
Rect dock_area;
gint edge;
+ guint i;
a = screen_area(self->desktop, SCREEN_AREA_ALL_MONITORS,
&self->frame->area);
- mon = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR,
- &self->frame->area);
switch (dir) {
case OB_DIRECTION_NORTH:
- if (my_head >= RECT_TOP(*mon) + 1)
- edge = RECT_TOP(*mon) - 1;
- else
- edge = RECT_TOP(*a) - 1;
+ edge = RECT_TOP(*a) - 1;
break;
case OB_DIRECTION_SOUTH:
- if (my_head <= RECT_BOTTOM(*mon) - 1)
- edge = RECT_BOTTOM(*mon) + 1;
- else
- edge = RECT_BOTTOM(*a) + 1;
+ edge = RECT_BOTTOM(*a) + 1;
break;
case OB_DIRECTION_EAST:
- if (my_head <= RECT_RIGHT(*mon) - 1)
- edge = RECT_RIGHT(*mon) + 1;
- else
- edge = RECT_RIGHT(*a) + 1;
+ edge = RECT_RIGHT(*a) + 1;
break;
case OB_DIRECTION_WEST:
- if (my_head >= RECT_LEFT(*mon) + 1)
- edge = RECT_LEFT(*mon) - 1;
- else
- edge = RECT_LEFT(*a) - 1;
+ edge = RECT_LEFT(*a) - 1;
break;
default:
g_assert_not_reached();
*dest = edge;
*near_edge = TRUE;
+ /* search for edges of monitors */
+ for (i = 0; i < screen_num_monitors; ++i) {
+ Rect *area = screen_area(self->desktop, i, NULL);
+ detect_edge(*area, dir, my_head, my_size, my_edge_start,
+ my_edge_size, dest, near_edge);
+ g_free(area);
+ }
+
+ /* search for edges of clients */
for (it = client_list; it; it = g_list_next(it)) {
ObClient *cur = it->data;
detect_edge(dock_area, dir, my_head, my_size, my_edge_start,
my_edge_size, dest, near_edge);
g_free(a);
- g_free(mon);
}
void client_find_move_directional(ObClient *self, ObDirection dir,