GTK3 gtk_window_new in popup style: How to keep the focus event ?

Hello all,

I've created a popup menu (which works), but have a problem: the popup window doesn't generate "focus-out-event" signals anymore (something which I intend to use to easily dismiss the popup).

I've tried to use standard popup together with setting a mask for that signal to re-enable it :

GtkWidget *popup = gtk_window_new(GTK_WINDOW_POPUP) gtk_widget_add_events(G_OBJECT(popup), GDK_FOCUS_CHANGE_MASK);

but that didn't want to work.

Than I tried a standard toplevel window with some changes applied, but it turned out that removing the taskbar-hint also blocked the focus-change signal :

GtkWidget *popup = gtk_window_new(GTK_WINDOW_TOPLEVEL) gtk_window_set_skip_taskbar_hint (GTK_WINDOW (popup_window), TRUE);

Trying to re-add the focus-change mask didn't help here either.

So, the question: How do I create a popup window (or one that looks like it!), while maintaining the "focus-out-event" signal (or how do I re-enable it again when its disabled).

Also, its my intention to allow for keyboard navigation (to select items in the to-be-added GtkListBox or other). But for some reason keyboard interaction is also disabled for a popup style window (it refuses to accept focus). Although I've been able to use "gdk_keyboard_grab()"* for that, I wonder if it can be done with less force (maybe setting a flag which allows setting focus ?)

*funny thing that by the way: using that throws a warning its depricated and I should use "gdk_device_grab()". However, when I do that I'm than told its depricated too, and I should use "gdk_seat_grab()" (which is way more complex and doesn't seem to be intended to do a simple "allow & set focus" action on a window. :-\ )

Regards, Rudy Wieser

Reply to
R.Wieser
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.