diff options
author | pingc <pingc> | 2007-11-28 18:24:07 +0000 |
---|---|---|
committer | pingc <pingc> | 2007-11-28 18:24:07 +0000 |
commit | 4d07e21841e26f5212917c7fad2b069df71232b0 (patch) | |
tree | e6f8523829d565a1bda469f7a87c0848e4db18a0 | |
parent | 6f65a53cde6be39012e69546fdc44a7eb9ac9191 (diff) | |
download | xf86-input-wacom-4d07e21841e26f5212917c7fad2b069df71232b0.tar.gz |
Merge patches 1818295, 1831998, and 1839008
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/2.4.22/wacom.c | 18 | ||||
-rw-r--r-- | src/2.4.30x86-64/wacom.c | 18 | ||||
-rw-r--r-- | src/2.4/wacom.c | 21 | ||||
-rwxr-xr-x | src/wacomxi/wacomcpl-exec | 412 | ||||
-rwxr-xr-x | src/xdrv/wcmCommon.c | 44 | ||||
-rwxr-xr-x | src/xdrv/wcmConfig.c | 26 | ||||
-rwxr-xr-x | src/xdrv/wcmUSB.c | 56 | ||||
-rw-r--r-- | src/xdrv/wcmXCommand.c | 51 | ||||
-rwxr-xr-x | src/xdrv/xf86Wacom.c | 42 |
10 files changed, 467 insertions, 230 deletions
@@ -1,3 +1,12 @@ +2007-11-28 Ping Cheng <pingc@wacom.com> + * Updated TwinView support to eliminate the unnecessary tvoffset (bug 1812593) + * Incorporated Bartosz Fabianowski's patch (bug 1831998) + * Patch 1818295 from Alexander V. Inyukhin + * Patch 1834712 from Magnus Vigerlöf + * Fixed bug 1791005 (protocol 4 tablets don't support serial numbers) + * Patch 1839008 from Magnus Vigerlöf + * Label 0.7.9-3 + 2007-11-12 Ping Cheng <pingc@wacom.com> * Support legacy kernels * Label 0.7.9-2 diff --git a/src/2.4.22/wacom.c b/src/2.4.22/wacom.c index 6ad899a..ef0dd64 100644 --- a/src/2.4.22/wacom.c +++ b/src/2.4.22/wacom.c @@ -232,8 +232,9 @@ static void wacom_pl_irq(struct urb *urb) /* was entered with stylus2 pressed */ if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { /* report out proximity for previous tool */ + input_report_abs(dev, ABS_MISC, id); /* report tool id */ input_report_key(dev, wacom->tool[1], 0); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); wacom->tool[1] = BTN_TOOL_PEN; return; } @@ -261,13 +262,13 @@ static void wacom_pl_irq(struct urb *urb) wacom->tool[1] = BTN_TOOL_PEN; } input_report_key(dev, wacom->tool[1], prox); - input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ + input_report_abs(dev, ABS_MISC, id); } wacom->tool[0] = prox; /* Save proximity state */ /* end of proximity code */ - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } static void wacom_ptu_irq(struct urb *urb) @@ -305,7 +306,7 @@ static void wacom_ptu_irq(struct urb *urb) input_report_key(dev, BTN_STYLUS, data[1] & 0x02); input_report_key(dev, BTN_STYLUS2, data[1] & 0x10); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } @@ -440,11 +441,11 @@ static void wacom_graphire_irq(struct urb *urb) input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ input_report_key(dev, wacom->tool[0], 0); } - input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01); + input_event(dev, EV_MSC, MSC_SERIAL, id); /* send pad data */ if ( strstr(wacom->features->name, "Graphire4") ) { - if ( (wacom->serial[1] & 0xc0) != (data[7] & 0xf8) ) { + if (data[7] & 0xf8) { wacom->id[1] = 1; wacom->serial[1] = (data[7] & 0xf8); input_report_key(dev, BTN_0, (data[7] & 0x40)); @@ -456,6 +457,9 @@ static void wacom_graphire_irq(struct urb *urb) input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); } else if ( wacom->id[1] ) { wacom->id[1] = 0; + input_report_key(dev, BTN_0, (data[7] & 0x40)); + input_report_key(dev, BTN_4, (data[7] & 0x80)); + input_report_rel(dev, REL_WHEEL, 0); input_report_key(dev, BTN_TOOL_FINGER, 0); input_report_abs(dev, ABS_MISC, PAD_DEVICE_ID); input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); @@ -927,7 +931,7 @@ struct wacom_features wacom_features[] = { /* 44 */ { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS }, - /* 45 */ { "Wacom Cintiq 12UX", 10, 53020, 33440, 1023, 63, + /* 45 */ { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_BEE_BUTTONS, WACOM_INTUOS3_TOOLS }, /* 46 */ { "Wacom DTF720", 8, 6858, 5506, 511, 0, diff --git a/src/2.4.30x86-64/wacom.c b/src/2.4.30x86-64/wacom.c index f56c294..50d878c 100644 --- a/src/2.4.30x86-64/wacom.c +++ b/src/2.4.30x86-64/wacom.c @@ -180,8 +180,9 @@ static void wacom_pl_irq(struct urb *urb) /* was entered with stylus2 pressed */ if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { /* report out proximity for previous tool */ + input_report_abs(dev, ABS_MISC, id); /* report tool id */ input_report_key(dev, wacom->tool[1], 0); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); wacom->tool[1] = BTN_TOOL_PEN; return; } @@ -214,7 +215,7 @@ static void wacom_pl_irq(struct urb *urb) wacom->tool[0] = prox; /* Save proximity state */ /* end of proximity code */ - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } static void wacom_ptu_irq(struct urb *urb) @@ -251,7 +252,7 @@ static void wacom_ptu_irq(struct urb *urb) input_report_key(dev, BTN_STYLUS, data[1] & 0x02); input_report_key(dev, BTN_STYLUS2, data[1] & 0x10); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } @@ -383,11 +384,11 @@ static void wacom_graphire_irq(struct urb *urb) input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ input_report_key(dev, wacom->tool[0], 0); } - input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01); + input_event(dev, EV_MSC, MSC_SERIAL, id); /* send pad data */ if ( strstr(wacom->features->name, "Graphire4") ) { - if ( (wacom->serial[1] & 0xc0) != (data[7] & 0xf8) ) { + if (data[7] & 0xf8) { wacom->id[1] = 1; wacom->serial[1] = (data[7] & 0xf8); input_report_key(dev, BTN_0, (data[7] & 0x40)); @@ -399,8 +400,11 @@ static void wacom_graphire_irq(struct urb *urb) input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); } else if ( wacom->id[1] ) { wacom->id[1] = 0; + input_report_key(dev, BTN_0, (data[7] & 0x40)); + input_report_key(dev, BTN_4, (data[7] & 0x80)); + input_report_rel(dev, REL_WHEEL, 0); input_report_key(dev, BTN_TOOL_FINGER, 0); - input_report_abs(dev, ABS_MISC, PAD_DEVICE_ID); + input_report_abs(dev, ABS_MISC, 0); input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); } } @@ -869,7 +873,7 @@ struct wacom_features wacom_features[] = { /* 44 */ { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS }, - /* 45 */ { "Wacom Cintiq 12UX", 10, 53020, 33440, 1023, 63, + /* 45 */ { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_BEE_BUTTONS, WACOM_INTUOS3_TOOLS }, /* 46 */ { "Wacom DTF720", 8, 6858, 5506, 511, 0, diff --git a/src/2.4/wacom.c b/src/2.4/wacom.c index a5a30a3..435e795 100644 --- a/src/2.4/wacom.c +++ b/src/2.4/wacom.c @@ -90,6 +90,7 @@ * v1.30-j0.7.7 - Support Intuos outbound tracking * v1.30-j0.7.8 - Added Bamboo * v1.30-j0.7.9 - added Bamboo1, Bamboo Fun, and Hummingbird + * v1.30-j0.7.9-3 - Sync with wcmUSB.c */ /* @@ -120,7 +121,7 @@ /* * Version Information */ -#define DRIVER_VERSION "v1.30-j0.7.9" +#define DRIVER_VERSION "v1.30-j0.7.9-3" #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@suse.cz>" #ifndef __JEJ_DEBUG #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver (LINUXWACOM)" @@ -233,7 +234,8 @@ static void wacom_pl_irq(struct urb *urb) if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { /* report out proximity for previous tool */ input_report_key(dev, wacom->tool[1], 0); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_report_abs(dev, ABS_MISC, id); /* report tool id */ + input_event(dev, EV_MSC, MSC_SERIAL, id); wacom->tool[1] = BTN_TOOL_PEN; return; } @@ -261,13 +263,13 @@ static void wacom_pl_irq(struct urb *urb) wacom->tool[1] = BTN_TOOL_PEN; } input_report_key(dev, wacom->tool[1], prox); - input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ + input_report_abs(dev, ABS_MISC, id); } wacom->tool[0] = prox; /* Save proximity state */ /* end of proximity code */ - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } static void wacom_ptu_irq(struct urb *urb) @@ -305,7 +307,7 @@ static void wacom_ptu_irq(struct urb *urb) input_report_key(dev, BTN_STYLUS, data[1] & 0x02); input_report_key(dev, BTN_STYLUS2, data[1] & 0x10); - input_event(dev, EV_MSC, MSC_SERIAL, 0); + input_event(dev, EV_MSC, MSC_SERIAL, id); } static void wacom_penpartner_irq(struct urb *urb) @@ -437,11 +439,11 @@ static void wacom_graphire_irq(struct urb *urb) input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ input_report_key(dev, wacom->tool[0], 0); } - input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01); + input_event(dev, EV_MSC, MSC_SERIAL, id); /* send pad data */ if ( strstr(wacom->features->name, "Graphire4") ) { - if ( (wacom->serial[1] & 0xc0) != (data[7] & 0xf8) ) { + if (data[7] & 0xf8) { wacom->id[1] = 1; wacom->serial[1] = (data[7] & 0xf8); input_report_key(dev, BTN_0, (data[7] & 0x40)); @@ -454,6 +456,9 @@ static void wacom_graphire_irq(struct urb *urb) input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); } else if ( wacom->id[1] ) { wacom->id[1] = 0; + input_report_key(dev, BTN_0, (data[7] & 0x40)); + input_report_key(dev, BTN_4, (data[7] & 0x80)); + input_report_rel(dev, REL_WHEEL, 0); input_report_key(dev, BTN_TOOL_FINGER, 0); input_report_abs(dev, ABS_MISC, 0); input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); @@ -926,7 +931,7 @@ struct wacom_features wacom_features[] = { /* 44 */ { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS }, - /* 45 */ { "Wacom Cintiq 12UX", 10, 53020, 33440, 1023, 63, + /* 45 */ { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS, 0, WACOM_BEE_BUTTONS, WACOM_INTUOS3_TOOLS }, /* 46 */ { "Wacom DTF720", 8, 6858, 5506, 511, 0, diff --git a/src/wacomxi/wacomcpl-exec b/src/wacomxi/wacomcpl-exec index c0a4e81..b7c9805 100755 --- a/src/wacomxi/wacomcpl-exec +++ b/src/wacomxi/wacomcpl-exec @@ -49,11 +49,16 @@ set windowSize "540x300" set device "" set deviceIndex 0 set showHelp 0 +set modeToggleB 33 +set ignoreButton 34 +set doubleClickB 35 +set keystrokeB 36 + proc updateCurrentScreenInfo {} { - global device numScreens currentScreen + global device numScreens currentScreen global screenXBottom screenYBottom screenX_org screenY_org - global getScreenInfo + global getScreenInfo screenWidth screenHeight if { $numScreens($device) != 1 } { set screenInfo $getScreenInfo($device,Screen$currentScreen) @@ -61,6 +66,8 @@ proc updateCurrentScreenInfo {} { set screenYBottom [ lindex $screenInfo 1 ] set screenX_org [ lindex $screenInfo 2 ] set screenY_org [ lindex $screenInfo 3 ] + set screenWidth abs([ expr $screenXBottom-$screenX_org ]) + set screenHeight abs([ expr $screenYBottom-$screenY_org ]) } } @@ -135,8 +142,8 @@ proc calibrationSequence {which xDev yDev} { set borderOffset [expr ($size / 2 )] set widthDev [expr $calibResults(xDev,1) - $calibResults(xDev,0)] set heightDev [expr $calibResults(yDev,1) - $calibResults(yDev,0)] - set widthX [expr $screenXBottom-$size*(abs($screenXBottom)/$screenXBottom)] - set heightX [expr $screenYBottom-$size*(abs($screenYBottom)/$screenYBottom)] + set widthX [expr $screenWidth-$size] + set heightX [expr $screenHeight-$size] # # A rough verification of the click @@ -330,8 +337,8 @@ proc disableButtons {} { } proc getDeviceOptionProc { dev i } { - global getOption getOptionDefault Option oldKeys - global spName numButton + global getOption getOptionDefault Option oldKeys spName numButton + global modeToggleB ignoreButton doubleClickB keystrokeB for { set j 1 } { $j < [ expr $i+1 ] } { incr j 1 } { set value [ exec xsetwacom get $dev $Option($j) ] @@ -362,28 +369,29 @@ proc getDeviceOptionProc { dev i } { } } else { set match 0 - for { set k 1 } { $k <= [expr ($numButton+8)] } { incr k 1 } { + # are they wheel/ring/strips? + for { set k 1 } { $k <= 8 } { incr k 1 } { if { ![string compare -nocase $Option($j) $spName($k)] } { - set k [expr ($numButton+9)] + set k 9 set match 1 } } if { $match } { - if { ($value > 19) || ($value == 0) } { + if { ($value > $doubleClickB) || ($value == 0) } { set output [ exec xsetwacom get $dev $Option($j) ] set outputd [ lindex $output 0 ] if { ![string compare -nocase -length 8 DBLCLICK $outputd ] } { - set getOption($dev,$Option($j)) 17 + set getOption($dev,$Option($j)) $doubleClickB } if { ![string compare -nocase -length 4 "Core" $outputd ] } { - set getOption($dev,$Option($j)) 20 + set getOption($dev,$Option($j)) $keystrokeB set oldKeys($Option($j)) $output } if { ![string compare -nocase -length 10 MODETOGGLE $outputd ] } { - set getOption($dev,$Option($j)) 19 + set getOption($dev,$Option($j)) $modetoggleB } if { ($value == 0) } { - set getOption($dev,$Option($j)) 18 + set getOption($dev,$Option($j)) $ignoreButton } } else { set getOption($dev,$Option($j)) $value @@ -397,8 +405,8 @@ proc getDeviceOptionProc { dev i } { } proc updateDevice {} { - global device deviceIndex getOption - global numScreens getDeviceModel Option + global device deviceIndex getOption hasPad isLCD + global numScreens getDeviceModel Option set olddev $device set device [ .workingDev.list get anchor ] @@ -423,17 +431,11 @@ proc updateDevice {} { set mode $getOption($device,Mode) destroy .panel if { ![ string compare $type "pad" ] } { - if { ($model == 101 || $model == 21 \ - || $model == 22 || $model == 21 \ - || $model == 63 \ - || ($model >= 176 && $model <= 183)) } { + if { $hasPad($model) } { createPanel 0 1 0 0 } } else { - if { ($model >= 48 && $model < 64) \ - || ($model >= 192 && $model <= 195) \ - || ($model == 63) \ - || ($model >= 144 && $model < 151) } { # LCD tablets + if { $isLCD($model) } { if { ![ string compare $type "stylus" ] } { createPanel 1 1 0 1 } else { @@ -560,8 +562,9 @@ proc displayScreenList { dev } { } proc updateButton {} { - global device getDeviceModel sm getOption spName + global device getDeviceModel sm getOption spName isLCD global dm currentW oldKeys numButton cKeys numStrips + global modeToggleB ignoreButton doubleClickB keystrokeB set type $getDeviceModel($device,type) set model $getDeviceModel($device,model) @@ -584,34 +587,30 @@ proc updateButton {} { { set j 5 set v "Button 5" } "Left Double" - { set j 17 + { set j $doubleClickB set v "DBLCLICK 1" } "Mode Toggle" - { set j 19 + { set j $modeToggleB set v "ModeToggle 1" } "KeyStroke" - { set j 20 + { set j $keystrokeB set v $cKeys($spName($i)) set oldKeys($spName($i)) $cKeys($spName($i)) } "Ignore" - { set j 18 + { set j $ignoreButton set v "Button 0" } } set getOption($device,$spName($i)) $j updateXinitrc $device $spName($i) $v # reset key strokes - if { $j != 20 } { + if { $j != $keystrokeB } { set $oldKeys($spName($i)) "" set cKeys($spName($i)) "" } } - if { !(($model >= 48 && $model < 64) \ - || ($model >= 192 && $model < 196) \ - || ($model == 63) \ - || ($model == 144)) && - [string compare $type "pad"] } { + if { !isLCD($model) && [string compare $type "pad"] } { set mode [ $currentW.f.mode cget -text ] updateXinitrc $device mode $mode if { $mode == $dm(1) } { @@ -635,7 +634,8 @@ proc updateButton {} { } proc defaultButton {} { - global db db1 db2 db3 db4 db5 db6 db7 db8 db9 + global db db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 + global db11 db12 db13 db14 isLCD global dm sm dmv smv numButton global device getOptionDefault getDeviceModel @@ -646,10 +646,7 @@ proc defaultButton {} { set model $getDeviceModel($device,model) set type $getDeviceModel($device,type) - if { !(($model >= 48 && $model < 64) \ - || ($model >= 192 && $model < 196) \ - || ($model == 63) \ - || ($model == 144)) } { + if { !$isLCD($model) } { set dmv $dm([ expr $getOptionDefault($device,Mode)+1 ]) } @@ -659,7 +656,7 @@ proc defaultButton {} { } proc getNumButton { type } { - global device Option numButton + global device Option numButton getDeviceModel numPadButtons set Option(1) "Button1" set t 1 @@ -672,6 +669,13 @@ proc getNumButton { type } { set Option(5) "Button5" set t [ expr ($t+2) ] } + if { ![ string compare $type "pad" ] } { + set model $getDeviceModel($device,model) + set t $numPadButtons($model) + for { set i 6 } { $i <= $t } { incr i 1 } { + set Option($i) "Button$i" + } + } } set numButton $t } @@ -734,7 +738,8 @@ proc displayMode {} { if { ( !(($model >= 48 && $model < 64) \ || ($model >= 192 && $model < 196) \ || ($model == 63) \ - || ($model == 144)) ) \ + || ($model == 144) \ + || ($model == 198)) ) \ && [ string compare $type "pad" ] } { set dmv $dm([ expr $getOption($device,Mode)+1 ]) tk_optionMenu $currentW.f.mode dmv $dm(1) $dm(2) @@ -752,8 +757,8 @@ proc displayMode {} { } } -proc displaySubWindow { okF deF initial i cbutton } { - global wName currentb currentW +proc displaySubWindow { okF deF initial winID cbutton } { + global currentb currentW wName set currentb $cbutton @@ -764,13 +769,14 @@ proc displaySubWindow { okF deF initial i cbutton } { } toplevel $currentW wm geometry $currentW =650x300 - wm title $currentW "$wName($i)" + wm title $currentW $wName($winID) wm transient $currentW . wm state $currentW normal frame $currentW.f button $currentW.f.ok -text "Ok" -command $okF button $currentW.f.cancel -text "Cancel" -command closeSubWindow + set columnN 0 if { $deF != 0 } { button $currentW.f.default -text "Default" -command $deF grid $currentW.f.default -row 8 -column 0 -columnspan 3 -padx 10 -pady 10 @@ -778,14 +784,15 @@ proc displaySubWindow { okF deF initial i cbutton } { # Suppress tags on listboxes to prevent changing the # device and disable other controls bindtags .workingDev.list . + set columnN 4 } disableButtons $initial grid $currentW.f -row 0 -column 0 -sticky nw - grid $currentW.f.ok -row 8 -column 8 -columnspan 3 -padx 10 -pady 10 - grid $currentW.f.cancel -row 8 -column 4 -columnspan 3 -padx 10 -pady 10 + grid $currentW.f.ok -row 8 -column [expr ($columnN + 4)] -columnspan 3 -padx 10 -pady 10 + grid $currentW.f.cancel -row 8 -column $columnN -columnspan 3 -padx 10 -pady 10 } proc closeSubWindow {} { @@ -833,9 +840,12 @@ proc closeTabWindow {} { } proc expressKeys { } { - global db db1 db2 db3 db4 db5 db6 db7 db8 db9 + global db db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 + global db11 db12 db13 db14 global currentW device numButton spName numStrips global Option getOption getDeviceModel cKeys oldKeys + global doubleClickB ignoreButton modeToggleB keystrokeB + global numPadRings numPadStrips numPadAbsW numPadRelW for { set i 1 } { $i <= 8 } { incr i 1 } { set Option($i) $spName([expr ($numButton + $i)]) @@ -854,37 +864,53 @@ proc expressKeys { } { set s1 5 set s2 8 + set model $getDeviceModel($device,model) + if { $numPadRelW($model) } { # G4 + set s1 1 + set s2 2 + } elseif { $numPadStrips($model) == 1 } { # I3 4x5 + set s1 5 + set s2 6 + } elseif { $numPadRings($model) } { # Bamboo + set s1 3 + set s2 4 + } set numStrips [expr ($s2 - $s1) + 1] for { set i $s1 } { $i <= $s2 } { incr i 1 } { set cur [ expr ($numButton + $i - $s1 + 1) ] set opt $getOption($device,$Option($i)) - if { $opt == "" } { set opt 18 } + if { $opt == "" } { set opt $ignoreButton } set cur [ expr ($numButton + $i - $s1 + 1) ] set db$cur $db($opt) #reset keys - if { $opt != 20 } { + if { $opt != $keystrokeB } { set cKeys($Option($i)) "" set oldKeys($Option($i)) "" } set bmenu [ tk_optionMenu $currentW.f.$cur db$cur \ $db(1) $db(2) $db(3) $db(4) $db(5) ] - $bmenu insert 6 radiobutton -label "$db(20)" \ + $bmenu insert 6 radiobutton -label "$db($keystrokeB)" \ -variable menvar -command "displaySubWindow \ updateKeys 0 initialKeys 5 $cur" - $bmenu insert 7 radiobutton -label "$db(18)" + $bmenu insert 7 radiobutton -label "$db($ignoreButton)" label $currentW.f.name$cur -text "$name($i): " - if { $i >= [expr ($s1+2)] } { - set t2 [expr ($numButton+1)/2+2] - } else { - set t2 [expr ($numButton+1)/2+1] - } - if { [expr ($cur/2)] == [expr ($cur+1)/2] } { - set t1 2 + set t2 [expr ($numButton+1)/2+1] + set t1 0 + if { [expr ($s2 - $s1) > 1] } { + if { $i == [expr ($s1+1)] || \ + $i == [expr ($s1+3)] } { + set t2 [expr ($numButton+1)/2+2] + } + if { [expr ($i - $s1) > 1] } { + set t1 2 + } } else { - set t1 0 + if { [expr ($i - $s1) > 0] } { + set t1 2 + } } grid $currentW.f.$cur -row $t2 -column [expr $t1+1] grid $currentW.f.name$cur -row $t2 -column $t1 @@ -892,41 +918,48 @@ proc expressKeys { } { } proc addMenu { curb } { - global db db1 db2 db3 db4 db5 db6 db7 db8 db9 currentW + global db db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 + global db11 db12 db13 db14 currentW global getOption getDeviceModel cKeys oldKeys device spName + global doubleClickB ignoreButton modeToggleB keystrokeB set model $getDeviceModel($device,model) set type $getDeviceModel($device,type) set opt $getOption($device,$spName($curb)) if { $opt == "" } { set opt $curb } - if { ($opt >= 9 && $opt <= 16) && (![string compare $type "pad"]) } { - set opt [ expr ($opt-8) ] + if { ![string compare $type "pad"] } { + if { ($opt > 8 && $opt < 14) } { + set opt [ expr ($opt-8) ] + } else { + set opt $ignoreButton + } } set db$curb $db($opt) #reset keys - if { $opt != 20 } { + if { $opt != $keystrokeB } { set cKeys($spName($curb)) "" set oldKeys($spName($curb)) "" } + set bmenu [ tk_optionMenu $currentW.f.$curb db$curb $db(1) $db(2) \ $db(3) $db(4) $db(5) ] set i 5 if { [string compare $type "pad"] } { set i [expr ($i+1)] - $bmenu insert $i radiobutton -label "$db(17)" + $bmenu insert $i radiobutton -label "$db($doubleClickB)" if { $model != 144 } { set i [expr ($i+1)] - $bmenu insert $i radiobutton -label "$db(19)" + $bmenu insert $i radiobutton -label "$db($modeToggleB)" } } set i [expr ($i+1)] - $bmenu insert $i radiobutton -label "$db(20)" \ + $bmenu insert $i radiobutton -label "$db($keystrokeB)" \ -variable menvar -command "displaySubWindow \ updateKeys 0 initialKeys 5 $curb" set i [expr ($i+1)] - $bmenu insert $i radiobutton -label "$db(18)" + $bmenu insert $i radiobutton -label "$db($ignoreButton)" label $currentW.f.name$curb -text "Button $curb: " set t2 [expr ($curb-1)/2] @@ -1109,11 +1142,11 @@ proc initialSet {} { global device getDeviceModel getOption Option global tvd snd currentW - # used by both TwinView and no TwinView multimonitor setup - label $currentW.f.sns -text "Display Toggle: " + # used by both TwinView and non TwinView multimonitor setup + label $currentW.f.sns -text "Display Mapping: " set numS [ exec xsetwacom get $device NumScreen ] - set tvd [ exec xsetwacom get $device TwinView ] + set tvID [ exec xsetwacom get $device TwinView ] set snd [ exec xsetwacom get $device Screen_no ] if { $snd == -1 } { set snd "Desktop" @@ -1122,48 +1155,55 @@ proc initialSet {} { } if { $numS == 1 } { - if { $tvd } { - set sn0 "Desktop" - set sn1 "Screen0" - set sn2 "Screen1" - tk_optionMenu $currentW.f.snsmenu snd $sn0 $sn1 $sn2 - } + set sn0 "Desktop" + set sn1 "Screen0" + set sn2 "Screen1" + tk_optionMenu $currentW.f.snsmenu snd $sn0 $sn1 $sn2 } else { - if { $numS > 1 } { - set smenu [ tk_optionMenu $currentW.f.snsmenu snd "Desktop" ] - pack $currentW.f.snsmenu -side left - for { set i 0 } { $i < $numS } { incr i } { - $smenu insert $i radiobutton -label "Screen$i" \ + set smenu [ tk_optionMenu $currentW.f.snsmenu snd "Desktop" ] + pack $currentW.f.snsmenu -side left + for { set i 0 } { $i < $numS } { incr i } { + $smenu insert $i radiobutton -label "Screen$i" \ -variable smenvar -command \ { global smenvar; set snd $smenvar } - } } } - - if { $numS > 1 || $tvd } { - grid $currentW.f.sns -row 2 -column 0 -columnspan 2 -padx 3 -pady 3 - grid $currentW.f.snsmenu -row 2 -column 3 -columnspan 2 -padx 3 -pady 3 - } - if { $numS == 1 } { - label $currentW.f.tv -text "TwinView Setup: " - set tv(0) "None" - set tv(1) "Vertical" - set tv(2) "Horizontal" - for { set i 0 } { $i < 3 } { incr i 1 } { - if { $tvd == $i } { - set tvd $tv($i) - } + grid $currentW.f.sns -row 3 -column 0 + grid $currentW.f.snsmenu -row 3 -column 1 + if { $numS > 1 } { + $currentW.f.snsmenu configure -state normal + } else { + $currentW.f.snsmenu configure -state disable + } + + label $currentW.f.tv -text "TwinView Setup: " + set tv(0) "None" + set tv(1) "Vertical" + set tv(2) "Horizontal" + for { set i 0 } { $i < 3 } { incr i 1 } { + if { $tvID == $i } { + set tvd $tv($i) } + } - tk_optionMenu $currentW.f.tvmenu tvd $tv(0) $tv(1) $tv(2) - grid $currentW.f.tv -row 1 -column 0 -columnspan 2 -padx 3 -pady 3 - grid $currentW.f.tvmenu -row 1 -column 3 -columnspan 2 -padx 3 -pady 3 + tk_optionMenu $currentW.f.tvmenu tvd $tv(0) $tv(1) $tv(2) + grid $currentW.f.tv -row 2 -column 0 + grid $currentW.f.tvmenu -row 2 -column 1 + + $currentW.f.tvmenu configure -state normal + if { $numS == 1 } { + label $currentW.f.message1 -text "Please click on \"Cancel\" " + label $currentW.f.message2 -text "if your X server isn't in TwinView setup." + grid $currentW.f.message1 -row 0 -column 0 + grid $currentW.f.message2 -row 0 -column 1 + } elseif { !$tvID } { + $currentW.f.tvmenu configure -state disable } } proc updateSet {} { - global device currentW + global device currentW tvd snd set numS [ exec xsetwacom get $device NumScreen ] @@ -1182,17 +1222,19 @@ proc updateSet {} { set getOption($device,Screen_No) $sn } - if { $numS == 1 } { - set tv [ $currentW.f.tvmenu cget -text ] - if { ![ string compare $tv "None" ] } { - set tv 0 - } - if { ![ string compare $tv "Horizontal" ] } { - set tv 2 - } - if { ![ string compare $tv "Vertical" ] } { - set tv 1 - } + set tv [ $currentW.f.tvmenu cget -text ] + if { ![ string compare $tv "None" ] } { + set tv 0 + } + if { ![ string compare $tv "Horizontal" ] } { + set tv 2 + } + if { ![ string compare $tv "Vertical" ] } { + set tv 1 + } + + set tvID [ exec xsetwacom get $device TwinView ] + if { $tv != $tvID } { updateXinitrc $device TwinView $tv set getOption($device,TwinView) $tv } @@ -1225,7 +1267,7 @@ proc initialKeys {} { } scrollbar $currentW.f.panelt.srl_y -width 10 -command \ "$currentW.f.panelt.input yview" - label $currentW.f.panelt.title1 -text "Entered keystrokes:" + label $currentW.f.panelt.title1 -text "Entered keystrokes (type the keys if they are not in the lists):" grid $currentW.f.panelt.title1 -row 0 -column 0 -sticky we grid $currentW.f.panelt.input -row 1 -column 0 -sticky we grid $currentW.f.panelt.srl_y -row 1 -sticky nse @@ -1237,17 +1279,17 @@ proc initialKeys {} { set mod(4) "META" set mod(5) "SUPER" set mod(6) "HYPER" - set mmenu [ tk_optionMenu $currentW.f.panel.modmenu mod0 " " ] + set mmenu [ tk_optionMenu $currentW.f.panel.modmenu mod0 "Modifiers" ] pack $currentW.f.panel.modmenu -side left label $currentW.f.panel.title2 -text "Select special keys below:" - grid $currentW.f.panel.title2 -row 0 -column 1 - grid $currentW.f.panel.modmenu -row 1 -column 1 + grid $currentW.f.panel.title2 -row 0 -column 2 + grid $currentW.f.panel.modmenu -row 1 -column 2 $mmenu delete 0 for { set i 1 } { $i <= 6 } { incr i 1 } { $mmenu insert $i radiobutton -label $mod($i) \ -variable menvar -command \ { $currentW.f.panelt.input insert end " "; \ - global menvar; set mod0 $menvar; \ + global menvar; \ $currentW.f.panelt.input insert end $menvar; \ $currentW.f.panelt.input insert end " " } } @@ -1264,15 +1306,15 @@ proc initialKeys {} { set fk(10) "F10" set fk(11) "F11" set fk(12) "F12" - set fmenu [ tk_optionMenu $currentW.f.panel.fmenu fk0 " " ] + set fmenu [ tk_optionMenu $currentW.f.panel.fmenu fk0 "Function Keys" ] pack $currentW.f.panel.fmenu -side left - grid $currentW.f.panel.fmenu -row 2 -column 1 + grid $currentW.f.panel.fmenu -row 2 -column 2 $fmenu delete 0 for { set i 1 } { $i <= 12 } { incr i 1 } { $fmenu insert $i radiobutton -label $fk($i) \ -variable fmenvar -command \ { $currentW.f.panelt.input insert end " "; \ - global fmenvar; set fk0 $fmenvar; \ + global fmenvar; \ $currentW.f.panelt.input insert end $fmenvar; \ $currentW.f.panelt.input insert end " " } } @@ -1289,15 +1331,15 @@ proc initialKeys {} { set fs(10) "backslash" set fs(11) "break" set fs(12) "print" - set fsmenu [ tk_optionMenu $currentW.f.panel.fsmenu fs0 " " ] + set fsmenu [ tk_optionMenu $currentW.f.panel.fsmenu fs0 "Special Keys 1" ] pack $currentW.f.panel.fsmenu -side left - grid $currentW.f.panel.fsmenu -row 3 -column 1 + grid $currentW.f.panel.fsmenu -row 3 -column 2 $fsmenu delete 0 for { set i 1 } { $i <= 12 } { incr i 1 } { $fsmenu insert $i radiobutton -label $fs($i) \ -variable fsmenvar -command \ { $currentW.f.panelt.input insert end " "; \ - global fsmenvar; set fs0 $fsmenvar; \ + global fsmenvar; \ $currentW.f.panelt.input insert end $fsmenvar; \ $currentW.f.panelt.input insert end " " } } @@ -1314,25 +1356,27 @@ proc initialKeys {} { set sk(10) "space" set sk(11) "NumLock" set sk(12) "BackSpace" - set skmenu [ tk_optionMenu $currentW.f.panel.skmenu sk0 " " ] + set skmenu [ tk_optionMenu $currentW.f.panel.skmenu sk0 "Special Keys 2" ] pack $currentW.f.panel.skmenu -side left - grid $currentW.f.panel.skmenu -row 4 -column 1 + grid $currentW.f.panel.skmenu -row 4 -column 2 $skmenu delete 0 for { set i 1 } { $i <= 12 } { incr i 1 } { $skmenu insert $i radiobutton -label $sk($i) \ -variable skmenvar -command \ { $currentW.f.panelt.input insert end " "; \ - global skmenvar; set sk0 $skmenvar; \ + global skmenvar; \ $currentW.f.panelt.input insert end $skmenvar; \ $currentW.f.panelt.input insert end " " } } grid $currentW.f.panelt -row 0 -column 0 - grid $currentW.f.panel -row 0 -column 1 + grid $currentW.f.panel -row 0 -column 2 } proc updateKeys {} { - global device oldKeys currentb cKeys spName - global db1 db2 db3 db4 db5 db6 db7 db8 db9 currentW + global device oldKeys currentb cKeys spName currentW + global db db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 + global db11 db12 db13 db14 + global doubleClickB ignoreButton modeToggleB keystrokeB set keys [ $currentW.f.panelt.input get 1.0 end ] @@ -1350,12 +1394,12 @@ proc updateKeys {} { } else { set cKeys($spName($currentb)) $keys } - set getOption($device,$spName($currentb)) 20 - set db$currentb "KeyStroke" + set getOption($device,$spName($currentb)) $keystrokeB + set db$currentb $db($keystroke) } } else { # ignore the button - set getOption($device,$spName($currentb)) 18 - set db$currentb "Ignore" + set getOption($device,$spName($currentb)) $ignoreButton + set db$currentb $db($ignoreButton) } if { [ string length $cKeys($spName($currentb)) ] > 240 } { helpWindow "Help Window " \ @@ -1368,7 +1412,7 @@ proc updateKeys {} { } proc createPanel { pressure button mapping calibrate } { - global bName device getOption getDeviceModel currentb + global bName device getOption getDeviceModel currentb wName frame .panel set bName(pressure) $pressure @@ -1385,25 +1429,31 @@ proc createPanel { pressure button mapping calibrate } { } if { $pressure } { - button .panel.pressure -text "Feel" \ + button .panel.pressure -text $wName(1) \ -state normal -command "displaySubWindow \ updateTip defaultTip initialTip 1 0" grid .panel.pressure -row 5 -column 0 -columnspan 2 -sticky news -padx 10 } if { $button } { - button .panel.button -text "Tool Buttons" \ - -state normal -command "displaySubWindow \ - updateButton defaultButton initialButton 2 0" + if { ![string compare $getDeviceModel($device,type) "pad"] } { + button .panel.button -text $wName(6) \ + -state normal -command "displaySubWindow \ + updateButton defaultButton initialButton 6 0" + } else { + button .panel.button -text $wName(2) \ + -state normal -command "displaySubWindow \ + updateButton defaultButton initialButton 2 0" + } grid .panel.button -row 6 -column 0 -columnspan 2 -sticky news -padx 10 } if { $mapping } { - button .panel.mapping -text "Tracking" \ + button .panel.mapping -text $wName(3) \ -state normal -command "displaySubWindow \ updateT defaultT initialT 3 0" grid .panel.mapping -row 6 -column 3 -columnspan 2 -sticky news -padx 10 } if { $calibrate } { - button .panel.calibrate -text "Calibrate" \ + button .panel.calibrate -text "Calibration" \ -command Calibration -state normal grid .panel.calibrate -row 5 -column 3 -columnspan 2 -sticky news -padx 10 } @@ -1413,7 +1463,7 @@ proc createPanel { pressure button mapping calibrate } { set bName(advanced) 0 if { ($pressure || $mapping) && $mode } { #not a pad and in absolute mode set bName(advanced) 1 - button .panel.advanced -text "Advanced Settings..." \ + button .panel.advanced -text $wName(4) \ -state normal -command "displaySubWindow \ updateSet defaultSet initialSet 4 0" grid .panel.advanced -row 9 -column 2 -columnspan 2 -sticky news -padx 10 @@ -1422,37 +1472,105 @@ proc createPanel { pressure button mapping calibrate } { grid .panel -row 0 -column 1 -columnspan 8 -sticky news -padx 10 -pady 40 } +proc updateModelInfo { } { + global isLCD numPadButtons numPadRings hasPad + global numPadStrips numPadAbsW numPadRelW + + for { set i 0 } { $i <= 198 } { incr i 1 } { + set isLCD($i) 0 + set numPadButtons($i) 0 + set numPadRings($i) 0 + set numPadStrips($i) 0 + set numPadAbsW($i) 0 + set numPadRelW($i) 0 + } + #PL + for { set i 48} { $i <= 63 } { incr i 1 } { + set isLCD($i) 1 + } + #TabletPC + for { set i 144 } { $i <= 151 } { incr i 1 } { + set isLCD($i) 1 + } + #Cintiq + for { set i 192 } { $i <= 198 } { incr i 1 } { + set isLCD($i) 1 + } + + # G4 + set numPadButtons(21) 2 + set numPadButtons(22) 2 + set numPadRelW(21) 1 + set numPadRelW(22) 1 + # Bamboo Fun + set numPadButtons(23) 4 + set numPadRings(23) 1 + set numPadButtons(24) 4 + set numPadRings(24) 1 + #Cintiq 21UX + set numPadButtons(63) 8 + set numPadStrips(63) 2 + # Bamboo + for { set i 101 } { $i <= 105 } { incr i 1 } { + set numPadButtons($i) 4 + set numPadRings($i) 1 + } + # I3 + set numPadButtons(176) 4 + set numPadStrips(176) 1 + for { set i 177 } { $i <= 183 } { incr i 1 } { + set numPadButtons($i) 8 + set numPadStrips($i) 2 + } + # Hummingbird + set numPadButtons(198) 10 + set numPadStrips(198) 2 + + for { set i 0 } { $i <= 198 } { incr i 1 } { + if { $numPadButtons($i) || $numPadRings($i) + || $numPadStrips($i) || $numPadAbsW($i) + || $numPadRelW($i) } { + set hasPad($i) 1 + } else { + set hasPad($i) 0 + } + } +} + proc createControls { } { global numScreens currentScreen cKeys spName global desktopHeight desktopWidth oldKeys numStrips global workingTags db dm sm wName bName numButton + global doubleClickB ignoreButton modeToggleB keystrokeB createDeviceList + updateModelInfo set db(1) "Left" set db(2) "Middle" set db(3) "Right" set db(4) "Fourth" set db(5) "Fifth" - set db(17) "Left Double" - set db(19) "Mode Toggle" - set db(18) "Ignore" - set db(20) "KeyStroke" + set db($doubleClickB) "Left Double" + set db($modeToggleB) "Mode Toggle" + set db($ignoreButton) "Ignore" + set db($keystrokeB) "KeyStroke" set dm(1) "Relative" set dm(2) "Absolute" set sm(1) "Side Switch Only" set sm(2) "Side Switch + Tip" + set bName(keystroke) 0 set wName(1) "Feel" set wName(2) "Tool Buttons" set wName(3) "Tracking" - set wName(4) "Advanced Settings" + set wName(4) "Screen Mapping" set wName(5) "Keystrokes" - set bName(keystroke) 0 + set wName(6) "Tablet Controls" # up to the max number of buttons - set numButton 5 + set numButton 10 set numStrips 4 setspName diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c index 918f021..4b4b87b 100755 --- a/src/xdrv/wcmCommon.c +++ b/src/xdrv/wcmCommon.c @@ -77,7 +77,6 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1) if (!(priv->flags & ABSOLUTE_FLAG)) { - /* screenToSet lags by one event, but not that important */ #if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 priv->currentScreen = miPointerCurrentScreen()->myNum; #else @@ -95,7 +94,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1) return; } - if (priv->twinview == TV_NONE && (priv->flags & ABSOLUTE_FLAG)) + if (priv->twinview == TV_NONE) { v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX : v0 < priv->topX ? 0 : v0 - priv->topX; @@ -108,7 +107,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1) */ if (screenInfo.numScreens == 1 || !priv->common->wcmMMonitor) { - if (priv->twinview != TV_NONE && (priv->flags & ABSOLUTE_FLAG)) + if (priv->twinview != TV_NONE) { if (priv->screen_no == -1) { @@ -461,8 +460,15 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, */ /* Dynamically modify the button map as required -- * to be moved in the place where button mappings are changed */ +#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 + /* +1 to be able to support Xorg xserver 1.4, which due to a + * button translation bug will run the translation twice. By + * adding 1 to the button# we're able to support at least a + * simple button1 is button1 mapping. + */ + button_idx++; +#endif local->dev->button->map [button_idx] = button & AC_CODE; - xf86PostButtonEvent(local->dev, is_absolute, button_idx, mask != 0,0,naxes,rx,ry,rz,v3,v4,v5); @@ -510,6 +516,12 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, * to be moved in the place where button mappings are changed. * Only left double is supported. */ +#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 + /Match the button sent to the actual pos due to a bug in Xorg + * xserver 1.4. I.e. button1 is button1. + */ + button_idx = 1; +#endif local->dev->button->map [button_idx] = 1; if (mask) @@ -532,8 +544,7 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, } #if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 - /* Switch the device out of the core mode, if required - */ + /* Switch the device out of the core mode, if required */ if (!is_core && (button & AC_CORE)) xf86XInputSetSendCoreEvents (local, FALSE); #endif @@ -655,12 +666,21 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d switch (fakeButton & AC_TYPE) { case AC_BUTTON: - /* pad may only have 2 buttons */ - local->dev->button->map [0] = fakeButton & AC_CODE; - - xf86PostButtonEvent(local->dev, is_absolute, 0, + /* send both button on/off in the same event for pad */ + i = 0; +#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 + /* Match the button sent to the actual pos due to a bug in Xorg + * xserver 1.4. I.e. button4 is button4. This makes it usable if + * no exotic configuration is made. + */ + i = fakeButton & AC_CODE; +#endif + local->dev->button->map [i] = fakeButton & AC_CODE; + + xf86PostButtonEvent(local->dev, is_absolute, i, 1,0,naxes,x,y,z,v3,v4,v5); - xf86PostButtonEvent(local->dev, is_absolute, 0, + + xf86PostButtonEvent(local->dev, is_absolute, i, 0,0,naxes,x,y,z,v3,v4,v5); break; @@ -1353,7 +1373,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, #if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 if (!miPointerCurrentScreen()) #else - if (!miPointerGetScreen(pDev->dev)) + if (pDev && !miPointerGetScreen(pDev->dev)) #endif { DBG(1, common->debugLevel, ErrorF("xf86WcmEvent: " diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c index c5726e3..a2dbbcb 100755 --- a/src/xdrv/wcmConfig.c +++ b/src/xdrv/wcmConfig.c @@ -126,21 +126,22 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) priv->nPressCtrl [1] = 0; /* pressure curve y0 */ priv->nPressCtrl [2] = 100; /* pressure curve x1 */ priv->nPressCtrl [3] = 100; /* pressure curve y1 */ - /* Pad by default emits keypresses, other devices emits buttons */ + + /* Default button and expresskey values */ for (i=0; i<MAX_BUTTONS; i++) priv->button[i] = IsPad (priv) ? (AC_BUTTON | (MAX_MOUSE_BUTTONS/2 + i + 1)) : (AC_BUTTON | (i + 1)); - for (i=MAX_MOUSE_BUTTONS/2; i<MAX_BUTTONS; i++) +/* for (i=MAX_MOUSE_BUTTONS/2; i<MAX_BUTTONS; i++) priv->button[i] = IsPad (priv) ? (AC_KEY | (XK_F1 + i)) : (AC_BUTTON | (i + 1)); - +*/ /* Now for backward compatibility make some keys emit button events * with button indices 9-16... */ - if (IsPad (priv) /* && check for backward-compatibility models? */) +/* if (IsPad (priv)) for (i = 0; i < 8; i++) priv->button[i] = (AC_BUTTON | (i + 9)); - +*/ for (i=0; i<MAX_BUTTONS; i++) for (j=0; j<256; j++) priv->keys[i][j] = 0; @@ -148,12 +149,12 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) priv->nbuttons = MAX_BUTTONS; /* Default number of buttons */ priv->relup = 5; /* Default relative wheel up event */ priv->reldn = 4; /* Default relative wheel down event */ - priv->wheelup = 5; /* Default absolute wheel up event */ - priv->wheeldn = 4; /* Default absolute wheel down event */ - priv->striplup = 0; /* Default left strip up event. Let user app take care of */ - priv->stripldn = 0; /* Default left strip down event. Let user app take care of */ - priv->striprup = 0; /* Default right strip up event. Let user app take care of */ - priv->striprdn = 0; /* Default right strip down event. Let user app take care of */ + priv->wheelup = 0; /* Default absolute wheel up event */ + priv->wheeldn = 0; /* Default absolute wheel down event */ + priv->striplup = 4; /* Default left strip up event */ + priv->stripldn = 5; /* Default left strip down event */ + priv->striprup = 4; /* Default right strip up event */ + priv->striprdn = 5; /* Default right strip down event */ priv->naxes = 6; /* Default number of axes */ priv->debugLevel = 0; /* debug level */ priv->numScreen = screenInfo.numScreens; /* configured screens count */ @@ -173,6 +174,7 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) common->wcmDevice = ""; /* device file name */ common->wcmFlags = RAW_FILTERING_FLAG; /* various flags */ common->wcmDevices = priv; + common->npadkeys = 0; /* Default number of pad keys */ common->wcmMaxX = 0; /* max X value */ common->wcmMaxY = 0; /* max Y value */ common->wcmMaxZ = 0; /* max Z value */ @@ -489,7 +491,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) "CommonDBG", common->debugLevel); if (common->debugLevel > 0) xf86Msg(X_CONFIG, "WACOM: %s tablet common debug level set to %d\n", - common->wcmModel->name, common->debugLevel); + dev->identifier, common->debugLevel); s = xf86FindOptionValue(local->options, "Mode"); diff --git a/src/xdrv/wcmUSB.c b/src/xdrv/wcmUSB.c index 8ae4c6a..b5a080b 100755 --- a/src/xdrv/wcmUSB.c +++ b/src/xdrv/wcmUSB.c @@ -756,37 +756,49 @@ static void usbParseEvent(LocalDevicePtr local, /* figure out the channel to use based on serial number */ channel = -1; - - /* find existing channel */ - for (i=0; i<MAX_CHANNELS; ++i) - { - if (common->wcmChannel[i].work.proximity && - common->wcmChannel[i].work.serial_num == common->wcmLastToolSerial) + if (common->wcmProtocolLevel == 4) + { + /* Protocol 4 don't support tool serial numbers */ + if (common->wcmLastToolSerial == 0xf0) + channel = 1; + else + channel = 0; + if (!common->wcmChannel[channel].work.proximity) { - channel = i; - break; + memset(&common->wcmChannel[channel],0,sizeof(WacomChannel)); + /* in case the in-prox event was missing */ + common->wcmChannel[channel].work.proximity = 1; } } - - /* find an empty channel */ - if (channel < 0) + else { + /* find existing channel */ for (i=0; i<MAX_CHANNELS; ++i) { - if (!common->wcmChannel[i].work.proximity) + if (common->wcmChannel[i].work.proximity && + common->wcmChannel[i].work.serial_num == common->wcmLastToolSerial) { - memset(&common->wcmChannel[i],0, - sizeof(WacomChannel)); - /* in case the in-prox event was missing */ - common->wcmChannel[i].work.proximity = 1; - /* Intuos3 or Graphire4 Pad */ - if (common->wcmLastToolSerial == 0xffffffff || - common->wcmLastToolSerial == 0xf0) - common->wcmChannel[i].work.device_type = PAD_ID; channel = i; break; } } + + /* find an empty channel */ + if (channel < 0) + { + for (i=0; i<MAX_CHANNELS; ++i) + { + if (!common->wcmChannel[i].work.proximity) + { + memset(&common->wcmChannel[i],0, + sizeof(WacomChannel)); + /* in case the in-prox event was missing */ + common->wcmChannel[i].work.proximity = 1; + channel = i; + break; + } + } + } } /* fresh out of channels */ @@ -941,6 +953,10 @@ static void usbParseChannel(LocalDevicePtr local, int channel, int serial) } } /* next event */ + /* it is an out-prox when id or/and serial number is zero */ + if (!ds->device_id || !ds->serial_num) + ds->proximity = 0; + /* DTF720 doesn't support eraser */ if (common->tablet_id == 0xC0 && ds->device_type == ERASER_ID) { diff --git a/src/xdrv/wcmXCommand.c b/src/xdrv/wcmXCommand.c index 7f3a283..cb8727d 100644 --- a/src/xdrv/wcmXCommand.c +++ b/src/xdrv/wcmXCommand.c @@ -300,9 +300,24 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) || (priv->twinview != TV_NONE && value > 1) ) return BadValue; - else + else if (priv->screen_no != value) { priv->screen_no = value; + if (priv->twinview != TV_NONE) + { + if (priv->screen_no == -1) + { + if (priv->twinview == TV_LEFT_RIGHT) + priv->tvoffsetX = 60; + else + priv->tvoffsetY = 60; + } + else + { + priv->tvoffsetX = 0; + priv->tvoffsetY = 0; + } + } xf86ReplaceIntOption(local->options, "ScreenNo", value); } break; @@ -314,8 +329,6 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) priv->twinview = value; switch(value) { case TV_NONE: - /* reset resolutions */ - priv->tvResolution[0] = 0; xf86ReplaceStrOption(local->options, "TwinView", "None"); break; case TV_ABOVE_BELOW: @@ -324,6 +337,8 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) case TV_LEFT_RIGHT: xf86ReplaceStrOption(local->options, "TwinView", "Horizontal"); break; + default: + return BadValue; } xf86WcmInitialTVScreens(local); } @@ -362,7 +377,8 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) return BadValue; priv->tvResolution[sNum++] = value & 0xffff; priv->tvResolution[sNum] = (value >> 16) & 0xffff; - DBG(10, priv->debugLevel, ErrorF("xf86WcmSetParam " "to ResX=%d ResY=%d \n", + DBG(10, priv->debugLevel, ErrorF("xf86WcmSetParam " + "to ResX=%d ResY=%d \n", value & 0xffff, (value >> 16) & 0xffff)); } break; @@ -494,6 +510,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) static int xf86WcmSetButtonParam(LocalDevicePtr local, int param, int value) { WacomDevicePtr priv = (WacomDevicePtr)local->private; + WacomCommonPtr common = priv->common; static int button_keys = 0, number_keys = 0; int *setVal = 0, bn = param - XWACOM_PARAM_BUTTON1; unsigned *keyP = 0; @@ -501,7 +518,7 @@ static int xf86WcmSetButtonParam(LocalDevicePtr local, int param, int value) if (param >= XWACOM_PARAM_BUTTON1 && param <= XWACOM_PARAM_BUTTON32) { - if (bn > priv->nbuttons) + if (bn > priv->nbuttons && bn > common->npadkeys) return BadValue; else { @@ -584,13 +601,14 @@ static int xf86WcmSetButtonParam(LocalDevicePtr local, int param, int value) static int xf86WcmGetButtonParam(LocalDevicePtr local, int param) { WacomDevicePtr priv = (WacomDevicePtr)local->private; + WacomCommonPtr common = priv->common; static int button_keys = 0, number_keys = 0; int retVal = 0, bn = param - XWACOM_PARAM_BUTTON1; unsigned *keyP = 0; if (param >= XWACOM_PARAM_BUTTON1 && param <= XWACOM_PARAM_BUTTON32) { - if (bn > priv->nbuttons) + if (bn > priv->nbuttons && bn > common->npadkeys) return BadValue; else { @@ -701,6 +719,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) } case XWACOM_PARAM_STOPY0: case XWACOM_PARAM_STOPY1: + case XWACOM_PARAM_STOPY2: case XWACOM_PARAM_STOPY3: case XWACOM_PARAM_STOPY4: case XWACOM_PARAM_STOPY5: @@ -842,6 +861,11 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) case XWACOM_PARAM_STOPX0: case XWACOM_PARAM_STOPX1: case XWACOM_PARAM_STOPX2: + case XWACOM_PARAM_STOPX3: + case XWACOM_PARAM_STOPX4: + case XWACOM_PARAM_STOPX5: + case XWACOM_PARAM_STOPX6: + case XWACOM_PARAM_STOPX7: { int sn = (param - XWACOM_PARAM_STOPX0) / 4; if (sn >= numS) @@ -861,6 +885,11 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) case XWACOM_PARAM_STOPY0: case XWACOM_PARAM_STOPY1: case XWACOM_PARAM_STOPY2: + case XWACOM_PARAM_STOPY3: + case XWACOM_PARAM_STOPY4: + case XWACOM_PARAM_STOPY5: + case XWACOM_PARAM_STOPY6: + case XWACOM_PARAM_STOPY7: { int sn = (param - XWACOM_PARAM_STOPY0) / 4; if (sn >= numS) @@ -880,6 +909,11 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) case XWACOM_PARAM_SBOTTOMX0: case XWACOM_PARAM_SBOTTOMX1: case XWACOM_PARAM_SBOTTOMX2: + case XWACOM_PARAM_SBOTTOMX3: + case XWACOM_PARAM_SBOTTOMX4: + case XWACOM_PARAM_SBOTTOMX5: + case XWACOM_PARAM_SBOTTOMX6: + case XWACOM_PARAM_SBOTTOMX7: { int sn = (param - XWACOM_PARAM_SBOTTOMX0) / 4; if (sn >= numS) @@ -892,6 +926,11 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) case XWACOM_PARAM_SBOTTOMY0: case XWACOM_PARAM_SBOTTOMY1: case XWACOM_PARAM_SBOTTOMY2: + case XWACOM_PARAM_SBOTTOMY3: + case XWACOM_PARAM_SBOTTOMY4: + case XWACOM_PARAM_SBOTTOMY5: + case XWACOM_PARAM_SBOTTOMY6: + case XWACOM_PARAM_SBOTTOMY7: { int sn = (param - XWACOM_PARAM_SBOTTOMY0) / 4; if (sn >= numS) diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c index 967421b..9786a56 100755 --- a/src/xdrv/xf86Wacom.c +++ b/src/xdrv/xf86Wacom.c @@ -56,10 +56,11 @@ * 2007-06-05 47-pc0.7.7-11 - Test Ron's patches * 2007-06-15 47-pc0.7.7-12 - enable changing number of raw data * 2007-06-25 47-pc0.7.8 - new release - * 2007-06-25 47-pc0.7.9-1 - Support multimonitors in both horizonal and vertical settings + * 2007-10-25 47-pc0.7.9-1 - Support multimonitors in both horizonal and vertical settings + * 2007-11-21 47-pc0.7.9-3 - Updated TwinView screen switch offset */ -static const char identification[] = "$Identification: 47-0.7.9-1 $"; +static const char identification[] = "$Identification: 47-0.7.9-3 $"; /****************************************************************************/ @@ -137,9 +138,9 @@ static int xf86WcmInitArea(LocalDevicePtr local) { if (priv->twinview == TV_NONE || priv->screen_no != 1) { - ErrorF("%s: invalid screen number %d, resetting to 0\n", + ErrorF("%s: invalid screen number %d, resetting to default (-1) \n", local->name, priv->screen_no); - priv->screen_no = 0; + priv->screen_no = -1; } } @@ -319,14 +320,16 @@ void xf86WcmInitialTVScreens(LocalDevicePtr local) { WacomDevicePtr priv = (WacomDevicePtr)local->private; + priv->tvoffsetX = 0; + priv->tvoffsetY = 0; if (priv->twinview == TV_NONE) return; - priv->tvoffsetX = 60; - priv->tvoffsetY = 60; - if (priv->twinview == TV_LEFT_RIGHT) { + if (priv->screen_no == -1) + priv->tvoffsetX = 60; + /* default resolution */ if(!priv->tvResolution[0]) { @@ -338,6 +341,9 @@ void xf86WcmInitialTVScreens(LocalDevicePtr local) } else if (priv->twinview == TV_ABOVE_BELOW) { + if (priv->screen_no == -1) + priv->tvoffsetY = 60; + if(!priv->tvResolution[0]) { priv->tvResolution[0] = screenInfo.screens[0]->width; @@ -389,15 +395,25 @@ void xf86WcmInitialScreens(LocalDevicePtr local) return; /* initial screen info */ + priv->screenTopX[0] = 0; + priv->screenTopY[0] = 0; + priv->screenBottomX[0] = 0; + priv->screenBottomY[0] = 0; for (i=0; i<screenInfo.numScreens; i++) { +#if !(defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0) priv->screenTopX[i] = dixScreenOrigins[i].x; priv->screenTopY[i] = dixScreenOrigins[i].y; priv->screenBottomX[i] = dixScreenOrigins[i].x; priv->screenBottomY[i] = dixScreenOrigins[i].y; +#endif priv->screenBottomX[i] += screenInfo.screens[i]->width; priv->screenBottomY[i] += screenInfo.screens[i]->height; +#if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 + priv->screenTopX[i] = priv->screenBottomX[i]; + priv->screenTopY[i] = priv->screenBottomY[i]; +#endif DBG(10, priv->debugLevel, ErrorF("xf86WcmInitialScreens for \"%s\" " "topX[%d]=%d topY[%d]=%d bottomX[%d]=%d bottomY[%d]=%d \n", local->name, i, priv->screenTopX[i], i, priv->screenTopY[i], @@ -490,13 +506,15 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) if (nbkeys) { KeySymsRec wacom_keysyms; - KeySym keymap[MAX_BUTTONS]; + KeySym keymap[256]; for (loop = 0; loop < nbkeys; loop++) if ((priv->button [loop] & AC_TYPE) == AC_KEY) keymap [loop] = priv->button [loop] & AC_CODE; else keymap [loop] = NoSymbol; + for(loop = nbkeys; loop<256; loop++) + keymap [loop] = NoSymbol; /* There seems to be a long-standing misunderstanding about * how a keymap should be defined. All tablet drivers from @@ -515,7 +533,7 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) wacom_keysyms.map = keymap; /* minKeyCode = 8 because this is the min legal key code */ wacom_keysyms.minKeyCode = 8; - wacom_keysyms.maxKeyCode = 8 + nbkeys - 1; + wacom_keysyms.maxKeyCode = 255; wacom_keysyms.mapWidth = 1; if (InitKeyClassDeviceStruct(local->dev, &wacom_keysyms, NULL) == FALSE) { @@ -567,8 +585,10 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) InitValuatorAxisStruct(local->dev, 4, -64, 63, 1, 1, 1); } - if (strstr(common->wcmModel->name, "Intuos3") && IsStylus(priv)) - /* Intuos3 Marker Pen rotation */ + if ((strstr(common->wcmModel->name, "Intuos3") || + strstr(common->wcmModel->name, "CintiqV5")) + && IsStylus(priv)) + /* Art Marker Pen rotation */ InitValuatorAxisStruct(local->dev, 5, -900, 899, 1, 1, 1); else if (strstr(common->wcmModel->name, "Bamboo") && IsPad(priv)) InitValuatorAxisStruct(local->dev, 5, 0, 71, 1, 1, 1); |