ButtonPressMask | ButtonReleaseMask)
static gboolean screen_validate_layout(ObDesktopLayout *l);
-static gboolean replace_wm();
-static void screen_tell_ksplash();
-static void screen_fallback_focus();
+static gboolean replace_wm(void);
+static void screen_tell_ksplash(void);
+static void screen_fallback_focus(void);
guint screen_num_desktops;
guint screen_num_monitors;
guint screen_desktop;
-guint screen_last_desktop;
+guint screen_last_desktop = 1;
+guint screen_old_desktop;
+gboolean screen_desktop_timeout = TRUE;
Size screen_physical_size;
gboolean screen_showing_desktop;
ObDesktopLayout screen_desktop_layout;
static ObPagerPopup *desktop_popup;
-static gboolean replace_wm()
+static gboolean replace_wm(void)
{
gchar *wm_sn;
Atom wm_sn_atom;
return TRUE;
}
-gboolean screen_annex()
+gboolean screen_annex(void)
{
XSetWindowAttributes attrib;
pid_t pid;
return TRUE;
}
-static void screen_tell_ksplash()
+static void screen_tell_ksplash(void)
{
XEvent e;
char **argv;
guint32 d;
gboolean namesexist = FALSE;
- desktop_popup = pager_popup_new(FALSE);
+ desktop_popup = pager_popup_new();
pager_popup_height(desktop_popup, POPUP_HEIGHT);
if (reconfig) {
screen_desktop_names = NULL;
}
-void screen_resize()
+void screen_resize(void)
{
static gint oldw = 0, oldh = 0;
gint w, h;
screen_set_desktop(num - 1, TRUE);
}
-static void screen_fallback_focus()
+static void screen_fallback_focus(void)
{
ObClient *c;
gboolean allow_omni;
do this before hiding the windows so if helper windows are coming
with us, they don't get hidden
*/
- if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni))) {
+ if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni,
+ !allow_omni)))
+ {
/* only do the flicker reducing stuff ahead of time if we are going
to call xsetinputfocus on the window ourselves. otherwise there is
no guarantee the window will actually take focus.. */
}
}
+static gboolean last_desktop_func(gpointer data)
+{
+ screen_desktop_timeout = TRUE;
+ return FALSE;
+}
+
void screen_set_desktop(guint num, gboolean dofocus)
{
GList *it;
- guint old;
+ guint previous;
gulong ignore_start;
g_assert(num < screen_num_desktops);
- old = screen_desktop;
+ previous = screen_desktop;
screen_desktop = num;
- if (old == num) return;
+ if (previous == num) return;
PROP_SET32(RootWindow(ob_display, ob_screen),
net_current_desktop, cardinal, num);
- screen_last_desktop = old;
+ if (screen_desktop_timeout) {
+ if (screen_desktop == screen_last_desktop) {
+ screen_last_desktop = previous;
+ screen_old_desktop = screen_desktop;
+ } else {
+ screen_old_desktop = screen_last_desktop;
+ screen_last_desktop = previous;
+ }
+ } else {
+ if (screen_desktop == screen_last_desktop) {
+ if (previous == screen_old_desktop) {
+ screen_last_desktop = screen_old_desktop;
+ } else if (screen_last_desktop == screen_old_desktop) {
+ screen_last_desktop = previous;
+ } else {
+ screen_last_desktop = screen_old_desktop;
+ }
+ } else {
+ if (screen_desktop == screen_old_desktop) {
+ /* do nothing */
+ } else if (previous == screen_old_desktop) {
+ /* do nothing */
+ } else if (screen_last_desktop == screen_old_desktop) {
+ screen_last_desktop = previous;
+ } else {
+ /* do nothing */
+ }
+ }
+ }
+ screen_desktop_timeout = FALSE;
+ ob_main_loop_timeout_remove(ob_main_loop, last_desktop_func);
+ ob_main_loop_timeout_add(ob_main_loop, 500000, last_desktop_func,
+ NULL, NULL, NULL);
ob_debug("Moving to desktop %d\n", num+1);
ob_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func);
ob_main_loop_timeout_add(ob_main_loop, config_desktop_popup_time * 1000,
hide_desktop_popup_func, NULL, NULL, NULL);
+ g_free(a);
+}
+
+void screen_hide_desktop_popup(void)
+{
+ ob_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func);
+ pager_popup_hide(desktop_popup);
}
guint screen_find_desktop(guint from, ObDirection dir,
return TRUE;
}
-void screen_update_layout()
+void screen_update_layout(void)
{
ObDesktopLayout l;
}
}
-void screen_update_desktop_names()
+void screen_update_desktop_names(void)
{
guint i;
else if (!show_only) {
ObClient *c;
- if ((c = focus_fallback(TRUE, FALSE, TRUE))) {
+ if ((c = focus_fallback(TRUE, FALSE, TRUE, FALSE))) {
/* only do the flicker reducing stuff ahead of time if we are going
to call xsetinputfocus on the window ourselves. otherwise there
is no guarantee the window will actually take focus.. */
} \
}
-void screen_update_areas()
+void screen_update_areas(void)
{
guint i, j;
gulong *dims;
guint screen_find_monitor(Rect *search)
{
guint i;
- guint most = 0;
+ guint most = screen_num_monitors;
guint mostv = 0;
for (i = 0; i < screen_num_monitors; ++i) {
return most;
}
-Rect* screen_physical_area_all_monitors()
+Rect* screen_physical_area_all_monitors(void)
{
return screen_physical_area_monitor(screen_num_monitors);
}
return RECT_INTERSECTS_RECT(monitor_area[head], *search);
}
-Rect* screen_physical_area_active()
+Rect* screen_physical_area_active(void)
{
Rect *a;
gint x, y;
return a;
}
-void screen_set_root_cursor()
+void screen_set_root_cursor(void)
{
if (sn_app_starting())
XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),