Comment 36 for bug 282387

On Sat, Oct 25, 2008 at 08:30:15AM -0700, <email address hidden> wrote:
> Ok, so I used the b0737bdbd1f6e601eb4984b6f4cb49279190984c commit to patch the
> Ubuntu version, and it solved the scrolling problem I had with the Ubuntu
> version as well as the crashing problem I had with HEAD, but it appears that
> another bug was introduced. After a VT-switch I cannot drag things with the
> mouse, for instance drag a window or copy with the mouse.
> I'm guessing thats what draglock that was mentioned in the commit is for?

no. draglock is a feature for those who can't hold a button down while
dragging. shouldn't affect standard mouse operation at all.
the problem is caused because the wakeup handlers didn't register again. Please
try the patch below, fixes the problem for me.

commit ea13733382f85dec6cadfb631831cfa6ed4bc69a
Author: Peter Hutterer <email address hidden>
Date: Mon Oct 27 15:54:49 2008 +1030

    emuMB: add EvdevMBEmuOn and call from EvdevOn to register wakeup handlers.

    This got broken in b0737bdbd1f6e601eb4984b6f4cb49279190984c, when the
    EmuMBPreInit call was removed from EvdevOn. As a result, VT switching away and
    back wouldn't restore the wakeup handlers and mouse button presses
    disappeared.

diff --git a/src/emuMB.c b/src/emuMB.c
index 4af0791..e5a767a 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -317,6 +317,11 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)

     pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
                                                  "Emulate3Timeout", 50);
+}
+
+void
+EvdevMBEmuOn(InputInfoPtr pInfo)
+{
     RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
                                     EvdevMBEmuWakeupHandler,
                                     (pointer)pInfo);
diff --git a/src/evdev.c b/src/evdev.c
index d112efe..26ae0a1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1008,6 +1008,7 @@ EvdevOn(DeviceIntPtr device)
     } else
     {
         xf86AddEnabledDevice(pInfo);
+ EvdevMBEmuOn(pInfo);
         pEvdev->flags |= EVDEV_INITIALIZED;
         device->public.on = TRUE;
     }
diff --git a/src/evdev.h b/src/evdev.h
index c2f614a..7e1da15 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -127,6 +127,7 @@ BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
 void EvdevMBEmuWakeupHandler(pointer, int, pointer);
 void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
 void EvdevMBEmuPreInit(InputInfoPtr);
+void EvdevMBEmuOn(InputInfoPtr);
 void EvdevMBEmuFinalize(InputInfoPtr);
 void EvdevMBEmuEnable(InputInfoPtr, BOOL);