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

The OpenApple + <Return> problem #556

Closed
Keatah opened this Issue May 21, 2018 · 21 comments

Comments

Projects
None yet
4 participants
@Keatah

Keatah commented May 21, 2018

The Applewin OpenApple + <Return> problem? Seems this key combo from the //e doesn't work in AppleWin. The documentation confirms it.

Is there any workaround to send that keycombo to a program? If not, maybe a special key sequence or mouse/joystick sequence or one-time trigger could be devised that would allow it. There are some programs that do make use of that keycombo. The one I found the other day was part of a setup procedure for TIMEOUT, and the illegal keycombo is supposed to let you add a prodos prefix to a list.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 21, 2018

Contributor

Similar to #145 (for Open-Apple + ESC).

One workaround is to set "Joystick 1" to "Keyboard (num pad)", and then use the Numeric Pad's '0' and '.' for Open/Closed Apple respectively (instead of the left/right ALT keys).

Contributor

tomcw commented May 21, 2018

Similar to #145 (for Open-Apple + ESC).

One workaround is to set "Joystick 1" to "Keyboard (num pad)", and then use the Numeric Pad's '0' and '.' for Open/Closed Apple respectively (instead of the left/right ALT keys).

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 21, 2018

Contributor

And similar to the question you asked in #448 :-)

Contributor

tomcw commented May 21, 2018

And similar to the question you asked in #448 :-)

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 21, 2018

Contributor

And you were the one that originally request ALT+ENTER to go full-screen, here: #198!

Contributor

tomcw commented May 21, 2018

And you were the one that originally request ALT+ENTER to go full-screen, here: #198!

@landloafer

This comment has been minimized.

Show comment
Hide comment
@landloafer

landloafer May 23, 2018

I am on Win7. I heard "Ding" windows' warning beat when ever I hold Alt+anykey.

landloafer commented May 23, 2018

I am on Win7. I heard "Ding" windows' warning beat when ever I hold Alt+anykey.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 26, 2018

Contributor

A heavy-weight (system global) workaround, but you can make Default Beep make no sound:

image

Contributor

tomcw commented May 26, 2018

A heavy-weight (system global) workaround, but you can make Default Beep make no sound:

image

tomcw added a commit that referenced this issue May 26, 2018

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 26, 2018

Contributor

OK, I found a way to programmatically suppress the Default Beep.

Contributor

tomcw commented May 26, 2018

OK, I found a way to programmatically suppress the Default Beep.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 27, 2018

Contributor

As Michael said in #145, the solution is to use SetWindowsHookEx().

I've committed an initial implementation that suppresses ALT+TAB, ALT+ESC and CTRL+ESC globally within the system. So when AppleWin is running then these system key-combos don't do anything for whichever Window or application that has focus. Quitting AppleWin restores the default Windows behaviour for these key combos.

to do:

  • Update the other VS solutions to include this new HookFilter DLL project
  • Add a cmd line switch to inhibit this system key suppression and update help.
  • Check that AppleWin can now receive ALT+ESC, ie. the virtual machine can get OpenApple+ESC (#145)
  • Check that AppleWin can now receive ALT+TAB, ie. the virtual machine can get OpenApple+TAB
  • Check that AppleWin can now receive ALT+SPACE, ie. the virtual machine can get OpenApple+SPACE
  • Add a cmd line switch to inhibit ALT+ENTER from toggling full-screen.

Also:

  • Check that AppleWin can now receive ALT-GR+key, ie. the virtual machine can get ClosedApple+key (#558)
Contributor

tomcw commented May 27, 2018

As Michael said in #145, the solution is to use SetWindowsHookEx().

I've committed an initial implementation that suppresses ALT+TAB, ALT+ESC and CTRL+ESC globally within the system. So when AppleWin is running then these system key-combos don't do anything for whichever Window or application that has focus. Quitting AppleWin restores the default Windows behaviour for these key combos.

to do:

  • Update the other VS solutions to include this new HookFilter DLL project
  • Add a cmd line switch to inhibit this system key suppression and update help.
  • Check that AppleWin can now receive ALT+ESC, ie. the virtual machine can get OpenApple+ESC (#145)
  • Check that AppleWin can now receive ALT+TAB, ie. the virtual machine can get OpenApple+TAB
  • Check that AppleWin can now receive ALT+SPACE, ie. the virtual machine can get OpenApple+SPACE
  • Add a cmd line switch to inhibit ALT+ENTER from toggling full-screen.

Also:

  • Check that AppleWin can now receive ALT-GR+key, ie. the virtual machine can get ClosedApple+key (#558)
@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 28, 2018

Contributor

Simple test:

5 PR#3
10 B0 = 49249 : REM $C061 / Button#0
20 B1 = B0 + 1
30 K = 49152 : REM $C000
40 AKD = K + 16
100  PRINT  PEEK (B0), PEEK (B1), PEEK (K), PEEK (AKD)
110  GOTO 100
Contributor

tomcw commented May 28, 2018

Simple test:

5 PR#3
10 B0 = 49249 : REM $C061 / Button#0
20 B1 = B0 + 1
30 K = 49152 : REM $C000
40 AKD = K + 16
100  PRINT  PEEK (B0), PEEK (B1), PEEK (K), PEEK (AKD)
110  GOTO 100
@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 28, 2018

Contributor

Commit 6b53add - extend hook filter for ALT+SPACE, PostMessage() and special AKD support.

Contributor

tomcw commented May 28, 2018

Commit 6b53add - extend hook filter for ALT+SPACE, PostMessage() and special AKD support.

@Keatah

This comment has been minimized.

Show comment
Hide comment
@Keatah

Keatah May 28, 2018

Ohh dear.. I work with so many emulators it gets hard to remember what I asked for.

Keatah commented May 28, 2018

Ohh dear.. I work with so many emulators it gets hard to remember what I asked for.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw May 29, 2018

Contributor

Not to worry - it's prompted me to take a closer look at this.

Contributor

tomcw commented May 29, 2018

Not to worry - it's prompted me to take a closer look at this.

tomcw added a commit that referenced this issue Jun 16, 2018

Hook system keys: (#556)
. added -no-hook-system-key to prevent hooking system keys
. updated help
. HookFilter.dll: changed to directly send virtual key code

@tomcw tomcw added the bug label Jun 16, 2018

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jun 16, 2018

Contributor

I noticed that the save-state is always saving 'Last Key' as 0x00, so I'll roll the fix up into this issue.
Fixed at 6ad2621.

Contributor

tomcw commented Jun 16, 2018

I noticed that the save-state is always saving 'Last Key' as 0x00, so I'll roll the fix up into this issue.
Fixed at 6ad2621.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jun 16, 2018

Contributor

Added regression test for system keys, AKD and -alt-enter=open-apple-enter: AppleWin/AppleWin-Test@12cbcd8

Contributor

tomcw commented Jun 16, 2018

Added regression test for system keys, AKD and -alt-enter=open-apple-enter: AppleWin/AppleWin-Test@12cbcd8

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jun 16, 2018

Contributor

Closing this as all work complete. I'll add a comment here when there's a new build to try.

Contributor

tomcw commented Jun 16, 2018

Closing this as all work complete. I'll add a comment here when there's a new build to try.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jun 24, 2018

Contributor

@Keatah: I've released a new 1.27.5 version here.

You'll need to use a new command-line switch to enable OpenApple + Return (as this key combination defaults to full-screen toggle). See the help or release note.

Contributor

tomcw commented Jun 24, 2018

@Keatah: I've released a new 1.27.5 version here.

You'll need to use a new command-line switch to enable OpenApple + Return (as this key combination defaults to full-screen toggle). See the help or release note.

@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Jul 28, 2018

Contributor

Not being able to use Alt-Tab in Windows when AppleWin is open cramps my style! ; - )

What's the plan going forward?

Contributor

sicklittlemonkey commented Jul 28, 2018

Not being able to use Alt-Tab in Windows when AppleWin is open cramps my style! ; - )

What's the plan going forward?

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jul 29, 2018

Contributor

There is a cmd line switch (-no-hook-system-key) to suppress the keyboard hook filter, but this is no good once you've started AppleWin (and forgotten to use the switch).

Some ideas:

  1. When AppleWin loses the focus, then unhook the keyboard filter (and vice versa: re-hook when AppleWin gets the focus again).
    • but when you ALT+TAB back into AppleWin, then you'll be stuck again!
  2. Provide a GUI Config option to enable/disable this keyboard hook behaviour
    • default to allowing ALT+TAB to switch apps (ie. standard Windows behaviour)
Contributor

tomcw commented Jul 29, 2018

There is a cmd line switch (-no-hook-system-key) to suppress the keyboard hook filter, but this is no good once you've started AppleWin (and forgotten to use the switch).

Some ideas:

  1. When AppleWin loses the focus, then unhook the keyboard filter (and vice versa: re-hook when AppleWin gets the focus again).
    • but when you ALT+TAB back into AppleWin, then you'll be stuck again!
  2. Provide a GUI Config option to enable/disable this keyboard hook behaviour
    • default to allowing ALT+TAB to switch apps (ie. standard Windows behaviour)
@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Jul 29, 2018

Contributor

Yeah for (2) - this should be a GUI option that I'd personally never want to enable. ; - )

I suppose it might make more sense in full screen, in the sense of turning your PC into an Apple II. But again I personally wouldn't use it even then unless there was some particular case I was testing.

Contributor

sicklittlemonkey commented Jul 29, 2018

Yeah for (2) - this should be a GUI option that I'd personally never want to enable. ; - )

I suppose it might make more sense in full screen, in the sense of turning your PC into an Apple II. But again I personally wouldn't use it even then unless there was some particular case I was testing.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Jul 29, 2018

Contributor

Well, I'd rather not add extra GUI options, especially since there's no actual request for ALT+TAB... so perhaps the best approach is only support it via a cmd-line switch.

Therefore what about:

  • default: keyboard hook filter enabled, but it only suppresses ALT+ESC (#145) and ALT+SPACE (no user requests)
  • new switch for hook filter to suppress ALT+TAB (no user requests)
  • new switch for hook filter to suppress ALT GR's fake LCONTROL message (#558, no user request)
    • NB. suppressing this fake LCONTROL seems to prevent international keyboards from being able to type certain keys
    • But (when RMENU / ALT GR is pressed) then posting WM_CHAR, seems to be fine, but just won't work in the ALT GR + CONTROL +<key> case. Again no one's asking for this, so currently no big deal.

Why even bother with the new switches to suppress ALT+TAB and the fake LCONTROL? Well I've done the work now, and if in the future there's a request to support these then they will be available.

Contributor

tomcw commented Jul 29, 2018

Well, I'd rather not add extra GUI options, especially since there's no actual request for ALT+TAB... so perhaps the best approach is only support it via a cmd-line switch.

Therefore what about:

  • default: keyboard hook filter enabled, but it only suppresses ALT+ESC (#145) and ALT+SPACE (no user requests)
  • new switch for hook filter to suppress ALT+TAB (no user requests)
  • new switch for hook filter to suppress ALT GR's fake LCONTROL message (#558, no user request)
    • NB. suppressing this fake LCONTROL seems to prevent international keyboards from being able to type certain keys
    • But (when RMENU / ALT GR is pressed) then posting WM_CHAR, seems to be fine, but just won't work in the ALT GR + CONTROL +<key> case. Again no one's asking for this, so currently no big deal.

Why even bother with the new switches to suppress ALT+TAB and the fake LCONTROL? Well I've done the work now, and if in the future there's a request to support these then they will be available.

tomcw added a commit that referenced this issue Jul 29, 2018

Keyboard:
. reverted default so that ALT+TAB is not hooked (#556)
. reverted default so that ALT GR's fake LCONTROL is not hooked (#558)
. added new switches: -hook-alt-tab and -hook-altgr-control to support hooking these key combo's (#556)
@sicklittlemonkey

This comment has been minimized.

Show comment
Hide comment
@sicklittlemonkey

sicklittlemonkey Jul 30, 2018

Contributor

Ok, sounds good. The new behaviour just surprised me, and someone else on FB: "Yikes, it captures Alt-Tab! rolls back"! ; - )

Cheers,
Nick.

Contributor

sicklittlemonkey commented Jul 30, 2018

Ok, sounds good. The new behaviour just surprised me, and someone else on FB: "Yikes, it captures Alt-Tab! rolls back"! ; - )

Cheers,
Nick.

@tomcw

This comment has been minimized.

Show comment
Hide comment
@tomcw

tomcw Aug 6, 2018

Contributor

Hi Nick,
FYI, there's a new 1.27.7 release here with the hooked ALT+TAB reverted.

Contributor

tomcw commented Aug 6, 2018

Hi Nick,
FYI, there's a new 1.27.7 release here with the hooked ALT+TAB reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment