using python and swig for now.
@@ -80,11 +80,17 @@ AC_MSG_ERROR([Openbox requires the use of Python 2.2. This is its secret special formula for extreme sexiness.
See http://www.python.org ])) AC_CHECK_LIB([python2.2], [Py_Initialize], - PYTHON_LDFLAGS="-lpython2.2 -Xlinker -export-dynamic", + PYTHON_LDFLAGS="-lpython2.2", +dnl -Xlinker -export-dynamic", AC_MSG_ERROR([Openbox requires the use of Python 2.2. This is its secret special formula for extreme sexiness. See http://www.python.org ])) +PYTHON_CFLAGS="-I/usr/include/python2.2 -I/usr/gwar/include/python2.2" +AC_SUBST([PYTHON_CFLAGS]) AC_SUBST([PYTHON_LDFLAGS]) + +dnl Check for guile +GUILE_FLAGS dnl Check for X headers and libraries AC_PATH_X
@@ -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
@@ -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@@ -110,19 +124,6 @@ Decor_Close = 1 << 6 //!< Display a close button
}; //! 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@@ -306,6 +307,7 @@ void updateClass();
// 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 @@ */
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; }
@@ -13,6 +13,8 @@ #ifdef HAVE_LOCALE_H
# include <locale.h> #endif // HAVE_LOCALE_H +#include <guile/gh.h> + #include "gettext.h" }@@ -22,17 +24,21 @@
#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(); +} - return(0); +int main(int argc, char **argv) { + // initialize the locale + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + // start up guile + //gh_enter(argc, argv, main_prog); + main_prog(argc, argv); }
@@ -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 "openbox.hh"
#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 @@ #ifdef HAVE_SYS_SELECT_H
# 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 @@ printf(_("No screens were found without a window manager. Exiting.\n"));
::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 @@ } else {
PyRun_SimpleFile(rcpyfd, "/home/natas/.openbox/user.py"); fclose(rcpyfd); } + _state = State_Normal; // done starting }
@@ -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 @@ State_Normal, //!< The window manager is running in its normal state
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 @@ //! Handles signal events for the application
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 @@ */
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 @@
//! 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 @@ It loops indefinately while handling all events for the application.
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);
@@ -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*>;
@@ -94,10 +94,12 @@ */
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 @@ inline const otk::Rect &area() const { return _area; }
//! 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);