Tk Source Code

Check-in [27b9615d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 2949774]: cascade menus should popdown ofter loosing the pointer.

When the pointer moves to another entry from a cascade entry the sub-menu should popdown. This is how other menus on X11 work today. This effect will not be used if the user has configured ClickToFocus to maintain the previous Tk menu effects.

(backported from trunk)

Signed-off-by: Pat Thoyts <[email protected]>

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 27b9615d2c9cdec2cd2d88e8146ca626e8e9dff1
User & Date: patthoyts 2011-04-30 22:28:14
Context
2011-04-30
22:29
[Bug 3294593] fix menu unposting under some conditions.

Moving the pointer off a cascaded submenu over the application window and then back to the parent menu window on a non-cascade entry would leave the submenu displayed when it should be unposted. This patch solves this issue.

Suggested-by: Schelte Bron <[email protected]> Signed-off-by: Pat Thoyts <[email protected]> check-in: a337b2c4 user: patthoyts tags: core-8-5-branch

22:28
[Bug 2949774]: cascade menus should popdown ofter loosing the pointer.

When the pointer moves to another entry from a cascade entry the sub-menu should popdown. This is how other menus on X11 work today. This effect will not be used if the user has configured ClickToFocus to maintain the previous Tk menu effects.

(backported from trunk)

Signed-off-by: Pat Thoyts <[email protected]> check-in: 27b9615d user: patthoyts tags: core-8-5-branch

2011-04-22
18:21
[Bug 3291543] There was a crash if dchars removed all coordinates of a polygon. check-in: 7262cbf0 user: pspjuth tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to library/menu.tcl.

404
405
406
407
408
409
410


411
412
413
414
415
416
417
    set Priv(focus) ""

    # Unpost menu(s) and restore some stuff that's dependent on
    # what was posted.

    after cancel [array get Priv menuActivatedTimer]
    unset -nocomplain Priv(menuActivated)



    catch {
	if {$mb ne ""} {
	    set menu [$mb cget -menu]
	    $menu unpost
	    set Priv(postedMb) {}
	    if {$::tk_strictMotif} {







>
>







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
    set Priv(focus) ""

    # Unpost menu(s) and restore some stuff that's dependent on
    # what was posted.

    after cancel [array get Priv menuActivatedTimer]
    unset -nocomplain Priv(menuActivated)
    after cancel [array get Priv menuDeactivatedTimer]
    unset -nocomplain Priv(menuDeactivated)

    catch {
	if {$mb ne ""} {
	    set menu [$mb cget -menu]
	    $menu unpost
	    set Priv(postedMb) {}
	    if {$::tk_strictMotif} {
559
560
561
562
563
564
565
566
567
568
569
570





571
572

573
574
575
576
577
578
579
	} else {
	    $menu activate @$x,$y
	    GenerateMenuSelect $menu
	}
        set index [$menu index @$x,$y]
        if {[info exists Priv(menuActivated)] \
                && $index ne "none" \
                && $index ne $activeindex \
                && [$menu type $index] eq "cascade"} {
            set mode [option get $menu clickToFocus ClickToFocus]
            if {$mode eq "" || ([string is boolean $mode] && !$mode)} {
                set delay [expr {[$menu cget -type] eq "menubar"? 0 : 50}]





                set Priv(menuActivatedTimer) \
                    [after $delay [list $menu postcascade active]]

            }
        }
    }
}

# ::tk::MenuButtonDown --
# Handles button presses in menus.  There are a couple of tricky things







|
<


|
>
>
>
>
>
|
|
>







561
562
563
564
565
566
567
568

569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
	} else {
	    $menu activate @$x,$y
	    GenerateMenuSelect $menu
	}
        set index [$menu index @$x,$y]
        if {[info exists Priv(menuActivated)] \
                && $index ne "none" \
                && $index ne $activeindex} {

            set mode [option get $menu clickToFocus ClickToFocus]
            if {$mode eq "" || ([string is boolean $mode] && !$mode)} {
                set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}]
                if {[$menu type $activeindex] eq "cascade"} {
                    set Priv(menuDeactivatedTimer) \
                        [after $delay [list $menu postcascade none]]
                }
                if {[$menu type $index] eq "cascade"} {
                    set Priv(menuActivatedTimer) \
                        [after $delay [list $menu postcascade active]]
                }
            }
        }
    }
}

# ::tk::MenuButtonDown --
# Handles button presses in menus.  There are a couple of tricky things