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

Double clicks not recognized when accelerated #2

Closed
inexorabletash opened this issue Sep 10, 2017 · 7 comments
Closed

Double clicks not recognized when accelerated #2

inexorabletash opened this issue Sep 10, 2017 · 7 comments
Assignees
Labels
bug Control Panel DA Control Panel DA (new or existing) DeskTop DeskTop bugs or feature requests root-cause-identified
Milestone

Comments

@inexorabletash
Copy link
Collaborator

Double clicks are not recognized as such when the machine (real or virtual) is faster than about 2MHz.

Observed on both Virtual ][ (emulation) and Laser 128EX (at 3.6MHz)

@inexorabletash
Copy link
Collaborator Author

Code at $85FC MAIN is used to detect double-clicks. It is called by DeskTop after an icon click (window or desktop), and it stashes the coords and starts a counter, then enters an input loop. If the counter hits zero, the cursor moves beyond a pixel threshold, or a non move/click event occurs it exits. If the event is a click it signals a double click.

The counter is initialized with machine-specific values (IIe = $12C, IIc = $1F4, IIgs = $1FA). These could be inflated although the counter decrement logic only handles values in the range $0 ... $1FF. (There's enough room to replace the counter initialization with larger but fixed values, e.g. $3FF, and generalize the counter decrement logic.)

If the counter is set to infinity (e.g. NOP out the checks) then basic click actions don't work until the mouse moves beyond the pixel threshold, so that's not an acceptable fix for arbitrary acceleration (e.g. an emulator running flat out) - there really does need to be a time limit.

@inexorabletash inexorabletash added the Control Panel DA Control Panel DA (new or existing) label Apr 22, 2018
@inexorabletash inexorabletash self-assigned this Apr 24, 2018
@inexorabletash
Copy link
Collaborator Author

inexorabletash commented May 9, 2018

Interestingly, there is a second, possibly unused implementation of the double-click detection code.

  • The main one is at desktop_main.s $85FC and uses delta x/y of 8/7 and machine_type*2 as delta t.
  • The second is at desktop_main.s $B554 and uses delta x/y of 5/4 and the machine_type*2 as delta t.

Related, there is insertion point blinking. There are again two implementations:

  • One at main $A56C for the Rename/New Folder prompt; it uses a fixed value of $14 as delta t.
  • One is in ovl4.s circa $5C60 and uses machine_type as the delta t.

Under Virtual ][ at normal speed, both have a cycle of about 1s, which is... weird.

The machine_type field uses: IIgs=$FD, IIc=$FA, IIe=$96; presumably this correlates with the speed of the mouse firmware which affects the input loop.

@inexorabletash
Copy link
Collaborator Author

The speed setting could also be used to slow down the open/close window animation on fast machines.

@inexorabletash
Copy link
Collaborator Author

Crazy idea for emulators: since emulators slow down when sound is produced, toggle the speaker when initiating a double-click detection loop, and infrequently during the loop. There may be a sweet spot where it isn't audible, but slows the emulator enough.

@inexorabletash
Copy link
Collaborator Author

The SPKR trick works in Virtual ][, although it induces a bit of UI jank on any click in a window

@inexorabletash
Copy link
Collaborator Author

Correction to previous:

  • There are two IP blinking implementations (one in desktop_main.s, one in ovl4.s, but both use hardcoded $14 value.
  • The routine in ovl4.s circa $5C60 is (yet another) a double-click detection routine, in the file picker dialog.

@inexorabletash
Copy link
Collaborator Author

image

The settings should be appropriate for roughly 1MHz, 4MHz, and 32MHz systems (i.e. baseline IIe, accelerated IIc+/IIgs/Laser, and emulators/FastChip).

We can iterate and add more steps if needed.

@inexorabletash inexorabletash added this to the 1.2 milestone Feb 12, 2021
inexorabletash added a commit that referenced this issue Jun 21, 2022
Broken in 5979ebf, when event params were consolidated. Oops #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Control Panel DA Control Panel DA (new or existing) DeskTop DeskTop bugs or feature requests root-cause-identified
Projects
None yet
Development

No branches or pull requests

1 participant