if (openbox.focusedWindow()) {
openbox.focusedWindow()->setInputFocus();
openbox.focusedWindow()->setFocusFlag(True);
- } else {
- XSetInputFocus(display, PointerRoot, None, CurrentTime);
- }
+ } else
+ openbox.focusWindow((OpenboxWindow *) 0);
+
// check to make sure that new_name[0] != 0... otherwise we have a null
// workspace name which causes serious problems, especially for the
// Openbox::LoadRC() method.
}
-Bool OpenboxWindow::setInputFocus(void) {
+bool OpenboxWindow::setInputFocus(void) {
if (((signed) (frame.x + frame.width)) < 0) {
if (((signed) (frame.y + frame.y_border)) < 0)
configure(frame.border_w, frame.border_w, frame.width, frame.height);
openbox.grab();
if (! validateClient()) return False;
- Bool ret = False;
+ bool ret = false;
if (client.transient && flags.modal) {
ret = client.transient->setInputFocus();
} else if (! flags.focused) {
- if (focus_mode == F_LocallyActive || focus_mode == F_Passive)
+ if (focus_mode == F_LocallyActive || focus_mode == F_Passive) {
XSetInputFocus(display, client.window,
RevertToPointerRoot, CurrentTime);
- else
- XSetInputFocus(display, screen->getRootWindow(),
- RevertToNone, CurrentTime);
-
- openbox.focusWindow(this);
-
- if (flags.send_focus_message) {
- XEvent ce;
- ce.xclient.type = ClientMessage;
- ce.xclient.message_type = openbox.getWMProtocolsAtom();
- ce.xclient.display = display;
- ce.xclient.window = client.window;
- ce.xclient.format = 32;
- ce.xclient.data.l[0] = openbox.getWMTakeFocusAtom();
- ce.xclient.data.l[1] = openbox.getLastTime();
- ce.xclient.data.l[2] = 0l;
- ce.xclient.data.l[3] = 0l;
- ce.xclient.data.l[4] = 0l;
- XSendEvent(display, client.window, False, NoEventMask, &ce);
- }
+ openbox.focusWindow(this);
+
+ if (flags.send_focus_message) {
+ XEvent ce;
+ ce.xclient.type = ClientMessage;
+ ce.xclient.message_type = openbox.getWMProtocolsAtom();
+ ce.xclient.display = display;
+ ce.xclient.window = client.window;
+ ce.xclient.format = 32;
+ ce.xclient.data.l[0] = openbox.getWMTakeFocusAtom();
+ ce.xclient.data.l[1] = openbox.getLastTime();
+ ce.xclient.data.l[2] = 0l;
+ ce.xclient.data.l[3] = 0l;
+ ce.xclient.data.l[4] = 0l;
+ XSendEvent(display, client.window, False, NoEventMask, &ce);
+ }
- if (screen->sloppyFocus() && screen->autoRaise())
- timer->start();
+ if (screen->sloppyFocus() && screen->autoRaise())
+ timer->start();
- ret = True;
+ ret = true;
+ }
}
openbox.ungrab();
#endif // SHAPE
-Bool OpenboxWindow::validateClient(void) {
+bool OpenboxWindow::validateClient(void) {
XSync(display, False);
XEvent e;
XPutBackEvent(display, &e);
openbox.ungrab();
- return False;
+ return false;
}
- return True;
+ return true;
}
timer->fireOnce(True);
ungrab();
+
+ focusWindow((OpenboxWindow *) 0);
}
void Openbox::shutdown() {
BaseDisplay::shutdown();
- XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
+ focusWindow((OpenboxWindow *) 0);
std::for_each(screenList.begin(), screenList.end(),
std::mem_fun(&BScreen::shutdown));
if (tbar)
tbar->redrawWindowLabel(true);
focused_screen->updateNetizenWindowFocus();
- //} else {
- // focused_window = (OpenboxWindow *) 0;
+ } else {
+ ASSERT(focused_screen != (BScreen *) 0);
+ XSetInputFocus(getXDisplay(), focused_screen->getRootWindow(),
+ None, CurrentTime);
}
if (old_tbar && old_tbar != tbar)