* Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0f32f7ddeb
commit
8f2be9ef82
@ -1,16 +1,23 @@
|
||||
#include "AddOnMonitorHandler.h"
|
||||
#include <Directory.h>
|
||||
|
||||
#ifndef ADD_ON_STABLE_SECONDS
|
||||
#define ADD_ON_STABLE_SECONDS 15
|
||||
#endif
|
||||
|
||||
/*
|
||||
* public functions
|
||||
* Copyright 2004-2008, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Andrew Bachmann
|
||||
*/
|
||||
|
||||
AddOnMonitorHandler::AddOnMonitorHandler(const char * name)
|
||||
: NodeMonitorHandler(name)
|
||||
#include "AddOnMonitorHandler.h"
|
||||
|
||||
#include <Directory.h>
|
||||
|
||||
|
||||
#ifndef ADD_ON_STABLE_SECONDS
|
||||
# define ADD_ON_STABLE_SECONDS 5
|
||||
#endif
|
||||
|
||||
|
||||
AddOnMonitorHandler::AddOnMonitorHandler(const char* name)
|
||||
: NodeMonitorHandler(name != NULL ? name : "AddOnMonitorHandler")
|
||||
{
|
||||
}
|
||||
|
||||
@ -20,139 +27,131 @@ AddOnMonitorHandler::~AddOnMonitorHandler()
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::MessageReceived(BMessage * msg)
|
||||
void
|
||||
AddOnMonitorHandler::MessageReceived(BMessage* msg)
|
||||
{
|
||||
if (msg->what == B_PULSE) {
|
||||
HandlePulse();
|
||||
}
|
||||
if (msg->what == B_PULSE)
|
||||
_HandlePulse();
|
||||
|
||||
inherited::MessageReceived(msg);
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ status_t
|
||||
AddOnMonitorHandler::AddDirectory(const node_ref * nref)
|
||||
status_t
|
||||
AddOnMonitorHandler::AddDirectory(const node_ref* nref)
|
||||
{
|
||||
// ignore directories added twice
|
||||
std::list<add_on_directory_info>::iterator diter = directories.begin();
|
||||
for (; diter != directories.end() ; diter++) {
|
||||
if (diter->nref == *nref) {
|
||||
std::list<add_on_directory_info>::iterator iterator = fDirectories.begin();
|
||||
for (; iterator != fDirectories.end() ; iterator++) {
|
||||
if (iterator->nref == *nref)
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
BDirectory directory(nref);
|
||||
status_t status = directory.InitCheck();
|
||||
if (status != B_OK) {
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
}
|
||||
|
||||
add_on_directory_info dir_info;
|
||||
dir_info.nref = *nref;
|
||||
directories.push_back(dir_info);
|
||||
add_on_directory_info dirInfo;
|
||||
dirInfo.nref = *nref;
|
||||
fDirectories.push_back(dirInfo);
|
||||
|
||||
status = watch_node(nref, B_WATCH_DIRECTORY, this);
|
||||
if (status != B_OK) {
|
||||
directories.pop_back();
|
||||
fDirectories.pop_back();
|
||||
return status;
|
||||
}
|
||||
|
||||
BEntry entry;
|
||||
while (directory.GetNextEntry(&entry, true) == B_OK) {
|
||||
add_on_entry_info entry_info;
|
||||
if (entry.GetName(entry_info.name) != B_OK) {
|
||||
continue; // discard and proceed
|
||||
add_on_entry_info entryInfo;
|
||||
if (entry.GetName(entryInfo.name) != B_OK
|
||||
|| entry.GetNodeRef(&entryInfo.nref) != B_OK) {
|
||||
continue;
|
||||
}
|
||||
if (entry.GetNodeRef(&entry_info.nref) != B_OK) {
|
||||
continue; // discard and proceed
|
||||
}
|
||||
entry_info.dir_nref = *nref;
|
||||
pending_entries.push_back(entry_info);
|
||||
|
||||
entryInfo.dir_nref = *nref;
|
||||
fPendingEntries.push_back(entryInfo);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* AddOnMonitorHandler hooks
|
||||
*/
|
||||
// #pragma mark - AddOnMonitorHandler hooks
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::AddOnCreated(const add_on_entry_info * entry_info)
|
||||
|
||||
void
|
||||
AddOnMonitorHandler::AddOnCreated(const add_on_entry_info* entryInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::AddOnEnabled(const add_on_entry_info * entry_info)
|
||||
void
|
||||
AddOnMonitorHandler::AddOnEnabled(const add_on_entry_info* entryInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::AddOnDisabled(const add_on_entry_info * entry_info)
|
||||
void
|
||||
AddOnMonitorHandler::AddOnDisabled(const add_on_entry_info* entryInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::AddOnRemoved(const add_on_entry_info * entry_info)
|
||||
void
|
||||
AddOnMonitorHandler::AddOnRemoved(const add_on_entry_info* entryInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NodeMonitorHandler hooks
|
||||
*/
|
||||
// #pragma mark - NodeMonitorHandler hooks
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::EntryCreated(const char *name, ino_t directory,
|
||||
void
|
||||
AddOnMonitorHandler::EntryCreated(const char* name, ino_t directory,
|
||||
dev_t device, ino_t node)
|
||||
{
|
||||
add_on_entry_info entry_info;
|
||||
strncpy(entry_info.name, name, sizeof(entry_info.name));
|
||||
make_node_ref(device, node, &entry_info.nref);
|
||||
make_node_ref(device, directory, &entry_info.dir_nref);
|
||||
pending_entries.push_back(entry_info);
|
||||
add_on_entry_info entryInfo;
|
||||
strncpy(entryInfo.name, name, sizeof(entryInfo.name));
|
||||
make_node_ref(device, node, &entryInfo.nref);
|
||||
make_node_ref(device, directory, &entryInfo.dir_nref);
|
||||
fPendingEntries.push_back(entryInfo);
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
void
|
||||
AddOnMonitorHandler::EntryRemoved(ino_t directory, dev_t device, ino_t node)
|
||||
{
|
||||
node_ref entry_nref;
|
||||
make_node_ref(device, node, &entry_nref);
|
||||
node_ref entryNodeRef;
|
||||
make_node_ref(device, node, &entryNodeRef);
|
||||
|
||||
// Search pending entries first, which can simply be discarded
|
||||
// We might have this entry in the pending list multiple times,
|
||||
// so we search entire list through, even after finding one.
|
||||
std::list<add_on_entry_info>::iterator eiter = pending_entries.begin();
|
||||
while (eiter != pending_entries.end()) {
|
||||
if (eiter->nref == entry_nref) {
|
||||
eiter = pending_entries.erase(eiter);
|
||||
std::list<add_on_entry_info>::iterator eiter = fPendingEntries.begin();
|
||||
while (eiter != fPendingEntries.end()) {
|
||||
if (eiter->nref == entryNodeRef) {
|
||||
eiter = fPendingEntries.erase(eiter);
|
||||
} else {
|
||||
eiter++;
|
||||
}
|
||||
}
|
||||
|
||||
add_on_entry_info info;
|
||||
node_ref dir_nref;
|
||||
make_node_ref(device, directory, &dir_nref);
|
||||
node_ref dirNodeRef;
|
||||
make_node_ref(device, directory, &dirNodeRef);
|
||||
|
||||
// find the entry's info, and the entry's directory info
|
||||
std::list<add_on_directory_info>::iterator diter = directories.begin();
|
||||
for (; diter != directories.end() ; diter++) {
|
||||
if (diter->nref == dir_nref) {
|
||||
std::list<add_on_entry_info>::iterator eiter = diter->entries.begin();
|
||||
std::list<add_on_directory_info>::iterator diter = fDirectories.begin();
|
||||
for (; diter != fDirectories.end() ; diter++) {
|
||||
if (diter->nref == dirNodeRef) {
|
||||
std::list<add_on_entry_info>::iterator eiter
|
||||
= diter->entries.begin();
|
||||
for (; eiter != diter->entries.end() ; eiter++) {
|
||||
info = *eiter;
|
||||
if (eiter->nref == entry_nref) {
|
||||
if (eiter->nref == entryNodeRef) {
|
||||
info = *eiter;
|
||||
diter->entries.erase(eiter);
|
||||
break;
|
||||
@ -163,15 +162,15 @@ AddOnMonitorHandler::EntryRemoved(ino_t directory, dev_t device, ino_t node)
|
||||
}
|
||||
|
||||
// if it was not found, we're done
|
||||
if (diter == directories.end()) {
|
||||
if (diter == fDirectories.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start at the top again, and search until the directory we found
|
||||
// the old add_on in. If we find a add_on with the same name then
|
||||
// the old add_on was not enabled. So we deallocate the old
|
||||
// add_on and return.
|
||||
std::list<add_on_directory_info>::iterator diter2 = directories.begin();
|
||||
// the old add-on in. If we find a add-on with the same name then
|
||||
// the old add-on was not enabled. So we deallocate the old
|
||||
// add-on and return.
|
||||
std::list<add_on_directory_info>::iterator diter2 = fDirectories.begin();
|
||||
for (; diter2 != diter ; diter2++) {
|
||||
std::list<add_on_entry_info>::iterator eiter = diter2->entries.begin();
|
||||
for (; eiter != diter2->entries.end() ; eiter++) {
|
||||
@ -182,14 +181,14 @@ AddOnMonitorHandler::EntryRemoved(ino_t directory, dev_t device, ino_t node)
|
||||
}
|
||||
}
|
||||
|
||||
// The active plugin was removed. We need to disable and
|
||||
// The active add-on was removed. We need to disable and
|
||||
// then subsequently deallocate it.
|
||||
AddOnDisabled(&info);
|
||||
AddOnRemoved(&info);
|
||||
|
||||
// Continue searching for a add_on below us. If we find a add_on
|
||||
// Continue searching for a add-on below us. If we find a add-on
|
||||
// with the same name, we must enable it.
|
||||
for (diter++ ; diter != directories.end() ; diter++) {
|
||||
for (diter++ ; diter != fDirectories.end() ; diter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter = diter->entries.begin();
|
||||
for (; eiter != diter->entries.end() ; eiter++) {
|
||||
if (strcmp(eiter->name, info.name) == 0) {
|
||||
@ -201,42 +200,44 @@ AddOnMonitorHandler::EntryRemoved(ino_t directory, dev_t device, ino_t node)
|
||||
}
|
||||
|
||||
|
||||
/* virtual */ void
|
||||
AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
ino_t to_directory, dev_t device, ino_t node)
|
||||
void
|
||||
AddOnMonitorHandler::EntryMoved(const char* name, ino_t fromDirectory,
|
||||
ino_t toDirectory, dev_t device, ino_t node)
|
||||
{
|
||||
node_ref from_nref;
|
||||
make_node_ref(device, from_directory, &from_nref);
|
||||
std::list<add_on_directory_info>::iterator from_iter = directories.begin();
|
||||
for ( ; from_iter != directories.end() ; from_iter++) {
|
||||
if (from_iter->nref == from_nref) {
|
||||
// Search the "from" directory in the known entries
|
||||
node_ref fromNodeRef;
|
||||
make_node_ref(device, fromDirectory, &fromNodeRef);
|
||||
std::list<add_on_directory_info>::iterator from_iter = fDirectories.begin();
|
||||
for (; from_iter != fDirectories.end(); from_iter++) {
|
||||
if (from_iter->nref == fromNodeRef)
|
||||
break;
|
||||
}
|
||||
|
||||
// Search the "to" directory in the known entries
|
||||
node_ref toNodeRef;
|
||||
make_node_ref(device, toDirectory, &toNodeRef);
|
||||
std::list<add_on_directory_info>::iterator to_iter = fDirectories.begin();
|
||||
for ( ; to_iter != fDirectories.end() ; to_iter++) {
|
||||
if (to_iter->nref == toNodeRef) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
node_ref to_nref;
|
||||
make_node_ref(device, to_directory, &to_nref);
|
||||
std::list<add_on_directory_info>::iterator to_iter = directories.begin();
|
||||
for ( ; to_iter != directories.end() ; to_iter++) {
|
||||
if (to_iter->nref == to_nref) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((from_iter == directories.end()) && (to_iter == directories.end())) {
|
||||
if (from_iter == fDirectories.end() && to_iter == fDirectories.end()) {
|
||||
// huh? whatever...
|
||||
return;
|
||||
}
|
||||
|
||||
add_on_entry_info info;
|
||||
node_ref entry_nref;
|
||||
make_node_ref(device, node, &entry_nref);
|
||||
node_ref entryNodeRef;
|
||||
make_node_ref(device, node, &entryNodeRef);
|
||||
|
||||
if (to_iter == directories.end()) {
|
||||
if (to_iter == fDirectories.end()) {
|
||||
// moved out of our view
|
||||
std::list<add_on_entry_info>::iterator eiter = from_iter->entries.begin();
|
||||
std::list<add_on_entry_info>::iterator eiter
|
||||
= from_iter->entries.begin();
|
||||
for (; eiter != from_iter->entries.end() ; eiter++) {
|
||||
if (entry_nref == eiter->nref) {
|
||||
if (entryNodeRef == eiter->nref) {
|
||||
// save the info and remove the entry
|
||||
info = *eiter;
|
||||
from_iter->entries.erase(eiter);
|
||||
@ -250,17 +251,17 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
}
|
||||
|
||||
// if the name is the same, save the information about this
|
||||
// add_on into former_entries for later use
|
||||
if (strcmp(info.name, name) == 0) {
|
||||
former_entries.push_back(info);
|
||||
}
|
||||
// add-on into fFormerEntries for later use
|
||||
if (strcmp(info.name, name) == 0)
|
||||
fFormerEntries.push_back(info);
|
||||
|
||||
// Start at the top again, and search until the from directory.
|
||||
// If we find a add_on with the same name then the moved add_on
|
||||
// If we find a add-on with the same name then the moved add-on
|
||||
// was not enabled. So we are done.
|
||||
std::list<add_on_directory_info>::iterator diter = directories.begin();
|
||||
std::list<add_on_directory_info>::iterator diter = fDirectories.begin();
|
||||
for (; diter != from_iter ; diter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = diter->entries.begin();
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= diter->entries.begin();
|
||||
for (; eiter2 != diter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
return;
|
||||
@ -268,13 +269,14 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
}
|
||||
}
|
||||
|
||||
// finally disable the add_on
|
||||
// finally disable the add-on
|
||||
AddOnDisabled(&info);
|
||||
|
||||
// Continue searching for a add_on below us. If we find a add_on
|
||||
// Continue searching for a add-on below us. If we find a add-on
|
||||
// with the same name, we must enable it.
|
||||
for (from_iter++ ; from_iter != directories.end() ; from_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = from_iter->entries.begin();
|
||||
for (from_iter++ ; from_iter != fDirectories.end() ; from_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= from_iter->entries.begin();
|
||||
for (; eiter2 != from_iter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
AddOnEnabled(&*eiter2);
|
||||
@ -292,19 +294,19 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_iter == directories.end()) {
|
||||
if (from_iter == fDirectories.end()) {
|
||||
// moved into our view
|
||||
std::list<add_on_entry_info>::iterator eiter = former_entries.begin();
|
||||
for (; eiter != former_entries.end() ; eiter++) {
|
||||
if (entry_nref == eiter->nref) {
|
||||
std::list<add_on_entry_info>::iterator eiter = fFormerEntries.begin();
|
||||
for (; eiter != fFormerEntries.end() ; eiter++) {
|
||||
if (entryNodeRef == eiter->nref) {
|
||||
// save the info and remove the entry
|
||||
info = *eiter;
|
||||
former_entries.erase(eiter);
|
||||
fFormerEntries.erase(eiter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (eiter != former_entries.end()) {
|
||||
if (eiter != fFormerEntries.end()) {
|
||||
if (strcmp(info.name, name) != 0) {
|
||||
// name changed on the way in, remove the old one
|
||||
AddOnRemoved(&info);
|
||||
@ -313,31 +315,30 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
|
||||
// update the info
|
||||
strncpy(info.name, name, sizeof(info.name));
|
||||
info.nref = entry_nref;
|
||||
info.dir_nref = to_nref;
|
||||
info.nref = entryNodeRef;
|
||||
info.dir_nref = toNodeRef;
|
||||
|
||||
if (eiter == former_entries.end()) {
|
||||
// this add_on was not seen before
|
||||
if (eiter == fFormerEntries.end()) {
|
||||
// this add-on was not seen before
|
||||
AddOnCreated(&info);
|
||||
}
|
||||
|
||||
// Start at the top again, and search until the to directory.
|
||||
// If we find a add_on with the same name then the moved add_on
|
||||
// If we find an add-on with the same name then the moved add-on
|
||||
// is not to be enabled. So we are done.
|
||||
std::list<add_on_directory_info>::iterator diter = directories.begin();
|
||||
std::list<add_on_directory_info>::iterator diter = fDirectories.begin();
|
||||
for (; diter != to_iter ; diter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = diter->entries.begin();
|
||||
for (; eiter2 != diter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
if (strcmp(eiter2->name, info.name) == 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The new add_on should be enabled, but first we check to see
|
||||
// if there is an add_on below us. If we find one, we disable it.
|
||||
// The new add-on should be enabled, but first we check to see
|
||||
// if there is an add-on below us. If we find one, we disable it.
|
||||
bool shadowing = false;
|
||||
for (diter++ ; diter != directories.end() ; diter++) {
|
||||
for (diter++ ; diter != fDirectories.end() ; diter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = diter->entries.begin();
|
||||
for (; eiter2 != diter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
@ -346,12 +347,11 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shadowing) {
|
||||
if (shadowing)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// enable the new add_on
|
||||
// enable the new add-on
|
||||
AddOnEnabled(&info);
|
||||
|
||||
// put the new entry into the target directory
|
||||
@ -363,7 +363,7 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
|
||||
std::list<add_on_entry_info>::iterator eiter = from_iter->entries.begin();
|
||||
for (; eiter != from_iter->entries.end() ; eiter++) {
|
||||
if (entry_nref == eiter->nref) {
|
||||
if (entryNodeRef == eiter->nref) {
|
||||
// save the old info and remove the entry
|
||||
info = *eiter;
|
||||
from_iter->entries.erase(eiter);
|
||||
@ -373,13 +373,15 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
|
||||
if (strcmp(info.name, name) == 0) {
|
||||
// same name moved in heirarchy
|
||||
debugger("add_on moved inside the heirarchy");
|
||||
debugger("add-on moved inside the heirarchy");
|
||||
} else {
|
||||
// check to see if it was formerly enabled
|
||||
bool was_enabled = true;
|
||||
std::list<add_on_directory_info>::iterator old_iter = directories.begin();
|
||||
std::list<add_on_directory_info>::iterator old_iter
|
||||
= fDirectories.begin();
|
||||
for (; old_iter != from_iter ; old_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = old_iter->entries.begin();
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= old_iter->entries.begin();
|
||||
for (; eiter2 != old_iter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
was_enabled = false;
|
||||
@ -391,12 +393,14 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
}
|
||||
}
|
||||
|
||||
// if it was enabled, disable it and enable the one under us, if it exists
|
||||
// if it was enabled, disable it and enable the one under us, if it
|
||||
// exists
|
||||
if (was_enabled) {
|
||||
AddOnDisabled(&info);
|
||||
bool done = false;
|
||||
for (; old_iter != directories.end() ; old_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = old_iter->entries.begin();
|
||||
for (; old_iter != fDirectories.end() ; old_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= old_iter->entries.begin();
|
||||
for (; eiter2 != old_iter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
AddOnEnabled(&*eiter2);
|
||||
@ -404,43 +408,45 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// kaboom!
|
||||
AddOnRemoved(&info);
|
||||
|
||||
// set up new addon info
|
||||
strncpy(info.name, name, sizeof(info.name));
|
||||
info.dir_nref = to_nref;
|
||||
info.dir_nref = toNodeRef;
|
||||
|
||||
// presto!
|
||||
AddOnCreated(&info);
|
||||
|
||||
// check to see if we are newly enabled
|
||||
bool is_enabled = true;
|
||||
std::list<add_on_directory_info>::iterator new_iter = directories.begin();
|
||||
bool isEnabled = true;
|
||||
std::list<add_on_directory_info>::iterator new_iter
|
||||
= fDirectories.begin();
|
||||
for (; new_iter != to_iter ; new_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = new_iter->entries.begin();
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= new_iter->entries.begin();
|
||||
for (; eiter2 != new_iter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
is_enabled = false;
|
||||
isEnabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!is_enabled) {
|
||||
if (!isEnabled)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if it is newly enabled, check under us for an enabled one, and disable that first
|
||||
if (is_enabled) {
|
||||
// if it is newly enabled, check under us for an enabled one, and
|
||||
// disable that first
|
||||
if (isEnabled) {
|
||||
bool done = false;
|
||||
for (; new_iter != directories.end() ; new_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2 = new_iter->entries.begin();
|
||||
for (; new_iter != fDirectories.end() ; new_iter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter2
|
||||
= new_iter->entries.begin();
|
||||
for (; eiter2 != new_iter->entries.end() ; eiter2++) {
|
||||
if (strcmp(eiter2->name, info.name) == 0) {
|
||||
AddOnDisabled(&*eiter2);
|
||||
@ -448,10 +454,9 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddOnEnabled(&info);
|
||||
}
|
||||
}
|
||||
@ -461,33 +466,30 @@ AddOnMonitorHandler::EntryMoved(const char *name, ino_t from_directory,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process pending entries
|
||||
*/
|
||||
|
||||
//! Process pending entries.
|
||||
void
|
||||
AddOnMonitorHandler::HandlePulse()
|
||||
AddOnMonitorHandler::_HandlePulse()
|
||||
{
|
||||
BDirectory directory;
|
||||
std::list<add_on_entry_info>::iterator iter = pending_entries.begin();
|
||||
while (iter != pending_entries.end()) {
|
||||
std::list<add_on_entry_info>::iterator iter = fPendingEntries.begin();
|
||||
while (iter != fPendingEntries.end()) {
|
||||
add_on_entry_info info = *iter;
|
||||
|
||||
node_ref dir_nref;
|
||||
if ((directory.GetNodeRef(&dir_nref) != B_OK) ||
|
||||
(dir_nref != info.dir_nref)) {
|
||||
node_ref dirNodeRef;
|
||||
if ((directory.GetNodeRef(&dirNodeRef) != B_OK) ||
|
||||
(dirNodeRef != info.dir_nref)) {
|
||||
if (directory.SetTo(&info.dir_nref) != B_OK) {
|
||||
// invalid directory, discard this pending entry
|
||||
iter = pending_entries.erase(iter);
|
||||
iter = fPendingEntries.erase(iter);
|
||||
continue;
|
||||
}
|
||||
dir_nref = info.dir_nref;
|
||||
dirNodeRef = info.dir_nref;
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
if (directory.GetStatFor(info.name, &st) != B_OK) {
|
||||
// invalid file name, discard this pending entry
|
||||
iter = pending_entries.erase(iter);
|
||||
iter = fPendingEntries.erase(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -499,12 +501,12 @@ AddOnMonitorHandler::HandlePulse()
|
||||
}
|
||||
|
||||
// we are going to deal with the stable entry, so remove it
|
||||
iter = pending_entries.erase(iter);
|
||||
iter = fPendingEntries.erase(iter);
|
||||
|
||||
// put the new entry into the directory info
|
||||
std::list<add_on_directory_info>::iterator diter = directories.begin();
|
||||
for (; diter != directories.end() ; diter++) {
|
||||
if (diter->nref == dir_nref) {
|
||||
std::list<add_on_directory_info>::iterator diter = fDirectories.begin();
|
||||
for (; diter != fDirectories.end() ; diter++) {
|
||||
if (diter->nref == dirNodeRef) {
|
||||
diter->entries.push_back(info);
|
||||
break;
|
||||
}
|
||||
@ -514,31 +516,32 @@ AddOnMonitorHandler::HandlePulse()
|
||||
AddOnCreated(&info);
|
||||
|
||||
// Start at the top again, and search until the directory we put
|
||||
// the new add_on in. If we find a add_on with the same name then
|
||||
// the new add_on should not be enabled.
|
||||
// the new add-on in. If we find a add-on with the same name then
|
||||
// the new add-on should not be enabled.
|
||||
bool enabled = true;
|
||||
std::list<add_on_directory_info>::iterator diter2 = directories.begin();
|
||||
std::list<add_on_directory_info>::iterator diter2
|
||||
= fDirectories.begin();
|
||||
for (; diter2 != diter ; diter2++) {
|
||||
std::list<add_on_entry_info>::iterator eiter = diter2->entries.begin();
|
||||
std::list<add_on_entry_info>::iterator eiter
|
||||
= diter2->entries.begin();
|
||||
for (; eiter != diter2->entries.end() ; eiter++) {
|
||||
if (strcmp(eiter->name, info.name) == 0) {
|
||||
enabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!enabled) {
|
||||
if (!enabled)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!enabled) {
|
||||
// if we are not enabled, go on to the next pending entry
|
||||
continue;
|
||||
}
|
||||
|
||||
// The new add_on should be enabled, but first we check to see
|
||||
// if there is an add_on below us. If we find one, we disable it.
|
||||
// The new add-on should be enabled, but first we check to see
|
||||
// if there is an add-on below us. If we find one, we disable it.
|
||||
bool shadowing = false;
|
||||
for (diter++ ; diter != directories.end() ; diter++) {
|
||||
for (diter++ ; diter != fDirectories.end() ; diter++) {
|
||||
std::list<add_on_entry_info>::iterator eiter = diter->entries.begin();
|
||||
for (; eiter != diter->entries.end() ; eiter++) {
|
||||
if (strcmp(eiter->name, info.name) == 0) {
|
||||
@ -547,10 +550,9 @@ AddOnMonitorHandler::HandlePulse()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shadowing) {
|
||||
if (shadowing)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// finally, enable the new entry
|
||||
AddOnEnabled(&info);
|
||||
|
@ -35,7 +35,7 @@ class AddOnManager::InputServerMonitorHandler : public AddOnMonitorHandler {
|
||||
}
|
||||
|
||||
virtual void
|
||||
AddOnCreated(const add_on_entry_info * entry_info)
|
||||
AddOnCreated(const add_on_entry_info* entryInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@ -125,16 +125,16 @@ AddOnManager::RegisterAddOn(BEntry& entry)
|
||||
BString pathString = path.Path();
|
||||
|
||||
if (pathString.FindFirst("input_server/devices") > 0) {
|
||||
BInputServerDevice *(*instantiate_func)();
|
||||
BInputServerDevice* (*instantiateFunc)();
|
||||
|
||||
if (get_image_symbol(addonImage, "instantiate_input_device",
|
||||
B_SYMBOL_TYPE_TEXT, (void **)&instantiate_func) < B_OK) {
|
||||
B_SYMBOL_TYPE_TEXT, (void**)&instantiateFunc) < B_OK) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): can't find instantiate_input_device in \"%s\"\n",
|
||||
path.Path()));
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
BInputServerDevice *device = (*instantiate_func)();
|
||||
BInputServerDevice* device = (*instantiateFunc)();
|
||||
if (device == NULL) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): instantiate_input_device in \"%s\" returned NULL\n",
|
||||
path.Path()));
|
||||
@ -151,16 +151,16 @@ AddOnManager::RegisterAddOn(BEntry& entry)
|
||||
|
||||
RegisterDevice(device, ref, addonImage);
|
||||
} else if (pathString.FindFirst("input_server/filters") > 0) {
|
||||
BInputServerFilter *(*instantiate_func)();
|
||||
BInputServerFilter* (*instantiateFunc)();
|
||||
|
||||
if (get_image_symbol(addonImage, "instantiate_input_filter",
|
||||
B_SYMBOL_TYPE_TEXT, (void **)&instantiate_func) < B_OK) {
|
||||
B_SYMBOL_TYPE_TEXT, (void**)&instantiateFunc) < B_OK) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): can't find instantiate_input_filter in \"%s\"\n",
|
||||
path.Path()));
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
BInputServerFilter *filter = (*instantiate_func)();
|
||||
BInputServerFilter* filter = (*instantiateFunc)();
|
||||
if (filter == NULL) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): instantiate_input_filter in \"%s\" returned NULL\n",
|
||||
path.Path()));
|
||||
@ -176,16 +176,16 @@ AddOnManager::RegisterAddOn(BEntry& entry)
|
||||
|
||||
RegisterFilter(filter, ref, addonImage);
|
||||
} else if (pathString.FindFirst("input_server/methods") > 0) {
|
||||
BInputServerMethod *(*instantiate_func)();
|
||||
BInputServerMethod* (*instantiateFunc)();
|
||||
|
||||
if (get_image_symbol(addonImage, "instantiate_input_method",
|
||||
B_SYMBOL_TYPE_TEXT, (void **)&instantiate_func) < B_OK) {
|
||||
B_SYMBOL_TYPE_TEXT, (void**)&instantiateFunc) < B_OK) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): can't find instantiate_input_method in \"%s\"\n",
|
||||
path.Path()));
|
||||
goto exit_error;
|
||||
}
|
||||
|
||||
BInputServerMethod *method = (*instantiate_func)();
|
||||
BInputServerMethod* method = (*instantiateFunc)();
|
||||
if (method == NULL) {
|
||||
PRINTERR(("AddOnManager::RegisterAddOn(): instantiate_input_method in \"%s\" returned NULL\n",
|
||||
path.Path()));
|
||||
@ -319,16 +319,18 @@ AddOnManager::RegisterAddOns()
|
||||
BDirectory directory;
|
||||
BPath path;
|
||||
// when safemode, only B_BEOS_ADDONS_DIRECTORY is used
|
||||
for (uint32 i = fSafeMode ? 2 : 0 ; i < sizeof(directories) / sizeof(directory_which) ; i++)
|
||||
for (uint32 j = 0 ; j < sizeof(subDirectories) / sizeof(char[24]) ; j++) {
|
||||
if ((find_directory(directories[i], &path) == B_OK)
|
||||
&& (path.Append(subDirectories[j]) == B_OK)
|
||||
&& (directory.SetTo(path.Path()) == B_OK)
|
||||
&& (directory.GetNodeRef(&nref) == B_OK)) {
|
||||
for (uint32 i = fSafeMode ? 2 : 0;
|
||||
i < sizeof(directories) / sizeof(directory_which); i++) {
|
||||
for (uint32 j = 0; j < sizeof(subDirectories) / sizeof(char[24]); j++) {
|
||||
if (find_directory(directories[i], &path) == B_OK
|
||||
&& path.Append(subDirectories[j]) == B_OK
|
||||
&& directory.SetTo(path.Path()) == B_OK
|
||||
&& directory.GetNodeRef(&nref) == B_OK) {
|
||||
fHandler->AddDirectory(&nref);
|
||||
}
|
||||
}
|
||||
#else
|
||||
}
|
||||
#else // APPSERVER_TEST_MODE
|
||||
BEntry entry("/boot/home/svnhaiku/trunk/tests/servers/input/view_input_device/input_server/devices/ViewInputDevice");
|
||||
RegisterAddOn(entry);
|
||||
#endif
|
||||
@ -349,7 +351,7 @@ AddOnManager::UnregisterAddOns()
|
||||
// we have to stop manually the addons because the monitor doesn't disable them on exit
|
||||
|
||||
{
|
||||
device_info *info;
|
||||
device_info* info;
|
||||
for (fDeviceList.Rewind(); fDeviceList.GetNext(&info);) {
|
||||
gInputServer->StartStopDevices(*info->device, false);
|
||||
delete info->device;
|
||||
@ -360,7 +362,7 @@ AddOnManager::UnregisterAddOns()
|
||||
}
|
||||
|
||||
{
|
||||
filter_info *info;
|
||||
filter_info* info;
|
||||
for (fFilterList.Rewind(); fFilterList.GetNext(&info);) {
|
||||
delete info->filter;
|
||||
if (info->addon_image >= B_OK)
|
||||
@ -370,7 +372,7 @@ AddOnManager::UnregisterAddOns()
|
||||
}
|
||||
|
||||
{
|
||||
method_info *info;
|
||||
method_info* info;
|
||||
for (fMethodList.Rewind(); fMethodList.GetNext(&info);) {
|
||||
delete info->method;
|
||||
if (info->addon_image >= B_OK)
|
||||
@ -387,9 +389,9 @@ AddOnManager::RegisterDevice(BInputServerDevice* device, const entry_ref& ref,
|
||||
{
|
||||
BAutolock locker(fLock);
|
||||
|
||||
device_info *pinfo;
|
||||
for (fDeviceList.Rewind(); fDeviceList.GetNext(&pinfo);) {
|
||||
if (!strcmp(pinfo->ref.name, ref.name)) {
|
||||
device_info* info;
|
||||
for (fDeviceList.Rewind(); fDeviceList.GetNext(&info);) {
|
||||
if (!strcmp(info->ref.name, ref.name)) {
|
||||
// we already know this device
|
||||
return;
|
||||
}
|
||||
@ -397,12 +399,12 @@ AddOnManager::RegisterDevice(BInputServerDevice* device, const entry_ref& ref,
|
||||
|
||||
PRINT(("AddOnManager::RegisterDevice, name %s\n", ref.name));
|
||||
|
||||
device_info info;
|
||||
info.ref = ref;
|
||||
info.addon_image = addonImage;
|
||||
info.device = device;
|
||||
device_info newInfo;
|
||||
newInfo.ref = ref;
|
||||
newInfo.addon_image = addonImage;
|
||||
newInfo.device = device;
|
||||
|
||||
fDeviceList.Insert(info);
|
||||
fDeviceList.Insert(newInfo);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,11 +12,12 @@
|
||||
// Manager for input_server add-ons (devices, filters, methods)
|
||||
|
||||
|
||||
#include <Locker.h>
|
||||
#include <Looper.h>
|
||||
#include <InputServerDevice.h>
|
||||
#include <InputServerFilter.h>
|
||||
#include <InputServerMethod.h>
|
||||
#include <Locker.h>
|
||||
#include <Looper.h>
|
||||
|
||||
#include "AddOnMonitor.h"
|
||||
#include "AddOnMonitorHandler.h"
|
||||
#include "TList.h"
|
||||
|
@ -1,28 +1,30 @@
|
||||
/*
|
||||
** Copyright 2004, the Haiku project. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
**
|
||||
** Author : Jérôme Duval
|
||||
** Original authors: Marcus Overhagen, Axel Dörfler
|
||||
*/
|
||||
* Copyright 2004-2008, the Haiku project. All rights reserved.
|
||||
* Distributed under the terms of the Haiku License.
|
||||
*
|
||||
* Authors:
|
||||
* Marcus Overhagen, Axel Dörfler
|
||||
* Jérôme Duval
|
||||
*/
|
||||
|
||||
#include "InputServer.h"
|
||||
#include "DeviceManager.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <image.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <image.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "InputServer.h"
|
||||
|
||||
|
||||
void
|
||||
DeviceManager::MessageReceived(BMessage * msg)
|
||||
DeviceManager::MessageReceived(BMessage *msg)
|
||||
{
|
||||
CALLED();
|
||||
if (msg->what == B_NODE_MONITOR) {
|
||||
@ -34,8 +36,8 @@ DeviceManager::MessageReceived(BMessage * msg)
|
||||
case B_ENTRY_MOVED:
|
||||
{
|
||||
node_ref dir_nref;
|
||||
if ((msg->FindInt32("device", &dir_nref.device)!=B_OK)
|
||||
|| (msg->FindInt64("directory", &dir_nref.node)!=B_OK))
|
||||
if (msg->FindInt32("device", &dir_nref.device) != B_OK
|
||||
|| msg->FindInt64("directory", &dir_nref.node) != B_OK)
|
||||
return;
|
||||
|
||||
_BDeviceAddOn_ *addon = NULL;
|
||||
@ -45,12 +47,14 @@ DeviceManager::MessageReceived(BMessage * msg)
|
||||
node_ref *dnref = NULL;
|
||||
while ((dnref = (node_ref *)addon->fMonitoredRefs.ItemAt(j++)) != NULL) {
|
||||
if (*dnref == dir_nref) {
|
||||
addon->fDevice->Control(NULL, NULL, msg->what, msg);
|
||||
}
|
||||
addon->fDevice->Control(NULL, NULL, msg->what,
|
||||
msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case B_STAT_CHANGED:
|
||||
case B_ATTR_CHANGED:
|
||||
case B_DEVICE_MOUNTED:
|
||||
@ -94,7 +98,7 @@ DeviceManager::AddDirectory(const node_ref *nref, _BDeviceAddOn_ *addon)
|
||||
|
||||
|
||||
status_t
|
||||
DeviceManager::RemoveDirectory(const node_ref * nref, _BDeviceAddOn_ *addon)
|
||||
DeviceManager::RemoveDirectory(const node_ref *nref, _BDeviceAddOn_ *addon)
|
||||
{
|
||||
CALLED();
|
||||
BDirectory directory(nref);
|
||||
@ -132,7 +136,7 @@ DeviceManager::DeviceManager()
|
||||
DeviceManager::~DeviceManager()
|
||||
{
|
||||
_BDeviceAddOn_ *addon = NULL;
|
||||
while ((addon = (_BDeviceAddOn_ *)fDeviceAddons.RemoveItem((int32)0)) !=NULL)
|
||||
while ((addon = (_BDeviceAddOn_ *)fDeviceAddons.RemoveItem((int32)0)) != NULL)
|
||||
delete addon;
|
||||
}
|
||||
|
||||
@ -155,8 +159,7 @@ DeviceManager::SaveState()
|
||||
|
||||
|
||||
status_t
|
||||
DeviceManager::StartMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
const char *device)
|
||||
DeviceManager::StartMonitoringDevice(_BDeviceAddOn_ *addon, const char *device)
|
||||
{
|
||||
CALLED();
|
||||
status_t err;
|
||||
@ -224,33 +227,31 @@ DeviceManager::StartMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyMonitored) {
|
||||
if (!alreadyMonitored)
|
||||
addon->fMonitoredRefs.AddItem(new node_ref(nref));
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
DeviceManager::StopMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
const char *device)
|
||||
DeviceManager::StopMonitoringDevice(_BDeviceAddOn_ *addon, const char *device)
|
||||
{
|
||||
CALLED();
|
||||
status_t err;
|
||||
node_ref nref;
|
||||
BDirectory directory;
|
||||
BPath path("/dev");
|
||||
if (((err = path.Append(device)) != B_OK)
|
||||
|| ((err = directory.SetTo(path.Path())) != B_OK)
|
||||
|| ((err = directory.GetNodeRef(&nref)) != B_OK))
|
||||
if ((err = path.Append(device)) != B_OK
|
||||
|| (err = directory.SetTo(path.Path())) != B_OK
|
||||
|| (err = directory.GetNodeRef(&nref)) != B_OK)
|
||||
return err;
|
||||
|
||||
// test if still monitored
|
||||
bool stillMonitored = false;
|
||||
_BDeviceAddOn_ *tmpaddon = NULL;
|
||||
int32 i = 0;
|
||||
while ((tmpaddon = (_BDeviceAddOn_ *)fDeviceAddons.ItemAt(i++)) !=NULL) {
|
||||
while ((tmpaddon = (_BDeviceAddOn_ *)fDeviceAddons.ItemAt(i++)) != NULL) {
|
||||
if (addon == tmpaddon)
|
||||
continue;
|
||||
|
||||
@ -268,7 +269,7 @@ DeviceManager::StopMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
|
||||
// remove from list
|
||||
node_ref *dnref = NULL;
|
||||
int32 j=0;
|
||||
int32 j = 0;
|
||||
while ((dnref = (node_ref *)addon->fMonitoredRefs.ItemAt(j)) != NULL) {
|
||||
if (*dnref == nref) {
|
||||
addon->fMonitoredRefs.RemoveItem(j);
|
||||
@ -278,9 +279,8 @@ DeviceManager::StopMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
j++;
|
||||
}
|
||||
|
||||
if (addon->fMonitoredRefs.IsEmpty()) {
|
||||
if (addon->fMonitoredRefs.IsEmpty())
|
||||
fDeviceAddons.RemoveItem(addon);
|
||||
}
|
||||
|
||||
// stop monitoring if needed
|
||||
if (!stillMonitored) {
|
||||
|
@ -1,27 +1,32 @@
|
||||
/*
|
||||
** Copyright 2004, the Haiku project. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
**
|
||||
** Author : Jérôme Duval
|
||||
** Original authors: Marcus Overhagen, Axel Dörfler
|
||||
*/
|
||||
* Copyright 2004-2008, the Haiku project. All rights reserved.
|
||||
* Distributed under the terms of the Haiku License.
|
||||
*
|
||||
* Authors:
|
||||
* Marcus Overhagen, Axel Dörfler
|
||||
* Jérôme Duval
|
||||
*/
|
||||
#ifndef _DEVICE_MANAGER_H
|
||||
#define _DEVICE_MANAGER_H
|
||||
|
||||
// Manager for devices monitoring
|
||||
//! Manager for devices monitoring
|
||||
|
||||
#include <Handler.h>
|
||||
#include <Looper.h>
|
||||
#include <Locker.h>
|
||||
#include <Node.h>
|
||||
|
||||
#include <InputServerDevice.h>
|
||||
#include <InputServerFilter.h>
|
||||
#include <InputServerMethod.h>
|
||||
|
||||
#include "TList.h"
|
||||
|
||||
|
||||
class DeviceManager : public BLooper {
|
||||
public:
|
||||
public:
|
||||
DeviceManager();
|
||||
~DeviceManager();
|
||||
virtual ~DeviceManager();
|
||||
|
||||
void LoadState();
|
||||
void SaveState();
|
||||
@ -30,15 +35,17 @@ class DeviceManager : public BLooper {
|
||||
const char *device);
|
||||
status_t StopMonitoringDevice(_BDeviceAddOn_ *addon,
|
||||
const char *device);
|
||||
_BDeviceAddOn_ *GetAddOn(int32 index) {
|
||||
return (_BDeviceAddOn_*)fDeviceAddons.ItemAt(index);
|
||||
}
|
||||
_BDeviceAddOn_ *GetAddOn(int32 index)
|
||||
{ return (_BDeviceAddOn_*)
|
||||
fDeviceAddons.ItemAt(index); }
|
||||
|
||||
void MessageReceived(BMessage *msg);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
private:
|
||||
status_t AddDirectory(const node_ref *nref, _BDeviceAddOn_ *addon);
|
||||
status_t RemoveDirectory(const node_ref *nref, _BDeviceAddOn_ *addon);
|
||||
private:
|
||||
status_t AddDirectory(const node_ref *nref,
|
||||
_BDeviceAddOn_ *addon);
|
||||
status_t RemoveDirectory(const node_ref *nref,
|
||||
_BDeviceAddOn_ *addon);
|
||||
|
||||
BList fDeviceAddons;
|
||||
BLocker fLock;
|
||||
|
@ -180,7 +180,6 @@ InputServer::InputServer()
|
||||
fSafeMode = true;
|
||||
}
|
||||
|
||||
|
||||
gDeviceManager.LoadState();
|
||||
|
||||
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
@ -1195,13 +1194,15 @@ InputServer::RegisterDevices(BInputServerDevice& serverDevice,
|
||||
|
||||
|
||||
status_t
|
||||
InputServer::StartStopDevices(const char* name, input_device_type type, bool doStart)
|
||||
InputServer::StartStopDevices(const char* name, input_device_type type,
|
||||
bool doStart)
|
||||
{
|
||||
CALLED();
|
||||
BAutolock lock(fInputDeviceListLocker);
|
||||
|
||||
for (int32 i = fInputDeviceList.CountItems() - 1; i >= 0; i--) {
|
||||
InputDeviceListItem* item = (InputDeviceListItem*)fInputDeviceList.ItemAt(i);
|
||||
InputDeviceListItem* item
|
||||
= (InputDeviceListItem*)fInputDeviceList.ItemAt(i);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user