Skip to content

Commit

Permalink
merge trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
fvogelnew1 committed Dec 12, 2024
2 parents d359179 + 6bc9125 commit 0348137
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 174 deletions.
5 changes: 3 additions & 2 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Release Tk 9.0.1 arises from the check-in with tag `core-9-0-1`.
- [Tk intialization overwrites thread specific data](https://core.tcl-lang.org/tk/tktview/bcbf4c)
- [File clamTheme.tcl misses code related to the -indicatorforeground option](https://core.tcl-lang.org/tk/tktview/a69fd7)
- [Segfault when using menu(button) with the -font option](https://core.tcl-lang.org/tk/tktview/8ce672)
- [TIP #706: Expose three Tk "In Context" functions via stubs table](https://core.tcl-lang.org/tips/doc/trunk/tip/706.md)
- [Bind mechanism vs. GNOME](https://core.tcl-lang.org/tk/tktview/6bdf1a)
- [many PIXEL options don't keep their configured value](https://core.tcl-lang.org/tk/tktview/29ba53)

Release Tk 9.0.0 arises from the check-in with tag `core-9-0-0`.

Expand Down Expand Up @@ -54,10 +57,8 @@ writing Tcl scripts containing Tk commands.
- Read/write access to photo image metadata

## Known bugs
- [many PIXEL options don't keep their configured value](https://core.tcl-lang.org/tk/tktview/29ba53)
- [Inconsistent reporting of child geometry changes to grid container](https://core.tcl-lang.org/tk/tktview/beaa8e)
- [Inconsistency in whether widgets allow negative borderwidths](https://core.tcl-lang.org/tk/tktview/5f739d)
- [Enter key works differently in Windows and Linux](https://core.tcl-lang.org/tk/tktview/b3a1b9)
- [slow widget creation if default font is not used](https://core.tcl-lang.org/tk/tktview/8da7af)
- [The wm manage command does not work on current macOS versions](https://core.tcl-lang.org/tk/tktview/8a6012)
- [Slow processing irregular transparencies](https://core.tcl-lang.org/tk/tktview/919066)
Expand Down
48 changes: 9 additions & 39 deletions generic/tkBind.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,6 @@
* Non-package-specific helpers.
*/

/*
* In old implementation (the one that used an event ring), <Double-1> and <1><1> were
* equivalent sequences. However it is logical to give <Double-1> higher precedence
* since it is more specific. Indeed <Double-1> includes time and space requirements,
* which is not the case for <1><1>.
* This is achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1.
*/

#ifndef PREFER_MOST_SPECIALIZED_EVENT
# define PREFER_MOST_SPECIALIZED_EVENT 1
#endif

/*
* 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 @@ -81,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 @@ -2131,13 +2104,12 @@ IsBetterMatch(
if (diff > 0) { return 1; }
if (diff < 0) { return 0; }

#if PREFER_MOST_SPECIALIZED_EVENT
{ /* local scope */
#define M (Tcl_WideUInt)1000000
static const Tcl_WideUInt weight[5] = { 0, 1, M, M*M, M*M*M };
#define M 1000000ULL
static const unsigned long long weight[5] = { 0, 1, M, M*M, M*M*M };
#undef M
Tcl_WideUInt fstCount = 0;
Tcl_WideUInt sndCount = 0;
unsigned long long fstCount = 0;
unsigned long long sndCount = 0;
unsigned i;

/*
Expand All @@ -2159,7 +2131,6 @@ IsBetterMatch(
if (sndCount > fstCount) { return 1; }
if (sndCount < fstCount) { return 0; }
}
#endif

return sndMatchPtr->number > fstMatchPtr->number;
}
Expand Down Expand Up @@ -3029,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 @@ -5005,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 @@ -5015,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 @@ -5042,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 @@ -5063,7 +5034,6 @@ ParseEventDescription(
patPtr->modMask |= Tk_GetButtonMask(button);
}
patPtr->info = ButtonNumberFromState(patPtr->modMask);
#endif
} else {
return FinalizeParseEventDescription(
interp,
Expand Down Expand Up @@ -5209,7 +5179,7 @@ GetPatternObj(
modMask = patPtr->modMask;
#if PRINT_SHORT_MOTION_SYNTAX
if (patPtr->eventType == MotionNotify) {
modMask &= ~(ModMask)ALL_BUTTONS;
modMask &= ~(unsigned)ALL_BUTTONS;
}
#endif

Expand Down
16 changes: 12 additions & 4 deletions generic/tkInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1028,17 +1028,25 @@ typedef struct TkpClipMask {
# define Button9 9
#endif

/*
* The Button<B>Mask modifiers for <B> in {6 7 8 9}
* are internally used by Tk. They must be above the
* AnyModifier bit since anything below is reserved
* for the X protocol. If a future X11 version
* defines these, we adhere.
*/

#ifndef Button6Mask
# define Button6Mask (1<<13)
# define Button6Mask (AnyModifier<<6)
#endif
#ifndef Button7Mask
# define Button7Mask (1<<14)
# define Button7Mask (AnyModifier<<7)
#endif
#ifndef Button8Mask
# define Button8Mask (AnyModifier<<4)
# define Button8Mask (AnyModifier<<8)
#endif
#ifndef Button9Mask
# define Button9Mask (AnyModifier<<5)
# define Button9Mask (AnyModifier<<9)
#endif

/*
Expand Down
Loading

0 comments on commit 0348137

Please sign in to comment.