]> Dogcows Code - chaz/openbox/blobdiff - src/screen.cc
modal works like a charm now
[chaz/openbox] / src / screen.cc
index 4878d7b658296e8c4871dce71019792191764d92..2c49c6cc5c16684cbfaae773af7b9271a5156a2d 100644 (file)
@@ -1,18 +1,8 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
+#include "config.h"
 
 extern "C" {
-#ifdef    HAVE_STDIO_H
-#  include <stdio.h>
-#endif // HAVE_STDIO_H
-
-#ifdef    HAVE_STRING_H
-#  include <string.h>
-#endif // HAVE_STRING_H
-
 #ifdef    HAVE_UNISTD_H
 #  include <sys/types.h>
 #  include <unistd.h>
@@ -33,6 +23,8 @@ extern "C" {
 
 #include <vector>
 #include <algorithm>
+#include <cstdio>
+#include <cstring>
 
 static bool running;
 static int anotherWMRunning(Display *display, XErrorEvent *) {
@@ -603,7 +595,7 @@ void Screen::unmanageWindow(Client *client)
   updateStrut();
 
   // unset modal before dropping our focus
-  client->setModal(false);
+  client->_modal = false;
   
   // unfocus the client (calls the focus callbacks)
   client->unfocus();
@@ -660,6 +652,10 @@ void Screen::raiseWindow(Client *client)
 
   assert(!_stacking.empty()); // this would be bad
 
+  Client *m = client->findModalChild();
+  // if we have a modal child, raise it instead, we'll go along tho later
+  if (m) raiseWindow(m);
+  
   // remove the client before looking so we can't run into ourselves
   _stacking.remove(client);
   
@@ -667,7 +663,10 @@ void Screen::raiseWindow(Client *client)
   const ClientList::iterator end = _stacking.end();
 
   // the stacking list is from highest to lowest
-  for (; it != end && (*it)->layer() > client->layer(); ++it);
+//  for (;it != end, ++it) {
+//    if ((*it)->layer() <= client->layer() && m != *it) break;
+//  }
+  for (; it != end && ((*it)->layer() > client->layer() || m == *it); ++it);
 
   /*
     if our new position is the top, we want to stack under the _focuswindow
@@ -681,11 +680,7 @@ void Screen::raiseWindow(Client *client)
 
   XRestackWindows(**otk::display, wins, 2);
 
-  // if the window has a modal child, then raise it after us to put it on top
-  if (client->modalChild())
-    raiseWindow(client->modalChild());
-  else
-    changeStackingList(); // no need to do this twice!
+  changeStackingList(); 
 }
 
 void Screen::changeDesktop(long desktop)
This page took 0.024133 seconds and 4 git commands to generate.