X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=3809e05aacac25e128b33020674dc4096051684a;hb=06fb4c7382a9c2a25e74adefbbc267417af5aadd;hp=1eb0051df609b4e55bfd5c98ee5857de5ffb40c0;hpb=3c5f6db04cb577fa3f547b45283eac7a0664be39;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 1eb0051d..3809e05a 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1,11 +1,11 @@ #include "debug.h" #include "openbox.h" +#include "mainloop.h" #include "dock.h" #include "xerror.h" #include "prop.h" #include "startup.h" #include "grab.h" -#include "timer.h" #include "config.h" #include "screen.h" #include "client.h" @@ -36,6 +36,7 @@ guint screen_num_desktops; guint screen_num_monitors; guint screen_desktop; +guint screen_last_desktop; Size screen_physical_size; gboolean screen_showing_desktop; DesktopLayout screen_desktop_layout; @@ -50,7 +51,6 @@ static Popup *desktop_cycle_popup; #ifdef USE_LIBSN static SnMonitorContext *sn_context; static int sn_busy_cnt; -static ObTimer *sn_timer; static void sn_event_func(SnMonitorEvent *event, void *data); #endif @@ -421,6 +421,8 @@ void screen_set_desktop(guint num) if (old == num) return; + screen_last_desktop = old; + ob_debug("Moving to desktop %d\n", num+1); /* show windows before hiding the rest to lessen the enter/leave events */ @@ -585,7 +587,7 @@ static void popup_cycle(guint d, gboolean show) } guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear, - gboolean done, gboolean cancel) + gboolean dialog, gboolean done, gboolean cancel) { static gboolean first = TRUE; static gboolean lin; @@ -595,8 +597,7 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear, if (cancel) { d = origd; goto done_cycle; - } else if (done) { - screen_set_desktop(d); + } else if (done && dialog) { goto done_cycle; } if (first) { @@ -683,7 +684,7 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear, d = translate_row_col(r, c); } - if (config_desktop_popup) { + if (dialog) { popup_cycle(d, TRUE); return d; } @@ -1077,13 +1078,13 @@ static void set_root_cursor() } #ifdef USE_LIBSN -static void sn_timeout(ObTimer *t, void *data) +static gboolean sn_timeout(gpointer data) { - timer_stop(sn_timer); - sn_timer = NULL; sn_busy_cnt = 0; set_root_cursor(); + + return FALSE; /* don't repeat */ } static void sn_event_func(SnMonitorEvent *ev, void *data) @@ -1104,26 +1105,20 @@ static void sn_event_func(SnMonitorEvent *ev, void *data) switch (sn_monitor_event_get_type(ev)) { case SN_MONITOR_EVENT_INITIATED: ++sn_busy_cnt; - if (sn_timer) - timer_stop(sn_timer); + ob_main_loop_timeout_remove(ob_main_loop, sn_timeout); /* 30 second timeout for apps to start */ - sn_timer = timer_start(30 * 1000000, sn_timeout, NULL); + ob_main_loop_timeout_add(ob_main_loop, 30 * G_USEC_PER_SEC, + sn_timeout, NULL, NULL); break; case SN_MONITOR_EVENT_CHANGED: break; case SN_MONITOR_EVENT_COMPLETED: if (sn_busy_cnt) --sn_busy_cnt; - if (sn_timer) { - timer_stop(sn_timer); - sn_timer = NULL; - } + ob_main_loop_timeout_remove(ob_main_loop, sn_timeout); break; case SN_MONITOR_EVENT_CANCELED: if (sn_busy_cnt) --sn_busy_cnt; - if (sn_timer) { - timer_stop(sn_timer); - sn_timer = NULL; - } + ob_main_loop_timeout_remove(ob_main_loop, sn_timeout); }; if (sn_busy_cnt != cnt)