Changeset 1342 for trunk/gui/scripts/grab.tcl
- Timestamp:
- Mar 18, 2009 2:59:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/grab.tcl
r210 r1342 41 41 set op [lindex $args 0] 42 42 if {[winfo exists $op]} { 43 43 set op "set" 44 44 } elseif {$op == "-global" && [winfo exists [lindex $args end]]} { 45 45 set op "set" 46 46 } 47 47 48 48 if {$op == "set"} { 49 50 51 52 53 54 55 56 57 49 # 50 # Handle GRAB SET specially. 51 # Add the new grab window to the grab stack. 52 # 53 set state $::Rappture::grab::state 54 set window [lindex $args end] 55 if {[lsearch -exact $args -global] >= 0} { 56 set state "-global" 57 } 58 58 59 60 61 59 if {"" != $state} { 60 # if it's a global grab, store the -global flag away for later 61 set window [linsert $window 0 $state] 62 62 63 64 65 63 # all grabs from now on are global 64 set ::Rappture::grab::state "-global" 65 } 66 66 67 68 69 67 # add the current configuration to the grab stack 68 set ::Rappture::grab::stack \ 69 [linsert $::Rappture::grab::stack 0 $window] 70 70 71 71 return [eval _grabset $window] 72 72 73 73 } elseif {$op == "release"} { 74 75 76 77 78 79 80 81 74 # 75 # Handle GRAB RELEASE specially. 76 # Release the current grab and grab the next window on the stack. 77 # Note that the current grab is on the top of the stack. The 78 # next one down is the one we want to revert to. 79 # 80 set window [lindex $::Rappture::grab::stack 1] 81 set ::Rappture::grab::stack [lrange $::Rappture::grab::stack 1 end] 82 82 83 84 83 # release the current grab 84 eval _tk_grab $args 85 85 86 87 88 89 90 91 92 93 94 86 # and set the next one 87 if {"" != $window} { 88 if {[lindex $window 0] != "-global"} { 89 # no more global grabs -- resume local grabs 90 set ::Rappture::grab::state "" 91 } 92 eval _grabset $window 93 } 94 return "" 95 95 } 96 96 … … 102 102 # give it 3 tries, if necessary 103 103 for {set i 0} {$i < 3} {incr i} { 104 105 106 107 108 104 set status [catch {eval _tk_grab set $args} result] 105 if {$status == 0} { 106 return $result 107 } 108 after 100; update 109 109 } 110 110 # oh well, we tried... … … 121 121 set w [_tk_grab current] 122 122 if {"" != $w} { 123 123 _tk_grab release $w 124 124 } 125 125 set Rappture::grab::stack "" … … 127 127 128 128 foreach win [blt::busy windows] { 129 129 blt::busy release $win 130 130 } 131 131 }
Note: See TracChangeset
for help on using the changeset viewer.