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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Window.hh"
@ -207,36 +207,7 @@ tab(0)
fluxbox->saveWindowSearch(client.window, this); fluxbox->saveWindowSearch(client.window, this);
// determine if this is a transient window // determine if this is a transient window
Window win; checkTransient();
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;
}
// adjust the window decorations based on transience and window sizes // adjust the window decorations based on transience and window sizes
if (transient) { if (transient) {
@ -408,7 +379,7 @@ FluxboxWindow::~FluxboxWindow(void) {
} }
if (client.transient_for!=0) { if (isTransient()) {
//guard from having transient_for = this //guard from having transient_for = this
if (client.transient_for == this) { if (client.transient_for == this) {
#ifdef DEBUG #ifdef DEBUG
@ -1705,7 +1676,7 @@ void FluxboxWindow::configure(int dx, int dy,
downsize(); downsize();
#ifdef SHAPE #ifdef SHAPE
if (Fluxbox::instance()->hasShapeExtensions() && frame.shaped) { if (Fluxbox::instance()->hasShapeExtensions() && frame.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding, XShapeCombineShape(display, frame.window, ShapeBounding,
frame.mwm_border_w, frame.y_border + frame.mwm_border_w, frame.y_border +
@ -1811,15 +1782,14 @@ bool FluxboxWindow::setInputFocus(void) {
bool ret = false; bool ret = false;
if (client.transient && modal) if (client.transient && modal)
ret = client.transient->setInputFocus(); return client.transient->setInputFocus();
else { else {
if (! focused) { if (! focused) {
if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE) if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE)
XSetInputFocus(display, client.window, XSetInputFocus(display, client.window,
RevertToPointerRoot, CurrentTime); RevertToPointerRoot, CurrentTime);
else else
XSetInputFocus(display, screen->getRootWindow(), return false;
RevertToNone, CurrentTime);
fluxbox->setFocusedWindow(this); fluxbox->setFocusedWindow(this);
@ -2877,7 +2847,7 @@ bool FluxboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) { bool FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
if (de->window == client.window) { if (de->window == client.window) {
#ifdef DEBUG #ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<":) DestroyNotifyEvent this="<<this<<endl; cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
#endif #endif
XUnmapWindow(display, frame.window); XUnmapWindow(display, frame.window);
return true; return true;
@ -2899,31 +2869,7 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
break; break;
case XA_WM_TRANSIENT_FOR: case XA_WM_TRANSIENT_FOR:
// determine if this is a transient window checkTransient();
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;
reconfigure(); reconfigure();
break; break;
@ -3482,6 +3428,7 @@ void FluxboxWindow::toggleDecoration() {
decor = false; decor = false;
} }
} }
bool FluxboxWindow::validateClient(void) { bool FluxboxWindow::validateClient(void) {
XSync(display, false); 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) { void FluxboxWindow::restore(void) {
XChangeSaveSet(display, client.window, SetModeDelete); XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask); 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -324,6 +324,7 @@ private:
void destroyTitlebar(); void destroyTitlebar();
void createHandle(); void createHandle();
void destroyHandle(); void destroyHandle();
void checkTransient();
#ifdef GNOME #ifdef GNOME