* Implemented AS_DIRECT_WINDOW_SET_FULLSCREEN so that it sets kWindowScreenFeel
when enabled, and B_NORMAL_WINDOW_FEEL when disabled. IOW when enabled, no other windows can interfere. * Therefore, it's no longer necessary to have the screen_blanker window use kWindowScreenFeel - it will set its window to full screen as long as the blanker runs. * Added a AS_APP_CRASHED notification in the app_server that will remove all kWindowScreenFeels from the windows of the crashed app. * This is now used by the debugger to ensure that the debugger alert will be visible. * Factored out a DesktopLink class out of the BRoster::_ActivateApp() method. This class is now also used in the new BRoster::_ApplicationCrashed() method as used in the debug_server (via BRoster::Private). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17785 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef _DESKTOP_LINK_H
|
||||
#define _DESKTOP_LINK_H
|
||||
|
||||
|
||||
#include <PortLink.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class DesktopLink : public PortLink {
|
||||
public:
|
||||
DesktopLink();
|
||||
virtual ~DesktopLink();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
private:
|
||||
port_id fReplyPort;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* _DESKTOP_LINK_H */
|
||||
@@ -70,6 +70,10 @@ class BRoster::Private {
|
||||
void SaveRecentLists(const char *file) const
|
||||
{ fRoster->_SaveRecentLists(file); }
|
||||
|
||||
// needed by the debug server
|
||||
void ApplicationCrashed(team_id team) const
|
||||
{ fRoster->_ApplicationCrashed(team); }
|
||||
|
||||
static void InitBeRoster();
|
||||
static void DeleteBeRoster();
|
||||
|
||||
|
||||
@@ -44,8 +44,7 @@ enum {
|
||||
AS_DELETE_APP,
|
||||
AS_QUIT_APP,
|
||||
AS_ACTIVATE_APP,
|
||||
|
||||
AS_SET_SERVER_PORT,
|
||||
AS_APP_CRASHED,
|
||||
|
||||
AS_CREATE_WINDOW,
|
||||
AS_CREATE_OFFSCREEN_WINDOW,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
ScreenSaverWindow::ScreenSaverWindow(BRect frame)
|
||||
: BDirectWindow(frame, "ScreenSaver Window",
|
||||
B_NO_BORDER_WINDOW_LOOK, kWindowScreenFeel, B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
|
||||
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE),
|
||||
fSaver(NULL)
|
||||
{
|
||||
frame.OffsetTo(0, 0);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
|
||||
|
||||
#include <DesktopLink.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
DesktopLink::DesktopLink()
|
||||
:
|
||||
fReplyPort(B_ERROR)
|
||||
{
|
||||
// get the app server port
|
||||
port_id port = find_port(SERVER_PORT_NAME);
|
||||
if (port < B_OK)
|
||||
return;
|
||||
|
||||
// create a reply port
|
||||
fReplyPort = create_port(1, "desktop reply");
|
||||
if (fReplyPort < B_OK)
|
||||
return;
|
||||
|
||||
SetTo(port, fReplyPort);
|
||||
|
||||
// We can't use AppServerLink because be_app may be NULL
|
||||
StartMessage(AS_GET_DESKTOP);
|
||||
Attach<port_id>(fReplyPort);
|
||||
Attach<int32>(getuid());
|
||||
|
||||
int32 code;
|
||||
if (FlushWithReply(code) != B_OK || code != B_OK)
|
||||
return;
|
||||
|
||||
// we now talk to the desktop
|
||||
Read<port_id>(&port);
|
||||
SetSenderPort(port);
|
||||
}
|
||||
|
||||
|
||||
DesktopLink::~DesktopLink()
|
||||
{
|
||||
delete_port(fReplyPort);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
DesktopLink::InitCheck() const
|
||||
{
|
||||
return fReplyPort < B_OK ? fReplyPort : B_OK;
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
@@ -31,6 +31,7 @@ MergeObject <libbe>app_kit.o :
|
||||
Cursor.cpp
|
||||
Clipboard.cpp
|
||||
dano_message.cpp
|
||||
DesktopLink.cpp
|
||||
Handler.cpp
|
||||
InitTerminateLibBe.cpp
|
||||
Invoker.cpp
|
||||
|
||||
+27
-44
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <AppFileInfo.h>
|
||||
#include <Application.h>
|
||||
#include <AppMisc.h>
|
||||
#include <Directory.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
@@ -22,21 +21,24 @@
|
||||
#include <fs_info.h>
|
||||
#include <image.h>
|
||||
#include <List.h>
|
||||
#include <MessengerPrivate.h>
|
||||
#include <Mime.h>
|
||||
#include <Node.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <OS.h>
|
||||
#include <Path.h>
|
||||
#include <PortLink.h>
|
||||
#include <Query.h>
|
||||
#include <RegistrarDefs.h>
|
||||
#include <Roster.h>
|
||||
#include <RosterPrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <Volume.h>
|
||||
#include <VolumeRoster.h>
|
||||
|
||||
#include <AppMisc.h>
|
||||
#include <DesktopLink.h>
|
||||
#include <MessengerPrivate.h>
|
||||
#include <PortLink.h>
|
||||
#include <RosterPrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <new>
|
||||
#include <stdio.h>
|
||||
@@ -770,52 +772,18 @@ BRoster::StopWatching(BMessenger target) const
|
||||
status_t
|
||||
BRoster::ActivateApp(team_id team) const
|
||||
{
|
||||
// get the app server port
|
||||
port_id port = find_port(SERVER_PORT_NAME);
|
||||
if (port < B_OK)
|
||||
return port;
|
||||
BPrivate::DesktopLink link;
|
||||
|
||||
// create a reply port
|
||||
struct ReplyPort {
|
||||
ReplyPort()
|
||||
: port(create_port(1, "activate app reply"))
|
||||
{
|
||||
}
|
||||
|
||||
~ReplyPort()
|
||||
{
|
||||
if (port >= 0)
|
||||
delete_port(port);
|
||||
}
|
||||
|
||||
port_id port;
|
||||
|
||||
} replyPort;
|
||||
|
||||
if (replyPort.port < 0)
|
||||
return replyPort.port;
|
||||
|
||||
BPrivate::PortLink link(port, replyPort.port);
|
||||
|
||||
// We can't use AppServerLink because be_app may be NULL
|
||||
link.StartMessage(AS_GET_DESKTOP);
|
||||
link.Attach<port_id>(replyPort.port);
|
||||
link.Attach<int32>(getuid());
|
||||
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) != B_OK || code != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
// we now talk to the desktop
|
||||
link.Read<port_id>(&port);
|
||||
link.SetSenderPort(port);
|
||||
status_t status = link.InitCheck();
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
// prepare the message
|
||||
status_t error = link.StartMessage(AS_ACTIVATE_APP);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
error = link.Attach(replyPort.port);
|
||||
error = link.Attach(link.ReceiverPort());
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
@@ -824,6 +792,7 @@ BRoster::ActivateApp(team_id team) const
|
||||
return error;
|
||||
|
||||
// send it
|
||||
status_t code;
|
||||
error = link.FlushWithReply(code);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
@@ -1724,6 +1693,20 @@ BRoster::_RemoveApp(team_id team) const
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BRoster::_ApplicationCrashed(team_id team)
|
||||
{
|
||||
BPrivate::DesktopLink link;
|
||||
if (link.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
if (link.StartMessage(AS_APP_CRASHED) == B_OK
|
||||
&& link.Attach(team) == B_OK)
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
|
||||
// _LaunchApp
|
||||
/*! \brief Launches the application associated with the supplied MIME type or
|
||||
the entry referred to by the supplied entry_ref.
|
||||
|
||||
@@ -542,6 +542,23 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_APP_CRASHED:
|
||||
{
|
||||
BAutolock locker(fApplicationsLock);
|
||||
|
||||
team_id team;
|
||||
if (link.Read(&team) != B_OK)
|
||||
break;
|
||||
|
||||
for (int32 i = 0; i < fApplications.CountItems(); i++) {
|
||||
ServerApp* app = fApplications.ItemAt(i);
|
||||
|
||||
if (app->ClientTeam() == team)
|
||||
app->PostMessage(AS_APP_CRASHED);
|
||||
}
|
||||
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
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <FontPrivate.h>
|
||||
#include <MessengerPrivate.h>
|
||||
#include <ServerProtocol.h>
|
||||
#include <WindowPrivate.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -432,6 +433,22 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_APP_CRASHED:
|
||||
// Allow the debugger to show its window: if needed, remove any
|
||||
// kWindowScreenFeels from the windows of this application
|
||||
if (fWindowListLock.Lock()) {
|
||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
||||
WindowLayer* window = serverWindow->Window();
|
||||
|
||||
if (window->Feel() == kWindowScreenFeel)
|
||||
fDesktop->SetWindowFeel(window, B_NORMAL_WINDOW_FEEL);
|
||||
}
|
||||
|
||||
fWindowListLock.Unlock();
|
||||
}
|
||||
break;
|
||||
|
||||
case AS_CREATE_WINDOW:
|
||||
case AS_CREATE_OFFSCREEN_WINDOW:
|
||||
{
|
||||
|
||||
@@ -1011,12 +1011,21 @@ fDesktop->LockSingleWindow();
|
||||
}
|
||||
case AS_DIRECT_WINDOW_SET_FULLSCREEN:
|
||||
{
|
||||
// TODO: maybe there is more to do than this?
|
||||
bool enable;
|
||||
link.Read<bool>(&enable);
|
||||
|
||||
fLink.StartMessage(B_ERROR);
|
||||
fLink.Flush();
|
||||
status_t status = B_OK;
|
||||
if (!fWindowLayer->IsOffscreenWindow()) {
|
||||
fDesktop->UnlockSingleWindow();
|
||||
fDesktop->SetWindowFeel(fWindowLayer,
|
||||
enable ? kWindowScreenFeel : B_NORMAL_WINDOW_FEEL);
|
||||
fDesktop->LockSingleWindow();
|
||||
} else
|
||||
status = B_BAD_TYPE;
|
||||
|
||||
fLink.StartMessage(status);
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net.
|
||||
* Copyright 2005-2006, Ingo Weinhold, bonefish@users.sf.net.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <debug_support.h>
|
||||
#include <Entry.h>
|
||||
#include <Invoker.h>
|
||||
|
||||
#include <RosterPrivate.h>
|
||||
#include <Server.h>
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
@@ -112,6 +114,7 @@ private:
|
||||
void _LookupSymbolAddress(debug_symbol_lookup_context *lookupContext,
|
||||
const void *address, char *buffer, int32 bufferSize);
|
||||
void _PrintStackTrace(thread_id thread);
|
||||
void _NotifyAppServer(team_id team);
|
||||
|
||||
status_t _InitGUI();
|
||||
|
||||
@@ -567,6 +570,9 @@ TeamDebugHandler::_HandleMessage(DebugMessage *message)
|
||||
|
||||
} else if (USE_GUI && _AreGUIServersAlive() && _InitGUI() == B_OK) {
|
||||
// normal app
|
||||
|
||||
_NotifyAppServer(fTeam);
|
||||
|
||||
char buffer[1024];
|
||||
snprintf(buffer, sizeof(buffer), "The application:\n\n %s\n\n"
|
||||
"has encountered an error which prevents it from continuing. Haiku "
|
||||
@@ -694,6 +700,16 @@ TeamDebugHandler::_PrintStackTrace(thread_id thread)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamDebugHandler::_NotifyAppServer(team_id team)
|
||||
{
|
||||
// This will remove any kWindowScreenFeels of the application, so that
|
||||
// the debugger alert is visible on screen
|
||||
BRoster::Private roster;
|
||||
roster.ApplicationCrashed(team);
|
||||
}
|
||||
|
||||
// _InitGUI
|
||||
status_t
|
||||
TeamDebugHandler::_InitGUI()
|
||||
|
||||
Reference in New Issue
Block a user