summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-07 09:30:00 +0000
committerDana Jansens <danakj@orodu.net>2003-01-07 09:30:00 +0000
commit6062fe404ce5f2505494132d5454370d696625ca (patch)
tree36c73bd4e97415ce4570b3801b49786e257e754b /src
parentf1ce4e660fe96816a699a89746a6105eca09babd (diff)
handle unmaps better. all thanks to acroread sending wacky unmap events
Diffstat (limited to 'src')
-rw-r--r--src/client.cc9
-rw-r--r--src/frame.cc18
-rw-r--r--src/frame.hh5
-rw-r--r--src/screen.cc9
4 files changed, 20 insertions, 21 deletions
diff --git a/src/client.cc b/src/client.cc
index 320fe4d7..d38ca79b 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -1219,15 +1219,18 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
void OBClient::unmapHandler(const XUnmapEvent &e)
{
+ if (ignore_unmaps) {
#ifdef DEBUG
- printf("UnmapNotify for 0x%lx\n", e.window);
+ printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event);
#endif // DEBUG
-
- if (ignore_unmaps) {
ignore_unmaps--;
return;
}
+#ifdef DEBUG
+ printf("UnmapNotify for 0x%lx\n", e.window);
+#endif // DEBUG
+
OtkEventHandler::unmapHandler(e);
// this deletes us etc
diff --git a/src/frame.cc b/src/frame.cc
index 0cc96c2a..5bed5833 100644
--- a/src/frame.cc
+++ b/src/frame.cc
@@ -63,7 +63,7 @@ OBFrame::OBFrame(OBClient *client, otk::Style *style)
OBFrame::~OBFrame()
{
- releaseClient(false);
+ releaseClient();
}
@@ -404,11 +404,12 @@ void OBFrame::adjustShape()
void OBFrame::grabClient()
{
-
// reparent the client to the frame
XReparentWindow(otk::OBDisplay::display, _client->window(),
_plate.window(), 0, 0);
- _client->ignore_unmaps++;
+ // this generates 2 unmap's that we catch, one to the window and one to root,
+ // but both have .window set to this window, so both need to be ignored
+ _client->ignore_unmaps+=2;
// select the event mask on the client's parent (to receive config req's)
XSelectInput(otk::OBDisplay::display, _plate.window(),
@@ -422,14 +423,14 @@ void OBFrame::grabClient()
}
-void OBFrame::releaseClient(bool remap)
+void OBFrame::releaseClient()
{
// check if the app has already reparented its window to the root window
XEvent ev;
if (XCheckTypedWindowEvent(otk::OBDisplay::display, _client->window(),
ReparentNotify, &ev)) {
- remap = true; // XXX: why do we remap the window if they already
- // reparented to root?
+ // XXX: ob2/bb didn't do this.. look up this process in other wm's!
+ XPutBackEvent(otk::OBDisplay::display, &ev);
} else {
// according to the ICCCM - if the client doesn't reparent to
// root, then we have to do it for them
@@ -438,9 +439,8 @@ void OBFrame::releaseClient(bool remap)
_client->area().x(), _client->area().y());
}
- // if we want to remap the window, do so now
- if (remap)
- XMapWindow(otk::OBDisplay::display, _client->window());
+ // do an extra map here .. ? XXX
+ XMapWindow(otk::OBDisplay::display, _client->window());
}
diff --git a/src/frame.hh b/src/frame.hh
index a36a6eec..b204567e 100644
--- a/src/frame.hh
+++ b/src/frame.hh
@@ -70,10 +70,7 @@ private:
//! Reparents the client window from the root window onto the frame
void grabClient();
//! Reparents the client window back to the root window
- /*!
- @param remap Re-map the client window when we're done reparenting?
- */
- void releaseClient(bool remap);
+ void releaseClient();
public:
//! Constructs an OBFrame object, and reparents the client to itself
diff --git a/src/screen.cc b/src/screen.cc
index 2dcc110f..3c364b4c 100644
--- a/src/screen.cc
+++ b/src/screen.cc
@@ -459,19 +459,21 @@ void OBScreen::manageWindow(Window window)
XWMHints *wmhint;
XSetWindowAttributes attrib_set;
+ otk::OBDisplay::grab();
+
// is the window a docking app
if ((wmhint = XGetWMHints(otk::OBDisplay::display, window))) {
if ((wmhint->flags & StateHint) &&
wmhint->initial_state == WithdrawnState) {
//slit->addClient(w); // XXX: make dock apps work!
+ otk::OBDisplay::ungrab();
+
XFree(wmhint);
return;
}
XFree(wmhint);
}
- otk::OBDisplay::grab();
-
// choose the events we want to receive on the CLIENT window
attrib_set.event_mask = OBClient::event_mask;
attrib_set.do_not_propagate_mask = OBClient::no_propagate_mask;
@@ -517,12 +519,9 @@ void OBScreen::manageWindow(Window window)
Openbox::instance->addClient(client->frame->grip_left(), client);
Openbox::instance->addClient(client->frame->grip_right(), client);
- bool shown = false;
-
// if on the current desktop.. (or all desktops)
if (client->desktop() == _desktop ||
client->desktop() == (signed)0xffffffff) {
- shown = true;
client->frame->show();
}