6892799.patch revision 919
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
diff -urp -x '*~' -x '*.orig' src/mouse.c src/mouse.c
--- src/mouse.c 2009-10-21 15:54:31.146864000 +0800
+++ src/mouse.c 2009-10-21 15:54:31.343475000 +0800
@@ -1744,13 +1744,14 @@ MouseProc(DeviceIntPtr device, int what)
ErrorF("assigning %p atom=%d name=%s\n", device, pInfo->atom,
pInfo->name);
#endif
- break;
-
- case DEVICE_ON:
pInfo->fd = xf86OpenSerial(pInfo->options);
if (pInfo->fd == -1)
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
- else {
+
+ break;
+
+ case DEVICE_ON:
+ if (pInfo->fd != -1) {
if (pMse->xisbscale)
pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4);
else
@@ -1800,6 +1801,22 @@ MouseProc(DeviceIntPtr device, int what)
break;
case DEVICE_OFF:
+ if (pInfo->fd != -1) {
+ xf86RemoveEnabledDevice(pInfo);
+ if (pMse->buffer) {
+ XisbFree(pMse->buffer);
+ pMse->buffer = NULL;
+ }
+ if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
+ {
+ RemoveBlockAndWakeupHandlers (MouseBlockHandler,
+ MouseWakeupHandler,
+ (pointer) pInfo);
+ }
+ }
+ device->public.on = FALSE;
+ break;
+
case DEVICE_CLOSE:
if (pInfo->fd != -1) {
xf86RemoveEnabledDevice(pInfo);