1. when another wm requests to replace openbox, openbox exits. but the SM will just restart openbox unless we tell it not to. so now ob_exit_replace() will change the session manager's view of openbox to not restart it. that way the new WM will be able to run.
2. allow windows to move themselves off of the screen 90% of the way, if they really want to. but only 90% to the left, right, and bottom of the screen. it won't let the app move off the top of the screen on its own at all now, since hiding the titlebar on you without you being a part of the process is pretty darn evil!
this is really to address bug # 2982 - for the tilda application. but i guess if windows really want to move off the screen, who's to say no? also, every other window manager will let them - except metacity won't let them on the left/top side of the screen.
/* XXX watch for xinerama dead areas */
/* This makes sure windows aren't entirely outside of the screen so you
- * can't see them at all */
+ can't see them at all.
+ It makes sure 10% of the window is on the screen at least. At don't let
+ it move itself off the top of the screen, which would hide the titlebar
+ on you. (The user can still do this if they want too, it's only limiting
+ the application.
+ */
if (client_normal(self)) {
a = screen_area(self->desktop);
- if (!self->strut.right && *x >= a->x + a->width - 1)
- *x = a->x + a->width - self->frame->area.width;
- if (!self->strut.bottom && *y >= a->y + a->height - 1)
- *y = a->y + a->height - self->frame->area.height;
- if (!self->strut.left && *x + self->frame->area.width - 1 < a->x)
- *x = a->x;
- if (!self->strut.top && *y + self->frame->area.height - 1 < a->y)
+ if (!self->strut.right &&
+ *x + self->frame->area.width/10 >= a->x + a->width - 1)
+ *x = a->x + a->width - self->frame->area.width/10;
+ if (!self->strut.bottom &&
+ *y + self->frame->area.height/10 >= a->y + a->height - 1)
+ *y = a->y + a->height - self->frame->area.height/10;
+ if (!self->strut.left && *x + self->frame->area.width*9/10 - 1 < a->x)
+ *x = a->x - self->frame->area.width*9/10;
+ if (!self->strut.top && *y < a->y)
*y = a->y;
}
* remember to fix the placement stuff to avoid it also and
* then remove this XXX */
a = screen_physical_area_monitor(client_monitor(self));
- /* dont let windows map/move into the strut unless they
+ /* dont let windows map into the strut unless they
are bigger than the available area */
if (w <= a->width) {
if (!self->strut.left && *x < a->x) *x = a->x;
switch(e->type) {
case SelectionClear:
ob_debug("Another WM has requested to replace us. Exiting.\n");
- ob_exit(0);
+ ob_exit_replace();
break;
case ClientMessage:
gint fh = h +
client->frame->size.top + client->frame->size.bottom;
client_find_onscreen(client, &newx, &newy, fw, fh,
- client_normal(client));
+ FALSE);
if (e->xconfigurerequest.value_mask & CWX)
x = newx;
if (e->xconfigurerequest.value_mask & CWY)
static KeyCode keys[OB_NUM_KEYS];
static gint exitcode = 0;
static gboolean reconfigure_and_exit = FALSE;
+static gboolean being_replaced = FALSE;
static void signal_handler(gint signal, gpointer data);
static void parse_args(gint argc, gchar **argv);
RrThemeFree(ob_rr_theme);
RrInstanceFree(ob_rr_inst);
- session_shutdown();
+ session_shutdown(being_replaced);
XCloseDisplay(ob_display);
void ob_exit_with_error(gchar *msg)
{
g_critical(msg);
- session_shutdown();
+ session_shutdown(TRUE);
exit(EXIT_FAILURE);
}
ob_main_loop_exit(ob_main_loop);
}
+void ob_exit_replace()
+{
+ exitcode = 0;
+ being_replaced = TRUE;
+ ob_main_loop_exit(ob_main_loop);
+}
+
Cursor ob_cursor(ObCursor cursor)
{
g_assert(cursor < OB_NUM_CURSORS);
void ob_restart_other(const gchar *path);
void ob_restart();
void ob_exit(gint code);
+void ob_exit_replace();
void ob_reconfigure();
}
}
-void session_shutdown()
+void session_shutdown(gboolean permanent)
{
if (sm_disable)
return;
g_free(sm_argv);
if (sm_conn) {
+ /* if permanent is true then we will change our session state so that
+ the SM won't run us again */
+ if (permanent) {
+ SmPropValue val_hint;
+ SmProp prop_hint = { SmRestartStyleHint, SmCARD8, 1, };
+ SmProp *props[1];
+ gulong hint;
+
+ /* when we exit, we want to reset this to a more friendly state */
+ hint = SmRestartIfRunning;
+ val_hint.value = &hint;
+ val_hint.length = 1;
+
+ prop_hint.vals = &val_hint;
+
+ props[0] = &prop_hint;
+
+ SmcSetProperties(sm_conn, 1, props);
+ }
+
SmcCloseConnection(sm_conn, 0, NULL);
while (session_saved_state) {
extern GList *session_saved_state;
void session_startup(gint argc, gchar **argv);
-void session_shutdown();
+void session_shutdown(gboolean permanent);
GList* session_state_find(struct _ObClient *c);
gboolean session_state_cmp(ObSessionState *s, struct _ObClient *c);