]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.cc
clarify an incorrect comment, and make some funcs const
[chaz/openbox] / src / openbox.cc
index 6ed00a2c84bbff5d4cd377af961d69bdf05a0999..dda528483f15630460b60474e71730a8838ac7f1 100644 (file)
@@ -58,17 +58,19 @@ Openbox *Openbox::instance  = (Openbox *) 0;
 void Openbox::signalHandler(int signal)
 {
   switch (signal) {
+  case SIGUSR1:
+    printf("Caught SIGUSR1 signal. Restarting.\n");
+    instance->restart();
+    break;
+
   case SIGHUP:
-    // XXX: Do something with HUP? Really shouldn't, we get this when X shuts
-    //      down and hangs-up on us.
-    
   case SIGINT:
   case SIGTERM:
   case SIGPIPE:
     printf("Caught signal %d. Exiting.\n", signal);
     instance->shutdown();
-
     break;
+
   case SIGFPE:
   case SIGSEGV:
     printf("Caught signal %d. Aborting and dumping core.\n", signal);
@@ -108,6 +110,7 @@ Openbox::Openbox(int argc, char **argv)
   action.sa_handler = Openbox::signalHandler;
   action.sa_mask = sigset_t();
   action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
+  sigaction(SIGUSR1, &action, (struct sigaction *) 0);
   sigaction(SIGPIPE, &action, (struct sigaction *) 0);
   sigaction(SIGSEGV, &action, (struct sigaction *) 0);
   sigaction(SIGFPE, &action, (struct sigaction *) 0);
@@ -303,7 +306,7 @@ void Openbox::showHelp()
 void Openbox::eventLoop()
 {
   while (!_shutdown) {
-    _timermanager.fire();
+    _timermanager.fire(!_sync); // wait if not in sync mode
     dispatchEvents(); // from OtkEventDispatcher
     XFlush(otk::OBDisplay::display); // flush here before we go wait for timers
   }
@@ -347,6 +350,22 @@ void Openbox::setFocusedClient(OBClient *c)
     XSetInputFocus(otk::OBDisplay::display, _focused_screen->focuswindow(),
                    RevertToNone, CurrentTime);
   }
+  // set the NET_ACTIVE_WINDOW hint for all screens
+  ScreenList::iterator it, end = _screens.end();
+  for (it = _screens.begin(); it != end; ++it) {
+    int num = (*it)->number();
+    Window root = otk::OBDisplay::screenInfo(num)->rootWindow();
+    _property->set(root, otk::OBProperty::net_active_window,
+                   otk::OBProperty::Atom_Window,
+                   (c && _focused_screen == *it) ? c->window() : None);
+  }
+
+  // call the python Focus callbacks
+  EventData *data = new_event_data(_focused_screen->number(),
+                                   c ? c->window() : 0,
+                                   EventFocus, 0);
+  Openbox::instance->bindings()->fireEvent(data);
+  Py_XDECREF((PyObject*)data);
 }
 
 void Openbox::execute(int screen, const std::string &bin)
This page took 0.024884 seconds and 4 git commands to generate.