fixed transient checking in a function
fluxgen fluxgen
2 files changed,
53 insertions(+),
67 deletions(-)
M
src/Window.cc
→
src/Window.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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,37 +207,8 @@
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) { decorations.maximize = functions.maximize = false;@@ -407,8 +378,8 @@ XFree(client.blackbox_hint);
client.blackbox_hint = 0; } - - if (client.transient_for!=0) { + + if (isTransient()) { //guard from having transient_for = this if (client.transient_for == this) { #ifdef DEBUG@@ -419,7 +390,7 @@ }
fluxbox->setFocusedWindow(client.transient_for); } - + if (client.window_group) { fluxbox->removeGroupSearch(client.window_group); client.window_group = 0;@@ -1705,7 +1676,7 @@ frame.height = dh;
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 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::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 @@ case XA_WM_COMMAND:
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 @@ setDecoration(old_decoration);
decor = false; } } + bool FluxboxWindow::validateClient(void) { XSync(display, false);@@ -3727,6 +3674,44 @@ fluxbox->removeWindowSearch(frame.handle);
XDestroyWindow(display, frame.handle); frame.handle = 0; } + +} + +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; }
M
src/Window.hh
→
src/Window.hh
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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,7 +324,8 @@ void createTitlebar();
void destroyTitlebar(); void createHandle(); void destroyHandle(); - + void checkTransient(); + #ifdef GNOME void updateGnomeAtoms() const;