X server testing

Thomas Jaeger thjaeger at gmail.com
Sat Jun 20 07:53:49 PDT 2009


Peter Hutterer wrote:
> Thanks again for the patch, I'll just comment on the patch in this email so
> we can keep the patch review separate from the XI2 questions in your email.
> 
>> From a620e928c3478636320d6924e4cbacf2667ad789 Mon Sep 17 00:00:00 2001
>> From: Thomas Jaeger <ThJaeger at gmail.com>
>> Date: Sun, 14 Jun 2009 13:58:39 -0400
>> Subject: [PATCH] reattach: Default to return to VCP/VCK when returnMode is AttachToMaster
>>
>> Signed-off-by: Thomas Jaeger <ThJaeger at gmail.com>
>> ---
>>  src/hierarchy.c |   40 ++++++++++++++++++++++++++++++++++++----
>>  src/xinput.c    |    2 +-
>>  2 files changed, 37 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/hierarchy.c b/src/hierarchy.c
>> index cf0f783..cb25876 100644
>> --- a/src/hierarchy.c
>> +++ b/src/hierarchy.c
>> @@ -77,8 +77,8 @@ remove_master(Display* dpy, int argc, char** argv, char *name, char *desc)
>>      info = xi2_find_device_info(dpy, argv[0]);
>>  
>>      if (!info) {
>> -	fprintf(stderr, "unable to find device %s\n", argv[0]);
>> -	return EXIT_FAILURE;
>> +        fprintf(stderr, "unable to find device %s\n", argv[0]);
>> +        return EXIT_FAILURE;
>>      }
>>  
>>      r.type = XIRemoveMaster;
> 
> Please skip this hunk. I'm not a big fan of changing whitespaces in an
> otherwise unrelated patch.
Sorry, this happened when I reindented the function to get rid of tabs.

> 
>> @@ -96,8 +96,40 @@ remove_master(Display* dpy, int argc, char** argv, char *name, char *desc)
>>  
>>      if (r.return_mode == XIAttachToMaster)
>>      {
>> -        r.return_pointer = atoi(argv[2]);
>> -        r.return_keyboard = atoi(argv[3]);
>> +        r.return_pointer = 0;
>> +        if (argc >= 3) {
>> +            info = xi2_find_device_info(dpy, argv[2]);
>> +            if (!info) {
>> +                fprintf(stderr, "unable to find device %s\n", argv[2]);
>> +                return EXIT_FAILURE;
>> +            }
>> +
>> +            r.return_pointer = info->deviceid;
>> +        }
>> +
>> +        r.return_keyboard = 0;
>> +        if (argc >= 4) {
>> +            info = xi2_find_device_info(dpy, argv[3]);
>> +            if (!info) {
>> +                fprintf(stderr, "unable to find device %s\n", argv[3]);
>> +                return EXIT_FAILURE;
>> +            }
>> +
>> +            r.return_keyboard = info->deviceid;
>> +        }
>> +
>> +        if (!r.return_pointer || !r.return_keyboard) {
>> +            int i, ndevices;
>> +            info = XIQueryDevice(dpy, XIAllMasterDevices, &ndevices);
>> +            for(i = 0; i < ndevices; i++) {
>> +                if (info[i].use == XIMasterPointer && !r.return_pointer)
>> +                    r.return_pointer = info[i].deviceid;
>> +                if (info[i].use == XIMasterKeyboard && !r.return_keyboard)
>> +                    r.return_keyboard = info[i].deviceid;
>> +            }
>> +
>> +            XIFreeDeviceInfo(info);
>> +        }
>>      }
>>  
> 
> minor nitpick: the loop condition should include the checks for
> r.return_pointer and r.return_keyboard so we can break early when we have
> found them.
> (which btw. is always after the VCK in the current implementation, the server
> guarantees VCP and VCK are always there and they have the lowest device
> ids. not that the protocol requires this, but might be interesting to know)

Done, although performance is really not something we need to worry
about here.

Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-reattach-Default-to-return-to-VCP-VCK-when-returnMod.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20090620/04cd2d75/attachment.bin 


More information about the xorg-devel mailing list