You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, when using the Win32 Console API, vtm reports mouse events with fractional mouse coordinates. Fractional coordinates are 32-bit floating-point numbers that represent the position of the cursor relative to the console's grid of text cells. Screen pixel coordinates can be calculated by multiplying the fractional coordinates by the cell size.
148
+
149
+
Example:
150
+
```c++
151
+
#include <iostream>
152
+
#include <vector>
153
+
#include <windows.h>
154
+
155
+
static constexpr auto custom_type = 0b1000'0000'0000'0000;
std::cout << "MOUSE_EVENT coord: " << x << "," << y << "\n";
197
+
}
198
+
}
199
+
}
200
+
}
201
+
```
202
+
144
203
### Window menu
145
204
146
205
It is possible to create your own terminal window menu from scratch by configuring own menu items in the `<config/terminal/menu/>` subsection of the configuration file. See (`doc/settings.md#event-scripting`)[https://github.com/directvt/vtm/blob/master/doc/settings.md#event-scripting] for details.
`kbmods=<KeyMods>` | Keyboard modifiers (see Keyboard event).
361
361
`coord=<X>,<Y>` | Pixel-wise coordinates of the mouse pointer. Each coordinate is represented in the form of a floating point value of the sum of the integer coordinate of the cell in the terminal window grid and the relative offset within the cell in the range `[0.0f, 1.0f)`.
362
362
`buttons=<ButtonState>` | Mouse button state.
363
-
`wheel=<DeltaY>[,<DeltaX>]` | Vertical and horizontal high-resolution wheel delta integer value.
363
+
`scroll=<DeltaX>,<DeltaY>` | Integer value of highresolution horizontal and vertical scroll delta in integer 1/120 units.
364
364
365
365
In response to the activation of `mouse` tracking, the application receives a vt-sequence containing current mouse state:
366
366
```
@@ -378,6 +378,8 @@ Bit | Active button
378
378
2 | Middle
379
379
3 | 4th
380
380
4 | 5th
381
+
... | ...
382
+
N-1 | Nth
381
383
382
384
Note: Mouse tracking will continue outside the terminal window as long as the mouse button pressed inside the window is active. In this case, coordinates with negative values are possible.
auto moved = gear.m_sys.buttons == gear.m_sav.buttons && gear.m_sys.wheelfp == 0.f; // No events means mouse move. MSFT: "MOUSE_EVENT_RECORD::dwEventFlags: If this value is zero, it indicates a mouse button being pressed or released". Far Manager relies on this.
@@ -982,7 +988,7 @@ struct impl : consrv
982
988
{
983
989
auto& s = dclick[i];
984
990
auto fired = gear.m_sys.timecod;
985
-
if (fired - s.fired < gear.delay && s.coord == coord) // Set the double-click flag if the delay has not expired and the mouse is in the same position.
991
+
if (fired - s.fired < gear.delay && s.coord == twod{ coord }) // Set the double-click flag if the delay has not expired and the mouse is in the same cell.
986
992
{
987
993
flags |= DOUBLE_CLICK;
988
994
s.fired = {};
@@ -1003,6 +1009,8 @@ struct impl : consrv
1003
1009
if (gear.m_sys.hzwheel) flags |= MOUSE_HWHEELED;
1004
1010
}
1005
1011
auto lock = std::lock_guard{ locker };
1012
+
auto r2 = nt::console::fp2d_mouse_input{ .coord = coord };
0 commit comments