[Xlib] Force Raise/Map/Focus a given Window

Andrew Troschinetz ast at arlut.utexas.edu
Tue Aug 12 09:19:23 PDT 2008


On Aug 11, 2008, at 3:40 PM, Mikhail Gusarov wrote:
> AT> Is there a known workaround for this,
> I'd say if there is a known workaround, this should be considered a  
> bug.

Well no. There are certain things that need to steal focus, like  
dialog windows for example. Basically what I'm doing is writing a baby  
window manager for a suite of applications that lives inside a of  
fully fledged window manager. I've got about 30 or 40 applications,  
many of which run fullscreen all the time. And I need a way to shuffle  
them around, bring some to the top, minimize, etc, all programatically.

Now, when the window is minimized to begin with, my present_window()  
function *will* present the window and the window *does* steal focus,  
in either RHEL4 or RHEL5. You're saying you consider that to be a bug?

I'm not trying to steal focus in the sense of "my application requires  
attention and I'm stealing focus from some other application that the  
user is interacting with." What I'm doing is more along the lines of  
"the user has requested that window X should come to the front and  
have focus, right now." And the window manager is denying the user's  
explicit request because it comes in the form of my function call and  
not the accepted "user clicks on taskbar item" workflow.

On Aug 11, 2008, at 4:46 PM, Daniel Stone wrote:
> No.  By design, the window manager has complete control over these  
> kinds
> of things.  Letting people subvert the 'don't steal my focus'  
> mechanism
> would utterly defeat the point of the 'don't steal my focus'  
> mechanism.


So there really is nothing I can do at the Xlib level to fix this?  
What if I set the window to keepabove, then change it back to not- 
keepabove after it's been raised. That might have the effect of  
bringing the window to the top of the stack, at least. I know at least  
that even though the window doesn't raise in RHEL5, it *does* get  
keyboard focus because the window manager can't mess with my  
XSetInputFocus() call.

I believe that this is due to the fact that XSetInputFocus requests  
are unconditionally granted by the XServer, regardless of the wishes  
of the WM. ( Read more here: http://lwn.net/Articles/148092/ )

Are there really no better suggestions?

--
Andrew Troschinetz
Applied Research Laboratories




More information about the xorg mailing list