summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am14
-rw-r--r--src/client.hh29
-rw-r--r--src/main.cc20
-rw-r--r--src/openbox.cc29
-rw-r--r--src/openbox.hh27
-rw-r--r--src/openbox.i28
-rw-r--r--src/screen.hh3
7 files changed, 111 insertions, 39 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 47483dc8..92e0b3b0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,12 +2,12 @@ localedir=$(datadir)/locale
DEFAULT_MENU=$(pkgdatadir)/menu
DEFAULT_STYLE=$(pkgdatadir)/styles/mbdtex
-CPPFLAGS=$(XFT_CFLAGS) @CPPFLAGS@ \
+CPPFLAGS=$(XFT_CFLAGS) $(GUILE_CFLAGS) $(PYTHON_CFLAGS) @CPPFLAGS@ \
-DDEFAULTMENU=\"$(DEFAULT_MENU)\" \
-DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\" \
-DLOCALEDIR=\"$(localedir)\"
-LIBS=$(XFT_LIBS) $(PYTHON_LDFLAGS) @LIBS@
+LIBS=$(XFT_LIBS) $(GUILE_LDFLAGS) $(PYTHON_LDFLAGS) @LIBS@
INCLUDES= -I../otk
@@ -17,11 +17,19 @@ openbox3_LDADD=../otk/libotk.a @LIBINTL@
openbox3_SOURCES= actions.cc client.cc frame.cc openbox.cc screen.cc \
main.cc rootwindow.cc backgroundwidget.cc labelwidget.cc \
- buttonwidget.cc python.cc
+ buttonwidget.cc openbox_wrap.cc
+# guile.cc
MAINTAINERCLEANFILES= Makefile.in
distclean-local:
rm -f *\~ *.orig *.rej .\#*
+openbox.i: openbox.hh screen.hh client.hh
+ touch openbox.i
+
+openbox_wrap.cc: openbox.i
+ swig -python -c++ -nodefault -module openbox -o openbox_wrap.cc openbox.i
+# swig -guile -c++ -nodefault -o openbox_wrap.cc openbox.i
+
# local dependencies
diff --git a/src/client.hh b/src/client.hh
index 458fe088..de250f37 100644
--- a/src/client.hh
+++ b/src/client.hh
@@ -27,6 +27,20 @@ namespace ob {
class OBFrame;
+//! The MWM Hints as retrieved from the window property
+/*!
+ This structure only contains 3 elements, even though the Motif 2.0
+ structure contains 5. We only use the first 3, so that is all gets defined.
+*/
+struct MwmHints {
+ //! The number of elements in the OBClient::MwmHints struct
+ static const unsigned int elements = 3;
+ unsigned long flags; //!< A bitmask of OBClient::MwmFlags values
+ unsigned long functions; //!< A bitmask of OBClient::MwmFunctions values
+ unsigned long decorations;//!< A bitmask of OBClient::MwmDecorations values
+};
+
+
//! Maintains the state of a client window.
/*!
OBClient maintains the state of a client window. The state consists of the
@@ -111,19 +125,6 @@ public:
//! Holds a bitmask of OBClient::Decoration values
typedef unsigned char DecorationFlags;
- //! The MWM Hints as retrieved from the window property
- /*!
- This structure only contains 3 elements, even though the Motif 2.0
- structure contains 5. We only use the first 3, so that is all gets defined.
- */
- typedef struct MwmHints {
- //! The number of elements in the OBClient::MwmHints struct
- static const unsigned int elements = 3;
- unsigned long flags; //!< A bitmask of OBClient::MwmFlags values
- unsigned long functions; //!< A bitmask of OBClient::MwmFunctions values
- unsigned long decorations;//!< A bitmask of OBClient::MwmDecorations values
- };
-
//! Possible actions that can be made with the _NET_WM_STATE client message
enum StateAction { State_Remove = 0, //!< _NET_WM_STATE_REMOVE
State_Add, //!< _NET_WM_STATE_ADD
@@ -306,6 +307,7 @@ private:
// XXX: updateTransientFor();
public:
+#ifndef SWIG
//! Constructs a new OBClient object around a specified window id
/*!
@param window The window id that the OBClient class should handle
@@ -314,6 +316,7 @@ public:
OBClient(int screen, Window window);
//! Destroys the OBClient object
virtual ~OBClient();
+#endif
//! Returns the screen on which the clien resides
inline int screen() const { return _screen; }
diff --git a/src/main.cc b/src/main.cc
index 1d6ce0b1..5d878d79 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -13,6 +13,8 @@ extern "C" {
# include <locale.h>
#endif // HAVE_LOCALE_H
+#include <guile/gh.h>
+
#include "gettext.h"
}
@@ -22,17 +24,21 @@ using std::string;
#include "blackbox.hh"
#include "openbox.hh"
-int main(int argc, char **argv) {
- // initialize the locale
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-
+void main_prog(int argc, char **argv) {
ob::Openbox openbox(argc, argv);
//ob::Blackbox blackbox(argc, argv, 0);
//Blackbox blackbox(argv, session_display, rc_file);
openbox.eventLoop();
+}
+
+int main(int argc, char **argv) {
+ // initialize the locale
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
- return(0);
+ // start up guile
+ //gh_enter(argc, argv, main_prog);
+ main_prog(argc, argv);
}
diff --git a/src/openbox.cc b/src/openbox.cc
index 01e23281..2254f9ef 100644
--- a/src/openbox.cc
+++ b/src/openbox.cc
@@ -1,4 +1,4 @@
-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H
# include "../config.h"
@@ -9,7 +9,6 @@
#include "client.hh"
#include "screen.hh"
#include "actions.hh"
-#include "python.hh"
#include "otk/property.hh"
#include "otk/display.hh"
#include "otk/assassin.hh"
@@ -43,7 +42,12 @@ extern "C" {
# include <sys/select.h>
#endif // HAVE_SYS_SELECT_H
-#include <python2.2/Python.h>
+//#include <guile/gh.h>
+
+#include <Python.h>
+
+// The initializer in openbox_wrap.cc
+extern void init_openbox(void);
#include "gettext.h"
#define _(str) gettext(str)
@@ -153,10 +157,24 @@ Openbox::Openbox(int argc, char **argv)
::exit(1);
}
- // initialize the python interface
+ /*
+ // make our guile interfaces exist
+ SWIG_init();
+
+ // run the guile of d3th
+ FILE *rcpyfd = fopen("/home/natas/.openbox/user.scm", "r");
+ if (!rcpyfd) {
+ printf("failed to load guile script /home/natas/.openbox/user.scm\n");
+ } else {
+ fclose(rcpyfd);
+ gh_load("/home/natas/.openbox/user.scm");
+ }
+ */
+
Py_SetProgramName(argv[0]);
Py_Initialize();
- initopenbox(); // initialize the static 'openbox' module
+ //initopenbox(); // initialize the static 'openbox' module
+ init_openbox();
FILE *rcpyfd = fopen("/home/natas/.openbox/user.py", "r");
if (!rcpyfd) {
printf("failed to load python file /home/natas/.openbox/user.py\n");
@@ -164,6 +182,7 @@ Openbox::Openbox(int argc, char **argv)
PyRun_SimpleFile(rcpyfd, "/home/natas/.openbox/user.py");
fclose(rcpyfd);
}
+
_state = State_Normal; // done starting
}
diff --git a/src/openbox.hh b/src/openbox.hh
index abdcfef3..b632cecf 100644
--- a/src/openbox.hh
+++ b/src/openbox.hh
@@ -1,4 +1,4 @@
-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __openbox_hh
#define __openbox_hh
@@ -31,6 +31,17 @@ class OBScreen;
class OBClient;
class OBActions;
+//! Mouse cursors used throughout Openbox
+struct Cursors {
+ Cursor session; //!< The default mouse cursor
+ Cursor move; //!< For moving a window
+ Cursor ll_angle; //!< For resizing the bottom left corner of a window
+ Cursor lr_angle; //!< For resizing the bottom right corner of a window
+ Cursor ul_angle; //!< For resizing the top left corner of a window
+ Cursor ur_angle; //!< For resizing the right corner of a window
+};
+
+
//! The main class for the Openbox window manager
/*!
Only a single instance of the Openbox class may be used in the application. A
@@ -58,16 +69,6 @@ public:
State_Exiting //!< The window manager is exiting (being destroyed)
};
- //! Mouse cursors used throughout Openbox
- struct Cursors {
- Cursor session; //!< The default mouse cursor
- Cursor move; //!< For moving a window
- Cursor ll_angle; //!< For resizing the bottom left corner of a window
- Cursor lr_angle; //!< For resizing the bottom right corner of a window
- Cursor ul_angle; //!< For resizing the top left corner of a window
- Cursor ur_angle; //!< For resizing the right corner of a window
- };
-
//! A map for looking up a specific client class from the window id
typedef std::map<Window, OBClient *> ClientMap;
@@ -138,6 +139,7 @@ private:
static void signalHandler(int signal);
public:
+#ifndef SWIG
//! Openbox constructor.
/*!
\param argc Number of command line arguments, as received in main()
@@ -146,6 +148,7 @@ public:
Openbox(int argc, char **argv);
//! Openbox destructor.
virtual ~Openbox();
+#endif
//! Returns the state of the window manager (starting, exiting, etc)
inline RunState state() const { return _state; }
@@ -169,6 +172,7 @@ public:
//! Returns the mouse cursors used throughout Openbox
inline const Cursors &cursors() const { return _cursors; }
+#ifndef SWIG
//! The main function of the Openbox class
/*!
This function should be called after instantiating the Openbox class.
@@ -176,6 +180,7 @@ public:
The Openbox::shutdown method will cause this function to exit.
*/
void eventLoop();
+#endif
//! Adds an OBClient to the client list for lookups
void addClient(Window window, OBClient *client);
diff --git a/src/openbox.i b/src/openbox.i
new file mode 100644
index 00000000..bde9a8cb
--- /dev/null
+++ b/src/openbox.i
@@ -0,0 +1,28 @@
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
+
+%module openbox
+
+%{
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
+#include "openbox.hh"
+#include "screen.hh"
+#include "client.hh"
+%}
+
+%immutable ob::Openbox::instance;
+
+%include "openbox.hh"
+%include "screen.hh"
+%include "client.hh"
+
+
+%include stl.i
+%include std_list.i
+
+%{
+class OBClient;
+%}
+%template(ClientList) std::list<OBClient*>;
diff --git a/src/screen.hh b/src/screen.hh
index 543e216c..a35e4ca0 100644
--- a/src/screen.hh
+++ b/src/screen.hh
@@ -94,10 +94,12 @@ private:
void setWorkArea();
public:
+#ifndef SWIG
//! Constructs a new OBScreen object
OBScreen(int screen, const otk::Configuration &config);
//! Destroys the OBScreen object
virtual ~OBScreen();
+#endif
//! Returns if the screen was successfully managed
/*!
@@ -112,6 +114,7 @@ public:
//! Returns the style in use on the screen
inline const otk::Style *style() const { return &_style; }
+ inline ClientList clients() { return _clients; }
//! Adds a window's strut to the screen's list of reserved spaces
void addStrut(otk::Strut *strut);