I see. It is a twisted case. Let's keep it as is until the real solution comes.
Ping On Sun, Feb 28, 2010 at 2:32 AM, Peter Hutterer <[email protected]> wrote: > On Sat, Feb 27, 2010 at 05:41:59PM -0800, Ping Cheng wrote: >> On Wed, Feb 24, 2010 at 10:53 PM, Peter Hutterer > > yes, you are right, it even says in the protocol spec that logical buttons >> > "are not restricted in value by the number of physical buttons, but no two >> > elements can have the same nonzero value" (SetPointerMapping) >> > however, this affects the _logical_ button mapping, not the physical button >> > mapping. in the driver we do not have access to the former (only during >> > initialization time). >> > any wacom-internal button mapping makes the mapped button appear as if it >> > was a different physical button. hence the limitation applies. >> > >> > e.g. a _wacom_ button mapping of 1:3 makes button 1 appear as physical >> > button 3. Neither server nor client know that it's in fact button 1 that >> > was >> > pressed. With the same _logical_ map (XSetPointerMapping), the clients can >> > still query the map and then know that if a button 3 event arrives, it was >> > likely button 1 that was pressed (likely, not guaranteed on server >> > supporting XI 1.5 or later). >> >> >> I don't think server or client needs to know which physical button is >> pressed. Server only cares which logical button event needs to be >> posted and client only cares which logical button event has been >> received. It is up to the end users or the application to map a >> physical button to a logical button through "xinput --set-button-map" >> or "xsetwacom set" and keep track of the button mappings. > > not at all, the physical button is quite important to both the server and > some clients. For example, a desktop environment may apply a left-handed > mouse setup with a button map of "3 2 1 4 5..." instead of "1 2 3 4 5...". > once this is set, any phys button 1 will deliver a logical button 3, a right > click in most applications. > > if the server had no concept of mapping and instead left this up to the > driver it would require re-implementation of the same mapping code in all > drivers. furthermore, if the applications didn't allow for this setup, you'd > have to let every application know that the device is now left-handed and > let them adjust. > > in the current setup where clients can query and modify the button mapping > but the button events always include the logical button only, this is quite > trivial to handle. there is no driver code necessary to support any of this. > >> > I just tried this on my sever here and it worked fine: >> > >> > :: w...@barra:~> xinput --set-button-map "Wacom Intuos4 6x9" 20 21 22 >> > :: w...@barra:~> xinput --get-button-map "Wacom Intuos4 6x9" >> > 20 21 22 4 5 6 7 8 9 10 11 >> >> If number of physical buttons does not affect the logical button event >> we send, what's the purpose of buttons and butmap in >> InitButtonClassDeviceStruct(local->dev, num_buttons, butmap)? Do we >> suppose to initialize the ButtonClassDeviceStruct again each time when >> we change the button mapping? With your testing result above, it >> looks like we don't need to. > > no, this call is for devices that already come with a different button map. > so in theory, you could have a specific left-handed mouse that sets itself > up as lefthanded regardless of the desktop setting. since this is a default > setting only, once the driver has initialized the button mapping is in the > hands of the server and the clients. > > again, the _only_ reason we need button mapping in the driver aside from the > initial map (which is the standard one anyway) is if we want to make two > physical buttons look like a different physical button. this is actually a > rather problematic feature as it prevents generic configuration if this > button mapping is used. > > e.g. if you map button 1 to button 3 in the wacom driver, you need a client > that is aware of the wacom driver to undo this mapping. if you use the > server's button map, any client can do this. > I'm rather inclined to purge the internal button map since with XI 1.5 (X > server 1.6), button maps aren't really restricted anymore anyway. I don't > think we're there just yet though so for the time being I'll leave it in. > > Cheers, > Peter > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
