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 <[email protected]> > 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 <[email protected]> > --- > 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. > @@ -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) > ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&r, 1); > diff --git a/src/xinput.c b/src/xinput.c > index 007fe2c..7c47c3c 100644 > --- a/src/xinput.c > +++ b/src/xinput.c > @@ -87,7 +87,7 @@ static entry drivers[] = > create_master > }, > { "remove-master", > - "<id> [returnMode (dflt:Floating)] [returnPointer] [returnKeyboard]", > + "<id> [returnMode (dflt:Floating, AttachToMaster)] [returnPointer] > [returnKeyboard]", > remove_master > }, > { "reattach", > -- > 1.6.3.1 > Cheers, Peter _______________________________________________ xorg-devel mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-devel
