Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not define "ControlMask" as a macro in pTk/mTk/xlib/X11/X.h #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Xlib/X/X.xs
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ int arg;
goto not_there;
#endif
if (strEQ(name, "ControlMask"))
#ifdef ControlMask
return ControlMask;
#ifdef ControlMask2
return ControlMask2;
#else
goto not_there;
#endif
Expand Down
2 changes: 1 addition & 1 deletion pTk/mTk/generic/tkBind.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ typedef struct {
#define MULT_CLICKS 7

static ModInfo modArray[] = {
{"Control", ControlMask, 0},
{"Control", ControlMask2, 0},
{"Shift", ShiftMask, 0},
{"Lock", LockMask, 0},
{"Meta", META_MASK, 0},
Expand Down
8 changes: 4 additions & 4 deletions pTk/mTk/win/tkWinKey.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ KeycodeToKeysym(keycode, state, noascii)
memset(keys, 0, 256);
if (state & ShiftMask)
keys[VK_SHIFT] = 0x80;
if (state & ControlMask)
if (state & ControlMask2)
keys[VK_CONTROL] = 0x80;
if (state & Mod2Mask)
keys[VK_MENU] = 0x80;
Expand Down Expand Up @@ -395,8 +395,8 @@ TkpGetKeySym(dispPtr, eventPtr)
* is no keysym defined, try without the modifiers.
*/

if ((sym == NoSymbol) && ((state & ControlMask) || (state & Mod2Mask))) {
state &= ~(ControlMask | Mod2Mask);
if ((sym == NoSymbol) && ((state & ControlMask2) || (state & Mod2Mask))) {
state &= ~(ControlMask2 | Mod2Mask);
sym = KeycodeToKeysym(eventPtr->xkey.keycode, state, 0);
}
if ((sym == NoSymbol) && (state & ShiftMask)) {
Expand Down Expand Up @@ -578,7 +578,7 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
if (shift & 1)
eventPtr->xkey.state |= ShiftMask;
if (shift & 2)
eventPtr->xkey.state |= ControlMask;
eventPtr->xkey.state |= ControlMask2;
if (shift & 4)
eventPtr->xkey.state |= Mod2Mask;
eventPtr->xkey.keycode = (KeyCode) (result & 0xff);
Expand Down
2 changes: 1 addition & 1 deletion pTk/mTk/win/tkWinPointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TkWinGetModifierState()
state |= ShiftMask;
}
if (GetKeyState(VK_CONTROL) & 0x8000) {
state |= ControlMask;
state |= ControlMask2;
}
if (GetKeyState(VK_MENU) & 0x8000) {
state |= ALT_MASK;
Expand Down
4 changes: 2 additions & 2 deletions pTk/mTk/win/tkWinX.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ GetState(message, wParam, lParam)
mask = ShiftMask;
break;
case VK_CONTROL:
mask = ControlMask;
mask = ControlMask2;
break;
case VK_MENU:
mask = ALT_MASK;
Expand Down Expand Up @@ -1666,7 +1666,7 @@ TkWinResendEvent(wndproc, hwnd, eventPtr)
if (eventPtr->xbutton.state & ShiftMask) {
wparam |= MK_SHIFT;
}
if (eventPtr->xbutton.state & ControlMask) {
if (eventPtr->xbutton.state & ControlMask2) {
wparam |= MK_CONTROL;
}
lparam = MAKELPARAM((short) eventPtr->xbutton.x,
Expand Down
5 changes: 4 additions & 1 deletion pTk/mTk/xlib/X11/X.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ are reserved in the protocol for errors and replies. */

#define ShiftMask (1<<0)
#define LockMask (1<<1)
#define ControlMask (1<<2)
/* Use ControlMask2 due to conflict with ControlMask defined in processthreadsapi.h
for Win32, see https://github.com/eserte/perl-tk/issues/87 for more information
*/
#define ControlMask2 (1<<2)
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
Expand Down