split the moveresize tab's code out from window.c
authorDana Jansens <danakj@orodu.net>
Sat, 12 Jan 2008 17:43:08 +0000 (12:43 -0500)
committerDana Jansens <danakj@orodu.net>
Sat, 12 Jan 2008 17:43:08 +0000 (12:43 -0500)
Makefile.am
src/main.c
src/moveresize.c [new file with mode: 0644]
src/moveresize.h [new file with mode: 0644]
src/obconf.glade
src/strings.c
src/windows.c

index c292e2f..6cbc989 100644 (file)
@@ -43,6 +43,8 @@ src_obconf_SOURCES = \
        src/archive.h \
        src/windows.c \
        src/windows.h \
+       src/moveresize.c \
+       src/moveresize.h \
        src/margins.c \
        src/margins.h \
        src/mouse.c \
index 95a3a50..5769384 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
 
    main.c for ObConf, the configuration tool for Openbox
-   Copyright (c) 2003-2007   Dana Jansens
+   Copyright (c) 2003-2008   Dana Jansens
    Copyright (c) 2003        Tim Riley
 
    This program is free software; you can redistribute it and/or modify
@@ -164,6 +164,7 @@ int main(int argc, char **argv)
     theme_setup_tab();
     appearance_setup_tab();
     windows_setup_tab();
+    moveresize_setup_tab();
     mouse_setup_tab();
     desktops_setup_tab();
     margins_setup_tab();
diff --git a/src/moveresize.c b/src/moveresize.c
new file mode 100644 (file)
index 0000000..fe69ed5
--- /dev/null
@@ -0,0 +1,214 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   windows.c for ObConf, the configuration tool for Openbox
+   Copyright (c) 2003-2008   Dana Jansens
+   Copyright (c) 2003        Tim Riley
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "main.h"
+#include "tree.h"
+
+static gboolean mapping = FALSE;
+
+#define POPUP_NONPIXEL 0
+#define POPUP_ALWAYS   1
+#define POPUP_NEVER    2
+
+#define POSITION_CENTER 0
+#define POSITION_TOP    1
+
+static void enable_stuff();
+
+void moveresize_setup_tab()
+{
+    GtkWidget *w, *w1, *w2, *w3;
+    GtkSizeGroup *group;
+    gchar *s;
+    gint pos, i;
+
+    mapping = TRUE;
+
+    w1    = get_widget("resist_window");
+    w2    = get_widget("resist_edge");
+    w3    = get_widget("drag_threshold");
+    group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+    gtk_size_group_add_widget(group, w1);
+    gtk_size_group_add_widget(group, w2);
+    gtk_size_group_add_widget(group, w3);
+
+    w1    = get_widget("resist_window_label");
+    w2    = get_widget("resist_edge_label");
+    w3    = get_widget("drag_threshold_label");
+    group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+    gtk_size_group_add_widget(group, w1);
+    gtk_size_group_add_widget(group, w2);
+    gtk_size_group_add_widget(group, w3);
+
+    w = get_widget("resize_contents");
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
+                                 tree_get_bool("resize/drawContents", TRUE));
+
+    w = get_widget("resist_window");
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+                              tree_get_int("resistance/strength", 10));
+
+    w = get_widget("resist_edge");
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+                              tree_get_int("resistance/screen_edge_strength",
+                                           20));
+
+    w = get_widget("resize_popup");
+    s = tree_get_string("resize/popupShow", "NonPixel");
+    if (!strcasecmp(s, "Always"))     pos = POPUP_ALWAYS;
+    else if (!strcasecmp(s, "Never")) pos = POPUP_NEVER;
+    else                              pos = POPUP_NONPIXEL;
+    g_free(s);
+    gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos);
+
+    w = get_widget("drag_threshold");
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+                              tree_get_int("mouse/dragThreshold", 8));
+
+    w = get_widget("resize_position");
+    s = tree_get_string("resize/popupPosition", "Center");
+    if (!strcasecmp(s, "Top")) pos = POSITION_TOP;
+    else                       pos = POSITION_CENTER;
+    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;
+}
+
+static void enable_stuff()
+{
+    GtkWidget *w;
+    gboolean b;
+
+    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("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_resist_window_value_changed(GtkSpinButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_int("resistance/strength", gtk_spin_button_get_value_as_int(w));
+}
+
+void on_resist_edge_value_changed(GtkSpinButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_int("resistance/screen_edge_strength",
+                 gtk_spin_button_get_value_as_int(w));
+}
+
+void on_resize_contents_toggled(GtkToggleButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_bool("resize/drawContents", gtk_toggle_button_get_active(w));
+}
+
+void on_resize_popup_nonpixel_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupShow", "NonPixel");
+    enable_stuff();
+}
+
+void on_resize_popup_always_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupShow", "Always");
+    enable_stuff();
+}
+
+void on_resize_popup_never_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupShow", "Never");
+    enable_stuff();
+}
+
+void on_drag_threshold_value_changed(GtkSpinButton *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_int("mouse/dragThreshold",
+                 gtk_spin_button_get_value_as_int(w));
+}
+
+void on_resize_position_center_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupPosition", "Center");
+    enable_stuff();
+}
+
+
+void on_resize_position_top_activate(GtkMenuItem *w, gpointer data)
+{
+    if (mapping) return;
+
+    tree_set_string("resize/popupPosition", "Top");
+    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);
+    enable_stuff();
+}
+
+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));
+}
+
diff --git a/src/moveresize.h b/src/moveresize.h
new file mode 100644 (file)
index 0000000..82ecc96
--- /dev/null
@@ -0,0 +1,25 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   windows.h for ObConf, the configuration tool for Openbox
+   Copyright (c) 2003-2008   Dana Jansens
+   Copyright (c) 2003        Tim Riley
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#ifndef obconf__moveresize_h
+#define obconf__moveresize_h
+
+void moveresize_setup_tab();
+
+#endif
index 0bff06f..41de687 100644 (file)
@@ -2138,6 +2138,15 @@ C - The close button</property>
                                              <signal name="activate" handler="on_resize_position_top_activate" last_modification_time="Fri, 01 Jun 2007 02:29:30 GMT"/>
                                            </widget>
                                          </child>
+
+                                         <child>
+                                           <widget class="GtkMenuItem" id="fixed_position_on_screen1">
+                                             <property name="visible">True</property>
+                                             <property name="label" translatable="yes">Fixed position on screen</property>
+                                             <property name="use_underline">True</property>
+                                             <signal name="activate" handler="on_resize_position_fixed_activate" last_modification_time="Sat, 12 Jan 2008 17:37:27 GMT"/>
+                                           </widget>
+                                         </child>
                                        </widget>
                                      </child>
                                    </widget>
index 5139add..a56bdd2 100644 (file)
@@ -65,6 +65,7 @@ gchar *s = N_("    ");
 gchar *s = N_("Information _dialog's position:");
 gchar *s = N_("Centered on the window");
 gchar *s = N_("Above the window");
+gchar *s = N_("Fixed position on screen");
 gchar *s = N_("Move & Resize");
 gchar *s = N_("<span weight=\"bold\">Focusing Windows</span>");
 gchar *s = N_("    ");
index f8d4008..f9e735c 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
 
    windows.c for ObConf, the configuration tool for Openbox
-   Copyright (c) 2003-2007   Dana Jansens
+   Copyright (c) 2003-2008   Dana Jansens
    Copyright (c) 2003        Tim Riley
 
    This program is free software; you can redistribute it and/or modify
 
 static gboolean mapping = FALSE;
 
-#define POPUP_NONPIXEL 0
-#define POPUP_ALWAYS   1
-#define POPUP_NEVER    2
-
-#define POSITION_CENTER 0
-#define POSITION_TOP    1
-
 #define PLACE_ON_ALL    0
 #define PLACE_ON_ACTIVE 1
 
@@ -36,46 +29,15 @@ static void enable_stuff();
 
 void windows_setup_tab()
 {
-    GtkWidget *w, *w1, *w2, *w3;
-    GtkSizeGroup *group;
+    GtkWidget *w;
     gchar *s;
-    gint pos, i;
 
     mapping = TRUE;
 
-    w1    = get_widget("resist_window");
-    w2    = get_widget("resist_edge");
-    w3    = get_widget("drag_threshold");
-    group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-    gtk_size_group_add_widget(group, w1);
-    gtk_size_group_add_widget(group, w2);
-    gtk_size_group_add_widget(group, w3);
-
-    w1    = get_widget("resist_window_label");
-    w2    = get_widget("resist_edge_label");
-    w3    = get_widget("drag_threshold_label");
-    group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-    gtk_size_group_add_widget(group, w1);
-    gtk_size_group_add_widget(group, w2);
-    gtk_size_group_add_widget(group, w3);
-
     w = get_widget("focus_new");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
                                  tree_get_bool("focus/focusNew", TRUE));
 
-    w = get_widget("resize_contents");
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                 tree_get_bool("resize/drawContents", TRUE));
-
-    w = get_widget("resist_window");
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
-                              tree_get_int("resistance/strength", 10));
-
-    w = get_widget("resist_edge");
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
-                              tree_get_int("resistance/screen_edge_strength",
-                                           20));
-
     w = get_widget("place_mouse");
     s = tree_get_string("placement/policy", "Smart");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
@@ -92,33 +54,6 @@ void windows_setup_tab()
     else
         gtk_option_menu_set_history(GTK_OPTION_MENU(w), PLACE_ON_ALL);
 
-    w = get_widget("resize_popup");
-    s = tree_get_string("resize/popupShow", "NonPixel");
-    if (!strcasecmp(s, "Always"))     pos = POPUP_ALWAYS;
-    else if (!strcasecmp(s, "Never")) pos = POPUP_NEVER;
-    else                              pos = POPUP_NONPIXEL;
-    g_free(s);
-    gtk_option_menu_set_history(GTK_OPTION_MENU(w), pos);
-
-    w = get_widget("drag_threshold");
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
-                              tree_get_int("mouse/dragThreshold", 8));
-
-    w = get_widget("resize_position");
-    s = tree_get_string("resize/popupPosition", "Center");
-    if (!strcasecmp(s, "Top")) pos = POSITION_TOP;
-    else                       pos = POSITION_CENTER;
-    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;
@@ -129,20 +64,10 @@ static void enable_stuff()
     GtkWidget *w;
     gboolean b;
 
-    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)
@@ -182,99 +107,3 @@ void on_place_active_popup_active_activate(GtkMenuItem *w, gpointer data)
 
     tree_set_bool("placement/active", TRUE);
 }
-
-void on_resist_window_value_changed(GtkSpinButton *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_int("resistance/strength", gtk_spin_button_get_value_as_int(w));
-}
-
-void on_resist_edge_value_changed(GtkSpinButton *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_int("resistance/screen_edge_strength",
-                 gtk_spin_button_get_value_as_int(w));
-}
-
-void on_resize_contents_toggled(GtkToggleButton *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_bool("resize/drawContents", gtk_toggle_button_get_active(w));
-}
-
-void on_resize_popup_nonpixel_activate(GtkMenuItem *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_string("resize/popupShow", "NonPixel");
-    enable_stuff();
-}
-
-void on_resize_popup_always_activate(GtkMenuItem *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_string("resize/popupShow", "Always");
-    enable_stuff();
-}
-
-void on_resize_popup_never_activate(GtkMenuItem *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_string("resize/popupShow", "Never");
-    enable_stuff();
-}
-
-void on_drag_threshold_value_changed(GtkSpinButton *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_int("mouse/dragThreshold",
-                 gtk_spin_button_get_value_as_int(w));
-}
-
-void on_resize_position_center_activate(GtkMenuItem *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_string("resize/popupPosition", "Center");
-    enable_stuff();
-}
-
-
-void on_resize_position_top_activate(GtkMenuItem *w, gpointer data)
-{
-    if (mapping) return;
-
-    tree_set_string("resize/popupPosition", "Top");
-    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);
-    enable_stuff();
-}
-
-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));
-}
-