Sign up

How to find out if something in the GTK application reserved particular accelerator?

In the tiny IDE I work on I have the following problem:

This works:

MenuItem compileFileItem = new MenuItem("_Compile file", (MenuItem mi) => pm.compileFile(), "activate");
compileFileItem.addAccelerator("activate", accelGroup, GdkKeysyms.GDK_F6, ModifierType.SHIFT_MASK, 
                            AccelFlags.VISIBLE);
projectMenu.add(compileFileItem);

However, this does not

MenuItem compileFileItem = new MenuItem("_Compile file", (MenuItem mi) => pm.compileFile(), "activate");
compileFileItem.addAccelerator("activate", accelGroup, GdkKeysyms.GDK_F6, ModifierType.CONTROL_MASK, 
                            AccelFlags.VISIBLE);
projectMenu.add(compileFileItem);

I suspect something "stole" the CTRL-F6 shortcut. Same is happening with ALT-F6. Any ideas how to fix this?

Re: How to find out if something in the GTK application reserved particular accelerator?

On 23-08-2022 16:00, Dejan Lekic wrote:

In the tiny IDE I work on I have the following problem:

This works:

 MenuItem compileFileItem = new MenuItem("_Compile file", (MenuItem mi) => pm.compileFile(), "activate");
 compileFileItem.addAccelerator("activate", accelGroup, GdkKeysyms.GDK_F6, ModifierType.SHIFT_MASK,
                             AccelFlags.VISIBLE);
 projectMenu.add(compileFileItem);

However, this does not

 MenuItem compileFileItem = new MenuItem("_Compile file", (MenuItem mi) => pm.compileFile(), "activate");
 compileFileItem.addAccelerator("activate", accelGroup, GdkKeysyms.GDK_F6, ModifierType.CONTROL_MASK,
                             AccelFlags.VISIBLE);
 projectMenu.add(compileFileItem);

I suspect something "stole" the CTRL-F6 shortcut. Same is happening with ALT-F6. Any ideas how to fix this?

You might be able to trace it using the gtk inspector, by running your
application with the following environment variable set:

GTK_DEBUG=interactive

Re: How to find out if something in the GTK application reserved particular accelerator?

On Wed, 24 Aug 2022 05:20:56 -0400, Mike Wey wrote:

You might be able to trace it using the gtk inspector, by running your
application with the following environment variable set:

GTK_DEBUG=interactive

Thanks Mike, I will try that.
Do you know if there is perhaps a GtkD application somewhere that just prints out all events, including keyboard presses? What I fear is that application for whatever reason does not get these events at all (if that is possible).

Re: How to find out if something in the GTK application reserved particular accelerator?

OK, i decided to test my theory that my XFCE4 session is somehow causing this, started a new GNOME session, and all started to work as expected. All CTRL-Fx shortcuts I have in my application work on GNOME.

I asked a question on Fedora site about this - I hope someone will know how to fix it -
Fedora question.

Re: How to find out if something in the GTK application reserved particular accelerator?

On Wed, 24 Aug 2022 13:29:11 GMT, Dejan Lekic wrote:

I asked a question on Fedora site about this - I hope someone will know how to fix it -
Fedora question.

Got an answer on the XFCE forum...

In short, XFCE reserves CTRL-Fxx for switching workspaces (1 to 12).