From 4ddd26fe21edba8e7df65b12d721e9bed579e6e4 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 12 Apr 2024 02:49:15 +1000 Subject: Initial touch input support: * Feed mouse/pen/touch pointer events through UI input manager with Win32 and SDL. * Started migrating UI code to use new API and reworking mouse/touch interaction. * emu/render.cpp: Support pressing multiple clickable layout items simultaneously. * emu/render.cpp: Allow UI elements to be drawn in any window. * emu/rendlay.cpp, luaengine_render.cpp: Added layout view events for pointer input. * ui/ui.cpp: Allow the UI handler to control pointer display. * ui/analogipt.cpp: Added mouse/touch and more keys for navigating field state list. * ui/menu.cpp: Use vertical swipe to scroll and horizontal swipe to adjust. * ui/menu.cpp: Draw after processing input - greatly improves responsiveness. * ui/menu.cpp: Ignore keyboard/gamepad input during pointer actions. * ui/selmenu.cpp: Made left/right info pane arrows repeat when held. * ui/selmenu.cpp: Use middle click to move keyboard focus. * ui/selmenu.cpp: Let filter list scroll if it's too tall, and use a bit of horizontal padding. * ui/selmenu.cpp: Improved divider sizing. * ui/state.cpp: Don't allow clicks to pass through the confirm deletion prompt to the menu. * ui/simpleselgame.cpp: Fixed error message display and graphics/sound status not showing. * ui/simpleselgame.cpp: Allow tap/click to dismiss error message. * ui/utils.cpp: Show UI for choice filters when there are no choices - it's less confusing. * modules/input/input_sdl.cpp: Made scaling for mouse scroll better match RawInput and DirectInput. * modules/input/input_rawinput.cpp: Added support for horizontal scroll axis. * modules/input/input_win32.cpp: Added support for scroll axes and more buttons to mouse/lightgun. * modules/debugger/debugimgui.cpp: Don't fight over events with the UI manager - it breaks menus. * osd/windows/window.cpp: Translate mouse position to window cooridinates for scroll wheel events. * osd/sdl/window.cpp: Supply last mouse position for scroll wheel events if possible. * scripts/build/complay.py: Made zero input mask an error - it was only being used to block clicks. --- docs/source/luascript/ref-input.rst | 10 ------ docs/source/luascript/ref-render.rst | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 10 deletions(-) (limited to 'docs/source/luascript') diff --git a/docs/source/luascript/ref-input.rst b/docs/source/luascript/ref-input.rst index 7390d46743f..f146d6c78ff 100644 --- a/docs/source/luascript/ref-input.rst +++ b/docs/source/luascript/ref-input.rst @@ -750,16 +750,6 @@ uiinput:reset() Clears pending events and UI input states. Should be called when leaving a modal state where input is handled directly (e.g. configuring an input combination). -uiinput:find_mouse() - Returns host system mouse pointer X position, Y position, button state, and - the :ref:`render target ` it falls in. The - position is in host pixels, where zero is at the top/left. The button state - is a Boolean indicating whether the primary mouse button is pressed. - - If the mouse pointer is not over one of MAME’s windows, this may return the - position and render target from when the mouse pointer was most recently - over one of MAME’s windows. The render target may be ``nil`` if the mouse - pointer is not over one of MAME’s windows. uiinput:pressed(type) Returns a Boolean indicating whether the specified UI input has been pressed. The input type is an enumerated value. diff --git a/docs/source/luascript/ref-render.rst b/docs/source/luascript/ref-render.rst index 265e52b5016..eee432660dd 100644 --- a/docs/source/luascript/ref-render.rst +++ b/docs/source/luascript/ref-render.rst @@ -1057,6 +1057,66 @@ view:set_recomputed_callback(cb) View coordinates are recomputed in various events, including the window being resized, entering or leaving full-screen mode, and changing the zoom to screen area setting. +view:set_pointer_updated_callback(cb) + Set a function to receive notifications when a pointer enters, moves or + changes button states over the view. The function must accept nine + arguments: + + * The pointer type (``mouse``, ``pen``, ``touch`` or ``unknown``). + * The pointer ID (a non-negative integer that will not change for the + lifetime of a pointer). + * The device ID for grouping pointers to recognise multi-touch gestures + (non-negative integer). + * Horizontal position in layout coordinates. + * Vertical position in layout coordinates. + * A bit mask representing the currently pressed buttons. + * A bit mask representing the buttons that were pressed in this update. + * A bit mask representing the buttons that were released in this update. + * The click count (positive for multi-click actions, or negative if a click + is turned into a hold or drag). + + Call with ``nil`` to remove the callback. +view:set_pointer_left_callback(cb) + Set a function to receive notifications when a pointer leaves the view + normally. The function must accept seven arguments: + + * The pointer type (``mouse``, ``pen``, ``touch`` or ``unknown``). + * The pointer ID (a non-negative integer that will not change for the + lifetime of a pointer). The ID may be reused for a new pointer after + receiving this notification. + * The device ID for grouping pointers to recognise multi-touch gestures + (non-negative integer). + * Horizontal position in layout coordinates. + * Vertical position in layout coordinates. + * A bit mask representing the buttons that were released in this update. + * The click count (positive for multi-click actions, or negative if a click + is turned into a hold or drag). + + Call with ``nil`` to remove the callback. +view:set_pointer_aborted_callback(cb) + Set a function to receive notifications when a pointer leaves the view + abnormally. The function must accept seven arguments: + + * The pointer type (``mouse``, ``pen``, ``touch`` or ``unknown``). + * The pointer ID (a non-negative integer that will not change for the + lifetime of a pointer). The ID may be reused for a new pointer after + receiving this notification. + * The device ID for grouping pointers to recognise multi-touch gestures + (non-negative integer). + * Horizontal position in layout coordinates. + * Vertical position in layout coordinates. + * A bit mask representing the buttons that were released in this update. + * The click count (positive for multi-click actions, or negative if a click + is turned into a hold or drag). + + Call with ``nil`` to remove the callback. +view:set_forget_pointers_callback(cb) + Set a function to receive notifications when the view should stop processing + pointer input. The function must accept no arguments. Call with ``nil`` to + remove the callback. + + This can happen in a number of situations, including the view configuration + changing or a menu taking over input handling. Properties ~~~~~~~~~~ -- cgit v1.2.3-70-g09d2