From 7ba95fb161dbce0ade9df9c084b767be3cab6007 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 1 Jun 2007 02:13:49 +0000 Subject: [PATCH] move mouse focus options to mouse tab --- src/mouse.c | 72 +++++++ src/obconf.glade | 491 ++++++++++++++++++++++++++++------------------- src/strings.c | 14 +- src/windows.c | 74 ------- 4 files changed, 370 insertions(+), 281 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index 95d7f85..940f989 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -32,6 +32,7 @@ static gint read_doubleclick_action(); static void write_doubleclick_action(gint a); static void on_titlebar_doubleclick_custom_activate(GtkMenuItem *w, gpointer data); +static void enable_stuff(); void mouse_setup_tab() { @@ -53,6 +54,22 @@ void mouse_setup_tab() gtk_size_group_add_widget(group, w1); gtk_size_group_add_widget(group, w2); + w = get_widget("focus_mouse"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), + tree_get_bool("focus/followMouse", FALSE)); + + w = get_widget("focus_delay"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + tree_get_int("focus/focusDelay", 0)); + + w = get_widget("focus_raise"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), + tree_get_bool("focus/raiseOnFocus", FALSE)); + + w = get_widget("focus_last"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), + tree_get_bool("focus/focusLast", FALSE)); + w = get_widget("doubleclick_time"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), tree_get_int("mouse/doubleClickTime", 200)); @@ -75,9 +92,64 @@ void mouse_setup_tab() } gtk_option_menu_set_history(GTK_OPTION_MENU(w), a); + enable_stuff(); + mapping = FALSE; } +static void enable_stuff() +{ + GtkWidget *w; + gboolean b; + + w = get_widget("focus_mouse"); + b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); + + w = get_widget("focus_delay"); + gtk_widget_set_sensitive(w, b); + w = get_widget("focus_delay_label"); + gtk_widget_set_sensitive(w, b); + w = get_widget("focus_delay_label_units"); + gtk_widget_set_sensitive(w, b); + w = get_widget("focus_raise"); + gtk_widget_set_sensitive(w, b); + w = get_widget("focus_last"); + gtk_widget_set_sensitive(w, b); +} + +void on_focus_mouse_toggled(GtkToggleButton *w, gpointer data) +{ + gboolean b; + + if (mapping) return; + + b = gtk_toggle_button_get_active(w); + tree_set_bool("focus/followMouse", b); + + enable_stuff(); +} + +void on_focus_delay_value_changed(GtkSpinButton *w, gpointer data) +{ + if (mapping) return; + + tree_set_int("focus/focusDelay", gtk_spin_button_get_value_as_int(w)); +} + +void on_focus_raise_toggled(GtkToggleButton *w, gpointer data) +{ + if (mapping) return; + + tree_set_bool("focus/raiseOnFocus", gtk_toggle_button_get_active(w)); +} + +void on_focus_last_toggled(GtkToggleButton *w, gpointer data) +{ + if (mapping) return; + + tree_set_bool("focus/focusLast", gtk_toggle_button_get_active(w)); +} + void on_titlebar_doubleclick_maximize_activate(GtkMenuItem *w, gpointer data) { if (mapping) return; diff --git a/src/obconf.glade b/src/obconf.glade index 44183d1..3ac3ce5 100644 --- a/src/obconf.glade +++ b/src/obconf.glade @@ -1011,13 +1011,13 @@ C - The close button 18 - + True False 6 - + True <span weight="bold">Focusing Windows</span> False @@ -1042,13 +1042,13 @@ C - The close button - + True False 0 - + True False @@ -1073,206 +1073,11 @@ C - The close button - + True False 6 - - - True - True - _Focus windows when the mouse pointer moves over them - 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 - True - _Raise windows when the mouse pointer moves over them - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - - True - False - 6 - - - - True - _Delay before focusing and raising windows: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - focus_delay - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 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 - - - - - - True - True - _Give focus to the last used window when switching desktops - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - False - - - True @@ -1302,7 +1107,7 @@ C - The close button 0 - False + True True @@ -1736,6 +1541,290 @@ C - The close button False 18 + + + True + False + 6 + + + + True + <span weight="bold">Focusing Windows</span> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 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 + True + _Focus windows when the mouse pointer moves over them + 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 + True + _Raise windows when the mouse pointer moves over them + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + False + 6 + + + + True + _Delay before focusing and raising windows: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + focus_delay + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 0 0 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 + + + + + + True + True + _Give focus to the last used window when switching desktops + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + False + True + + + + + 0 + False + True + + + True diff --git a/src/strings.c b/src/strings.c index 9047994..67255f0 100644 --- a/src/strings.c +++ b/src/strings.c @@ -33,12 +33,6 @@ gchar *s = N_("_On-screen display: "); gchar *s = N_("Appearance"); gchar *s = N_("Focusing Windows"); gchar *s = N_(" "); -gchar *s = N_("_Focus windows when the mouse pointer moves over them"); -gchar *s = N_(" "); -gchar *s = N_("_Raise windows when the mouse pointer moves over them"); -gchar *s = N_("_Delay before focusing and raising windows:"); -gchar *s = N_("ms"); -gchar *s = N_("_Give focus to the last used window when switching desktops"); gchar *s = N_("Focus _new windows when they appear"); gchar *s = N_("Placing Windows"); gchar *s = N_(" "); @@ -51,6 +45,14 @@ gchar *s = N_("px"); gchar *s = N_("Amount of resistance against screen _edges:"); gchar *s = N_("px"); gchar *s = N_("Windows"); +gchar *s = N_("Focusing Windows"); +gchar *s = N_(" "); +gchar *s = N_("_Focus windows when the mouse pointer moves over them"); +gchar *s = N_(" "); +gchar *s = N_("_Raise windows when the mouse pointer moves over them"); +gchar *s = N_("_Delay before focusing and raising windows:"); +gchar *s = N_("ms"); +gchar *s = N_("_Give focus to the last used window when switching desktops"); gchar *s = N_("Titlebar"); gchar *s = N_(" "); gchar *s = N_("_Double click on the titlebar:"); diff --git a/src/windows.c b/src/windows.c index 898523a..dc690a1 100644 --- a/src/windows.c +++ b/src/windows.c @@ -22,8 +22,6 @@ static gboolean mapping = FALSE; -static void windows_enable_stuff(); - void windows_setup_tab() { GtkWidget *w, *w1, *w2; @@ -44,22 +42,6 @@ void windows_setup_tab() gtk_size_group_add_widget(group, w1); gtk_size_group_add_widget(group, w2); - w = get_widget("focus_mouse"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), - tree_get_bool("focus/followMouse", FALSE)); - - w = get_widget("focus_delay"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), - tree_get_int("focus/focusDelay", 0)); - - w = get_widget("focus_raise"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), - tree_get_bool("focus/raiseOnFocus", FALSE)); - - w = get_widget("focus_last"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), - tree_get_bool("focus/focusLast", FALSE)); - w = get_widget("focus_new"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), tree_get_bool("focus/focusNew", TRUE)); @@ -83,65 +65,9 @@ void windows_setup_tab() !g_ascii_strcasecmp(s, "UnderMouse")); g_free(s); - windows_enable_stuff(); - mapping = FALSE; } -static void windows_enable_stuff() -{ - GtkWidget *w; - gboolean b; - - w = get_widget("focus_mouse"); - b = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); - - w = get_widget("focus_delay"); - gtk_widget_set_sensitive(w, b); - w = get_widget("focus_delay_label"); - gtk_widget_set_sensitive(w, b); - w = get_widget("focus_delay_label_units"); - gtk_widget_set_sensitive(w, b); - w = get_widget("focus_raise"); - gtk_widget_set_sensitive(w, b); - w = get_widget("focus_last"); - gtk_widget_set_sensitive(w, b); -} - -void on_focus_mouse_toggled(GtkToggleButton *w, gpointer data) -{ - gboolean b; - - if (mapping) return; - - b = gtk_toggle_button_get_active(w); - tree_set_bool("focus/followMouse", b); - - windows_enable_stuff(); -} - -void on_focus_delay_value_changed(GtkSpinButton *w, gpointer data) -{ - if (mapping) return; - - tree_set_int("focus/focusDelay", - gtk_spin_button_get_value_as_int(w)); -} - -void on_focus_raise_toggled(GtkToggleButton *w, gpointer data) -{ - if (mapping) return; - - tree_set_bool("focus/raiseOnFocus", gtk_toggle_button_get_active(w)); -} - -void on_focus_last_toggled(GtkToggleButton *w, gpointer data) -{ - if (mapping) return; - - tree_set_bool("focus/focusLast", gtk_toggle_button_get_active(w)); -} - void on_focus_new_toggled(GtkToggleButton *w, gpointer data) { if (mapping) return; -- 2.34.1