]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
keep a minimum menu height so that the pixmaps (checkmarks) draw right in them
[chaz/openbox] / util / epist / screen.cc
index 281a093e3aa10745bee6978eb301b5a6b6302670..1dc32f0231b566c1b8413973ceeff493a78e9275 100644 (file)
@@ -65,7 +65,7 @@ screen::screen(epist *epist, int number)
   _managed = false;
   while (! (_epist->doShutdown() || _managed || count <= 0)) {
     if (! (_managed = findSupportingWM()))
-      usleep(1000);
+      sleep(1);
     --count;
   }
   if (_managed)
@@ -455,21 +455,13 @@ void screen::updateActiveWindow() {
 void screen::execCommand(const string &cmd) const {
   pid_t pid;
   if ((pid = fork()) == 0) {
-    extern char **environ;
-
-    char *const argv[] = {
-      "sh",
-      "-c",
-      const_cast<char *>(cmd.c_str()),
-      0
-    };
     // make the command run on the correct screen
     if (putenv(const_cast<char*>(_info->displayString().c_str()))) {
       cout << "warning: couldn't set environment variable 'DISPLAY'\n";
       perror("putenv()");
     }
-    execve("/bin/sh", argv, environ);
-    exit(127);
+    execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL);
+    exit(-1);
   } else if (pid == -1) {
     cout << _epist->getApplicationName() <<
       ": Could not fork a process for executing a command\n";
@@ -489,11 +481,10 @@ void screen::cycleWindow(const bool forward, const bool allscreens,
     classname = (*_active)->appClass();
 
   WindowList::const_iterator target = _active,
-                             first = _active,
                              begin = _clients.begin(),
                              end = _clients.end();
  
-  do {
+  while (1) {
     if (forward) {
       if (target == end) {
         target = begin;
@@ -509,18 +500,23 @@ void screen::cycleWindow(const bool forward, const bool allscreens,
     }
 
     // must be no window to focus
-    if (target == first)
+    if (target == _active)
       return;
-  } while ((*target)->iconic() ||
-           (! allscreens && (*target)->getScreen() != this) ||
-           (! alldesktops &&
-            (*target)->desktop() != _active_desktop &&
-            (*target)->desktop() != 0xffffffff) ||
-           (sameclass && ! classname.empty() &&
-            (*target)->appClass() != classname));
-  
-  if (target != _clients.end())
-    (*target)->focus();
+
+    // determine if this window is invalid for cycling to
+    const XWindow *t = *target;
+    if (t->iconic()) continue;
+    if (! allscreens && t->getScreen() != this) continue;
+    if (! alldesktops && ! (t->desktop() == _active_desktop ||
+                            t->desktop() == 0xffffffff)) continue;
+    if (sameclass && ! classname.empty() &&
+        t->appClass() != classname) continue;
+    if (! t->canFocus()) continue;
+
+    // found a good window!
+    t->focus();
+    return;
+  }
 }
 
 
This page took 0.024978 seconds and 4 git commands to generate.