summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Hill <colin.james.hill@gmail.com>2011-02-15 17:53:44 -0800
committerColin Hill <colin.james.hill@gmail.com>2011-02-15 17:53:44 -0800
commit03ea5c1ba1bc28a3034d4573dcf92acce411dd11 (patch)
treed60450842b6365040dc10f9db8cd7bd84cfcf4d3
parente79d7d9075316e964a6cb5cbc212865213f07d7f (diff)
Got NestedMousePreInit to invoke.
-rw-r--r--src/driver.c2
-rw-r--r--src/xNestedMouse.c41
-rw-r--r--src/xNestedMouse.h25
-rw-r--r--src/xlibclient.c70
4 files changed, 65 insertions, 73 deletions
diff --git a/src/driver.c b/src/driver.c
index 253fc00..df7b22e 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -166,8 +166,8 @@ NestedSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
if (!setupDone) {
setupDone = TRUE;
- xf86AddDriver(&NESTED, module, HaveDriverFuncs);
Load_Nested_Mouse(module);
+ xf86AddDriver(&NESTED, module, HaveDriverFuncs);
return (pointer)1;
} else {
diff --git a/src/xNestedMouse.c b/src/xNestedMouse.c
index 8970d27..66cee22 100644
--- a/src/xNestedMouse.c
+++ b/src/xNestedMouse.c
@@ -100,6 +100,8 @@ NestedMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) {
"/dev/nestedmouse");
xf86Msg(X_INFO, "%s: Using device %s.\n", pInfo->name, pNestedMouse->device);
+
+ xf86Msg(X_ERROR, "PreInitPreInitPreInitPreInitPreInitPreInit");
/* process generic options */
xf86CollectInputOptions(pInfo, NULL, NULL);
@@ -191,13 +193,40 @@ NestedMouseReadInput(InputInfoPtr pInfo) {
void Load_Nested_Mouse(pointer module) {
xf86Msg(X_INFO, "NESTED MOUSE LOADING\n");
xf86AddInputDriver(&NESTEDMOUSE, module, 0);
-}
+
+ /*
+ InputOption driverOption = {
+ "driver",
+ "nestedmouse",
+ NULL
+ };
+
+ InputOption options = {
+ "identifier",
+ "nesmouse",
+ &driverOption
+ //NULL
+ };
+*/
+
+ InputOption* options = (InputOption*)xalloc(sizeof(InputOption));
+
+ options->key = "driver";
+ options->value = "nestedmouse";
-void NestedPostInputEvent(NestedInputEvent event) {
+ options->next = (InputOption*)xalloc(sizeof(InputOption));
- if (event.type == NestedMouseMotion) {
- xf86Msg(X_ERROR, "Received nested mouse motion event: %i %i\n", event.data.mouseMotion.x, event.data.mouseMotion.y);
- } else {
- xf86Msg(X_ERROR, "Received unknown nested event: %i\n", event.type);
+ options->next->key = "identifier";
+ options->next->value = "nestedmouse";
+ options->next->next = NULL;
+
+ DeviceIntPtr dev;
+ int ret = NewInputDeviceRequest(options, NULL, &dev);
+
+ if (ret == Success) {
+ //xf86Msg(X_INFO, "Success\n");
}
+
+ xf86Msg(X_INFO, "NESTED MOUSE LOADING DONE\n");
}
+
diff --git a/src/xNestedMouse.h b/src/xNestedMouse.h
index 4b7a07d..53d4ad5 100644
--- a/src/xNestedMouse.h
+++ b/src/xNestedMouse.h
@@ -1,26 +1 @@
-
-#define NestedMouseMotion 1
-#define NestedKeyPress 2
-
-typedef struct {
- int x;
- int y;
-} NestedMouseMotionData;
-
-typedef struct {
- char key;
-} NestedKeyPressData;
-
-typedef union {
- NestedMouseMotionData mouseMotion;
- NestedKeyPressData keyPress;
-} NestedInputData;
-
-typedef struct {
- int type;
- NestedInputData data;
-} NestedInputEvent;
-
void Load_Nested_Mouse(pointer module);
-
-void NestedPostInputEvent(NestedInputEvent event);
diff --git a/src/xlibclient.c b/src/xlibclient.c
index 08c8034..b044769 100644
--- a/src/xlibclient.c
+++ b/src/xlibclient.c
@@ -112,13 +112,13 @@ NestedClientCreateScreen(int scrnIndex,
sizeHints.max_height = height;
XSetWMNormalHints(pPriv->display, pPriv->window, &sizeHints);
- XStoreName(pPriv->display, pPriv->window, "TTCCWN#123456");
+ XStoreName(pPriv->display, pPriv->window, "Title");
XMapWindow(pPriv->display, pPriv->window);
XSelectInput(pPriv->display, pPriv->window, ExposureMask |
PointerMotionMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask |
- ButtonReleaseMask | KeyPressMask |KeyReleaseMask);
+ ButtonReleaseMask | KeyPressMask |KeyReleaseMask);
if (XShmQueryExtension(pPriv->display)) {
if (XShmQueryVersion(pPriv->display, &shmMajor, &shmMinor,
@@ -211,7 +211,7 @@ xf86DrvMsg(scrnIndex, X_INFO, "blu_mask: 0x%lx\n", pPriv->img->blue_mask);
break;
}
}
-
+
return pPriv;
}
@@ -268,16 +268,6 @@ NestedClientTimerCallback(NestedClientPrivatePtr pPriv) {
}
if (ev.type == MotionNotify) {
-
- // Create a nested input event and send it to the input driver.
- NestedInputEvent nev;
- nev.type = NestedMouseMotion;
-
- nev.data.mouseMotion.x = ((XMotionEvent*)&ev)->x;
- nev.data.mouseMotion.y = ((XMotionEvent*)&ev)->y;
-
- NestedPostInputEvent(nev);
-
/*
XDrawString(pPriv->display, pPriv->window,
DefaultGC(pPriv->display, pPriv->screenNumber),
@@ -298,41 +288,39 @@ NestedClientTimerCallback(NestedClientPrivatePtr pPriv) {
xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Cursor left window!\n");
}
- if (ev.type == ButtonPress) {
- switch (ev.xbutton.button)
- {
- case Button1: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Left Mouse Button Pressed\n");
- break;
- case Button2: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Middle Mouse Button Pressed\n");
- break;
- case Button3: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Right Mouse Button Pressed\n");
- break;
- case Button4: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Up Pressed\n");
- break;
- case Button5: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Down Pressed\n");
- }
+ if (ev.type == ButtonPress) {
+ switch (ev.xbutton.button) {
+ case Button1: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Left Mouse Button Pressed\n");
+ break;
+ case Button2: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Middle Mouse Button Pressed\n");
+ break;
+ case Button3: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Right Mouse Button Pressed\n");
+ break;
+ case Button4: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Up Pressed\n");
+ break;
+ case Button5: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Down Pressed\n");
+ }
}
- if (ev.type == ButtonRelease) {
- switch (ev.xbutton.button)
- {
- case Button1: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Left Mouse Button Released\n");
- break;
- case Button2: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Middle Mouse Button Released\n");
- break;
- case Button3: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Right Mouse Button Released\n");
- break;
- case Button4: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Up Released\n");
- break;
- case Button5: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Down Released\n");
- }
+ if (ev.type == ButtonRelease) {
+ switch (ev.xbutton.button) {
+ case Button1: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Left Mouse Button Released\n");
+ break;
+ case Button2: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Middle Mouse Button Released\n");
+ break;
+ case Button3: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Right Mouse Button Released\n");
+ break;
+ case Button4: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Up Released\n");
+ break;
+ case Button5: xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Wheel Down Released\n");
+ }
}
- if (ev.type == KeyPress) {
+ if (ev.type == KeyPress) {
xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Key Pressed!--%d\n",ev.xkey.keycode);
}
- if (ev.type == KeyRelease) {
+ if (ev.type == KeyRelease) {
xf86DrvMsg(pPriv->scrnIndex, X_INFO, "Key Released!--%d\n",ev.xkey.keycode);
}
}