handle toolbars and utility windows proper. also, no more crashes from kpager (i...
authorDana Jansens <danakj@orodu.net>
Fri, 9 Aug 2002 00:44:35 +0000 (00:44 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 9 Aug 2002 00:44:35 +0000 (00:44 +0000)
src/Screen.cc
src/Screen.hh
src/Window.cc
src/Window.hh
src/Workspace.cc

index 3d51a2d..d49e418 100644 (file)
@@ -1313,6 +1313,9 @@ void BScreen::manageWindow(Window w) {
     // don't list non-normal windows as managed windows
     windowList.push_back(win);
     updateClientList();
+  
+    if (win->isTopmost())
+      specialWindowList.push_back(win->getFrameWindow());
   } else if (win->isDesktop()) {
     desktopWindowList.push_back(win->getFrameWindow());
   }
@@ -1345,6 +1348,17 @@ void BScreen::unmanageWindow(BlackboxWindow *w, bool remap) {
     // we don't list non-normal windows as managed windows
     windowList.remove(w);
     updateClientList();
+
+    if (w->isTopmost()) {
+      WindowList::iterator it = specialWindowList.begin();
+      const WindowList::iterator end = specialWindowList.end();
+      for (; it != end; ++it)
+        if (*it == w->getFrameWindow()) {
+          specialWindowList.erase(it);
+          break;
+        }
+      assert(it != end);  // the window wasnt a special window?
+    }
   } else if (w->isDesktop()) {
     WindowList::iterator it = desktopWindowList.begin();
     const WindowList::iterator end = desktopWindowList.end();
@@ -1495,7 +1509,8 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
 #endif // XINERAMA
 
   Window *session_stack = new
-    Window[(num + workspacesList.size() + rootmenuList.size() + bbwins)];
+    Window[(num + workspacesList.size() + rootmenuList.size() +
+            specialWindowList.size() + bbwins)];
   unsigned int i = 0, k = num;
 
   XRaiseWindow(blackbox->getXDisplay(), iconmenu->getWindowID());
@@ -1536,6 +1551,10 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
   if (slit->isOnTop())
     *(session_stack + i++) = slit->getWindowID();
 
+  WindowList::iterator sit, send = specialWindowList.end();
+  for (sit = specialWindowList.begin(); sit != send; ++sit)
+    *(session_stack + i++) = *sit;
+
   while (k--)
     *(session_stack + i++) = *(workspace_stack + k);
 
index 71a012d..4b454e0 100644 (file)
@@ -120,7 +120,7 @@ private:
   BlackboxWindowList iconList, windowList;
 
   typedef std::vector<Window> WindowList;
-  WindowList desktopWindowList, systrayWindowList;
+  WindowList specialWindowList, desktopWindowList, systrayWindowList;
 
   Slit *slit;
   Toolbar *toolbar;
index fae990b..243bfa4 100644 (file)
@@ -202,14 +202,20 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
   case Type_Desktop:
   case Type_Dock:
   case Type_Menu:
-  case Type_Toolbar:
-  case Type_Utility:
+    blackbox_attrib.workspace = 0;  // we do need to belong to a workspace
+    flags.stuck = True;             // we show up on all workspaces
   case Type_Splash:
     // none of these windows are decorated or manipulated by the window manager
     decorations = 0;
     functions = 0;
-    blackbox_attrib.workspace = 0;  // we do need to belong to a workspace
-    flags.stuck = True;             // we show up on all workspaces
+    break;
+
+  case Type_Toolbar:
+  case Type_Utility:
+    // these windows get less decorations and functionality
+    decorations &= ~(Decor_Maximize | Decor_Handle | Decor_Iconify |
+                     Decor_Border);
+    functions &= ~(Func_Maximize | Func_Resize | Func_Iconify);
     break;
 
   case Type_Dialog:
@@ -349,6 +355,9 @@ BlackboxWindow::~BlackboxWindow(void) {
   if (! timer) // window not managed...
     return;
 
+  if (flags.moving)
+    endMove();
+
   screen->removeStrut(&client.strut);
   screen->updateAvailableArea();
 
index 105aef1..8143ade 100644 (file)
@@ -325,7 +325,10 @@ public:
 
   // is a 'normal' window? meaning, a standard client application
   inline bool isNormal(void) const
-  { return window_type == Type_Dialog || window_type == Type_Normal; }
+  { return window_type == Type_Dialog || window_type == Type_Normal ||
+           window_type == Type_Toolbar || window_type == Type_Utility; }
+  inline bool isTopmost(void) const
+  { return window_type == Type_Toolbar || window_type == Type_Utility; }
   inline bool isDesktop(void) const { return window_type == Type_Desktop; }
   
   inline bool hasTitlebar(void) const { return decorations & Decor_Titlebar; }
index 7e05e4c..b03ee7b 100644 (file)
@@ -84,7 +84,7 @@ void Workspace::addWindow(BlackboxWindow *w, bool place, bool sticky) {
   if (place) placeWindow(w);
 
   stackingList.push_front(w);
-    
+
   if (w->isNormal()) {
     if (! sticky) {
       w->setWorkspace(id);