summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-21 10:55:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-21 10:55:52 (GMT)
commit6a5d401c8ab95a3cf1033c389fbe4aba81947f70 (patch)
treea1270f881f52b1e086fc6ee946e270cb021c7f3f /generic
parentb3d84c8374a4c16f82007407a76c8357fecb8e11 (diff)
parentdbdee3437e5549936d4d0c1d4c3e0595b0cccb08 (diff)
downloadtk-6a5d401c8ab95a3cf1033c389fbe4aba81947f70.zip
tk-6a5d401c8ab95a3cf1033c389fbe4aba81947f70.tar.gz
tk-6a5d401c8ab95a3cf1033c389fbe4aba81947f70.tar.bz2
Improve implementation in tkEvent.c.
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h5
-rw-r--r--generic/tkEvent.c19
2 files changed, 12 insertions, 12 deletions
diff --git a/generic/tk.h b/generic/tk.h
index d5f876e..c7ad54b 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -92,13 +92,14 @@ extern "C" {
#ifndef RC_INVOKED
-#ifndef _XLIB_H
+#if !defined(_XLIB_H) && !defined(_X11_XLIB_H_)
# include <X11/Xlib.h>
# ifdef MAC_OSX_TK
# include <X11/X.h>
# endif
#endif
-#ifdef __STDC__
+#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
+ || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
# include <stddef.h>
#endif
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index f2393f2..2f486f0 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -578,23 +578,14 @@ UpdateButtonEventState(
case ButtonPress:
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
dispPtr->mouseButtonWindow = eventPtr->xbutton.window;
-
- if ((eventPtr->xbutton.button >= 6) && (eventPtr->xbutton.button <= 7)) {
- /* In case of X11, translate mouse buttons 6/7 to Shift-4/5 */
- eventPtr->xbutton.button -= 2;
- eventPtr->xbutton.state |= ShiftMask;
- }
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
+
dispPtr->mouseButtonState |= TkGetButtonMask(eventPtr->xbutton.button);
break;
case ButtonRelease:
dispPtr = TkGetDisplay(eventPtr->xbutton.display);
dispPtr->mouseButtonWindow = None;
- if ((eventPtr->xbutton.button >= 6) && (eventPtr->xbutton.button <= 7)) {
- /* In case of X11, translate mouse buttons 6/7 to Shift-4/5 */
- eventPtr->xbutton.button -= 2;
- }
dispPtr->mouseButtonState &= ~TkGetButtonMask(eventPtr->xbutton.button);
eventPtr->xbutton.state |= dispPtr->mouseButtonState;
break;
@@ -1218,6 +1209,14 @@ Tk_HandleEvent(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+#if !defined(MAC_OSX_TK) && !defined(_WIN32)
+ if (((eventPtr->type == ButtonPress) || (eventPtr->type == ButtonRelease))
+ && ((eventPtr->xbutton.button - 6) < 2)) {
+ eventPtr->xbutton.button -= 2;
+ eventPtr->xbutton.state |= ShiftMask;
+ }
+#endif
+
UpdateButtonEventState(eventPtr);
/*