From fdb4e652f7b196eacc4f942d403910400087ce2a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 4 Jan 2003 09:27:50 +0000 Subject: [PATCH] move the approproate code for map request handling to the client class. this will deiconify the window when requested. --- src/client.cc | 22 ++++++++++++++---- src/client.hh | 1 + src/openbox_wrap.cc | 56 +++++++++++++++++++++++++++++++++------------ src/rootwindow.cc | 11 ++++----- src/rootwindow.hh | 2 +- 5 files changed, 65 insertions(+), 27 deletions(-) diff --git a/src/client.cc b/src/client.cc index 2bb15780..a6990a8d 100644 --- a/src/client.cc +++ b/src/client.cc @@ -264,9 +264,10 @@ void OBClient::getState() if (state[i] == property->atom(otk::OBProperty::net_wm_state_modal)) _modal = true; else if (state[i] == - property->atom(otk::OBProperty::net_wm_state_shaded)) + property->atom(otk::OBProperty::net_wm_state_shaded)) { _shaded = true; - else if (state[i] == + _wmstate = IconicState; + } else if (state[i] == property->atom(otk::OBProperty::net_wm_state_skip_taskbar)) _skip_taskbar = true; else if (state[i] == @@ -1120,13 +1121,13 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e) switch (e.detail) { case Below: case BottomIf: - // XXX: lower the window + Openbox::instance->screen(_screen)->restack(false, this); // lower break; case Above: case TopIf: default: - // XXX: raise the window + Openbox::instance->screen(_screen)->restack(true, this); // raise break; } } @@ -1186,4 +1187,17 @@ void OBClient::reparentHandler(const XReparentEvent &e) Openbox::instance->screen(_screen)->unmanageWindow(this); } + +void OBClient::mapRequestHandler(const XMapRequestEvent &e) +{ + printf("\nMAP REQUEST\n\n"); + + otk::OtkEventHandler::mapRequestHandler(e); + + if (_shaded) + shade(false); + // XXX: uniconify the window + focus(); +} + } diff --git a/src/client.hh b/src/client.hh index b64878ee..41ca3dd2 100644 --- a/src/client.hh +++ b/src/client.hh @@ -498,6 +498,7 @@ public: virtual void unmapHandler(const XUnmapEvent &e); virtual void destroyHandler(const XDestroyWindowEvent &e); virtual void reparentHandler(const XReparentEvent &e); + virtual void mapRequestHandler(const XMapRequestEvent &e); #if defined(SHAPE) virtual void shapeHandler(const XShapeEvent &e); #endif // SHAPE diff --git a/src/openbox_wrap.cc b/src/openbox_wrap.cc index a60d48e0..c8e2e65d 100644 --- a/src/openbox_wrap.cc +++ b/src/openbox_wrap.cc @@ -656,21 +656,22 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { #define SWIGTYPE_p_ob__Openbox swig_types[8] #define SWIGTYPE_p_otk__Strut swig_types[9] #define SWIGTYPE_p_XConfigureRequestEvent swig_types[10] -#define SWIGTYPE_p_otk__OtkEventHandler swig_types[11] -#define SWIGTYPE_p_otk__Rect swig_types[12] -#define SWIGTYPE_p_ob__OBWidget swig_types[13] -#define SWIGTYPE_p_XFocusChangeEvent swig_types[14] -#define SWIGTYPE_p_XClientMessageEvent swig_types[15] -#define SWIGTYPE_p_otk__OBProperty swig_types[16] -#define SWIGTYPE_p_otk__OtkEventDispatcher swig_types[17] -#define SWIGTYPE_p_XPropertyEvent swig_types[18] -#define SWIGTYPE_p_XDestroyWindowEvent swig_types[19] -#define SWIGTYPE_p_otk__BImageControl swig_types[20] -#define SWIGTYPE_p_PyObject swig_types[21] -#define SWIGTYPE_p_ob__OBBindings swig_types[22] -#define SWIGTYPE_p_ob__MwmHints swig_types[23] -#define SWIGTYPE_p_XUnmapEvent swig_types[24] -static swig_type_info *swig_types[26]; +#define SWIGTYPE_p_XMapRequestEvent swig_types[11] +#define SWIGTYPE_p_otk__OtkEventHandler swig_types[12] +#define SWIGTYPE_p_otk__Rect swig_types[13] +#define SWIGTYPE_p_ob__OBWidget swig_types[14] +#define SWIGTYPE_p_XFocusChangeEvent swig_types[15] +#define SWIGTYPE_p_XClientMessageEvent swig_types[16] +#define SWIGTYPE_p_otk__OBProperty swig_types[17] +#define SWIGTYPE_p_otk__OtkEventDispatcher swig_types[18] +#define SWIGTYPE_p_XPropertyEvent swig_types[19] +#define SWIGTYPE_p_XDestroyWindowEvent swig_types[20] +#define SWIGTYPE_p_otk__BImageControl swig_types[21] +#define SWIGTYPE_p_PyObject swig_types[22] +#define SWIGTYPE_p_ob__OBBindings swig_types[23] +#define SWIGTYPE_p_ob__MwmHints swig_types[24] +#define SWIGTYPE_p_XUnmapEvent swig_types[25] +static swig_type_info *swig_types[27]; /* -------- TYPES TABLE (END) -------- */ @@ -2574,6 +2575,28 @@ static PyObject *_wrap_OBClient_reparentHandler(PyObject *self, PyObject *args) } +static PyObject *_wrap_OBClient_mapRequestHandler(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::OBClient *arg1 = (ob::OBClient *) 0 ; + XMapRequestEvent *arg2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:OBClient_mapRequestHandler",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_XMapRequestEvent,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg2 == NULL) { + PyErr_SetString(PyExc_TypeError,"null reference"); SWIG_fail; + } + (arg1)->mapRequestHandler((XMapRequestEvent const &)*arg2); + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + static PyObject * OBClient_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; @@ -2773,6 +2796,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"OBClient_unmapHandler", _wrap_OBClient_unmapHandler, METH_VARARGS }, { (char *)"OBClient_destroyHandler", _wrap_OBClient_destroyHandler, METH_VARARGS }, { (char *)"OBClient_reparentHandler", _wrap_OBClient_reparentHandler, METH_VARARGS }, + { (char *)"OBClient_mapRequestHandler", _wrap_OBClient_mapRequestHandler, METH_VARARGS }, { (char *)"OBClient_swigregister", OBClient_swigregister, METH_VARARGS }, { (char *)"mbind", _wrap_mbind, METH_VARARGS }, { (char *)"kbind", _wrap_kbind, METH_VARARGS }, @@ -2810,6 +2834,7 @@ static swig_type_info _swigt__p_ob__OBClient[] = {{"_p_ob__OBClient", 0, "ob::OB static swig_type_info _swigt__p_ob__Openbox[] = {{"_p_ob__Openbox", 0, "ob::Openbox *", 0},{"_p_ob__Openbox"},{0}}; static swig_type_info _swigt__p_otk__Strut[] = {{"_p_otk__Strut", 0, "otk::Strut *", 0},{"_p_otk__Strut"},{0}}; static swig_type_info _swigt__p_XConfigureRequestEvent[] = {{"_p_XConfigureRequestEvent", 0, "XConfigureRequestEvent *", 0},{"_p_XConfigureRequestEvent"},{0}}; +static swig_type_info _swigt__p_XMapRequestEvent[] = {{"_p_XMapRequestEvent", 0, "XMapRequestEvent *", 0},{"_p_XMapRequestEvent"},{0}}; static swig_type_info _swigt__p_otk__OtkEventHandler[] = {{"_p_otk__OtkEventHandler", 0, "otk::OtkEventHandler *", 0},{"_p_ob__OBActions", _p_ob__OBActionsTo_p_otk__OtkEventHandler},{"_p_otk__OtkEventHandler"},{"_p_ob__Openbox", _p_ob__OpenboxTo_p_otk__OtkEventHandler},{"_p_ob__OBClient", _p_ob__OBClientTo_p_otk__OtkEventHandler},{0}}; static swig_type_info _swigt__p_otk__Rect[] = {{"_p_otk__Rect", 0, "otk::Rect *", 0},{"_p_otk__Rect"},{0}}; static swig_type_info _swigt__p_ob__OBWidget[] = {{"_p_ob__OBWidget", 0, "ob::OBWidget *", 0},{"_p_ob__OBWidget"},{"_p_ob__OBClient", _p_ob__OBClientTo_p_ob__OBWidget},{0}}; @@ -2837,6 +2862,7 @@ _swigt__p_ob__OBClient, _swigt__p_ob__Openbox, _swigt__p_otk__Strut, _swigt__p_XConfigureRequestEvent, +_swigt__p_XMapRequestEvent, _swigt__p_otk__OtkEventHandler, _swigt__p_otk__Rect, _swigt__p_ob__OBWidget, diff --git a/src/rootwindow.cc b/src/rootwindow.cc index 771cc799..81b19ee1 100644 --- a/src/rootwindow.cc +++ b/src/rootwindow.cc @@ -7,6 +7,7 @@ #include "rootwindow.hh" #include "openbox.hh" #include "screen.hh" +#include "client.hh" #include "otk/display.hh" namespace ob { @@ -102,17 +103,13 @@ void OBRootWindow::setDesktopName(int i, const std::string &name) void OBRootWindow::mapRequestHandler(const XMapRequestEvent &e) { + otk::OtkEventHandler::mapRequestHandler(e); + #ifdef DEBUG printf("MapRequest for 0x%lx\n", e.window); #endif // DEBUG - OBClient *client = Openbox::instance->findClient(e.window); - - if (client) { - // XXX: uniconify and/or unshade the window - } else { - Openbox::instance->screen(_info->screen())->manageWindow(e.window); - } + Openbox::instance->screen(_info->screen())->manageWindow(e.window); } } diff --git a/src/rootwindow.hh b/src/rootwindow.hh index 5ff386e1..241b35c3 100644 --- a/src/rootwindow.hh +++ b/src/rootwindow.hh @@ -65,7 +65,7 @@ public: virtual void propertyHandler(const XPropertyEvent &e); virtual void clientMessageHandler(const XClientMessageEvent &e); - virtual void mapRequestHandler(const XMapRequestEvent &); + virtual void mapRequestHandler(const XMapRequestEvent &e); }; } -- 2.39.2