unmap works.. once

This commit is contained in:
Dana Jansens 2002-12-04 01:04:31 +00:00
parent 22bd294c7b
commit 9860b76c50
7 changed files with 52 additions and 19 deletions

View file

@ -6,6 +6,7 @@
#include "client.hh"
#include "frame.hh"
#include "screen.hh"
#include "bbscreen.hh"
#include "openbox.hh"
#include "otk/display.hh"
@ -30,8 +31,6 @@ OBClient::OBClient(int screen, Window window)
assert(screen >= 0);
assert(window);
Openbox::instance->registerHandler(_window, this);
ignore_unmaps = 0;
// update EVERYTHING the first time!!
@ -772,6 +771,8 @@ void OBClient::move(int x, int y)
void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
{
OtkEventHandler::configureRequestHandler(e);
// XXX: if we are iconic (or shaded? (fvwm does that)) ignore the event
if (e.value_mask & CWBorderWidth)
@ -825,4 +826,30 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
}
void OBClient::unmapHandler(const XUnmapEvent &e)
{
#ifdef DEBUG
printf("UnmapNotify for 0x%lx\n", e.window);
#endif // DEBUG
OtkEventHandler::unmapHandler(e);
// this deletes us etc
Openbox::instance->screen(_screen)->unmanageWindow(this);
}
void OBClient::destroyHandler(const XDestroyWindowEvent &e)
{
#ifdef DEBUG
printf("DestroyNotify for 0x%lx\n", e.window);
#endif // DEBUG
OtkEventHandler::destroyHandler(e);
// this deletes us etc
Openbox::instance->screen(_screen)->unmanageWindow(this);
}
}

View file

@ -130,7 +130,8 @@ public:
};
//! The event mask to grab on client windows
static const long event_mask = PropertyChangeMask | FocusChangeMask;
static const long event_mask = PropertyChangeMask | FocusChangeMask |
StructureNotifyMask;
//! The number of unmap events to ignore on the window
int ignore_unmaps;
@ -415,12 +416,11 @@ public:
inline const otk::Rect &area() const { return _area; }
virtual void propertyHandler(const XPropertyEvent &e);
virtual void clientMessageHandler(const XClientMessageEvent &e);
virtual void shapeHandler(const XShapeEvent &e);
virtual void configureRequestHandler(const XConfigureRequestEvent &e);
virtual void unmapHandler(const XUnmapEvent &e);
virtual void destroyHandler(const XDestroyWindowEvent &e);
};
}

View file

@ -354,16 +354,15 @@ void OBFrame::adjustShape()
void OBFrame::grabClient()
{
// select the event mask on the frame
//XSelectInput(otk::OBDisplay::display, _window, SubstructureRedirectMask);
// reparent the client to the frame
XReparentWindow(otk::OBDisplay::display, _client->window(),
_plate.getWindow(), 0, 0);
_client->ignore_unmaps++;
// raise the client above the frame
//XRaiseWindow(otk::OBDisplay::display, _client->window());
// select the event mask on the client's parent
//XSelectInput(otk::OBDisplay::display, _plate.getWindow(),
// SubstructureRedirectMask);
// map the client so it maps when the frame does
XMapWindow(otk::OBDisplay::display, _client->window());

View file

@ -25,6 +25,9 @@ namespace ob {
//! Holds and decorates a frame around an OBClient (client window)
/*!
The frame is responsible for calling XSelectInput on the client window's new
parent with the SubstructureRedirectMask so that structure events for the
client are sent to the window manager.
*/
class OBFrame : public otk::OtkWidget {
private:

View file

@ -112,6 +112,8 @@ void OBRootWindow::mapRequestHandler(const XMapRequestEvent &e)
#include <stdio.h>
void OBRootWindow::configureRequestHandler(const XConfigureRequestEvent &e)
{
OtkEventHandler::configureRequestHandler(e);
// when configure requests come to the root window, just pass them on
XWindowChanges xwc;

View file

@ -52,20 +52,17 @@ public:
//! Destroys the OBRootWindow object
virtual ~OBRootWindow();
virtual void propertyHandler(const XPropertyEvent &e);
virtual void clientMessageHandler(const XClientMessageEvent &e);
virtual void mapRequestHandler(const XMapRequestEvent &);
virtual void configureRequestHandler(const XConfigureRequestEvent &e);
//! Sets the name of a desktop
/*!
@param i The index of the desktop to set the name for (base 0)
@param name The name to set for the desktop
*/
void setDesktopName(int i, const std::string &name);
virtual void propertyHandler(const XPropertyEvent &e);
virtual void clientMessageHandler(const XClientMessageEvent &e);
virtual void mapRequestHandler(const XMapRequestEvent &);
virtual void configureRequestHandler(const XConfigureRequestEvent &e);
};
}

View file

@ -350,6 +350,8 @@ void OBScreen::manageWindow(Window window)
// create the OBClient class, which gets all of the hints on the window
Openbox::instance->addClient(window, client = new OBClient(_number, window));
// register for events
Openbox::instance->registerHandler(window, client);
// we dont want a border on the client
XSetWindowBorderWidth(otk::OBDisplay::display, window, 0);
@ -384,6 +386,9 @@ void OBScreen::unmanageWindow(OBClient *client)
OBFrame *frame = client->frame;
// XXX: pass around focus if this window was focused
// unregister for handling events
Openbox::instance->clearHandler(client->window());
// remove the window from our save set
XChangeSaveSet(otk::OBDisplay::display, client->window(), SetModeDelete);