Small cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41945 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2010, Haiku.
|
* Copyright 2004-2011, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -218,7 +218,7 @@ MouseDevice::Start()
|
|||||||
kMouseThreadPriority, (void*)this);
|
kMouseThreadPriority, (void*)this);
|
||||||
|
|
||||||
status_t status;
|
status_t status;
|
||||||
if (fThread < B_OK)
|
if (fThread < 0)
|
||||||
status = fThread;
|
status = fThread;
|
||||||
else {
|
else {
|
||||||
fActive = true;
|
fActive = true;
|
||||||
@@ -228,7 +228,7 @@ MouseDevice::Start()
|
|||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
LOG_ERR("%s: can't spawn/resume watching thread: %s\n",
|
LOG_ERR("%s: can't spawn/resume watching thread: %s\n",
|
||||||
fDeviceRef.name, strerror(status));
|
fDeviceRef.name, strerror(status));
|
||||||
if (fDevice >= B_OK)
|
if (fDevice >= 0)
|
||||||
close(fDevice);
|
close(fDevice);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -249,7 +249,7 @@ MouseDevice::Stop()
|
|||||||
close(fDevice);
|
close(fDevice);
|
||||||
fDevice = -1;
|
fDevice = -1;
|
||||||
|
|
||||||
if (fThread >= B_OK) {
|
if (fThread >= 0) {
|
||||||
// unblock the thread, which might wait on a semaphore.
|
// unblock the thread, which might wait on a semaphore.
|
||||||
suspend_thread(fThread);
|
suspend_thread(fThread);
|
||||||
resume_thread(fThread);
|
resume_thread(fThread);
|
||||||
@@ -290,6 +290,8 @@ MouseDevice::UpdateTouchpadSettings(const BMessage* message)
|
|||||||
|
|
||||||
delete fTouchpadSettingsMessage;
|
delete fTouchpadSettingsMessage;
|
||||||
fTouchpadSettingsMessage = new BMessage(*message);
|
fTouchpadSettingsMessage = new BMessage(*message);
|
||||||
|
if (fTouchpadSettingsMessage == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -457,7 +459,7 @@ MouseDevice::_ControlThread()
|
|||||||
fTarget.EnqueueMessage(message);
|
fTarget.EnqueueMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) {
|
if (movements.wheel_ydelta != 0 || movements.wheel_xdelta != 0) {
|
||||||
BMessage* message = new BMessage(B_MOUSE_WHEEL_CHANGED);
|
BMessage* message = new BMessage(B_MOUSE_WHEEL_CHANGED);
|
||||||
if (message == NULL)
|
if (message == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -491,7 +493,7 @@ MouseDevice::_ControlThreadCleanup()
|
|||||||
} else {
|
} else {
|
||||||
// In case active is already false, another thread
|
// In case active is already false, another thread
|
||||||
// waits for this thread to quit, and may already hold
|
// waits for this thread to quit, and may already hold
|
||||||
// locks that _RemoveDevice() wants to acquire. In another
|
// locks that _RemoveDevice() wants to acquire. In other
|
||||||
// words, the device is already being removed, so we simply
|
// words, the device is already being removed, so we simply
|
||||||
// quit here.
|
// quit here.
|
||||||
}
|
}
|
||||||
@@ -820,7 +822,7 @@ MouseInputDevice::_AddDevice(const char* path)
|
|||||||
_RemoveDevice(path);
|
_RemoveDevice(path);
|
||||||
|
|
||||||
MouseDevice* device = new(std::nothrow) MouseDevice(*this, path);
|
MouseDevice* device = new(std::nothrow) MouseDevice(*this, path);
|
||||||
if (!device) {
|
if (device == NULL) {
|
||||||
TRACE("No memory\n");
|
TRACE("No memory\n");
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user