src/about.c \
src/archive.c \
src/archive.h \
- src/behavior.c \
- src/behavior.h \
+ src/windows.c \
+ src/windows.h \
+ src/mouse.c \
+ src/mouse.h \
src/desktops.c \
src/desktops.h \
src/dock.h \
#include "archive.h"
#include "theme.h"
#include "appearance.h"
-#include "behavior.h"
+#include "windows.h"
+#include "mouse.h"
#include "desktops.h"
#include "dock.h"
#include "preview_update.h"
theme_setup_tab();
appearance_setup_tab();
- behavior_setup_tab();
+ windows_setup_tab();
+ mouse_setup_tab();
desktops_setup_tab();
dock_setup_tab();
--- /dev/null
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ mouse.c for ObConf, the configuration tool for Openbox
+ Copyright (c) 2007 Dana Jansens
+
+ 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"
+#include "gettext.h"
+#include <openbox/parse.h>
+
+static gboolean mapping = FALSE;
+static xmlNodePtr saved_custom = NULL;
+
+#define TITLEBAR_MAXIMIZE 0
+#define TITLEBAR_SHADE 1
+#define TITLEBAR_CUSTOM 2
+
+static gint read_doubleclick_action();
+static void write_doubleclick_action(gint a);
+static void on_titlebar_doubleclick_custom_activate(GtkMenuItem *w,
+ gpointer data);
+
+void mouse_setup_tab()
+{
+ GtkWidget *w, *w1, *w2;
+ GtkSizeGroup *group;
+ gint a;
+
+ mapping = TRUE;
+
+ w1 = get_widget("doubleclick_time");
+ w2 = 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);
+
+ w1 = get_widget("doubleclick_time_label");
+ w2 = 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);
+
+ w = get_widget("doubleclick_time");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+ tree_get_int("mouse/doubleClickTime", 200));
+
+ w = get_widget("drag_threshold");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
+ tree_get_int("mouse/dragThreshold", 3));
+
+ w = get_widget("titlebar_doubleclick");
+ a = read_doubleclick_action();
+ if (a == TITLEBAR_CUSTOM) {
+ GtkWidget *i = gtk_menu_item_new_with_label(_("Custom actions"));
+ g_signal_connect(i, "activate",
+ G_CALLBACK (on_titlebar_doubleclick_custom_activate),
+ NULL);
+ gtk_menu_shell_append
+ (GTK_MENU_SHELL
+ (gtk_option_menu_get_menu
+ (GTK_OPTION_MENU(w))), i);
+ }
+ gtk_option_menu_set_history(GTK_OPTION_MENU(w), a);
+
+ mapping = FALSE;
+}
+
+void on_titlebar_doubleclick_maximize_activate(GtkMenuItem *w, gpointer data)
+{
+ if (mapping) return;
+
+ write_doubleclick_action(TITLEBAR_MAXIMIZE);
+}
+
+void on_titlebar_doubleclick_shade_activate(GtkMenuItem *w, gpointer data)
+{
+ if (mapping) return;
+
+ write_doubleclick_action(TITLEBAR_SHADE);
+}
+
+static void on_titlebar_doubleclick_custom_activate(GtkMenuItem *w,
+ gpointer data)
+{
+ if (mapping) return;
+
+ write_doubleclick_action(TITLEBAR_CUSTOM);
+}
+
+void on_doubleclick_time_value_changed(GtkSpinButton *w, gpointer data)
+{
+ if (mapping) return;
+
+ tree_set_int("mouse/doubleClickTime",
+ gtk_spin_button_get_value_as_int(w));
+}
+
+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));
+}
+
+static gint read_doubleclick_action()
+{
+ xmlNodePtr n, top, c;
+ gint max = 0, shade = 0, other = 0;
+
+ top = tree_get_node("mouse/context:name=Titlebar"
+ "/mousebind:button=Left:action=DoubleClick", NULL);
+ n = top->children;
+
+ /* save the current state */
+ saved_custom = xmlCopyNode(top, 1);
+
+ /* remove the namespace from all the nodes under saved_custom..
+ without recursion! */
+ c = saved_custom;
+ while (c) {
+ xmlSetNs(c, NULL);
+ if (c->children)
+ c = c->children;
+ else if (c->next)
+ c = c->next;
+ while (c->parent && !c->parent->next)
+ c = c->parent;
+ if (!c->parent)
+ c = NULL;
+ }
+
+ while (n) {
+ if (!xmlStrcmp(n->name, (const xmlChar*)"action")) {
+ if (parse_attr_contains("ToggleMaximizeFull", n, "name"))
+ ++max;
+ else if (parse_attr_contains("ToggleShade", n, "name"))
+ ++shade;
+ else
+ ++other;
+
+ }
+ n = n->next;
+ }
+
+ if (max == 1 && shade == 0 && other == 0)
+ return TITLEBAR_MAXIMIZE;
+ if (max == 0 && shade == 1 && other == 0)
+ return TITLEBAR_SHADE;
+
+ return TITLEBAR_CUSTOM;
+}
+
+static void write_doubleclick_action(gint a)
+{
+ xmlNodePtr n;
+
+ n = tree_get_node("mouse/context:name=Titlebar"
+ "/mousebind:button=Left:action=DoubleClick", NULL);
+
+ /* remove all children */
+ while (n->children) {
+ xmlUnlinkNode(n->children);
+ xmlFreeNode(n->children);
+ }
+
+ if (a == TITLEBAR_MAXIMIZE) {
+ n = xmlNewChild(n, NULL, "action", NULL);
+ xmlSetProp(n, "name", "ToggleMaximizeFull");
+ } else if (a == TITLEBAR_SHADE) {
+ n = xmlNewChild(n, NULL, "action", NULL);
+ xmlSetProp(n, "name", "ToggleShade");
+ } else {
+ xmlNodePtr c = saved_custom->children;
+ while (c) {
+ xmlAddChild(n, xmlCopyNode(c, 1));
+ c = c->next;
+ }
+ }
+
+ tree_apply();
+}
--- /dev/null
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ mouse.h for ObConf, the configuration tool for Openbox
+ Copyright (c) 2007 Dana Jansens
+
+ 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__mouse_h
+#define obconf__mouse_h
+
+void mouse_setup_tab();
+
+#endif
<property name="fill">True</property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label22">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Windows</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="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox56">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
<child>
- <widget class="GtkVBox" id="vbox43">
+ <widget class="GtkVBox" id="vbox61">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label109">
+ <widget class="GtkLabel" id="label155">
<property name="visible">True</property>
<property name="label" translatable="yes"><span weight="bold">Mouse Behavior</span></property>
<property name="use_underline">False</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox59">
+ <widget class="GtkHBox" id="hbox84">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkLabel" id="label110">
+ <widget class="GtkLabel" id="label156">
<property name="visible">True</property>
<property name="label" translatable="yes"> </property>
<property name="use_underline">False</property>
</child>
<child>
- <widget class="GtkVBox" id="vbox44">
+ <widget class="GtkVBox" id="vbox62">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox60">
+ <widget class="GtkHBox" id="hbox87">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label161">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Double-click on the _titlebar:</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">dock_position</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="GtkOptionMenu" id="titlebar_doubleclick">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">0</property>
+
+ <child>
+ <widget class="GtkMenu" id="menu10">
+
+ <child>
+ <widget class="GtkMenuItem" id="titlebar_doubleclick_maximize">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Maximizes the window</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_titlebar_doubleclick_maximize_activate" last_modification_time="Fri, 01 Jun 2007 00:41:35 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="titlebar_doubleclick_shade">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Shades the window</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_titlebar_doubleclick_shade_activate" last_modification_time="Fri, 01 Jun 2007 00:41:35 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </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>
+
+ <child>
+ <widget class="GtkHBox" id="hbox85">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
</child>
<child>
- <widget class="GtkLabel" id="doubleclick_time_units_label">
+ <widget class="GtkLabel" id="label158">
<property name="visible">True</property>
<property name="label" translatable="yes">ms</property>
<property name="use_underline">False</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox61">
+ <widget class="GtkHBox" id="hbox86">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
</child>
<child>
- <widget class="GtkLabel" id="drag_threshold_units_label">
+ <widget class="GtkLabel" id="label160">
<property name="visible">True</property>
<property name="label" translatable="yes">px</property>
<property name="use_underline">False</property>
</child>
<child>
- <widget class="GtkLabel" id="label22">
+ <widget class="GtkLabel" id="label118">
<property name="visible">True</property>
- <property name="label" translatable="yes">Behavior</property>
+ <property name="label" translatable="yes">Mouse</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
gchar *s = N_("px");
gchar *s = N_("Amount of resistance against screen _edges:");
gchar *s = N_("px");
+gchar *s = N_("Windows");
gchar *s = N_("<span weight=\"bold\">Mouse Behavior</span>");
gchar *s = N_(" ");
+gchar *s = N_("Double-click on the _titlebar:");
+gchar *s = N_("Maximizes the window");
+gchar *s = N_("Shades the window");
gchar *s = N_("Double-_click time:");
gchar *s = N_("ms");
gchar *s = N_("Drag _threshold distance:");
gchar *s = N_("px");
-gchar *s = N_("Behavior");
+gchar *s = N_("Mouse");
gchar *s = N_("<span weight=\"bold\">Desktops</span>");
gchar *s = N_(" ");
gchar *s = N_("_Number of desktops: ");
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
- behavior.c for ObConf, the configuration tool for Openbox
+ windows.c for ObConf, the configuration tool for Openbox
Copyright (c) 2003-2007 Dana Jansens
Copyright (c) 2003 Tim Riley
static gboolean mapping = FALSE;
-static void behavior_enable_stuff();
+static void windows_enable_stuff();
-void behavior_setup_tab()
+void windows_setup_tab()
{
GtkWidget *w, *w1, *w2;
GtkSizeGroup *group;
gtk_size_group_add_widget(group, w1);
gtk_size_group_add_widget(group, w2);
- w1 = get_widget("doubleclick_time");
- w2 = 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);
-
- w1 = get_widget("doubleclick_time_label");
- w2 = 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);
-
w = get_widget("focus_mouse");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
tree_get_bool("focus/followMouse", FALSE));
!g_ascii_strcasecmp(s, "UnderMouse"));
g_free(s);
- w = get_widget("doubleclick_time");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
- tree_get_int("mouse/doubleClickTime", 200));
-
- w = get_widget("drag_threshold");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
- tree_get_int("mouse/dragThreshold", 3));
-
- behavior_enable_stuff();
+ windows_enable_stuff();
mapping = FALSE;
}
-static void behavior_enable_stuff()
+static void windows_enable_stuff()
{
GtkWidget *w;
gboolean b;
b = gtk_toggle_button_get_active(w);
tree_set_bool("focus/followMouse", b);
- behavior_enable_stuff();
+ windows_enable_stuff();
}
void on_focus_delay_value_changed(GtkSpinButton *w, gpointer data)
tree_set_bool("resize/drawContents", gtk_toggle_button_get_active(w));
}
-void on_doubleclick_time_value_changed(GtkSpinButton *w, gpointer data)
-{
- if (mapping) return;
-
- tree_set_int("mouse/doubleClickTime",
- gtk_spin_button_get_value_as_int(w));
-}
-
-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));
-}
-
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
- behavior.h for ObConf, the configuration tool for Openbox
+ windows.h for ObConf, the configuration tool for Openbox
Copyright (c) 2003-2007 Dana Jansens
Copyright (c) 2003 Tim Riley
See the COPYING file for a copy of the GNU General Public License.
*/
-#ifndef obconf__behavior_h
-#define obconf__behavior_h
+#ifndef obconf__windows_h
+#define obconf__windows_h
-void behavior_setup_tab();
+void windows_setup_tab();
#endif