fixed transient checking in a function

This commit is contained in:
fluxgen 2002-05-21 21:25:10 +00:00
parent 53c1cdefc9
commit 5a78e63212
2 changed files with 53 additions and 67 deletions

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Window.cc,v 1.53 2002/05/19 17:56:55 fluxgen Exp $
// $Id: Window.cc,v 1.54 2002/05/21 21:22:05 fluxgen Exp $
#include "Window.hh"
@ -207,36 +207,7 @@ tab(0)
fluxbox->saveWindowSearch(client.window, this);
// determine if this is a transient window
Window win;
if (XGetTransientForHint(display, client.window, &win)) {
if (win && (win != client.window)) {
FluxboxWindow *tr;
if ((tr = fluxbox->searchWindow(win))) {
while (tr->client.transient)
tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
} else if (win == client.window_group) {
if ((tr = fluxbox->searchGroup(win, this))) {
while (tr->client.transient)
tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
}
}
}
if (win == screen->getRootWindow())
modal = true;
}
checkTransient();
// adjust the window decorations based on transience and window sizes
if (transient) {
@ -408,7 +379,7 @@ FluxboxWindow::~FluxboxWindow(void) {
}
if (client.transient_for!=0) {
if (isTransient()) {
//guard from having transient_for = this
if (client.transient_for == this) {
#ifdef DEBUG
@ -1705,7 +1676,7 @@ void FluxboxWindow::configure(int dx, int dy,
downsize();
#ifdef SHAPE
#ifdef SHAPE
if (Fluxbox::instance()->hasShapeExtensions() && frame.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
frame.mwm_border_w, frame.y_border +
@ -1811,15 +1782,14 @@ bool FluxboxWindow::setInputFocus(void) {
bool ret = false;
if (client.transient && modal)
ret = client.transient->setInputFocus();
return client.transient->setInputFocus();
else {
if (! focused) {
if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE)
XSetInputFocus(display, client.window,
RevertToPointerRoot, CurrentTime);
else
XSetInputFocus(display, screen->getRootWindow(),
RevertToNone, CurrentTime);
return false;
fluxbox->setFocusedWindow(this);
@ -2877,7 +2847,7 @@ bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
if (de->window == client.window) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<":) DestroyNotifyEvent this="<<this<<endl;
cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
#endif
XUnmapWindow(display, frame.window);
return true;
@ -2899,31 +2869,7 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
break;
case XA_WM_TRANSIENT_FOR:
// determine if this is a transient window
Window win;
if (XGetTransientForHint(display, client.window, &win)) {
if (win && (win != client.window))
if ((client.transient_for = fluxbox->searchWindow(win))) {
client.transient_for->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
} else if (win == client.window_group) {
//jr This doesn't look quite right...
if ((client.transient_for = fluxbox->searchGroup(win, this))) {
client.transient_for->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
}
}
if (win == screen->getRootWindow()) modal = true;
}
// adjust the window decorations based on transience
if (transient)
decorations.maximize = decorations.handle =
decorations.border = functions.maximize = false;
checkTransient();
reconfigure();
break;
@ -3482,6 +3428,7 @@ void FluxboxWindow::toggleDecoration() {
decor = false;
}
}
bool FluxboxWindow::validateClient(void) {
XSync(display, false);
@ -3730,6 +3677,44 @@ void FluxboxWindow::destroyHandle() {
}
void FluxboxWindow::checkTransient() {
Fluxbox *fluxbox = Fluxbox::instance();
// determine if this is a transient window
Window win;
if (!XGetTransientForHint(display, client.window, &win)) {
client.transient_for = 0;
return;
}
if (win && (win != client.window)) {
FluxboxWindow *tr;
if ((tr = fluxbox->searchWindow(win))) {
while (tr->client.transient)
tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
} else if (win == client.window_group) {
if ((tr = fluxbox->searchGroup(win, this))) {
while (tr->client.transient)
tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
stuck = client.transient_for->stuck;
transient = true;
}
}
}
if (win == screen->getRootWindow())
modal = true;
}
void FluxboxWindow::restore(void) {
XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Window.hh,v 1.20 2002/05/17 16:34:27 fluxgen Exp $
// $Id: Window.hh,v 1.21 2002/05/21 21:25:10 fluxgen Exp $
#ifndef WINDOW_HH
#define WINDOW_HH
@ -324,6 +324,7 @@ private:
void destroyTitlebar();
void createHandle();
void destroyHandle();
void checkTransient();
#ifdef GNOME