]> Dogcows Code - chaz/openbox/commitdiff
merge the sticky window fix from 1.2.
authorDana Jansens <danakj@orodu.net>
Thu, 23 May 2002 14:27:52 +0000 (14:27 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 23 May 2002 14:27:52 +0000 (14:27 +0000)
CHANGELOG
src/BaseDisplay.cc
src/Screen.cc
src/Window.cc
src/Workspace.cc
src/openbox.cc

index fb13110c46eb111f0acbc548776c36aa08732d03..4581419d1361e3c4397fcd1ceb9607bcaf66f7ac 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 Changelog for Openbox:
 
 2.0.0:
+ * fixed sticky windows behavior.                       (Ben Jansens)
+
  * make reconfigure reset the timeout values for
    windows, the slit, and the toolbar, so that a new
    autoRaiseDelay value will take effect without having
index ea3f123d11c027f0205045e7855aaba8ae3eed26..091804988e26b699aa69e9811005ea90f12c8cea 100644 (file)
@@ -462,34 +462,33 @@ static RETSIGTYPE signalhandler(int sig) {
         // check for timer timeout
         gettimeofday(&now, 0);
 
-        TimerList::iterator it;
-        for (it = timerList.begin(); it != timerList.end(); ++it) {
-          BTimer *timer = *it;
-          ASSERT(timer != NULL);
-
-          tm.tv_sec = timer->getStartTime().tv_sec +
-            timer->getTimeout().tv_sec;
-          tm.tv_usec = timer->getStartTime().tv_usec +
-            timer->getTimeout().tv_usec;
-
-          if ((now.tv_sec < tm.tv_sec) ||
-              (now.tv_sec == tm.tv_sec && now.tv_usec < tm.tv_usec))
-            break;
-
-          timer->fireTimeout();
-
-          // restart the current timer so that the start time is updated
-          if (! timer->doOnce()) {
-            // reorder
-            removeTimer(timer);
-            addTimer(timer);
-            timer->start();
-          } else
-            timer->stop();
-          it = timerList.begin(); // we no longer have any idea if the iterator is
-          // valid, but what was at the front() is no
-          // longer.
-        }
+      TimerList::iterator it;
+      for (it = timerList.begin(); it != timerList.end(); ++it) {
+        BTimer *timer = *it;
+        ASSERT(timer != NULL);
+
+        tm.tv_sec = timer->getStartTime().tv_sec +
+          timer->getTimeout().tv_sec;
+        tm.tv_usec = timer->getStartTime().tv_usec +
+          timer->getTimeout().tv_usec;
+
+        if ((now.tv_sec < tm.tv_sec) ||
+            (now.tv_sec == tm.tv_sec && now.tv_usec < tm.tv_usec))
+          break;
+
+        timer->fireTimeout();
+
+        // restart the current timer so that the start time is updated
+        if (! timer->doOnce()) {
+          // reorder
+          removeTimer(timer);
+          addTimer(timer);
+          timer->start();
+        } else
+          timer->stop();
+        it = timerList.begin(); // we no longer have any idea if the iterator is
+                                // valid, but what was at the front() is no
+                                // longer.
       }
     }
   }
@@ -540,6 +539,13 @@ static RETSIGTYPE signalhandler(int sig) {
     timerList.remove(timer);
   }
 
+<<<<<<< BaseDisplay.cc
+=======
+void BaseDisplay::removeTimer(BTimer *timer) {
+  ASSERT(timer != (BTimer *) 0);
+  timerList.remove(timer);
+}
+>>>>>>> 1.13.4.1
 
   /*
    * Grabs a button, but also grabs the button in every possible combination with
index 175d966d82dde5673d287759a95ce9801a538559..08b76971b267fed91dffc00f7d60b32f05fb5fc6 100644 (file)
@@ -1976,11 +1976,9 @@ void BScreen::load() {
       workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2,
                                      False);
 
-      if (openbox.focusedWindow() &&
-          openbox.focusedWindow()->getScreen() == this &&
-          (! openbox.focusedWindow()->isStuck())) {
-        openbox.focusWindow(0);
-      }
+    OpenboxWindow *fw = openbox.focusedWindow();
+    if (fw && fw->getScreen() == this)
+      openbox.focusWindow(0);
 
       current_workspace = getWorkspace(id);
 
index 3f531d52ded9623b08574550d452ef505fa52ab4..342864c9e11d4cbd48208e6555983e4158d3db11 100644 (file)
@@ -314,9 +314,14 @@ OpenboxWindow::~OpenboxWindow(void) {
     XUngrabPointer(display, CurrentTime);
   }
 
-  if (workspace_number != -1 && window_number != -1)
-    screen->getWorkspace(workspace_number)->removeWindow(this);
-  else if (flags.iconic)
+  if (workspace_number != -1 && window_number != -1) {
+    if (flags.stuck) {
+      // make sure no other workspaces think that we're focused
+      for (int i=0; i < screen->getWorkspaceCount(); i++)
+        screen->getWorkspace(i)->removeWindow(this);
+    } else
+      screen->getWorkspace(workspace_number)->removeWindow(this);
+  } else if (flags.iconic)
     screen->removeIcon(this);
 
   if (timer) {
index dc7007eecc68cb8517aec01e5ed2963e17dec50e..47ad3827f2ec2ea55053f088308c1f6c301f5549 100644 (file)
@@ -106,12 +106,21 @@ int Workspace::addWindow(OpenboxWindow *w, bool place) {
 int Workspace::removeWindow(OpenboxWindow *w) {
   if (! w) return -1;
 
-  _zorder.remove(w);
+  winVect::iterator winit = std::find(_windows.begin(), _windows.end(), w);
 
-  if (w->isFocused()) {
+  if (winit == _windows.end()) {
     if (w == _last)
       _last = (OpenboxWindow *) 0;
+    if (w == _focused)
+      _focused = (OpenboxWindow *) 0;
+    return _windows.size();
+  }
+  
+  _zorder.remove(w);
 
+  if (w == _last)
+    _last = (OpenboxWindow *) 0;
+  if (w == _focused) {
     OpenboxWindow *fw = (OpenboxWindow *) 0;
     if (w->isTransient() && w->getTransientFor() &&
         w->getTransientFor()->isVisible())
@@ -124,8 +133,8 @@ int Workspace::removeWindow(OpenboxWindow *w) {
     if (!(fw != (OpenboxWindow *) 0 && fw->setInputFocus()))
       screen.getOpenbox().focusWindow(0);
   }
-
-  _windows.erase(_windows.begin() + w->getWindowNumber());
+  
+  _windows.erase(winit);
   clientmenu->remove(w->getWindowNumber());
   clientmenu->update();
 
@@ -140,11 +149,13 @@ int Workspace::removeWindow(OpenboxWindow *w) {
 
 
 void Workspace::focusWindow(OpenboxWindow *win) {
-  if (win != (OpenboxWindow *) 0)
-    clientmenu->setItemSelected(win->getWindowNumber(), true);
   if (_focused != (OpenboxWindow *) 0)
     clientmenu->setItemSelected(_focused->getWindowNumber(), false);
   _focused = win;
+  // make sure the focused window belongs to this workspace before highlighting
+  // it in the menu (sticky windows arent in this workspace's menu).
+  if (_focused != (OpenboxWindow *) 0 && _focused->getWorkspaceNumber() == id)
+    clientmenu->setItemSelected(_focused->getWindowNumber(), true);
   if (win != (OpenboxWindow *) 0)
     _last = win;
 }
index ab88729f3d1ba204a539db02d2f170307c45a3d9..e71b269d50287267452f2d0754e7649dbf6f815c 100644 (file)
@@ -1088,7 +1088,10 @@ void Openbox::focusWindow(OpenboxWindow *win) {
   if (win && !win->isIconic()) {
     current_screen = win->getScreen();
     tbar = current_screen->getToolbar();
-    wkspc = current_screen->getWorkspace(win->getWorkspaceNumber());
+    if (win->isStuck())
+      wkspc = current_screen->getCurrentWorkspace();
+    else
+      wkspc = current_screen->getWorkspace(win->getWorkspaceNumber());
     win->setFocusFlag(true);
     wkspc->focusWindow(win);
 
This page took 0.029461 seconds and 4 git commands to generate.