Tk Source Code

Artifact [495e3bc6]
Login

Artifact 495e3bc64e859d702b97e5c0ae41e08d665ac3b42fd790423e100dcb7a258297:

Attachment "exercise.tcl" to ticket [3ed5b669] added by erikleunissen 2019-09-14 17:42:02. (unpublished)
#! /usr/bin/tclsh

package require Tk


# this is not essential, only useful for recognizing on screen.
. configure -highlightbackground red

# Note:
# - Root window may NOT be positioned at [0,0] in order to exercise the bug.
# - In my setup under Windows 7, the geometry values below were good
#   to show the buggy position offset.
wm geometry . 400x400+100+100

proc handleEvent {event W X Y} {
	puts "$event $X $Y"
	
	# Note: background colors are not essential for exercising the bug,
	# they are just useful for recognizing positions on screen.
	#
	# It's the (change of) highlightthickness that triggers the bug.
	if {$event eq "<Enter>"} {
		$W configure -bg #55CCFF -highlightthickness 2
	} else {
		$W configure -bg #FFAAAA -highlightthickness 0
	}
}

# Bindings on the root window only (for now). I didn't observe the bug on
# child widgets, but I think it's wise to test that more rigourously later.
bind . <Enter> {handleEvent <Enter> %W %X %Y}
bind . <Leave> {handleEvent <Leave> %W %X %Y}

# EOF