summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-15 13:08:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-15 13:08:36 (GMT)
commit003ddcc0f4d523d81ae9e2401549a189fe9fec79 (patch)
treec918ee43530387a9961aca8b3eef136a3d3e6396 /win/tkWinX.c
parent6c0f9c52947c3a5f4508a694723e355e9a653ce6 (diff)
parentdc8dcbced6e03edb40b76e2108e6a4ecf6ff37fd (diff)
downloadtk-003ddcc0f4d523d81ae9e2401549a189fe9fec79.zip
tk-003ddcc0f4d523d81ae9e2401549a189fe9fec79.tar.gz
tk-003ddcc0f4d523d81ae9e2401549a189fe9fec79.tar.bz2
Merge 8.6
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 34fabc9..3a55c0c 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -94,7 +94,7 @@ static Tcl_ThreadDataKey dataKey;
static void GenerateXEvent(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam);
-static void GetTranslatedKey(XKeyEvent *xkey, UINT type);
+static void GetTranslatedKey(TkKeyEvent *xkey, UINT type);
static void UpdateInputLanguage(int charset);
static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
@@ -981,7 +981,7 @@ GenerateXEvent(
WPARAM wParam,
LPARAM lParam)
{
- XEvent event;
+ union {XEvent x; TkKeyEvent key;} event;
TkWindow *winPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1007,33 +1007,33 @@ GenerateXEvent(
return;
}
- memset(&event, 0, sizeof(XEvent));
- event.xany.serial = winPtr->display->request++;
- event.xany.send_event = False;
- event.xany.display = winPtr->display;
- event.xany.window = winPtr->window;
+ memset(&event.x, 0, sizeof(XEvent));
+ event.x.xany.serial = winPtr->display->request++;
+ event.x.xany.send_event = False;
+ event.x.xany.display = winPtr->display;
+ event.x.xany.window = winPtr->window;
switch (message) {
case WM_PAINT: {
PAINTSTRUCT ps;
- event.type = Expose;
+ event.x.type = Expose;
BeginPaint(hwnd, &ps);
- event.xexpose.x = ps.rcPaint.left;
- event.xexpose.y = ps.rcPaint.top;
- event.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
- event.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
+ event.x.xexpose.x = ps.rcPaint.left;
+ event.x.xexpose.y = ps.rcPaint.top;
+ event.x.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
+ event.x.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
EndPaint(hwnd, &ps);
- event.xexpose.count = 0;
+ event.x.xexpose.count = 0;
break;
}
case WM_CLOSE:
- event.type = ClientMessage;
- event.xclient.message_type =
+ event.x.type = ClientMessage;
+ event.x.xclient.message_type =
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
- event.xclient.format = 32;
- event.xclient.data.l[0] =
+ event.x.xclient.format = 32;
+ event.x.xclient.data.l[0] =
Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW");
break;
@@ -1069,10 +1069,10 @@ GenerateXEvent(
return;
}
- event.xany.window = winPtr->window;
- event.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
- event.xfocus.mode = NotifyNormal;
- event.xfocus.detail = NotifyNonlinear;
+ event.x.xany.window = winPtr->window;
+ event.x.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
+ event.x.xfocus.mode = NotifyNormal;
+ event.x.xfocus.detail = NotifyNonlinear;
/*
* Destroy the caret if we own it. If we are moving to another Tk
@@ -1094,10 +1094,10 @@ GenerateXEvent(
return;
}
- event.type = SelectionClear;
- event.xselectionclear.selection =
+ event.x.type = SelectionClear;
+ event.x.xselectionclear.selection =
Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD");
- event.xselectionclear.time = TkpGetMS();
+ event.x.xselectionclear.time = TkpGetMS();
break;
case WM_MOUSEWHEEL:
@@ -1126,15 +1126,15 @@ GenerateXEvent(
* Set up the common event fields.
*/
- event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
- event.xbutton.subwindow = None;
- event.xbutton.x = clientPoint.x;
- event.xbutton.y = clientPoint.y;
- event.xbutton.x_root = root.point.x;
- event.xbutton.y_root = root.point.y;
- event.xbutton.state = state;
- event.xbutton.time = time;
- event.xbutton.same_screen = True;
+ event.x.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
+ event.x.xbutton.subwindow = None;
+ event.x.xbutton.x = clientPoint.x;
+ event.x.xbutton.y = clientPoint.y;
+ event.x.xbutton.x_root = root.point.x;
+ event.x.xbutton.y_root = root.point.y;
+ event.x.xbutton.state = state;
+ event.x.xbutton.time = time;
+ event.x.xbutton.same_screen = True;
/*
* Now set up event specific fields.
@@ -1166,10 +1166,10 @@ GenerateXEvent(
* TkpGetString. [Bug 1118340].
*/
- event.type = MouseWheelEvent;
- event.xany.send_event = -1;
- event.xkey.nbytes = 0;
- event.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA;
break;
}
@@ -1198,11 +1198,11 @@ GenerateXEvent(
* 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;
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state |= ShiftMask;
+ event.x.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA;
break;
}
@@ -1216,10 +1216,10 @@ GenerateXEvent(
* MBCS characters that came from the TranslateMessage call.
*/
- event.type = KeyPress;
- event.xany.send_event = -1;
- event.xkey.keycode = wParam;
- GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR :
+ event.x.type = KeyPress;
+ event.x.xany.send_event = -1;
+ event.x.xkey.keycode = wParam;
+ GetTranslatedKey(&event.key, (message == WM_KEYDOWN) ? WM_CHAR :
WM_SYSCHAR);
break;
@@ -1231,9 +1231,9 @@ GenerateXEvent(
* WM_CHAR messages which will follow.
*/
- event.type = KeyRelease;
- event.xkey.keycode = wParam;
- event.xkey.nbytes = 0;
+ event.x.type = KeyRelease;
+ event.x.xkey.keycode = wParam;
+ event.key.nbytes = 0;
break;
case WM_CHAR:
@@ -1267,9 +1267,9 @@ GenerateXEvent(
* character.
*/
- event.type = KeyPress;
- event.xany.send_event = -1;
- event.xkey.keycode = 0;
+ event.x.type = KeyPress;
+ event.x.xany.send_event = -1;
+ event.x.xkey.keycode = 0;
if ((int)wParam & 0xff00) {
int ch1 = wParam & 0xffff;
@@ -1282,12 +1282,12 @@ GenerateXEvent(
(ch1 & 0x3ff) | 0x10000;
tsdPtr->surrogateBuffer = 0;
}
- event.xany.send_event = -3;
- event.xkey.nbytes = 0;
- event.xkey.keycode = ch1;
+ event.x.xany.send_event = -3;
+ event.key.nbytes = 0;
+ event.x.xkey.keycode = ch1;
} else {
- event.xkey.nbytes = 1;
- event.xkey.trans_chars[0] = (char) wParam;
+ event.key.nbytes = 1;
+ event.key.trans_chars[0] = (char) wParam;
if (IsDBCSLeadByte((BYTE) wParam)) {
MSG msg;
@@ -1296,22 +1296,22 @@ GenerateXEvent(
PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR);
- event.xkey.nbytes = 2;
- event.xkey.trans_chars[1] = (char) msg.wParam;
+ event.key.nbytes = 2;
+ event.key.trans_chars[1] = (char) msg.wParam;
}
}
}
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
+ Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
+ event.x.type = KeyRelease;
break;
case WM_UNICHAR: {
- event.type = KeyPress;
- event.xany.send_event = -3;
- event.xkey.keycode = wParam;
- event.xkey.nbytes = 0;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
- event.type = KeyRelease;
+ event.x.type = KeyPress;
+ event.x.xany.send_event = -3;
+ event.x.xkey.keycode = wParam;
+ event.key.nbytes = 0;
+ Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
+ event.x.type = KeyRelease;
break;
}
@@ -1332,7 +1332,7 @@ GenerateXEvent(
* Post the translated event to the main Tk event queue.
*/
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
}
/*
@@ -1434,7 +1434,7 @@ GetState(
static void
GetTranslatedKey(
- XKeyEvent *xkey,
+ TkKeyEvent *xkey,
UINT type)
{
MSG msg;
@@ -1457,7 +1457,7 @@ GetTranslatedKey(
*/
if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) {
- xkey->state = 0;
+ xkey->keyEvent.state = 0;
}
xkey->trans_chars[xkey->nbytes++] = (char) msg.wParam;