-
Notifications
You must be signed in to change notification settings - Fork 54
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
ALT F4 doesnt copy ?? #40
Comments
I don't really know how to fix this issue. Maybe you can check if there's a keybindings setting in Linux Mint somewhere, and remove ALT+F4 that way. |
I had to change some settings on mac to actually "use" the function keys, as function keys, I suspect linux may have a similar issue, but a mac is a complete machine, linux is usually a self-installable. |
Right now I use the following dirty hack:
But of course this solution is not clean because it just checks if ALT has been pressed while the quit is processed. And as F4 does not arrive in the window I see no other solution to solve it right now. I found out that by using Xinput ( |
Ah I see, I thought ALT+F4 only closed programs on Windows, so the real fix is to move line 98 to 101 in ft2_main.c to before the |
Hmm, this may only work on Windows:
|
I did make the change anyway, can you try to see if it works now? |
Unfortunately this won't work because SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 only works on Windows :-( From Alt+F4 the Linux WM generates a WM_DELETE_WINDOW X11 message even before it arrives in the event queue of the application. No idea what to do here but I found out that by using Xinput you can somehow get that "F4" as Xi2 "RawKeyPress" event. But I neither coded with Xlib or Xinput so no idea how that really works. |
This issue should be forwarded to the SDL2's github repo instead. |
With xev you get
So just ALT, FocusOut, DeleteWindow. No F4. But with
Yeah I also think that should be fixed in SDL instead. Maybe SDL3 already supports it? |
I don't think I want to include your fix as SDL_QUIT can be read from the queue in several other instances than pressing ALT+F4. EDIT: Maybe you could check if F4 was held down as well? |
I don't receive the F4 unfortunately, that's why I only have that as dirty hack :-( I can try to find a way to read the F4 with Xinput but can't promise I'm successful. |
Ah I see, I guess I didn't read properly. I think this issue will have to stay open for now, until SDL2 eventually gets a fix. SDL2 is still getting minor fixes it seems like, even though SDL3 is in development. |
There must be several applications which have the same problem. Most of the people with Linux use a WM like KDE or Xfce to disable Alt-F4 for the affected applications. But I use GNOME and there are only system-wide keyboard shortcuts. |
As possible fix, I thought about taking that before SDL processes its events: https://gitlab.freedesktop.org/xorg/app/xinput/-/blob/master/src/test_xi2.c#L433 using XPeekEvent instead of XNextEvent and then just checking for the XI_RawKeyPress events to get the F4. |
Also have this issue on mac OS Ventura. Control (or any other like alt, command) F4 & F5 does not copy/paste pattern. sampCopy/sampPaste in sampEditor works as expected using command c/command v. So I tried to switch around SLDK_F4/F5 and SDLK_c/v to be able to use control/command + c/vand I was not successful manipulating the pattern. |
Like said on 16-bits.org/ft2.php, you need to disable these global OS shortcuts in macOS. You can do it somewhere in the macOS settings. |
Just FYI, my current fix (GNOME, X11 here) to this phenomena on Linux is still calling
at the end of the function |
Well, does ALT+TAB still work as intended (switch between open programs) with this fix? |
Yes, for me it does. |
Got someone with Ubuntu 22.04 to test it, and it didn't work for them. Also on Windows it takes over ALT+TAB, so that you can't switch between open programs with the keyboard. I just think that this is an unreliable solution, so I won't implement it after all... |
I would also love a fix that somehow intercepted the keypress in the application. As a workaround I tried disabling the ALT+F4 hotkey globally in Gnome. That stops the exit dialog from being shown as before, but copy/paste block still doesn't work. Not sure if it's the copy or paste part that is broken though. |
Seems like the copy paste keybindings dont work. When I ALT + F4 it prompts me if I want to exit or not. When I try to paste nothing happens.
Im using the version in Linux Mint software repository.
The text was updated successfully, but these errors were encountered: