From: Dana Jansens Date: Sat, 4 Aug 2007 15:56:28 +0000 (-0400) Subject: Add option for desktop warping X-Git-Tag: release-2.0.3~40 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=ac4181931c59248c23ef850fca64cc81ba422228;p=dana%2Fobconf.git Add option for desktop warping --- diff --git a/src/obconf.glade b/src/obconf.glade index 3ebd159..000d2a4 100644 --- a/src/obconf.glade +++ b/src/obconf.glade @@ -1844,6 +1844,148 @@ C - The close button True + + + + True + True + _Switch desktops when moving a window past the screen edge + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + False + 0 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 6 + + + + True + _Amount of time to wait before switching: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + warp_edge_time + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 0 100 10000 10 10 10 + + + + 0 + False + True + + + + + + True + ms + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + 0 diff --git a/src/strings.c b/src/strings.c index 55fb281..3b086d5 100644 --- a/src/strings.c +++ b/src/strings.c @@ -56,6 +56,10 @@ gchar *s = N_("Amount of resistance against other _windows:"); gchar *s = N_("px"); gchar *s = N_("Amount of resistance against screen _edges:"); gchar *s = N_("px"); +gchar *s = N_("_Switch desktops when moving a window past the screen edge"); +gchar *s = N_(" "); +gchar *s = N_("_Amount of time to wait before switching:"); +gchar *s = N_("ms"); gchar *s = N_("Windows"); gchar *s = N_("Focusing Windows"); gchar *s = N_(" "); diff --git a/src/windows.c b/src/windows.c index f81cec4..26efd8a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -36,7 +36,7 @@ void windows_setup_tab() GtkWidget *w, *w1, *w2, *w3; GtkSizeGroup *group; gchar *s; - gint pos; + gint pos, i; mapping = TRUE; @@ -102,6 +102,14 @@ void windows_setup_tab() g_free(s); gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos); + i = tree_get_int("mouse/screenEdgeWarpTime", 400); + + w = get_widget("warp_edge"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), i != 0); + + w = get_widget("warp_edge_time"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), i ? i : 400); + enable_stuff(); mapping = FALSE; @@ -114,15 +122,18 @@ static void enable_stuff() w = get_widget("resize_popup"); b = gtk_option_menu_get_history(GTK_OPTION_MENU(w)) != POPUP_NEVER; - w = get_widget("resize_position"); gtk_widget_set_sensitive(w, b); w = get_widget("place_mouse"); b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); - w = get_widget("place_center"); gtk_widget_set_sensitive(w, !b); + + w = get_widget("warp_edge"); + b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); + w = get_widget("warp_edge_time"); + gtk_widget_set_sensitive(w, b); } void on_focus_new_toggled(GtkToggleButton *w, gpointer data) @@ -220,3 +231,26 @@ void on_resize_position_top_activate(GtkMenuItem *w, gpointer data) enable_stuff(); } +void on_warp_edge_toggled(GtkToggleButton *w, gpointer data) +{ + if (mapping) return; + + if (gtk_toggle_button_get_active(w)) { + GtkWidget *w2; + + w2 = get_widget("warp_edge_time"); + tree_set_int("mouse/screenEdgeWarpTime", + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w2))); + } + else + tree_set_int("mouse/screenEdgeWarpTime", 0); +} + +void on_warp_edge_time_value_changed(GtkSpinButton *w, gpointer data) +{ + if (mapping) return; + + tree_set_int("mouse/screenEdgeWarpTime", + gtk_spin_button_get_value_as_int(w)); +} +