summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-05-24 21:47:06 +0000
committerDana Jansens <danakj@orodu.net>2003-05-24 21:47:06 +0000
commitd1e355de2c6aae38cea3cdc0e0b902ea2b194e86 (patch)
treedcb99d7232895e2b54ed58fbaa7d3a775da9ccfc /plugins
parent927f99e4125743bbecf41b1aa7dbce9587fb6156 (diff)
this is a big one! im putting stats in here just cuz!
59 files changed, 1691 insertions(+), 607 deletions(-) Adding the beginings of ObConf. Adding a resistance-config plugin for ObConf. Creating an obparser library that obrender can use, the kernel can use, plugins can use, and ObConf and its plugins can use. (its just code for using libXml2)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am18
-rw-r--r--plugins/interface.h19
-rw-r--r--plugins/keyboard/keyboard.c4
-rw-r--r--plugins/menu/Makefile.am3
-rw-r--r--plugins/mouse/mouse.c4
-rw-r--r--plugins/obconf_interface.h40
-rw-r--r--plugins/placement/history.c14
-rw-r--r--plugins/placement/placement.c2
-rw-r--r--plugins/resistance/.cvsignore8
-rw-r--r--plugins/resistance/Makefile.am32
-rw-r--r--plugins/resistance/resistance.c (renamed from plugins/resistance.c)7
-rw-r--r--plugins/resistance/resistance.glade109
-rw-r--r--plugins/resistance/resistance.gladep8
-rw-r--r--plugins/resistance/resistance.h2
-rw-r--r--plugins/resistance/resistance_config.c64
15 files changed, 297 insertions, 37 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index b23259d6..ec89616d 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,20 +1,6 @@
-plugindir=$(libdir)/openbox/plugins
+SUBDIRS = keyboard mouse placement menu resistance
-SUBDIRS = keyboard mouse placement menu
-
-CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(GL_CFLAGS) \
- $(XML_CFLAGS) @CPPFLAGS@ \
--DPLUGINDIR=\"$(plugindir)\"
-
-INCLUDES=-I..
-
-plugin_LTLIBRARIES=resistance.la
-
-resistance_la_CPPFLAGS=-DG_LOG_DOMAIN=\"Plugin-Resistance\"
-resistance_la_LDFLAGS=-module -avoid-version
-resistance_la_SOURCES=resistance.c
-
-noinst_HEADERS=
+noinst_HEADERS = interface.h obconf_interface.h
MAINTAINERCLEANFILES= Makefile.in
diff --git a/plugins/interface.h b/plugins/interface.h
new file mode 100644
index 00000000..8c5c6458
--- /dev/null
+++ b/plugins/interface.h
@@ -0,0 +1,19 @@
+#ifndef __plugins_interface_h
+#define __plugins_interface_h
+
+/* plugin_setup_config() */
+typedef void (*PluginSetupConfig)(void);
+
+/* plugin_startup() */
+typedef void (*PluginStartup)(void);
+
+/* plugin_shutdown() */
+typedef void (*PluginShutdown)(void);
+
+/* plugin_create() - for menu plugins only */
+typedef void *(*PluginCreate)(/* TODO */);
+
+/* plugin_destroy() - for menu plugins only */
+typedef void (*PluginDestroy)(void *);
+
+#endif
diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c
index d1d93241..374f2493 100644
--- a/plugins/keyboard/keyboard.c
+++ b/plugins/keyboard/keyboard.c
@@ -5,8 +5,8 @@
#include "kernel/grab.h"
#include "kernel/action.h"
#include "kernel/prop.h"
-#include "kernel/parse.h"
#include "kernel/timer.h"
+#include "parser/parse.h"
#include "tree.h"
#include "keyboard.h"
#include "translate.h"
@@ -45,7 +45,7 @@ static void parse_key(xmlDocPtr doc, xmlNodePtr node, GList *keylist)
if (keylist) {
nact = parse_find_node("action", node);
while (nact) {
- if ((action = parse_action(doc, nact))) {
+ if ((action = action_parse(doc, nact))) {
/* validate that its okay for a key binding */
if (action->func == action_moveresize &&
action->data.moveresize.corner !=
diff --git a/plugins/menu/Makefile.am b/plugins/menu/Makefile.am
index 40b9b64d..3ed9c5c6 100644
--- a/plugins/menu/Makefile.am
+++ b/plugins/menu/Makefile.am
@@ -1,6 +1,7 @@
plugindir=$(libdir)/openbox/plugins
-CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) @CPPFLAGS@ \
+CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(XML_CFLAGS)
+ \@CPPFLAGS@ \
-DG_LOG_DOMAIN=\"Plugin-Timed-Menu\"
INCLUDES=-I../..
diff --git a/plugins/mouse/mouse.c b/plugins/mouse/mouse.c
index 0bfe602c..a2b3d7e0 100644
--- a/plugins/mouse/mouse.c
+++ b/plugins/mouse/mouse.c
@@ -5,8 +5,8 @@
#include "kernel/client.h"
#include "kernel/prop.h"
#include "kernel/grab.h"
-#include "kernel/parse.h"
#include "kernel/frame.h"
+#include "parser/parse.h"
#include "translate.h"
#include "mouse.h"
#include <glib.h>
@@ -59,7 +59,7 @@ static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
goto next_nbut;
nact = parse_find_node("action", nbut->xmlChildrenNode);
while (nact) {
- if ((action = parse_action(doc, nact))) {
+ if ((action = action_parse(doc, nact))) {
/* validate that its okay for a mouse binding*/
if (mact == MouseAction_Motion) {
if (action->func != action_moveresize ||
diff --git a/plugins/obconf_interface.h b/plugins/obconf_interface.h
new file mode 100644
index 00000000..52b19a8f
--- /dev/null
+++ b/plugins/obconf_interface.h
@@ -0,0 +1,40 @@
+#ifndef __obconf_plugin_interface_h
+#define __obconf_plugin_interface_h
+
+#include "parser/parse.h"
+
+struct GtkWidget;
+
+#define OBCONF_INTERFACE_VERSION 1
+
+/* plugin_interface_version() */
+typedef int (*PluginInterfaceVersionFunc)(void);
+
+/* plugin_startup() */
+typedef void (*PluginStartupFunc)(void);
+
+/* plugin_shutdown() */
+typedef void (*PluginShutdownFunc)(void);
+
+/* plugin_name() - user friendly name of the plugin */
+typedef char* (*PluginNameFunc)(void);
+
+/* plugin_plugin_name() - the name of the plugin to load with openbox */
+typedef char* (*PluginPluginNameFunc)(void);
+
+/* plugin_icon() XXX FIXME */
+typedef void (*PluginIconFunc)(void);
+
+/* plugin_toplevel_widget() */
+typedef struct _GtkWidget* (*PluginToplevelWidgetFunc)(void);
+
+/* plugin_edited() */
+typedef gboolean (*PluginEditedFunc)(void);
+
+/* plugin_load() */
+typedef void (*PluginLoadFunc)(xmlDocPtr doc, xmlNodePtr root);
+
+/* plugin_save() */
+typedef void (*PluginSaveFunc)(xmlDocPtr doc, xmlNodePtr root);
+
+#endif
diff --git a/plugins/placement/history.c b/plugins/placement/history.c
index 9d932b9e..716487b6 100644
--- a/plugins/placement/history.c
+++ b/plugins/placement/history.c
@@ -3,7 +3,7 @@
#include "kernel/frame.h"
#include "kernel/client.h"
#include "kernel/screen.h"
-#include "kernel/parse.h"
+#include "parser/parse.h"
#include "history.h"
#include <glib.h>
#include <string.h>
@@ -193,18 +193,8 @@ static void load_history()
char *role;
struct HistoryItem *hi;
- if (!(doc = xmlParseFile(history_path)))
+ if (!parse_load(history_path, "openbox_history", &doc, &node))
return;
- if (!(node = xmlDocGetRootElement(doc))) {
- xmlFreeDoc(doc);
- doc = NULL;
- return;
- }
- if (xmlStrcasecmp(node->name, (const xmlChar*)"openbox_history")) {
- xmlFreeDoc(doc);
- doc = NULL;
- return;
- }
node = parse_find_node("entry", node->xmlChildrenNode);
while (node) {
diff --git a/plugins/placement/placement.c b/plugins/placement/placement.c
index dd818970..889168b9 100644
--- a/plugins/placement/placement.c
+++ b/plugins/placement/placement.c
@@ -3,7 +3,7 @@
#include "kernel/frame.h"
#include "kernel/screen.h"
#include "kernel/openbox.h"
-#include "kernel/parse.h"
+#include "parser/parse.h"
#include "history.h"
#include <glib.h>
diff --git a/plugins/resistance/.cvsignore b/plugins/resistance/.cvsignore
new file mode 100644
index 00000000..fe97c5fa
--- /dev/null
+++ b/plugins/resistance/.cvsignore
@@ -0,0 +1,8 @@
+.deps
+.libs
+Makefile
+Makefile.in
+resistance-config.la
+resistance.la
+resistance_config_la-resistance_config.lo
+resistance_la-resistance.lo
diff --git a/plugins/resistance/Makefile.am b/plugins/resistance/Makefile.am
new file mode 100644
index 00000000..9f95f947
--- /dev/null
+++ b/plugins/resistance/Makefile.am
@@ -0,0 +1,32 @@
+plugindir=$(libdir)/openbox/plugins
+
+CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(GL_CFLAGS) \
+ $(XML_CFLAGS) @CPPFLAGS@ \
+ -DPLUGINDIR=\"$(plugindir)\"
+
+INCLUDES=-I../.. -I../../tools
+
+plugin_LTLIBRARIES=resistance.la
+if OBCONF
+plugin_LTLIBRARIES+=resistance-config.la
+endif
+
+resistance_la_CPPFLAGS=-DG_LOG_DOMAIN=\"Plugin-Resistance\"
+resistance_la_LDFLAGS=-module -avoid-version
+resistance_la_SOURCES=resistance.c
+
+if OBCONF
+resistance_config_la_CPPFLAGS=-DG_LOG_DOMAIN=\"Plugin-Resistance\" \
+ $(GTK_CFLAGS) $(GLADE_CFLAGS)
+resistance_config_la_LDFLAGS=-module -avoid-version
+resistance_config_la_SOURCES=resistance_config.c
+endif
+
+noinst_HEADERS=resistance.h
+
+noinst_DATA=resistance.glade resistance.gladep
+
+MAINTAINERCLEANFILES= Makefile.in
+
+distclean-local:
+ $(RM) *\~ *.orig *.rej .\#*
diff --git a/plugins/resistance.c b/plugins/resistance/resistance.c
index ee6f6e1e..91c10c0e 100644
--- a/plugins/resistance.c
+++ b/plugins/resistance/resistance.c
@@ -1,9 +1,10 @@
#include "kernel/dispatch.h"
#include "kernel/client.h"
#include "kernel/frame.h"
-#include "kernel/parse.h"
#include "kernel/stacking.h"
#include "kernel/screen.h"
+#include "parser/parse.h"
+#include "resistance.h"
#include <glib.h>
static int resistance;
@@ -21,8 +22,8 @@ static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
void plugin_setup_config()
{
- resistance = 10;
- resist_windows = TRUE;
+ resistance = DEFAULT_RESISTANCE;
+ resist_windows = DEFAULT_RESIST_WINDOWS;
parse_register("resistance", parse_xml, NULL);
}
diff --git a/plugins/resistance/resistance.glade b/plugins/resistance/resistance.glade
new file mode 100644
index 00000000..ecb52b0e
--- /dev/null
+++ b/plugins/resistance/resistance.glade
@@ -0,0 +1,109 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="resistwindow">
+ <property name="title" translatable="yes"></property>
+ <property name="type">GTK_WINDOW_POPUP</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Strength</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.49</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">resist_strength</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="resist_strength">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Set to the amount of resistance to provide when moving or resizing a window past a screen or window edge. A value of 0 disables resistance.</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">1 0 30 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</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>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="resist_windows">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Resist other _Windows</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</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>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/plugins/resistance/resistance.gladep b/plugins/resistance/resistance.gladep
new file mode 100644
index 00000000..1951d46b
--- /dev/null
+++ b/plugins/resistance/resistance.gladep
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
+
+<glade-project>
+ <name>resistance</name>
+ <program_name>resistance</program_name>
+ <gnome_support>FALSE</gnome_support>
+</glade-project>
diff --git a/plugins/resistance/resistance.h b/plugins/resistance/resistance.h
new file mode 100644
index 00000000..5bec224b
--- /dev/null
+++ b/plugins/resistance/resistance.h
@@ -0,0 +1,2 @@
+#define DEFAULT_RESISTANCE 10
+#define DEFAULT_RESIST_WINDOWS TRUE
diff --git a/plugins/resistance/resistance_config.c b/plugins/resistance/resistance_config.c
new file mode 100644
index 00000000..1384fe3f
--- /dev/null
+++ b/plugins/resistance/resistance_config.c
@@ -0,0 +1,64 @@
+#include "plugins/obconf_interface.h"
+#include "parser/parse.h"
+#include "resistance.h"
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+static GtkWidget *conf_widget;
+static GtkCheckButton *conf_resist_windows;
+static GtkSpinButton *conf_resist_strength;
+static gboolean conf_edited = FALSE;
+
+int plugin_interface_version() { return OBCONF_INTERFACE_VERSION; }
+
+char *plugin_name() { return "Resistance"; }
+char *plugin_plugin_name() { return "resistance"; }
+void plugin_icon() {}
+
+GtkWidget *plugin_toplevel_widget() { return conf_widget; }
+
+gboolean plugin_edited() { return conf_edited; }
+
+void plugin_load(xmlDocPtr doc, xmlNodePtr root)
+{
+ xmlNodePtr node, n;
+
+ gtk_spin_button_set_value(conf_resist_strength, DEFAULT_RESISTANCE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(conf_resist_windows),
+ DEFAULT_RESIST_WINDOWS);
+
+ node = parse_find_node("resistance", root);
+ while (node) {
+ if ((n = parse_find_node("strength", node)))
+ gtk_spin_button_set_value(conf_resist_strength,
+ parse_int(doc, n));
+ if ((n = parse_find_node("windows", node)))
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON(conf_resist_windows),
+ parse_bool(doc, n));
+
+ node = parse_find_node("resistance", node->next);
+ }
+}
+
+void plugin_save(xmlDocPtr doc, xmlNodePtr root)
+{
+}
+
+void plugin_startup()
+{
+ GladeXML *xml;
+
+ xml = glade_xml_new("obconf.glade", NULL, NULL);
+ glade_xml_signal_autoconnect(xml);
+
+ conf_widget = glade_xml_get_widget(xml, "resistwindow");
+ conf_resist_strength =
+ GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "resist_strength"));
+ conf_resist_windows =
+ GTK_CHECK_BUTTON(glade_xml_get_widget(xml, "resist_windows"));
+}
+
+void plugin_shutdown()
+{
+}