+ windows that are being restored from a
+ session do also. we can assume you want
+ it back where you saved it. Clients saying
+ they placed themselves are subjected to
+ harder rules, ones that are placed by
+ place.c or by the user are allowed partially
+ off-screen and on xinerama divides (ie,
+ it is up to the placement routines to avoid
+ the xinerama divides) */
+ transient ||
+ (((self->positioned & PPosition) &&
+ !(self->positioned & USPosition)) &&
+ client_normal(self) &&
+ !self->session));
+ }
+
+ ob_debug("placing window 0x%x at %d, %d with size %d x %d\n",
+ self->window, self->area.x, self->area.y,
+ self->area.width, self->area.height);
+ if (self->session)
+ ob_debug(" but session requested %d %d instead, overriding\n",
+ self->session->x, self->session->y);
+
+ /* adjust the frame to the client's size before showing the window */
+ frame_adjust_area(self->frame, FALSE, TRUE, FALSE);
+ frame_adjust_client_area(self->frame);
+
+
+ /* move the client to its placed position, or it it's already there,
+ generate a ConfigureNotify telling the client where it is.
+
+ do this after adjusting the frame. otherwise it gets all weird and
+ clients don't work right */
+ client_configure(self, self->area.x, self->area.y,
+ self->area.width, self->area.height,
+ FALSE, TRUE);
+
+ /* do this after the window is placed, so the premax/prefullscreen numbers
+ won't be all wacko!!
+ also, this moves the window to the position where it has been placed
+ */
+ client_apply_startup_state(self);
+
+ if (activate) {
+ guint32 last_time = focus_client ?
+ focus_client->user_time : CurrentTime;
+
+ /* This is focus stealing prevention */
+ ob_debug_type(OB_DEBUG_FOCUS,
+ "Want to focus new window 0x%x with time %u "
+ "(last time %u)\n",
+ self->window, self->user_time, last_time);
+
+ /* if it's on another desktop */
+ if (!(self->desktop == screen_desktop || self->desktop == DESKTOP_ALL)
+ && /* the timestamp is from before you changed desktops */
+ self->user_time && screen_desktop_user_time &&
+ !event_time_after(self->user_time, screen_desktop_user_time))
+ {
+ activate = FALSE;
+ ob_debug_type(OB_DEBUG_FOCUS,
+ "Not focusing the window because its on another "
+ "desktop\n");
+ }
+ /* If something is focused, and it's not our parent... */
+ else if (focus_client && client_search_focus_parent(self) == NULL)
+ {
+ /* If time stamp is old, don't steal focus */
+ if (self->user_time && last_time &&
+ !event_time_after(self->user_time, last_time))
+ {
+ activate = FALSE;
+ ob_debug_type(OB_DEBUG_FOCUS,
+ "Not focusing the window because the time is "
+ "too old\n");
+ }
+ /* Don't steal focus from globally active clients.
+ I stole this idea from KWin. It seems nice.
+ */
+ if (!(focus_client->can_focus || focus_client->focus_notify)) {
+ activate = FALSE;
+ ob_debug_type(OB_DEBUG_FOCUS,
+ "Not focusing the window because a globally "
+ "active client has focus\n");
+ }
+ }
+
+ if (!activate) {
+ ob_debug_type(OB_DEBUG_FOCUS,
+ "Focus stealing prevention activated for %s with "
+ "time %u (last time %u)\n",
+ self->title, self->user_time, last_time);
+ /* if the client isn't focused, then hilite it so the user
+ knows it is there */
+ client_hilite(self, TRUE);
+ }
+ }
+ else {
+ /* This may look rather odd. Well it's because new windows are added
+ to the stacking order non-intrusively. If we're not going to focus
+ the new window or hilite it, then we raise it to the top. This will
+ take affect for things that don't get focused like splash screens.
+ Also if you don't have focus_new enabled, then it's going to get
+ raised to the top. Legacy begets legacy I guess?
+ */
+ if (!client_restore_session_stacking(self))
+ stacking_raise(CLIENT_AS_WINDOW(self));