static gboolean screen_validate_layout(ObDesktopLayout *l);
static gboolean replace_wm(void);
-static void screen_tell_ksplash(void);
+//static void screen_tell_ksplash(void);
static void screen_fallback_focus(void);
guint screen_num_desktops;
/* create the netwm support window */
attrib.override_redirect = TRUE;
- attrib.event_mask = PropertyChangeMask;
+ attrib.event_mask = PropertyChangeMask | KeyPressMask | KeyReleaseMask;
screen_support_win = XCreateWindow(obt_display, obt_root(ob_screen),
-100, -100, 1, 1, 0,
CopyFromParent, InputOutput,
supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_FRAME_STRUT);
supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
+ supported[i++] = OBT_PROP_ATOM(OB_FOCUS);
supported[i++] = OBT_PROP_ATOM(OB_WM_ACTION_UNDECORATE);
supported[i++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
supported[i++] = OBT_PROP_ATOM(OPENBOX_PID);
supported[i++] = OBT_PROP_ATOM(OB_THEME);
supported[i++] = OBT_PROP_ATOM(OB_CONFIG_FILE);
+ supported[i++] = OBT_PROP_ATOM(OB_LAST_DESKTOP);
supported[i++] = OBT_PROP_ATOM(OB_CONTROL);
supported[i++] = OBT_PROP_ATOM(OB_VERSION);
supported[i++] = OBT_PROP_ATOM(OB_APP_ROLE);
OBT_PROP_SETS(RootWindow(obt_display, ob_screen), OB_VERSION,
OPENBOX_VERSION);
- screen_tell_ksplash();
+ //screen_tell_ksplash();
return TRUE;
}
-
+#if 0
static void screen_tell_ksplash(void)
{
XEvent e;
XSendEvent(obt_display, obt_root(ob_screen),
False, SubstructureNotifyMask, &e);
}
-
+#endif
void screen_startup(gboolean reconfig)
{
gchar **names = NULL;
else
screen_set_desktop(MIN(config_screen_firstdesk,
screen_num_desktops) - 1, FALSE);
- screen_last_desktop = screen_desktop;
+ OBT_PROP_GET32(obt_root(ob_screen), OB_LAST_DESKTOP, CARDINAL, &screen_last_desktop);
+ if (screen_last_desktop < 0 || screen_last_desktop >= screen_num_desktops) {
+ screen_last_desktop = screen_desktop;
+ OBT_PROP_SET32(obt_root(ob_screen), OB_LAST_DESKTOP, CARDINAL, screen_last_desktop);
+ }
/* don't start in showing-desktop mode */
screen_show_desktop_mode = SCREEN_SHOW_DESKTOP_NO;
/* this calls screen_update_areas(), which we need ! */
dock_configure();
- for (it = client_list; it; it = g_list_next(it)) {
- client_move_onscreen(it->data, FALSE);
- client_reconfigure(it->data, FALSE);
- }
+ // bug: this is done in screen_update_areas() already
+// for (it = client_list; it; it = g_list_next(it)) {
+// client_move_onscreen(it->data, FALSE);
+// client_reconfigure(it->data, FALSE);
+// }
}
void screen_set_num_desktops(guint num)
static gboolean last_desktop_func(gpointer data)
{
screen_desktop_timeout = TRUE;
+ OBT_PROP_SET32(obt_root(ob_screen), OB_LAST_DESKTOP, CARDINAL, screen_last_desktop);
screen_desktop_timer = 0;
return FALSE; /* don't repeat */
}
{
if (sn_app_starting())
XDefineCursor(obt_display, obt_root(ob_screen),
- ob_cursor(OB_CURSOR_BUSYPOINTER));
+ ob_cursor(OB_CURSOR_BUSY));
else
XDefineCursor(obt_display, obt_root(ob_screen),
ob_cursor(OB_CURSOR_POINTER));
b = screen_desktop;
return a == b;
}
+
+void screen_apply_gravity_point(gint *x, gint *y, gint width, gint height,
+ const GravityPoint *position, const Rect *area)
+{
+ if (position->x.center)
+ *x = area->width / 2 - width / 2;
+ else {
+ *x = position->x.pos;
+ if (position->x.denom)
+ *x = (*x * area->width) / position->x.denom;
+ if (position->x.opposite)
+ *x = area->width - width - *x;
+ }
+
+ if (position->y.center)
+ *y = area->height / 2 - height / 2;
+ else {
+ *y = position->y.pos;
+ if (position->y.denom)
+ *y = (*y * area->height) / position->y.denom;
+ if (position->y.opposite)
+ *y = area->height - height - *y;
+ }
+
+ *x += area->x;
+ *y += area->y;
+}