Skip to content

Commit

Permalink
Eliminate SUPPORT_ADDITIONAL_MOTION_SYNTAX (always 1) too
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Dec 11, 2024
1 parent 2d5fef1 commit 8005dc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
24 changes: 4 additions & 20 deletions generic/tkBind.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
* Non-package-specific helpers.
*/

/*
* Traditionally motion events can be combined with buttons in this way: <B1-B2-Motion>.
* However it should be allowed to express this as <Motion-1-2> in addition. This is achieved
* by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1.
*/

#ifndef SUPPORT_ADDITIONAL_MOTION_SYNTAX
# define SUPPORT_ADDITIONAL_MOTION_SYNTAX 1
#endif

/*
* The output for motion events is of the type <B1-Motion>. This can be changed to become
* <Motion-1> instead by setting PRINT_SHORT_MOTION_SYNTAX to 1, however this would be a
Expand All @@ -69,11 +59,6 @@
# define PRINT_SHORT_MOTION_SYNTAX 0 /* set to 1 if wanted */
#endif

#if !SUPPORT_ADDITIONAL_MOTION_SYNTAX
# undef PRINT_SHORT_MOTION_SYNTAX
# define PRINT_SHORT_MOTION_SYNTAX 0
#endif

/*
* For debugging only, normally set to zero.
*/
Expand Down Expand Up @@ -3015,7 +3000,7 @@ ExpandPercents(
for (string = before; *string && *string != '%'; ++string)
;
if (string != before) {
Tcl_DStringAppend(dsPtr, before, (Tcl_Size)(string - before));
Tcl_DStringAppend(dsPtr, before, string - before);
before = string;
}
if (!*before) {
Expand Down Expand Up @@ -4991,6 +4976,7 @@ ParseEventDescription(
eventFlags = 0;
if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) {
const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr);

patPtr->eventType = eiPtr->type;
eventFlags = flagArray[eiPtr->type];
eventMask = eiPtr->eventMask;
Expand All @@ -5001,7 +4987,7 @@ ParseEventDescription(

if ((eventFlags & BUTTON)
|| (button && eventFlags == 0)
|| (SUPPORT_ADDITIONAL_MOTION_SYNTAX && (eventFlags & MOTION) && button == 0)) {
|| ((eventFlags & MOTION) && button == 0)) {
/* This must be a button (or bad motion) event. */
if (button == 0) {
return FinalizeParseEventDescription(
Expand All @@ -5028,14 +5014,13 @@ ParseEventDescription(
eventMask = KeyPressMask;
}
} else if (button) {
if (!SUPPORT_ADDITIONAL_MOTION_SYNTAX || patPtr->eventType != MotionNotify) {
if (patPtr->eventType != MotionNotify) {
return FinalizeParseEventDescription(
interp,
patPtr, 0,
Tcl_ObjPrintf("specified button \"%s\" for non-button event", field),
"NON_BUTTON");
}
#if SUPPORT_ADDITIONAL_MOTION_SYNTAX
patPtr->modMask |= Tk_GetButtonMask(button);
p = SkipFieldDelims(p);
while (*p && *p != '>') {
Expand All @@ -5049,7 +5034,6 @@ ParseEventDescription(
patPtr->modMask |= Tk_GetButtonMask(button);
}
patPtr->info = ButtonNumberFromState(patPtr->modMask);
#endif
} else {
return FinalizeParseEventDescription(
interp,
Expand Down
4 changes: 2 additions & 2 deletions tests/wm.test
Original file line number Diff line number Diff line change
Expand Up @@ -1511,10 +1511,10 @@ test wm-stackorder-2.3 {stacking order} -body {
toplevel .t2
tkwait visibility .t2
raiseDelay
lappend res [wm stackorder .]
lappend res [wm stackorder .]
raise .
raiseDelay
lappend res [wm stackorder .]
lappend res [wm stackorder .]
raise .t2
raiseDelay
lappend res [wm stackorder .]
Expand Down

0 comments on commit 8005dc4

Please sign in to comment.