| ︙ | | | ︙ | |
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
#ifdef RDB_DEBUG_PATCH
debug((25, "reset_window() -> font resize to (%d,%d)",
font_width, font_height));
#endif
}
}
static void click(Mouse_Button b, int x, int y, int shift, int ctrl)
{
int thistime = GetMessageTime();
if (send_raw_mouse && !(cfg.mouse_override && shift)) {
lastbtn = MBT_NOTHING;
term_mouse(b, MA_CLICK, x, y, shift, ctrl);
return;
}
if (lastbtn == b && thistime - lasttime < dbltime) {
lastact = (lastact == MA_CLICK ? MA_2CLK :
lastact == MA_2CLK ? MA_3CLK :
lastact == MA_3CLK ? MA_CLICK : MA_NOTHING);
} else {
lastbtn = b;
lastact = MA_CLICK;
}
if (lastact != MA_NOTHING)
term_mouse(b, lastact, x, y, shift, ctrl);
lasttime = thistime;
}
/*
* Translate a raw mouse button designation (LEFT, MIDDLE, RIGHT)
* into a cooked one (SELECT, EXTEND, PASTE).
*/
|
|
|
|
|
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
#ifdef RDB_DEBUG_PATCH
debug((25, "reset_window() -> font resize to (%d,%d)",
font_width, font_height));
#endif
}
}
static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
{
int thistime = GetMessageTime();
if (send_raw_mouse && !(cfg.mouse_override && shift)) {
lastbtn = MBT_NOTHING;
term_mouse(b, MA_CLICK, x, y, shift, ctrl, alt);
return;
}
if (lastbtn == b && thistime - lasttime < dbltime) {
lastact = (lastact == MA_CLICK ? MA_2CLK :
lastact == MA_2CLK ? MA_3CLK :
lastact == MA_3CLK ? MA_CLICK : MA_NOTHING);
} else {
lastbtn = b;
lastact = MA_CLICK;
}
if (lastact != MA_NOTHING)
term_mouse(b, lastact, x, y, shift, ctrl, alt);
lasttime = thistime;
}
/*
* Translate a raw mouse button designation (LEFT, MIDDLE, RIGHT)
* into a cooked one (SELECT, EXTEND, PASTE).
*/
|
| ︙ | | | ︙ | |
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
|
show = 1;
if (cursor_visible && !show)
ShowCursor(FALSE);
else if (!cursor_visible && show)
ShowCursor(TRUE);
cursor_visible = show;
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
static int ignore_clip = FALSE;
static int resizing = FALSE;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
|
show = 1;
if (cursor_visible && !show)
ShowCursor(FALSE);
else if (!cursor_visible && show)
ShowCursor(TRUE);
cursor_visible = show;
}
static int is_alt_pressed(void)
{
BYTE keystate[256];
int r = GetKeyboardState(keystate);
if (!r)
return FALSE;
if (keystate[VK_MENU] & 0x80)
return TRUE;
if (keystate[VK_RMENU] & 0x80)
return TRUE;
return FALSE;
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
static int ignore_clip = FALSE;
static int resizing = FALSE;
|
| ︙ | | | ︙ | |
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
|
b = MBT_WHEEL_DOWN;
wheel_accumulator += WHEEL_DELTA;
} else
break;
if (send_raw_mouse) {
/* send a mouse-down followed by a mouse up */
term_mouse(b,
MA_CLICK,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL);
term_mouse(b, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL);
} else {
/* trigger a scroll */
term_scroll(0,
b == MBT_WHEEL_UP ? -rows / 2 : rows / 2);
}
}
return 0;
}
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
{
int button, press;
switch (message) {
case WM_LBUTTONDOWN:
button = MBT_LEFT;
press = 1;
break;
case WM_MBUTTONDOWN:
button = MBT_MIDDLE;
|
>
|
|
>
|
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
|
b = MBT_WHEEL_DOWN;
wheel_accumulator += WHEEL_DELTA;
} else
break;
if (send_raw_mouse) {
/* send a mouse-down followed by a mouse up */
term_mouse(b,
MA_CLICK,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
term_mouse(b, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
} else {
/* trigger a scroll */
term_scroll(0,
b == MBT_WHEEL_UP ? -rows / 2 : rows / 2);
}
}
return 0;
}
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
{
int button, press;
switch (message) {
case WM_LBUTTONDOWN:
button = MBT_LEFT;
press = 1;
break;
case WM_MBUTTONDOWN:
button = MBT_MIDDLE;
|
| ︙ | | | ︙ | |
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
|
default:
button = press = 0; /* shouldn't happen */
}
show_mouseptr(1);
if (press) {
click(button,
TO_CHR_X(X_POS(lParam)), TO_CHR_Y(Y_POS(lParam)),
wParam & MK_SHIFT, wParam & MK_CONTROL);
SetCapture(hwnd);
} else {
term_mouse(button, MA_RELEASE,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL);
ReleaseCapture();
}
}
return 0;
case WM_MOUSEMOVE:
show_mouseptr(1);
/*
|
|
>
|
|
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
|
default:
button = press = 0; /* shouldn't happen */
}
show_mouseptr(1);
if (press) {
click(button,
TO_CHR_X(X_POS(lParam)), TO_CHR_Y(Y_POS(lParam)),
wParam & MK_SHIFT, wParam & MK_CONTROL,
is_alt_pressed());
SetCapture(hwnd);
} else {
term_mouse(button, MA_RELEASE,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
ReleaseCapture();
}
}
return 0;
case WM_MOUSEMOVE:
show_mouseptr(1);
/*
|
| ︙ | | | ︙ | |
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
|
b = MBT_LEFT;
else if (wParam & MK_MBUTTON)
b = MBT_MIDDLE;
else
b = MBT_RIGHT;
term_mouse(b, MA_DRAG, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL);
}
return 0;
case WM_NCMOUSEMOVE:
show_mouseptr(1);
noise_ultralight(lParam);
return 0;
case WM_IGNORE_CLIP:
|
|
|
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
|
b = MBT_LEFT;
else if (wParam & MK_MBUTTON)
b = MBT_MIDDLE;
else
b = MBT_RIGHT;
term_mouse(b, MA_DRAG, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
}
return 0;
case WM_NCMOUSEMOVE:
show_mouseptr(1);
noise_ultralight(lParam);
return 0;
case WM_IGNORE_CLIP:
|
| ︙ | | | ︙ | |