Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown when holding down Shift and Super #155

Closed
poach3r opened this issue Nov 25, 2024 · 3 comments
Closed

Error thrown when holding down Shift and Super #155

poach3r opened this issue Nov 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@poach3r
Copy link

poach3r commented Nov 25, 2024

My program is throwing an error whenever the user holds down Super and Shift at the same time:

java.lang.IllegalStateException: Unexpected value: 64
	at org.gnome.gdk.ModifierType.of(ModifierType.java:149)
	at io.github.jwharm.javagi.interop.Interop.intToEnumSet(Interop.java:1088)
	at org.gnome.gtk.EventControllerKey$KeyPressedCallback.upcall(EventControllerKey.java:396)
	at org.gnome.gio.Application.run(Application.java:1087)
	at org.poach3r.MainKt.main(Main.kt:4)
@poach3r poach3r changed the title Error thrown with Super mask Error thrown when holding down Shift and Super Nov 25, 2024
@jwharm jwharm added the bug Something isn't working label Nov 25, 2024
@jwharm
Copy link
Owner

jwharm commented Nov 25, 2024

Thanks for the bug report.

Java-GI throws an exception when an undefined flag is set. That turns out to be a bit too strict. I will change it, so that unexpected values are logged and ignored.

However, this is strictly incorrect in case of GdkModifierType, according to its documentation:

Note that GDK may add internal values to events which include values outside of this enumeration. Your code should preserve and ignore them. You can use GDK_MODIFIER_MASK to remove all private values.

So Java-GI can't just silently ignore the internal flags, because we're supposed to preserve them. To do that, I will add all possible "internal" flags to GdkModifierType, labeled INTERNAL_..., and hope that this horrible sort of API design doesn't exist elsewhere.

@jwharm jwharm closed this as completed in b23faa4 Nov 25, 2024
@jwharm jwharm reopened this Nov 25, 2024
@jwharm
Copy link
Owner

jwharm commented Nov 25, 2024

I published release 0.11.1-SNAPSHOT with the fix. Can you please confirm if it works for you?

For snapshot releases, add https://s01.oss.sonatype.org/content/repositories/snapshots to the repositories in your build script.

@poach3r
Copy link
Author

poach3r commented Nov 26, 2024

This worked for me, thanks!

@jwharm jwharm closed this as completed Nov 26, 2024
jwharm added a commit that referenced this issue Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants