* Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28239 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2008, Haiku, Inc.
|
* Copyright (c) 2001-2008, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Author: Marc Flerackers ([email protected])
|
* Authors:
|
||||||
* Description: Functions and class to manage input devices.
|
* Marc Flerackers ([email protected])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//! Functions and class to manage input devices.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -37,13 +39,13 @@ find_input_device(const char *name)
|
|||||||
BInputDevice *dev = new (std::nothrow) BInputDevice;
|
BInputDevice *dev = new (std::nothrow) BInputDevice;
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const char *device;
|
const char *device;
|
||||||
int32 type;
|
int32 type;
|
||||||
|
|
||||||
reply.FindString("device", &device);
|
reply.FindString("device", &device);
|
||||||
reply.FindInt32("type", &type);
|
reply.FindInt32("type", &type);
|
||||||
|
|
||||||
dev->_SetNameAndType(device, (input_device_type)type);
|
dev->_SetNameAndType(device, (input_device_type)type);
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
@@ -66,7 +68,7 @@ get_input_devices(BList *list)
|
|||||||
const char *name;
|
const char *name;
|
||||||
int32 type;
|
int32 type;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
|
|
||||||
while (reply.FindString("device", i, &name) == B_OK) {
|
while (reply.FindString("device", i, &name) == B_OK) {
|
||||||
reply.FindInt32("type", i++, &type);
|
reply.FindInt32("type", i++, &type);
|
||||||
|
|
||||||
@@ -208,8 +210,7 @@ BInputDevice::Stop(input_device_type type)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BInputDevice::Control(input_device_type type, uint32 code,
|
BInputDevice::Control(input_device_type type, uint32 code, BMessage *message)
|
||||||
BMessage *message)
|
|
||||||
{
|
{
|
||||||
BMessage command(IS_CONTROL_DEVICES);
|
BMessage command(IS_CONTROL_DEVICES);
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
@@ -260,10 +261,10 @@ _control_input_server_(BMessage *command, BMessage *reply)
|
|||||||
if (!sInputServer)
|
if (!sInputServer)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sInputServer->IsValid())
|
if (!sInputServer->IsValid())
|
||||||
*sInputServer = BMessenger("application/x-vnd.Be-input_server", -1, NULL);
|
*sInputServer = BMessenger("application/x-vnd.Be-input_server", -1, NULL);
|
||||||
|
|
||||||
status_t err = sInputServer->SendMessage(command, reply);
|
status_t err = sInputServer->SendMessage(command, reply);
|
||||||
|
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user