Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
93f1a8a273683636544ea703a19bd8d3 |
User & Date: | fvogel 2019-05-18 15:45:10.555 |
Context
2019-05-18
| ||
15:48 | Fix [0d93f2e628]: misleading error message on missed svg option check-in: dfc8b8e7 user: fvogel tags: trunk | |
15:45 | Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. check-in: 93f1a8a2 user: fvogel tags: trunk | |
15:44 | Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. check-in: d1b3d2ac user: fvogel tags: core-8-6-branch | |
2019-05-17
| ||
17:19 | Change .ext extension into .aaa in winDialog.test since some corporate policies forbid .ext extension. See https://core.tcl-lang.org/tcl/tktview/cc74e50996e20cbb6a851087b36c52eb75526aa4 check-in: bd9993e0 user: fvogel tags: trunk | |
Changes
Changes to win/tkWinX.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * The zmouse.h file includes the definition for WM_MOUSEWHEEL. */ #include <zmouse.h> /* * imm.h is needed by HandleIMEComposition */ #include <imm.h> #ifdef _MSC_VER # pragma comment (lib, "imm32.lib") | > > > > > > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * The zmouse.h file includes the definition for WM_MOUSEWHEEL. */ #include <zmouse.h> /* * WM_MOUSEHWHEEL is normally defined by Winuser.h for Vista/2008 or later, * but is also usable on 2000/XP if IntelliPoint drivers are installed. */ #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif /* * imm.h is needed by HandleIMEComposition */ #include <imm.h> #ifdef _MSC_VER # pragma comment (lib, "imm32.lib") |
︙ | ︙ | |||
67 68 69 70 71 72 73 | */ typedef struct ThreadSpecificData { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ int surrogateBuffer; /* Buffer for first of surrogate pair. */ | | > | > | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | */ typedef struct ThreadSpecificData { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ int surrogateBuffer; /* Buffer for first of surrogate pair. */ DWORD vWheelTickPrev; /* For high resolution wheels (vertical). */ DWORD hWheelTickPrev; /* For high resolution wheels (horizontal). */ short vWheelAcc; /* For high resolution wheels (vertical). */ short hWheelAcc; /* For high resolution wheels (horizontal). */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations of functions used in this file. */ |
︙ | ︙ | |||
505 506 507 508 509 510 511 512 513 514 515 516 517 518 | const char *display_name) { Screen *screen; TkWinDrawable *twdPtr; Display *display; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->winDisplay != NULL) { if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) { return tsdPtr->winDisplay; } else { return NULL; } | > | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | const char *display_name) { Screen *screen; TkWinDrawable *twdPtr; Display *display; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); DWORD initialWheelTick; if (tsdPtr->winDisplay != NULL) { if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) { return tsdPtr->winDisplay; } else { return NULL; } |
︙ | ︙ | |||
560 561 562 563 564 565 566 | TkWinDisplayChanged(display); tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; | | > > | > | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | TkWinDisplayChanged(display); tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; initialWheelTick = GetTickCount(); tsdPtr->vWheelTickPrev = initialWheelTick; tsdPtr->hWheelTickPrev = initialWheelTick; tsdPtr->vWheelAcc = 0; tsdPtr->hWheelAcc = 0; /* * Key map info must be available immediately, because of "send event". */ TkpInitKeymapInfo(tsdPtr->winDisplay); return tsdPtr->winDisplay; |
︙ | ︙ | |||
892 893 894 895 896 897 898 899 900 901 902 903 904 905 | case WM_KILLFOCUS: case WM_DESTROYCLIPBOARD: case WM_UNICHAR: case WM_CHAR: case WM_SYSKEYUP: case WM_KEYUP: case WM_MOUSEWHEEL: GenerateXEvent(hwnd, message, wParam, lParam); return 1; case WM_MENUCHAR: GenerateXEvent(hwnd, message, wParam, lParam); /* * MNC_CLOSE is the only one that looks right. This is a hack. | > | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | case WM_KILLFOCUS: case WM_DESTROYCLIPBOARD: case WM_UNICHAR: case WM_CHAR: case WM_SYSKEYUP: case WM_KEYUP: case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: GenerateXEvent(hwnd, message, wParam, lParam); return 1; case WM_MENUCHAR: GenerateXEvent(hwnd, message, wParam, lParam); /* * MNC_CLOSE is the only one that looks right. This is a hack. |
︙ | ︙ | |||
936 937 938 939 940 941 942 | LPARAM lParam) { XEvent event; TkWindow *winPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | LPARAM lParam) { XEvent event; TkWindow *winPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((message == WM_MOUSEWHEEL) || (message == WM_MOUSEHWHEEL)) { union {LPARAM lParam; POINTS point;} root; POINT pos; root.lParam = lParam; /* * Redirect mousewheel events to the window containing the cursor. * That feels much less strange to users, and is how all the other |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | event.type = SelectionClear; event.xselectionclear.selection = Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD"); event.xselectionclear.time = TkpGetMS(); break; case WM_MOUSEWHEEL: case WM_CHAR: case WM_UNICHAR: case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_KEYDOWN: case WM_KEYUP: { unsigned int state = GetState(message, wParam, lParam); | > | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | event.type = SelectionClear; event.xselectionclear.selection = Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD"); event.xselectionclear.time = TkpGetMS(); break; case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: case WM_CHAR: case WM_UNICHAR: case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_KEYDOWN: case WM_KEYUP: { unsigned int state = GetState(message, wParam, lParam); |
︙ | ︙ | |||
1092 1093 1094 1095 1096 1097 1098 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { /* | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { /* * Support for high resolution wheels (vertical). */ DWORD wheelTick = GetTickCount(); if (wheelTick - tsdPtr->vWheelTickPrev < 1500) { tsdPtr->vWheelAcc += (short) HIWORD(wParam); } else { tsdPtr->vWheelAcc = (short) HIWORD(wParam); } tsdPtr->vWheelTickPrev = wheelTick; if (abs(tsdPtr->vWheelAcc) < WHEEL_DELTA) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ event.type = MouseWheelEvent; event.xany.send_event = -1; event.xkey.nbytes = 0; event.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA; tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA; break; } case WM_MOUSEHWHEEL: { /* * Support for high resolution wheels (horizontal). */ DWORD wheelTick = GetTickCount(); if (wheelTick - tsdPtr->hWheelTickPrev < 1500) { tsdPtr->hWheelAcc -= (short) HIWORD(wParam); } else { tsdPtr->hWheelAcc = -((short) HIWORD(wParam)); } tsdPtr->hWheelTickPrev = wheelTick; if (abs(tsdPtr->hWheelAcc) < WHEEL_DELTA) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ event.type = MouseWheelEvent; event.xany.send_event = -1; event.xkey.nbytes = 0; event.xkey.state |= ShiftMask; event.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA; tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA; break; } case WM_SYSKEYDOWN: case WM_KEYDOWN: /* * Check for translated characters in the event queue. Setting * xany.send_event to -1 indicates to the Windows implementation |
︙ | ︙ |