Focus to specified application

I am writing multi-document text editor.
I have IPC for detect other instance, if other instance is called it send message to first instance and stop.
This action work OK.
First instance must bring to front
My window brings to font using X11:
but this top window has not keyboard focus.
How also make focus?
Last edited on
It's normal to stop the new instance, and then restore the original instance.

However, I expect you'll have the same problem bringing the old instance to the top too.

Sorry, I know I'm not being much help with the actual problem, but it's possible you could loose something (data, layout, ...) by terminating the old instance.
I'm not so sure about X11, but other systems, such as Windows, do not allow applications to "steal" the focus – for reasons of security and user experience. If at all, the process that owns the window which is currently focused will be allowed to transfer the focus to another window (potentially belonging to another process), but other (background) processes will certainly not be allowed to just take over the focus...

See "Remarks" here:
Last edited on
Yes, but focus must be set to window by application which has these window,
Topic archived. No new replies allowed.