#449·toaruos

Implement menu mouse delay

Author: klangeCreated Apr 21, 2026Updated Apr 21, 2026

We have a very extensive menu library, which is a C re-implementation of a Python version of the same thing from many years ago.

One thing this menu library has always lacked is the intentional delay in registering a mouse movement as the mouse moves between menus. This trick is nearly as old as GUIs themselves: If the user moves the mouse diagonally to access a submenu, they are very likely to roll the cursor over another menu entry in the parent menu, potentially closing the submenu.

Most modern GUI toolkits use one or both of the following solutions:

  • Track the trajectory of the cursor: A cursor moving in a very downward direction is unlikely to be headed for a submenu that is to the left or right.
  • Delay hiding and showing menus. If the submenu is still there when the cursor arrives, no problem.