+
+void Openbox::setFocusedClient(OBClient *c)
+{
+ _focused_client = c;
+ if (c) {
+ _focused_screen = _screens[c->screen()];
+ } else {
+ assert(_focused_screen);
+ 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);
+ }
+}
+
+void Openbox::execute(int screen, const std::string &bin)
+{
+#ifdef __EMX__
+ // XXX: whats this for? windows?
+ spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", bin.c_str(), NULL);
+#else // __EMX__
+ if (screen >= ScreenCount(otk::OBDisplay::display))
+ screen = 0;
+ const std::string &dstr =
+ otk::OBDisplay::screenInfo(screen)->displayString();
+
+ if (! fork()) {
+ setsid();
+ int ret = putenv(const_cast<char *>(dstr.c_str()));
+ assert(ret != -1);
+ ret = execl("/bin/sh", "/bin/sh", "-c", bin.c_str(), NULL);
+ exit(ret);
+ }
+#endif // __EMX__
+}
+