Add option for desktop warping
authorDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 15:56:28 +0000 (11:56 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 15:56:28 +0000 (11:56 -0400)
src/obconf.glade
src/strings.c
src/windows.c

index 3ebd159..000d2a4 100644 (file)
@@ -1844,6 +1844,148 @@ C - The close button</property>
                              <property name="fill">True</property>
                            </packing>
                          </child>
+
+                         <child>
+                           <widget class="GtkCheckButton" id="warp_edge">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">_Switch desktops when moving a window past the screen edge</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                             <property name="active">False</property>
+                             <property name="inconsistent">False</property>
+                             <property name="draw_indicator">True</property>
+                             <signal name="toggled" handler="on_warp_edge_toggled" after="yes" last_modification_time="Sat, 04 Aug 2007 15:51:15 GMT"/>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkHBox" id="hbox103">
+                             <property name="visible">True</property>
+                             <property name="homogeneous">False</property>
+                             <property name="spacing">0</property>
+
+                             <child>
+                               <widget class="GtkLabel" id="label214">
+                                 <property name="visible">True</property>
+                                 <property name="label">    </property>
+                                 <property name="use_underline">False</property>
+                                 <property name="use_markup">False</property>
+                                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                 <property name="wrap">False</property>
+                                 <property name="selectable">False</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                 <property name="width_chars">-1</property>
+                                 <property name="single_line_mode">False</property>
+                                 <property name="angle">0</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkHBox" id="hbox104">
+                                 <property name="visible">True</property>
+                                 <property name="homogeneous">False</property>
+                                 <property name="spacing">6</property>
+
+                                 <child>
+                                   <widget class="GtkLabel" id="label215">
+                                     <property name="visible">True</property>
+                                     <property name="label" translatable="yes">_Amount of time to wait before switching:</property>
+                                     <property name="use_underline">True</property>
+                                     <property name="use_markup">False</property>
+                                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                     <property name="wrap">False</property>
+                                     <property name="selectable">False</property>
+                                     <property name="xalign">0</property>
+                                     <property name="yalign">0.5</property>
+                                     <property name="xpad">0</property>
+                                     <property name="ypad">0</property>
+                                     <property name="mnemonic_widget">warp_edge_time</property>
+                                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                     <property name="width_chars">-1</property>
+                                     <property name="single_line_mode">False</property>
+                                     <property name="angle">0</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">False</property>
+                                   </packing>
+                                 </child>
+
+                                 <child>
+                                   <widget class="GtkSpinButton" id="warp_edge_time">
+                                     <property name="visible">True</property>
+                                     <property name="can_focus">True</property>
+                                     <property name="climb_rate">1</property>
+                                     <property name="digits">0</property>
+                                     <property name="numeric">True</property>
+                                     <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+                                     <property name="snap_to_ticks">False</property>
+                                     <property name="wrap">False</property>
+                                     <property name="adjustment">0 100 10000 10 10 10</property>
+                                     <signal name="value_changed" handler="on_warp_edge_time_value_changed" after="yes" last_modification_time="Sat, 04 Aug 2007 15:51:02 GMT"/>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">True</property>
+                                   </packing>
+                                 </child>
+
+                                 <child>
+                                   <widget class="GtkLabel" id="label216">
+                                     <property name="visible">True</property>
+                                     <property name="label" translatable="yes">ms</property>
+                                     <property name="use_underline">False</property>
+                                     <property name="use_markup">False</property>
+                                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                                     <property name="wrap">False</property>
+                                     <property name="selectable">False</property>
+                                     <property name="xalign">0.5</property>
+                                     <property name="yalign">0.5</property>
+                                     <property name="xpad">0</property>
+                                     <property name="ypad">0</property>
+                                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                                     <property name="width_chars">-1</property>
+                                     <property name="single_line_mode">False</property>
+                                     <property name="angle">0</property>
+                                   </widget>
+                                   <packing>
+                                     <property name="padding">0</property>
+                                     <property name="expand">False</property>
+                                     <property name="fill">False</property>
+                                   </packing>
+                                 </child>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">True</property>
+                                 <property name="fill">True</property>
+                               </packing>
+                             </child>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">True</property>
+                             <property name="fill">True</property>
+                           </packing>
+                         </child>
                        </widget>
                        <packing>
                          <property name="padding">0</property>
index 55fb281..3b086d5 100644 (file)
@@ -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_("<span weight=\"bold\">Focusing Windows</span>");
 gchar *s = N_("    ");
index f81cec4..26efd8a 100644 (file)
@@ -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));
+}
+