Re: Getting focus



Well, it seems that destroying the window and creating it again also
doesn't work.

It seems that I can't "steal" the focus when it is in other application,
but if my app has the focus in one window, I can pass it to another one
using grab_focus().


El 23/08/16 a las 16:24, rastersoft escribió:
Hi:

It's not a problem of being early: I even tried to put a 1-second timer
to call to grab_focus(), but didn't work.

In fact, the first time I create the window it works fine, but seems to
fail when I hide it and show it again.
So it may be related to the window manager?
I suspect that. In fact, I think I'm going to just save the internal
widget and create a new window every time I press the hotkey.

It is a guake clone written in Vala, using Gtk3. I'm using libkeybinder
to detect a global key. It is the same library used by guake and
terminator, but they use Gtk2. I also implemented a guake mode in
terminator, but had to do some tricks to ensure that the window received
the focus on those same cases when my vala code fails (I use a
show-hide-show scheme, that seems to guarantee that the window receives
the focus; but it seems to work only with gtk2, but not gtk3).

Is it Linux with Gnome3 shell? Gnome 3.20?
That's right. I'm using debian sid.

May other programs steal the focus?
No, AFAIK.

Do other tools work fine? When you hide and show gedit, will it have
the focus?

Yes, everything works fine.


-- 
Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]