]> Dogcows Code - chaz/openbox/commitdiff
better sticky windows.
authorDana Jansens <danakj@orodu.net>
Mon, 29 Jul 2002 06:21:31 +0000 (06:21 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 29 Jul 2002 06:21:31 +0000 (06:21 +0000)
src/Screen.cc
src/Window.cc
src/Workspace.cc

index 3cb6176b3c6abc45d25098f684e6c3a6230ded9c..d11894cebe70c6c340110d602b22977f6123df98 100644 (file)
@@ -1269,9 +1269,14 @@ void BScreen::unmanageWindow(BlackboxWindow *w, bool remap) {
   if (w->isModal()) w->setModal(False);
   
   if (w->getWorkspaceNumber() != BSENTINEL &&
-      w->getWindowNumber() != BSENTINEL)
+      w->getWindowNumber() != BSENTINEL) {
     getWorkspace(w->getWorkspaceNumber())->removeWindow(w);
-  else if (w->isIconic())
+    if (w->isStuck()) {
+      for (unsigned int i = 0; i < getNumberOfWorkspaces(); ++i)
+        if (i != w->getWorkspaceNumber())
+          getWorkspace(i)->removeWindow(w, True);
+    }
+  } else if (w->isIconic())
     removeIcon(w);
 
   if (w->isNormal()) {
@@ -1515,6 +1520,10 @@ void BScreen::reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id,
   if (w->isIconic()) {
     removeIcon(w);
     getWorkspace(wkspc_id)->addWindow(w);
+    if (w->isStuck())
+      for (unsigned int i = 0; i < getNumberOfWorkspaces(); ++i)
+        if (i != w->getWorkspaceNumber())
+          getWorkspace(i)->addWindow(w, True);
   } else if (ignore_sticky || ! w->isStuck()) {
     if (w->isStuck())
       w->stick();
index 14505a36f11950c36ecdaa79e7e8096842d03021..4b8efc8cd8a211383813b53a9bd70cb278290a65 100644 (file)
@@ -1540,8 +1540,7 @@ void BlackboxWindow::configureShape(void) {
 bool BlackboxWindow::setInputFocus(void) {
   if (flags.focused) return True;
 
-  assert(! flags.iconic &&
-         (flags.stuck ||  // window must be on the current workspace or sticky
+  assert((flags.stuck ||  // window must be on the current workspace or sticky
           blackbox_attrib.workspace == screen->getCurrentWorkspaceID()));
 
   /*
@@ -1631,6 +1630,11 @@ void BlackboxWindow::iconify(void) {
   setState(IconicState);
 
   screen->getWorkspace(blackbox_attrib.workspace)->removeWindow(this);
+  if (flags.stuck) {
+    for (unsigned int i = 0; i < screen->getNumberOfWorkspaces(); ++i)
+      if (i != blackbox_attrib.workspace)
+        screen->getWorkspace(i)->removeWindow(this, True);
+  }
 
   if (isTransient()) {
     if (client.transient_for != (BlackboxWindow *) ~0ul &&
@@ -1935,10 +1939,6 @@ void BlackboxWindow::stick(void) {
     blackbox_attrib.flags ^= AttribOmnipresent;
     blackbox_attrib.attrib ^= AttribOmnipresent;
 
-    for (unsigned int i = 0; i < screen->getNumberOfWorkspaces(); ++i)
-      if (i != blackbox_attrib.workspace)
-        screen->getWorkspace(i)->removeWindow(this, True);
-
     flags.stuck = False;
 
     if (! flags.iconic)
index f4a09680ac4e3c5e587c003ef009077217026cfd..964e1f42a0797368f5a0e0d352852c4208664bfe 100644 (file)
@@ -118,14 +118,6 @@ void Workspace::addWindow(BlackboxWindow *w, bool place, bool sticky) {
     raiseWindow(w);
   else
     lowerWindow(w);
-  
-  // if the window is sticky, then it needs to be added on all other
-  // workspaces too!
-  if (! sticky && w->isStuck()) {
-    for (unsigned int i = 0; i < screen->getWorkspaceCount(); ++i)
-      if (i != id)
-        screen->getWorkspace(i)->addWindow(w, place, True);
-  }
 }
 
 
@@ -140,14 +132,6 @@ void Workspace::removeWindow(BlackboxWindow *w, bool sticky) {
     focusFallback(w);
   }
     
-  // if the window is sticky, then it needs to be removed on all other
-  // workspaces too!
-  if (! sticky && w->isStuck()) {
-    for (unsigned int i = 0; i < screen->getWorkspaceCount(); ++i)
-      if (i != id)
-        screen->getWorkspace(i)->removeWindow(w, True);
-  }
-
   if (! w->isNormal()) return;
 
   BlackboxWindowList::iterator it, end = windowList.end();
This page took 0.034664 seconds and 4 git commands to generate.