Accepted.  Thank you.

Ping

On Sun, Jan 10, 2010 at 6:33 PM, Peter Hutterer
<[email protected]> wrote:
> The current matching algorithm only works if a device name doesn't include
> spaces. Any hotplugged device however does (names like "Wacom Intuos 4 6x9")
> and wacomcpl breaks.
>
> Update the matching to search for the end of the line, the last entry
> then is type name. Wherever xsetwacom is used, enclose the device name in
> quotation marks.
>
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
> Seems to work here but since so many other options are broken I can't tell
> for sure. Please test before applying.
> (This is a patch for linuxwacom, not xf86-input-wacom.)
>
>  src/wacomxi/wacomcpl-exec |   72 ++++++++++++++++++++++++--------------------
>  1 files changed, 39 insertions(+), 33 deletions(-)
>
> diff --git a/src/wacomxi/wacomcpl-exec b/src/wacomxi/wacomcpl-exec
> index eb6f201..65d20a8 100755
> --- a/src/wacomxi/wacomcpl-exec
> +++ b/src/wacomxi/wacomcpl-exec
> @@ -102,20 +102,20 @@ proc updateXinitrc {device option value} {
>        if { [ file exists ~/.xsession ] } {
>            file copy -force ~/.xsession ~/.xsession.bak
>            file copy -force ~/.xsession /tmp/xsession1
> -           exec sed -e "/xsetwacom set $device $option /d" /tmp/xsession1 > 
> /tmp/wacom
> -           exec echo "xsetwacom set $device $option \"$value\"" > ~/.xsession
> +           exec sed -e "/xsetwacom set \"$device\" $option /d" 
> /tmp/xsession1 > /tmp/wacom
> +           exec echo "xsetwacom set \"$device\" $option \"$value\"" > 
> ~/.xsession
>            exec cat /tmp/wacom >> ~/.xsession
>            file delete -force /tmp/wacom /tmp/xsession1
>        } else {
> -           exec echo "xsetwacom set $device $option \"$value\"" > ~/.xinitrc
> +           exec echo "xsetwacom set \"$device\" $option \"$value\"" > 
> ~/.xinitrc
>            exec echo "# run the primary system script" >> ~/.xinitrc
>            exec echo ". /etc/X11/xinit/xinitrc" >> ~/.xinitrc
>        }
>     } else {
>        file copy -force ~/.xinitrc ~/.xinitrc.bak
>        file copy -force ~/.xinitrc /tmp/xinitrc1
> -       exec sed -e "/xsetwacom set $device $option /d" /tmp/xinitrc1 > 
> /tmp/wacom
> -       exec echo "xsetwacom set $device $option \"$value\"" > ~/.xinitrc
> +       exec sed -e "/xsetwacom set \"$device\" $option /d" /tmp/xinitrc1 > 
> /tmp/wacom
> +       exec echo "xsetwacom set \"$device\" $option \"$value\"" > ~/.xinitrc
>        exec cat /tmp/wacom >> ~/.xinitrc
>        file delete -force /tmp/wacom /tmp/xinitrc1
>     }
> @@ -126,9 +126,9 @@ proc updateXinitrc {device option value} {
>            set index [ expr $index+1 ]
>            set v$i [ lindex $value $index ]
>        }
> -       exec xsetwacom set $device $option $v1 $v2 $v3 $v4
> +       exec xsetwacom set "$device" $option $v1 $v2 $v3 $v4
>     } else {
> -       exec xsetwacom set $device $option $value
> +       exec xsetwacom set "$device" $option $value
>     }
>  }
>
> @@ -138,7 +138,7 @@ proc calibrationSequence {which xDev yDev} {
>     global swapThresh screenWidth screenHeight
>     global getDeviceModel screenXBottom screenYBottom
>
> -    set scaling [exec xsetwacom get $device xscaling]
> +    set scaling [exec xsetwacom get "$device" xscaling]
>     set bottomX [exec xsetwacom getdefault $device BottomX]
>     set bottomY [exec xsetwacom getdefault $device BottomY]
>     if { $scaling == 1 } {
> @@ -265,7 +265,7 @@ proc startCalibration {} {
>     #
>     # Start calib sequence
>     catch {unset calibResults}
> -    exec xsetwacom set $device xydefault
> +    exec xsetwacom set "$device" xydefault
>     .topleft.m configure -background "#df94df"
>     wacomxi::bindevent .topleft.m $device <ButtonRelease> \
>                {calibrationSequence 0 %0 %1}
> @@ -365,8 +365,8 @@ proc getDeviceOptionProc { dev i } {
>     global numStrips numControls numButton spName
>
>     for { set j 1 } { $j < [ expr $i+1 ] } { incr j 1 } {
> -       set value [ exec xsetwacom get $dev $Option($j) ]
> -       set value1 [ exec xsetwacom getdefault $dev $Option($j) ]
> +       set value [ exec xsetwacom get "$dev" $Option($j) ]
> +       set value1 [ exec xsetwacom getdefault "$dev" $Option($j) ]
>        if { ![ string compare -nocase -length 10 $Option($j) "PressCurve" ] } 
> {
>            set getOption($dev,PressCurve) 4
>            set getOptionDefault($dev,PressCurve) 4
> @@ -484,20 +484,26 @@ proc createDeviceList {} {
>     global getDeviceModel
>
>     set infoString [exec xsetwacom list]
> -    set index 0
>     set devices ""
> -    set dev [ lindex $infoString $index ]
> +
> +    set index [ string first "\n" $infoString ]
> +    set dev [ string range $infoString 0 $index]
> +
>     while { $dev != "" } {
> -       set index [ expr $index+1 ]
> -       set type [ lindex $infoString $index ]
> +       set type [ lindex $dev end ]
> +       set dev [ lrange $dev 0 end-1 ]
>
> -       if { [catch { exec xsetwacom get $dev TabletID } model] == 0} {
> +       if { [catch { exec xsetwacom get "$dev" TabletID } model] == 0} {
>            set getDeviceModel($dev,type) $type
>            set getDeviceModel($dev,model) $model
> -           set devices "$devices $dev"
> +           set devices "$devices \"$dev\""
>            set index [ expr $index+1 ]
>        }
> -        set dev [ lindex $infoString $index ]
> +
> +       set infoString [ string range $infoString $index end ]
> +       set index [ string first "\n" $infoString ]
> +       if { $index == -1 } { set index [ string length $infoString ]  }
> +       set dev [ string range $infoString 0 $index]
>     }
>
>     frame .workingDev
> @@ -539,12 +545,12 @@ proc createScreenList { dev } {
>     global numScreens currentScreen
>     global desktopHeight desktopWidth getScreenInfo
>
> -    set numScreens($dev) [ exec xsetwacom get $dev NumScreen ]
> +    set numScreens($dev) [ exec xsetwacom get "$dev" NumScreen ]
>     for { set i 0 } {$i < $numScreens($dev)} { incr i 1 } {
> -       set s1 [ exec xsetwacom get $dev SBottomX$i ]
> -       set s2 [ exec xsetwacom get $dev SBottomY$i ]
> -       set s3 [ exec xsetwacom get $dev STopX$i ]
> -       set s4 [ exec xsetwacom get $dev STopY$i ]
> +       set s1 [ exec xsetwacom get "$dev" SBottomX$i ]
> +       set s2 [ exec xsetwacom get "$dev" SBottomY$i ]
> +       set s3 [ exec xsetwacom get "$dev" STopX$i ]
> +       set s4 [ exec xsetwacom get "$dev" STopY$i ]
>        set getScreenInfo($dev,Screen$i) "$s1 $s2 $s3 $s4"
>     }
>  }
> @@ -1288,7 +1294,7 @@ proc initialSet {} {
>  proc updateSet {} {
>     global device currentW tvd snd
>
> -    set numS [ exec xsetwacom get $device NumScreen ]
> +    set numS [ exec xsetwacom get "$device" NumScreen ]
>
>     if { $numS > 1 } {
>        set sn [ $currentW.f.snsmenu cget -text ]
> @@ -1316,7 +1322,7 @@ proc updateSet {} {
>        set tv 1
>     }
>
> -    set tvID [ exec xsetwacom get $device TwinView ]
> +    set tvID [ exec xsetwacom get "$device" TwinView ]
>     if { $tv != $tvID } {
>        updateXinitrc $device TwinView $tv
>        set getOption($device,TwinView) $tv
> @@ -1503,7 +1509,7 @@ proc touchState { theCButton } {
>     global device touchButton getDeviceModel
>
>     set touchButton 0
> -    if { $touchButton == [exec xsetwacom get $device touch]  } {
> +    if { $touchButton == [exec xsetwacom get "$device" touch]  } {
>          set touchButton 1
>     }
>     checkbutton $theCButton -text "Disable Touch" -anchor w \
> @@ -1561,8 +1567,8 @@ proc updateTouch {} {
>  proc defaultTouch {} {
>     global touchButton currentW getOptionDefault device
>
> -    if { [ exec xsetwacom get $device touch ] != 
> $getOptionDefault($device,touch) } {
> -       set touchButton [ exec xsetwacom get $device touch ]
> +    if { [ exec xsetwacom get "$device" touch ] != 
> $getOptionDefault($device,touch) } {
> +       set touchButton [ exec xsetwacom get "$device" touch ]
>        if { [ exec xsetwacom getdefault $device capacity ] < 0 } {
>            if { $touchButton == 0 } {
>                .panel.calibrate configure -state normal
> @@ -1583,14 +1589,14 @@ proc switchTouch { window } {
>        return
>     }
>
> -    if { $touchButton == [ exec xsetwacom get $device touch ] } {
> +    if { $touchButton == [ exec xsetwacom get "$device" touch ] } {
>        if { $touchButton == 0 } {
>            .panel.calibrate configure -state normal
> -           exec xsetwacom set $device touch 1
> +           exec xsetwacom set "$device" touch 1
>            updateXinitrc $device touch 1
>        } else {
>            .panel.calibrate configure -state disabled
> -           exec xsetwacom set $device touch 0
> +           exec xsetwacom set "$device" touch 0
>            updateXinitrc $device touch 0
>        }
>    }
> @@ -1613,7 +1619,7 @@ proc createPanel { pressure button mapping calibrate } {
>     getNumButton $type
>     setspName
>
> -    set SN [ exec xsetwacom get $device ToolSerial ]
> +    set SN [ exec xsetwacom get "$device" ToolSerial ]
>     if { $SN && [string compare type "pad"] } {
>        set hexSN [format %X $SN]
>        label .panel.sn -text "Serial Number: $hexSN"
> @@ -1633,7 +1639,7 @@ proc createPanel { pressure button mapping calibrate } {
>                button .panel.pressure -text $wName(1) \
>                        -state normal -command "displaySubWindow \
>                        updateTouch defaultTouch initialTouch 1 0 0"
> -               if { [ exec xsetwacom get $device touch ] == 1 } {
> +               if { [ exec xsetwacom get "$device" touch ] == 1 } {
>                    .panel.calibrate configure -state normal
>                } else {
>                    .panel.calibrate configure -state disable
> --
> 1.6.6
>
>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to