Re: Getting focus
On Tue, 2016-08-23 at 00:38 +0200, rastersoft wrote: > 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? Is it Linux with Gnome3 shell? Gnome 3.20? May other programs steal the focus? Do other tools work fine? When you hide and show gedit, will it have the focus? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting focus
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) ras...@rastersoft.com http://www.rastersoft.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
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) ras...@rastersoft.com http://www.rastersoft.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting focus
This is odd! If I change "org.gnome.desktop.wm.preferences.disable-workarounds" to TRUE, everything works fine El 23/08/16 a las 19:11, rastersoft escribió: > 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) ras...@rastersoft.com http://www.rastersoft.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting focus
False alarm... it doesn't work :( El 23/08/16 a las 19:39, rastersoft escribió: > This is odd! If I change > "org.gnome.desktop.wm.preferences.disable-workarounds" to TRUE, > everything works fine > > > El 23/08/16 a las 19:11, rastersoft escribió: >> 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) ras...@rastersoft.com http://www.rastersoft.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Getting focus
If someone wants to test it, the code is at https://github.com/rastersoft/terminus El 23/08/16 a las 19:39, rastersoft escribió: > This is odd! If I change > "org.gnome.desktop.wm.preferences.disable-workarounds" to TRUE, > everything works fine > > > El 23/08/16 a las 19:11, rastersoft escribió: >> 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) ras...@rastersoft.com http://www.rastersoft.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list