From 83c20c89439386f31050718c94551d863298cdb9 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 25 Oct 2014 00:30:36 -0400 Subject: Improvements to terminal mouse handling. Emit events for unhandled mouse events and connect to such events in order to focus and resize views. Patch libtermkey with new Win32 PDCurses driver for unified key/mouse input. Update CDK patch to always use libtermkey and to ignore mouse events. Requires Scinterm r97 (changeset 8d1a625c9b4d). Thanks to Chris Emerson for proof of concept code that handles mouse events and for the code that focuses and resizes views. --- core/events.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'core/events.lua') diff --git a/core/events.lua b/core/events.lua index 56331196..c63e98a8 100644 --- a/core/events.lua +++ b/core/events.lua @@ -192,6 +192,18 @@ local M = {} -- Arguments: -- -- * _`menu_id`_: The numeric ID of the menu item set in [`ui.menu()`](). +-- @field MOUSE (string) +-- Emitted by the terminal version for an unhandled mouse event. +-- Arguments: +-- +-- * _`event`_: The mouse event: `buffer.MOUSE_PRESS`, `buffer.MOUSE_DRAG`, or +-- `buffer.MOUSE_RELEASE`. +-- * _`button`_: The mouse button number. +-- * _`y`_: The y-coordinate of the mouse event, starting from 1. +-- * _`x`_: The x-coordinate of the mouse event, starting from 1. +-- * _`shift`_: The "Shift" modifier key is held down. +-- * _`ctrl`_: The "Control" modifier key is held down. +-- * _`alt`_: The "Alt"/"Option" modifier key is held down. -- @field QUIT (string) -- Emitted when quitting Textadept. -- When connecting to this event, connect with an index of 1 or the handler @@ -366,9 +378,9 @@ for _, n in pairs(scnotifications) do M[n[1]:upper()] = n[1] end local ta_events = { 'appleevent_odoc', 'buffer_after_switch', 'buffer_before_switch', 'buffer_deleted', 'buffer_new', 'csi', 'error', 'find', 'focus', - 'initialized', 'keypress', 'menu_clicked', 'quit', 'replace', 'replace_all', - 'reset_after', 'reset_before', 'view_after_switch', 'view_before_switch', - 'view_new' + 'initialized', 'keypress', 'menu_clicked', 'mouse', 'quit', 'replace', + 'replace_all', 'reset_after', 'reset_before', 'view_after_switch', + 'view_before_switch', 'view_new' } for _, e in pairs(ta_events) do M[e:upper()] = e end -- cgit v1.2.3