The app_server now starts and restarts (if needed) the input_server. The use of
a debugger call in _LaunchInputServer may be overkill, but at least you could conceivably cleanly restart the machine in the debugger (I think.) Because without the input_server the machine is pretty useless. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19615 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a06480efcb
commit
6869c8a59a
@ -36,8 +36,10 @@
|
||||
#include <Message.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <Region.h>
|
||||
#include <Roster.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if TEST_MODE
|
||||
# include "EventStream.h"
|
||||
@ -369,7 +371,12 @@ Desktop::Init()
|
||||
#if TEST_MODE
|
||||
gInputManager->AddStream(new InputServerStream);
|
||||
#endif
|
||||
|
||||
fEventDispatcher.SetDesktop(this);
|
||||
fEventDispatcher.SetTo(gInputManager->GetStream());
|
||||
if (fEventDispatcher.InitCheck() != B_OK)
|
||||
_LaunchInputServer();
|
||||
|
||||
fEventDispatcher.SetHWInterface(fVirtualScreen.HWInterface());
|
||||
|
||||
fEventDispatcher.SetMouseFilter(new MouseFilter(this));
|
||||
@ -389,6 +396,19 @@ Desktop::Init()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Desktop::_LaunchInputServer()
|
||||
{
|
||||
BRoster roster;
|
||||
status_t err = roster.Launch("application/x-vnd.Be-input_server");
|
||||
if (!(err == B_OK || err == B_ALREADY_RUNNING)) {
|
||||
char str[256];
|
||||
sprintf(str, "Failed to launch the input server (%s)!\n", strerror(err));
|
||||
debugger(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Desktop::_GetLooperName(char* name, size_t length)
|
||||
{
|
||||
@ -557,6 +577,12 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_EVENT_STREAM_CLOSED:
|
||||
{
|
||||
_LaunchInputServer();
|
||||
break;
|
||||
}
|
||||
|
||||
case B_QUIT_REQUESTED:
|
||||
// We've been asked to quit, so (for now) broadcast to all
|
||||
// test apps to quit. This situation will occur only when the server
|
||||
|
@ -181,6 +181,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
||||
BPrivate::LinkSender& sender);
|
||||
|
||||
private:
|
||||
void _LaunchInputServer();
|
||||
void _SetWorkspace(int32 index);
|
||||
void _ShowWindow(WindowLayer* window,
|
||||
bool affectsOtherWindows = true);
|
||||
|
@ -10,12 +10,14 @@
|
||||
#include "EventDispatcher.h"
|
||||
|
||||
#include "BitmapManager.h"
|
||||
#include "Desktop.h"
|
||||
#include "EventStream.h"
|
||||
#include "HWInterface.h"
|
||||
#include "InputManager.h"
|
||||
#include "ServerBitmap.h"
|
||||
|
||||
#include <MessagePrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <TokenSpace.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
@ -236,7 +238,8 @@ EventDispatcher::EventDispatcher()
|
||||
fTargets(10),
|
||||
fNextLatestMouseMoved(NULL),
|
||||
fCursorLock("cursor loop lock"),
|
||||
fHWInterface(NULL)
|
||||
fHWInterface(NULL),
|
||||
fDesktop(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -566,6 +569,13 @@ EventDispatcher::SetDragMessage(BMessage& message,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EventDispatcher::SetDesktop(Desktop* desktop)
|
||||
{
|
||||
fDesktop = desktop;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Message methods
|
||||
|
||||
|
||||
@ -909,6 +919,15 @@ EventDispatcher::_EventLoop()
|
||||
fNextLatestMouseMoved = NULL;
|
||||
delete event;
|
||||
}
|
||||
|
||||
// The loop quit, therefore no more events are coming from the input
|
||||
// server, it must have died. Unset ourselves and notify the desktop.
|
||||
fThread = -1;
|
||||
// Needed to avoid problems with wait_for_thread in _Unset()
|
||||
_Unset();
|
||||
|
||||
if (fDesktop)
|
||||
fDesktop->PostMessage(AS_EVENT_STREAM_CLOSED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <ObjectList.h>
|
||||
|
||||
|
||||
class Desktop;
|
||||
class EventStream;
|
||||
class HWInterface;
|
||||
class ServerBitmap;
|
||||
@ -93,6 +94,8 @@ class EventDispatcher : public BLocker {
|
||||
// if the mouse is not pressed, it should
|
||||
// be delivered to the "current" target right away.
|
||||
|
||||
void SetDesktop(Desktop* desktop);
|
||||
|
||||
private:
|
||||
status_t _Run();
|
||||
void _Unset();
|
||||
@ -151,6 +154,7 @@ class EventDispatcher : public BLocker {
|
||||
|
||||
BLocker fCursorLock;
|
||||
HWInterface* fHWInterface;
|
||||
Desktop* fDesktop;
|
||||
};
|
||||
|
||||
#endif /* EVENT_DISPATCHER_H */
|
||||
|
Loading…
Reference in New Issue
Block a user