[PATCH] reattach: Default to return to VCP/VCK when returnMode is AttachToMaster

Thomas Jaeger ThJaeger at gmail.com
Sun Jun 14 10:58:39 PDT 2009


Signed-off-by: Thomas Jaeger <ThJaeger at gmail.com>
---
 src/hierarchy.c |   19 +++++++++++++++++--
 src/xinput.c    |    2 +-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/hierarchy.c b/src/hierarchy.c
index cf0f783..c27d1f1 100644
--- a/src/hierarchy.c
+++ b/src/hierarchy.c
@@ -96,8 +96,23 @@ 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]);
+	char *name;
+
+	name = argc >= 3 ? argv[2] : "Virtual core pointer";
+	info = xi2_find_device_info(dpy, name);
+	if (!info) {
+	    fprintf(stderr, "unable to find device %s\n", name);
+	    return EXIT_FAILURE;
+	}
+	r.return_pointer = info->deviceid;
+
+	name = argc >= 4 ? argv[3] : "Virtual core keyboard";
+	info = xi2_find_device_info(dpy, name);
+	if (!info) {
+	    fprintf(stderr, "unable to find device %s\n", name);
+	    return EXIT_FAILURE;
+	}
+	r.return_keyboard = info->deviceid;
     }
 
     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


--------------020105080704000405080302
Content-Type: text/x-patch;
 name="0001-test-xi2-Use-standard-macros-instead-of-BitIsOn-SetB.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0001-test-xi2-Use-standard-macros-instead-of-BitIsOn-SetB.pa";
 filename*1="tch"



More information about the xorg-devel mailing list