Reputation: 137
While trying to implement click-to-focus in my custom window manager, I noticed that windows were lowering when I clicked on them, instead of raising. The lines in question looked like this:
XSetInputFocus(this->display, this->event.xbutton.subwindow, RevertToParent, CurrentTime);
XRaiseWindow(this->display, this->event.xbutton.subwindow);
I changed that to
XSetInputFocus(this->display, this->event.xbutton.subwindow, RevertToParent, CurrentTime);
XLowerWindow(this->display, this->event.xbutton.subwindow);
and now windows are being raised when I click on them, as is proper.
Per the man page: "The XRaiseWindow function raises the specified window to the top of the stack so that no sibling window obscures it." Vice versa for XLowerWindow. The behavior I'm observing is precisely the opposite of what is described; XRaiseWindow pushes windows to the background instead, and XLowerWindow moves them to the foreground.
What is going on here?
(This is with Ubuntu 14.04.2 LTS, for what it's worth.)
Upvotes: -1
Views: 976
Reputation: 137
The problem turned out to be trivial, and entirely my fault: the lines above were in a switch() statement, the break; statement below was missing. The next condition called XCirculateWindowsUp(). So focusing and raising the window would fall through to lowering it again.
Whoops.
Upvotes: 2