* There is now a server_read_only_memory structure that is placed in a (surprise!)
read-only area shared between the Desktop and all applications. * Right now, this area only contains the desktop colors, ie. B_PANEL_BACKGROUND_COLOR etc.; ui_color() no longer needs to ask the server for these colors. * The ui_colors are now maintained by DesktopSettings, though ColorSet is still there. * The default colors are now hardcoded once and for everyone in InterfaceDefs.h, ie. the app_server uses them as well. * Desktop::Init() can now also return an error (but that is not yet accounted for). * Cleaned up InterfaceDefs.h. * Fixed wrong include in moreUTF8.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17232 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -34,8 +34,7 @@ namespace BPrivate {
|
|||||||
class BApplication : public BLooper {
|
class BApplication : public BLooper {
|
||||||
public:
|
public:
|
||||||
BApplication(const char* signature);
|
BApplication(const char* signature);
|
||||||
BApplication(const char* signature,
|
BApplication(const char* signature, status_t* error);
|
||||||
status_t* error);
|
|
||||||
virtual ~BApplication();
|
virtual ~BApplication();
|
||||||
|
|
||||||
// Archiving
|
// Archiving
|
||||||
@@ -138,7 +137,6 @@ private:
|
|||||||
*/ bool _QuitAllWindows(bool force);
|
*/ bool _QuitAllWindows(bool force);
|
||||||
bool _WindowQuitLoop(bool quitFilePanels, bool force);
|
bool _WindowQuitLoop(bool quitFilePanels, bool force);
|
||||||
void _ArgvReceived(BMessage* message);
|
void _ArgvReceived(BMessage* message);
|
||||||
void SetAppCursor();
|
|
||||||
|
|
||||||
uint32 InitialWorkspace();
|
uint32 InitialWorkspace();
|
||||||
int32 _CountWindows(bool includeMenus) const;
|
int32 _CountWindows(bool includeMenus) const;
|
||||||
@@ -158,7 +156,8 @@ private:
|
|||||||
//_drag_data_* fDraggedMessage;
|
//_drag_data_* fDraggedMessage;
|
||||||
BMessageRunner* fPulseRunner;
|
BMessageRunner* fPulseRunner;
|
||||||
status_t fInitError;
|
status_t fInitError;
|
||||||
uint32 _reserved[13];
|
void* fServerReadOnlyMemory;
|
||||||
|
uint32 _reserved[12];
|
||||||
|
|
||||||
bool fReadyToRunCalled;
|
bool fReadyToRunCalled;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,57 +1,22 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, OpenBeOS
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||||
//
|
* Distributed under the terms of the MIT license.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* Erik Jaesler ([email protected])
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
//
|
|
||||||
// File Name: InterfaceDefs.h
|
|
||||||
// Author: Erik Jaesler ([email protected])
|
|
||||||
// Description: General Interface Kit definitions and global functions.
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef _INTERFACE_DEFS_H
|
#ifndef _INTERFACE_DEFS_H
|
||||||
#define _INTERFACE_DEFS_H
|
#define _INTERFACE_DEFS_H
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
class BRect;
|
class BRect;
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
struct key_info {
|
// some handy UTF-8 characters
|
||||||
uint32 modifiers;
|
|
||||||
uint8 key_states[16];
|
|
||||||
};
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define B_UTF8_ELLIPSIS "\xE2\x80\xA6"
|
#define B_UTF8_ELLIPSIS "\xE2\x80\xA6"
|
||||||
#define B_UTF8_OPEN_QUOTE "\xE2\x80\x9C"
|
#define B_UTF8_OPEN_QUOTE "\xE2\x80\x9C"
|
||||||
@@ -67,86 +32,97 @@ struct key_info {
|
|||||||
#define B_MAX_MOUSE_BUTTONS 16
|
#define B_MAX_MOUSE_BUTTONS 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
|
||||||
|
|
||||||
enum { B_BACKSPACE = 0x08,
|
// key definitions
|
||||||
B_RETURN = 0x0a,
|
|
||||||
B_ENTER = 0x0a,
|
|
||||||
B_SPACE = 0x20,
|
|
||||||
B_TAB = 0x09,
|
|
||||||
B_ESCAPE = 0x1b,
|
|
||||||
B_SUBSTITUTE = 0x1a,
|
|
||||||
|
|
||||||
B_LEFT_ARROW = 0x1c,
|
struct key_info {
|
||||||
B_RIGHT_ARROW = 0x1d,
|
uint32 modifiers;
|
||||||
B_UP_ARROW = 0x1e,
|
uint8 key_states[16];
|
||||||
B_DOWN_ARROW = 0x1f,
|
};
|
||||||
|
|
||||||
B_INSERT = 0x05,
|
enum {
|
||||||
B_DELETE = 0x7f,
|
B_BACKSPACE = 0x08,
|
||||||
B_HOME = 0x01,
|
B_RETURN = 0x0a,
|
||||||
B_END = 0x04,
|
B_ENTER = 0x0a,
|
||||||
B_PAGE_UP = 0x0b,
|
B_SPACE = 0x20,
|
||||||
B_PAGE_DOWN = 0x0c,
|
B_TAB = 0x09,
|
||||||
|
B_ESCAPE = 0x1b,
|
||||||
|
B_SUBSTITUTE = 0x1a,
|
||||||
|
|
||||||
B_FUNCTION_KEY = 0x10 };
|
B_LEFT_ARROW = 0x1c,
|
||||||
|
B_RIGHT_ARROW = 0x1d,
|
||||||
|
B_UP_ARROW = 0x1e,
|
||||||
|
B_DOWN_ARROW = 0x1f,
|
||||||
|
|
||||||
enum { B_F1_KEY = 0x02,
|
B_INSERT = 0x05,
|
||||||
B_F2_KEY = 0x03,
|
B_DELETE = 0x7f,
|
||||||
B_F3_KEY = 0x04,
|
B_HOME = 0x01,
|
||||||
B_F4_KEY = 0x05,
|
B_END = 0x04,
|
||||||
B_F5_KEY = 0x06,
|
B_PAGE_UP = 0x0b,
|
||||||
B_F6_KEY = 0x07,
|
B_PAGE_DOWN = 0x0c,
|
||||||
B_F7_KEY = 0x08,
|
|
||||||
B_F8_KEY = 0x09,
|
B_FUNCTION_KEY = 0x10
|
||||||
B_F9_KEY = 0x0a,
|
};
|
||||||
B_F10_KEY = 0x0b,
|
|
||||||
B_F11_KEY = 0x0c,
|
enum {
|
||||||
B_F12_KEY = 0x0d,
|
B_F1_KEY = 0x02,
|
||||||
B_PRINT_KEY = 0x0e,
|
B_F2_KEY = 0x03,
|
||||||
B_SCROLL_KEY = 0x0f,
|
B_F3_KEY = 0x04,
|
||||||
B_PAUSE_KEY = 0x10 };
|
B_F4_KEY = 0x05,
|
||||||
|
B_F5_KEY = 0x06,
|
||||||
|
B_F6_KEY = 0x07,
|
||||||
|
B_F7_KEY = 0x08,
|
||||||
|
B_F8_KEY = 0x09,
|
||||||
|
B_F9_KEY = 0x0a,
|
||||||
|
B_F10_KEY = 0x0b,
|
||||||
|
B_F11_KEY = 0x0c,
|
||||||
|
B_F12_KEY = 0x0d,
|
||||||
|
B_PRINT_KEY = 0x0e,
|
||||||
|
B_SCROLL_KEY = 0x0f,
|
||||||
|
B_PAUSE_KEY = 0x10
|
||||||
|
};
|
||||||
|
|
||||||
struct key_map {
|
struct key_map {
|
||||||
uint32 version;
|
uint32 version;
|
||||||
uint32 caps_key;
|
uint32 caps_key;
|
||||||
uint32 scroll_key;
|
uint32 scroll_key;
|
||||||
uint32 num_key;
|
uint32 num_key;
|
||||||
uint32 left_shift_key;
|
uint32 left_shift_key;
|
||||||
uint32 right_shift_key;
|
uint32 right_shift_key;
|
||||||
uint32 left_command_key;
|
uint32 left_command_key;
|
||||||
uint32 right_command_key;
|
uint32 right_command_key;
|
||||||
uint32 left_control_key;
|
uint32 left_control_key;
|
||||||
uint32 right_control_key;
|
uint32 right_control_key;
|
||||||
uint32 left_option_key;
|
uint32 left_option_key;
|
||||||
uint32 right_option_key;
|
uint32 right_option_key;
|
||||||
uint32 menu_key;
|
uint32 menu_key;
|
||||||
uint32 lock_settings;
|
uint32 lock_settings;
|
||||||
int32 control_map[128];
|
int32 control_map[128];
|
||||||
int32 option_caps_shift_map[128];
|
int32 option_caps_shift_map[128];
|
||||||
int32 option_caps_map[128];
|
int32 option_caps_map[128];
|
||||||
int32 option_shift_map[128];
|
int32 option_shift_map[128];
|
||||||
int32 option_map[128];
|
int32 option_map[128];
|
||||||
int32 caps_shift_map[128];
|
int32 caps_shift_map[128];
|
||||||
int32 caps_map[128];
|
int32 caps_map[128];
|
||||||
int32 shift_map[128];
|
int32 shift_map[128];
|
||||||
int32 normal_map[128];
|
int32 normal_map[128];
|
||||||
int32 acute_dead_key[32];
|
int32 acute_dead_key[32];
|
||||||
int32 grave_dead_key[32];
|
int32 grave_dead_key[32];
|
||||||
int32 circumflex_dead_key[32];
|
int32 circumflex_dead_key[32];
|
||||||
int32 dieresis_dead_key[32];
|
int32 dieresis_dead_key[32];
|
||||||
int32 tilde_dead_key[32];
|
int32 tilde_dead_key[32];
|
||||||
uint32 acute_tables;
|
uint32 acute_tables;
|
||||||
uint32 grave_tables;
|
uint32 grave_tables;
|
||||||
uint32 circumflex_tables;
|
uint32 circumflex_tables;
|
||||||
uint32 dieresis_tables;
|
uint32 dieresis_tables;
|
||||||
uint32 tilde_tables;
|
uint32 tilde_tables;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mouse_map {
|
struct mouse_map {
|
||||||
uint32 button[B_MAX_MOUSE_BUTTONS];
|
uint32 button[B_MAX_MOUSE_BUTTONS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
enum border_style {
|
enum border_style {
|
||||||
@@ -173,7 +149,7 @@ enum button_width {
|
|||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
enum join_mode {
|
enum join_mode {
|
||||||
B_ROUND_JOIN=0,
|
B_ROUND_JOIN = 0,
|
||||||
B_MITER_JOIN,
|
B_MITER_JOIN,
|
||||||
B_BEVEL_JOIN,
|
B_BEVEL_JOIN,
|
||||||
B_BUTT_JOIN,
|
B_BUTT_JOIN,
|
||||||
@@ -357,12 +333,6 @@ enum color_which {
|
|||||||
// the replacement for B_DESKTOP_COLOR.
|
// the replacement for B_DESKTOP_COLOR.
|
||||||
B_DESKTOP_COLOR = 5,
|
B_DESKTOP_COLOR = 5,
|
||||||
B_WINDOW_TAB_COLOR = 3,
|
B_WINDOW_TAB_COLOR = 3,
|
||||||
|
|
||||||
B_RANDOM_COLOR = 0x80000000,
|
|
||||||
B_MICHELANGELO_FAVORITE_COLOR,
|
|
||||||
B_DSANDLER_FAVORITE_SKY_COLOR,
|
|
||||||
B_DSANDLER_FAVORITE_INK_COLOR,
|
|
||||||
B_DSANDLER_FAVORITE_SHOES_COLOR
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_IMPEXP_BE rgb_color ui_color(color_which which);
|
_IMPEXP_BE rgb_color ui_color(color_which which);
|
||||||
@@ -386,7 +356,4 @@ const float B_DISABLED_LABEL_TINT = B_DARKEN_3_TINT;
|
|||||||
const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT;
|
const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT;
|
||||||
const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT;
|
const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT;
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif // _INTERFACE_DEFS_H
|
#endif // _INTERFACE_DEFS_H
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
|
struct server_read_only_memory;
|
||||||
|
|
||||||
|
|
||||||
class BApplication::Private {
|
class BApplication::Private {
|
||||||
public:
|
public:
|
||||||
@@ -19,6 +21,9 @@ class BApplication::Private {
|
|||||||
|
|
||||||
static inline BPrivate::ServerMemoryAllocator* ServerAllocator()
|
static inline BPrivate::ServerMemoryAllocator* ServerAllocator()
|
||||||
{ return be_app->fServerAllocator; }
|
{ return be_app->fServerAllocator; }
|
||||||
|
|
||||||
|
static inline server_read_only_memory* ServerReadOnlyMemory()
|
||||||
|
{ return (server_read_only_memory*)be_app->fServerReadOnlyMemory; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _APPLICATION_PRIVATE_H
|
#endif // _APPLICATION_PRIVATE_H
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class ServerMemoryAllocator {
|
|||||||
|
|
||||||
status_t InitCheck();
|
status_t InitCheck();
|
||||||
|
|
||||||
status_t AddArea(area_id serverArea, area_id& _localArea, uint8*& _base);
|
status_t AddArea(area_id serverArea, area_id& _localArea, uint8*& _base,
|
||||||
|
bool readOnly = false);
|
||||||
void RemoveArea(area_id serverArea);
|
void RemoveArea(area_id serverArea);
|
||||||
|
|
||||||
status_t AreaAndBaseFor(area_id serverArea, area_id& area, uint8*& base);
|
status_t AreaAndBaseFor(area_id serverArea, area_id& area, uint8*& base);
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
#ifndef SERVER_READ_ONLY_MEMORY_H
|
||||||
|
#define SERVER_READ_ONLY_MEMORY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <GraphicsDefs.h>
|
||||||
|
#include <InterfaceDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const int32 kNumColors = 32;
|
||||||
|
|
||||||
|
struct server_read_only_memory {
|
||||||
|
rgb_color colors[kNumColors];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static inline int32
|
||||||
|
color_which_to_index(color_which which)
|
||||||
|
{
|
||||||
|
if (which <= B_TOOLTIP_TEXT_COLOR)
|
||||||
|
return which - 1;
|
||||||
|
if (which >= B_SUCCESS_COLOR && which <= B_FAILURE_COLOR)
|
||||||
|
return which - B_SUCCESS_COLOR + B_TOOLTIP_TEXT_COLOR;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SERVER_READ_ONLY_MEMORY_H */
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _DEFAULT_COLORS_H
|
||||||
|
#define _DEFAULT_COLORS_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <GraphicsDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
extern const rgb_color* kDefaultColors;
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
#endif // _DEFAULT_COLORS_H
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#ifndef __MOREUTF8
|
#ifndef __MOREUTF8
|
||||||
#define __MOREUTF8
|
#define __MOREUTF8
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
IsInsideGlyph(uchar ch)
|
IsInsideGlyph(uchar ch)
|
||||||
@@ -203,5 +205,4 @@ UTF8ToLength(const char *bytes)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __MOREUTF8
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -660,11 +660,11 @@ bool
|
|||||||
BApplication::IsCursorHidden() const
|
BApplication::IsCursorHidden() const
|
||||||
{
|
{
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
int32 code = SERVER_FALSE;
|
int32 status = B_ERROR;
|
||||||
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
|
link.StartMessage(AS_QUERY_CURSOR_HIDDEN);
|
||||||
link.FlushWithReply(code);
|
link.FlushWithReply(status);
|
||||||
|
|
||||||
return code == SERVER_TRUE;
|
return status == B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -995,10 +995,6 @@ BApplication::_InitGUIContext()
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = _SetupServerAllocator();
|
|
||||||
if (error != B_OK)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
// Initialize the IK after we have set be_app because of a construction of a
|
// Initialize the IK after we have set be_app because of a construction of a
|
||||||
// AppServerLink (which depends on be_app) nested inside the call to get_menu_info.
|
// AppServerLink (which depends on be_app) nested inside the call to get_menu_info.
|
||||||
error = _init_interface_kit_();
|
error = _init_interface_kit_();
|
||||||
@@ -1061,21 +1057,37 @@ BApplication::_ConnectToServer()
|
|||||||
fServerLink->Attach<int32>(_get_object_token_(this));
|
fServerLink->Attach<int32>(_get_object_token_(this));
|
||||||
fServerLink->AttachString(fAppName);
|
fServerLink->AttachString(fAppName);
|
||||||
|
|
||||||
|
area_id sharedReadOnlyArea;
|
||||||
|
|
||||||
if (fServerLink->FlushWithReply(code) == B_OK
|
if (fServerLink->FlushWithReply(code) == B_OK
|
||||||
&& code == B_OK) {
|
&& code == B_OK) {
|
||||||
// We don't need to contact the main app_server anymore
|
// We don't need to contact the main app_server anymore
|
||||||
// directly; we now talk to our server alter ego only.
|
// directly; we now talk to our server alter ego only.
|
||||||
fServerLink->Read<port_id>(&serverPort);
|
fServerLink->Read<port_id>(&serverPort);
|
||||||
fServerLink->SetSenderPort(serverPort);
|
fServerLink->Read<area_id>(&sharedReadOnlyArea);
|
||||||
} else {
|
} else {
|
||||||
fServerLink->SetSenderPort(-1);
|
fServerLink->SetSenderPort(-1);
|
||||||
debugger("BApplication: couldn't obtain new app_server comm port");
|
debugger("BApplication: couldn't obtain new app_server comm port");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fServerLink->SetSenderPort(serverPort);
|
||||||
|
|
||||||
|
status_t status = _SetupServerAllocator();
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
area_id area;
|
||||||
|
uint8* base;
|
||||||
|
status = fServerAllocator->AddArea(sharedReadOnlyArea, area, base, true);
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
fServerReadOnlyMemory = base;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void
|
void
|
||||||
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
|
BApplication::send_drag(BMessage *message, int32 vs_token, BPoint offset,
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ ServerMemoryAllocator::InitCheck()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base)
|
ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base,
|
||||||
|
bool readOnly)
|
||||||
{
|
{
|
||||||
area_mapping* mapping = new (std::nothrow) area_mapping;
|
area_mapping* mapping = new (std::nothrow) area_mapping;
|
||||||
if (mapping == NULL || !fAreas.AddItem(mapping)) {
|
if (mapping == NULL || !fAreas.AddItem(mapping)) {
|
||||||
@@ -66,19 +67,20 @@ ServerMemoryAllocator::AddArea(area_id serverArea, area_id& _area, uint8*& _base
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
|
||||||
// reserve 128 MB of space for the area
|
|
||||||
void* base = (void*)0x60000000;
|
|
||||||
status_t status = _kern_reserve_heap_address_range((addr_t*)&base,
|
|
||||||
B_BASE_ADDRESS, 128 * 1024 * 1024);
|
|
||||||
#else
|
|
||||||
void* base;
|
|
||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
|
void* base;
|
||||||
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
|
if (!readOnly) {
|
||||||
|
// reserve 128 MB of space for the area
|
||||||
|
base = (void*)0x60000000;
|
||||||
|
status = _kern_reserve_heap_address_range((addr_t*)&base,
|
||||||
|
B_BASE_ADDRESS, 128 * 1024 * 1024);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mapping->local_area = clone_area("server_memory", &base,
|
mapping->local_area = clone_area(readOnly ? "server read-only memory" : "server_memory",
|
||||||
status == B_OK ? B_EXACT_ADDRESS : B_BASE_ADDRESS,
|
&base, status == B_OK ? B_EXACT_ADDRESS : B_BASE_ADDRESS,
|
||||||
B_READ_AREA | B_WRITE_AREA, serverArea);
|
B_READ_AREA | (readOnly ? 0 : B_WRITE_AREA), serverArea);
|
||||||
if (mapping->local_area < B_OK) {
|
if (mapping->local_area < B_OK) {
|
||||||
status = mapping->local_area;
|
status = mapping->local_area;
|
||||||
delete mapping;
|
delete mapping;
|
||||||
|
|||||||
@@ -10,7 +10,19 @@
|
|||||||
|
|
||||||
/** Global functions and variables for the Interface Kit */
|
/** Global functions and variables for the Interface Kit */
|
||||||
|
|
||||||
#include <Application.h>
|
#include "moreUTF8.h"
|
||||||
|
#include "truncate_string.h"
|
||||||
|
|
||||||
|
#include <ApplicationPrivate.h>
|
||||||
|
#include <AppServerLink.h>
|
||||||
|
#include <DefaultColors.h>
|
||||||
|
#include <InputServerTypes.h>
|
||||||
|
#include <input_globals.h>
|
||||||
|
#include <ServerProtocol.h>
|
||||||
|
#include <ServerReadOnlyMemory.h>
|
||||||
|
#include <WidthBuffer.h>
|
||||||
|
#include <WindowInfo.h>
|
||||||
|
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
@@ -20,18 +32,10 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <AppServerLink.h>
|
|
||||||
#include <WindowInfo.h>
|
|
||||||
#include <InputServerTypes.h>
|
|
||||||
#include <input_globals.h>
|
|
||||||
#include <ServerProtocol.h>
|
|
||||||
#include <WidthBuffer.h>
|
|
||||||
|
|
||||||
#include "moreUTF8.h"
|
|
||||||
#include "truncate_string.h"
|
|
||||||
|
|
||||||
// Private definitions not placed in public headers
|
// Private definitions not placed in public headers
|
||||||
void _init_global_fonts_();
|
void _init_global_fonts_();
|
||||||
@@ -54,6 +58,35 @@ menu_info *_menu_info_ptr_;
|
|||||||
|
|
||||||
extern "C" const char B_NOTIFICATION_SENDER[] = "be:sender";
|
extern "C" const char B_NOTIFICATION_SENDER[] = "be:sender";
|
||||||
|
|
||||||
|
static const rgb_color _kDefaultColors[kNumColors] = {
|
||||||
|
{216, 216, 216, 255}, // B_PANEL_BACKGROUND_COLOR
|
||||||
|
{216, 216, 216, 255}, // B_MENU_BACKGROUND_COLOR
|
||||||
|
{255, 0, 203, 255}, // B_WINDOW_TAB_COLOR
|
||||||
|
{0, 0, 229, 255}, // B_KEYBOARD_NAVIGATION_COLOR
|
||||||
|
{51, 102, 152, 255}, // B_DESKTOP_COLOR
|
||||||
|
{115, 120, 184, 255}, // B_MENU_SELECTED_BACKGROUND_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_MENU_ITEM_TEXT_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_MENU_SELECTED_ITEM_TEXT_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_MENU_SELECTED_BORDER_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_PANEL_TEXT_COLOR
|
||||||
|
{255, 255, 255, 255}, // B_DOCUMENT_BACKGROUND_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_DOCUMENT_TEXT_COLOR
|
||||||
|
{245, 245, 245, 255}, // B_CONTROL_BACKGROUND_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_CONTROL_TEXT_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_CONTROL_BORDER_COLOR
|
||||||
|
{102, 152, 203, 255}, // B_CONTROL_HIGHLIGHT_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_NAVIGATION_PULSE_COLOR
|
||||||
|
{255, 255, 255, 255}, // B_SHINE_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_SHADOW_COLOR
|
||||||
|
{255, 255, 0, 255}, // B_TOOLTIP_BACKGROUND_COLOR
|
||||||
|
{0, 0, 0, 255}, // B_TOOLTIP_TEXT_COLOR
|
||||||
|
// 100...
|
||||||
|
{0, 255, 0, 255}, // B_SUCCESS_COLOR
|
||||||
|
{255, 0, 0, 255}, // B_FAILURE_COLOR
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
const rgb_color* BPrivate::kDefaultColors = &_kDefaultColors[0];
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
mode2parms(uint32 space, uint32 *out_space, int32 *width, int32 *height)
|
mode2parms(uint32 space, uint32 *out_space, int32 *width, int32 *height)
|
||||||
@@ -686,66 +719,18 @@ mouse_mode()
|
|||||||
_IMPEXP_BE rgb_color
|
_IMPEXP_BE rgb_color
|
||||||
ui_color(color_which which)
|
ui_color(color_which which)
|
||||||
{
|
{
|
||||||
|
int32 index = color_which_to_index(which);
|
||||||
|
if (index < 0 || index >= kNumColors) {
|
||||||
|
fprintf(stderr, "ui_color(): unknown color_which %d\n", which);
|
||||||
|
return make_color(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (be_app) {
|
if (be_app) {
|
||||||
rgb_color color;
|
server_read_only_memory* shared = BApplication::Private::ServerReadOnlyMemory();
|
||||||
BPrivate::AppServerLink link;
|
return shared->colors[index];
|
||||||
link.StartMessage(AS_GET_UI_COLOR);
|
|
||||||
link.Attach<color_which>(which);
|
|
||||||
|
|
||||||
int32 code;
|
|
||||||
if (link.FlushWithReply(code) == B_OK && code == B_OK) {
|
|
||||||
link.Read<rgb_color>(&color);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (which) {
|
return kDefaultColors[index];
|
||||||
case B_PANEL_BACKGROUND_COLOR:
|
|
||||||
return make_color(216,216,216);
|
|
||||||
case B_PANEL_TEXT_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_DOCUMENT_BACKGROUND_COLOR:
|
|
||||||
return make_color(255,255,255);
|
|
||||||
case B_DOCUMENT_TEXT_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_CONTROL_BACKGROUND_COLOR:
|
|
||||||
return make_color(245,245,245);
|
|
||||||
case B_CONTROL_TEXT_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_CONTROL_BORDER_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_CONTROL_HIGHLIGHT_COLOR:
|
|
||||||
return make_color(102, 152, 203);
|
|
||||||
case B_NAVIGATION_BASE_COLOR:
|
|
||||||
return make_color(0,0,229);
|
|
||||||
case B_NAVIGATION_PULSE_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_SHINE_COLOR:
|
|
||||||
return make_color(255,255,255);
|
|
||||||
case B_SHADOW_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_MENU_BACKGROUND_COLOR:
|
|
||||||
return make_color(216,216,216);
|
|
||||||
case B_MENU_SELECTED_BACKGROUND_COLOR:
|
|
||||||
return make_color(115,120,184);
|
|
||||||
case B_MENU_ITEM_TEXT_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_MENU_SELECTED_BORDER_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_TOOLTIP_BACKGROUND_COLOR:
|
|
||||||
return make_color(255,255,0);
|
|
||||||
case B_TOOLTIP_TEXT_COLOR:
|
|
||||||
return make_color(0,0,0);
|
|
||||||
case B_SUCCESS_COLOR:
|
|
||||||
return make_color(0,255,0);
|
|
||||||
case B_FAILURE_COLOR:
|
|
||||||
return make_color(255,0,0);
|
|
||||||
case B_WINDOW_TAB_COLOR:
|
|
||||||
return make_color(255,0,203);
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "ui_color(): unknown color_which %d\n", which);
|
|
||||||
return make_color(0,0,0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -300,7 +300,8 @@ Desktop::Desktop(uid_t userID)
|
|||||||
: MessageLooper("desktop"),
|
: MessageLooper("desktop"),
|
||||||
|
|
||||||
fUserID(userID),
|
fUserID(userID),
|
||||||
fSettings(new DesktopSettings::Private()),
|
fSettings(NULL),
|
||||||
|
fSharedReadOnlyArea(-1),
|
||||||
fApplicationsLock("application list"),
|
fApplicationsLock("application list"),
|
||||||
fShutdownSemaphore(-1),
|
fShutdownSemaphore(-1),
|
||||||
fCurrentWorkspace(0),
|
fCurrentWorkspace(0),
|
||||||
@@ -317,17 +318,11 @@ Desktop::Desktop(uid_t userID)
|
|||||||
char name[B_OS_NAME_LENGTH];
|
char name[B_OS_NAME_LENGTH];
|
||||||
Desktop::_GetLooperName(name, sizeof(name));
|
Desktop::_GetLooperName(name, sizeof(name));
|
||||||
|
|
||||||
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
|
||||||
_Windows(i).SetIndex(i);
|
|
||||||
fWorkspaces[i].RestoreConfiguration(*fSettings->WorkspacesMessage(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
fMessagePort = create_port(DEFAULT_MONITOR_PORT_SIZE, name);
|
fMessagePort = create_port(DEFAULT_MONITOR_PORT_SIZE, name);
|
||||||
if (fMessagePort < B_OK)
|
if (fMessagePort < B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fLink.SetReceiverPort(fMessagePort);
|
fLink.SetReceiverPort(fMessagePort);
|
||||||
gFontManager->AttachUser(fUserID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -335,14 +330,32 @@ Desktop::~Desktop()
|
|||||||
{
|
{
|
||||||
delete fSettings;
|
delete fSettings;
|
||||||
|
|
||||||
|
delete_area(fSharedReadOnlyArea);
|
||||||
delete_port(fMessagePort);
|
delete_port(fMessagePort);
|
||||||
gFontManager->DetachUser(fUserID);
|
gFontManager->DetachUser(fUserID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
Desktop::Init()
|
Desktop::Init()
|
||||||
{
|
{
|
||||||
|
if (fMessagePort < B_OK)
|
||||||
|
return fMessagePort;
|
||||||
|
|
||||||
|
char name[B_OS_NAME_LENGTH];
|
||||||
|
snprintf(name, sizeof(name), "d:%d:shared read only", /*id*/0);
|
||||||
|
fSharedReadOnlyArea = create_area(name, (void **)&fServerReadOnlyMemory,
|
||||||
|
B_ANY_ADDRESS, B_PAGE_SIZE, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
|
if (fSharedReadOnlyArea < B_OK)
|
||||||
|
return fSharedReadOnlyArea;
|
||||||
|
|
||||||
|
fSettings = new DesktopSettings::Private(fServerReadOnlyMemory);
|
||||||
|
|
||||||
|
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
||||||
|
_Windows(i).SetIndex(i);
|
||||||
|
fWorkspaces[i].RestoreConfiguration(*fSettings->WorkspacesMessage(i));
|
||||||
|
}
|
||||||
|
|
||||||
fVirtualScreen.RestoreConfiguration(*this, fSettings->WorkspacesMessage(0));
|
fVirtualScreen.RestoreConfiguration(*this, fSettings->WorkspacesMessage(0));
|
||||||
|
|
||||||
// TODO: temporary workaround, fActiveScreen will be removed
|
// TODO: temporary workaround, fActiveScreen will be removed
|
||||||
@@ -371,6 +384,10 @@ Desktop::Init()
|
|||||||
BRegion stillAvailableOnScreen;
|
BRegion stillAvailableOnScreen;
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
||||||
_SetBackground(stillAvailableOnScreen);
|
_SetBackground(stillAvailableOnScreen);
|
||||||
|
|
||||||
|
gFontManager->AttachUser(fUserID);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class DrawingEngine;
|
|||||||
class HWInterface;
|
class HWInterface;
|
||||||
class ServerApp;
|
class ServerApp;
|
||||||
class WorkspacesLayer;
|
class WorkspacesLayer;
|
||||||
|
struct server_read_only_memory;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
class LinkSender;
|
class LinkSender;
|
||||||
@@ -55,10 +56,11 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
Desktop(uid_t userID);
|
Desktop(uid_t userID);
|
||||||
virtual ~Desktop();
|
virtual ~Desktop();
|
||||||
|
|
||||||
void Init();
|
status_t Init();
|
||||||
|
|
||||||
uid_t UserID() const { return fUserID; }
|
uid_t UserID() const { return fUserID; }
|
||||||
virtual port_id MessagePort() const { return fMessagePort; }
|
virtual port_id MessagePort() const { return fMessagePort; }
|
||||||
|
area_id SharedReadOnlyArea() const { return fSharedReadOnlyArea; }
|
||||||
|
|
||||||
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
||||||
|
|
||||||
@@ -217,6 +219,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
port_id fMessagePort;
|
port_id fMessagePort;
|
||||||
::EventDispatcher fEventDispatcher;
|
::EventDispatcher fEventDispatcher;
|
||||||
port_id fInputPort;
|
port_id fInputPort;
|
||||||
|
area_id fSharedReadOnlyArea;
|
||||||
|
server_read_only_memory* fServerReadOnlyMemory;
|
||||||
|
|
||||||
BLocker fApplicationsLock;
|
BLocker fApplicationsLock;
|
||||||
BObjectList<ServerApp> fApplications;
|
BObjectList<ServerApp> fApplications;
|
||||||
|
|||||||
@@ -14,15 +14,18 @@
|
|||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
|
|
||||||
|
#include <DefaultColors.h>
|
||||||
|
#include <ServerReadOnlyMemory.h>
|
||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
//#include <DataIO./h>
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
|
||||||
DesktopSettings::Private::Private()
|
DesktopSettings::Private::Private(server_read_only_memory* shared)
|
||||||
: BLocker("DesktopSettings_Private")
|
: BLocker("DesktopSettings_Private"),
|
||||||
|
fShared(*shared)
|
||||||
{
|
{
|
||||||
// if the on-disk settings are not complete, the defaults will be kept
|
// if the on-disk settings are not complete, the defaults will be kept
|
||||||
_SetDefaults();
|
_SetDefaults();
|
||||||
@@ -65,6 +68,8 @@ DesktopSettings::Private::_SetDefaults()
|
|||||||
fMenuInfo.triggers_always_shown = false;
|
fMenuInfo.triggers_always_shown = false;
|
||||||
|
|
||||||
fWorkspacesCount = 4;
|
fWorkspacesCount = 4;
|
||||||
|
|
||||||
|
memcpy(fShared.colors, BPrivate::kDefaultColors, sizeof(rgb_color) * kNumColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,12 @@
|
|||||||
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
|
||||||
|
struct server_read_only_memory;
|
||||||
|
|
||||||
|
|
||||||
class DesktopSettings::Private : public BLocker {
|
class DesktopSettings::Private : public BLocker {
|
||||||
public:
|
public:
|
||||||
Private();
|
Private(server_read_only_memory* shared);
|
||||||
~Private();
|
~Private();
|
||||||
|
|
||||||
status_t Save(uint32 mask = kAllSettings);
|
status_t Save(uint32 mask = kAllSettings);
|
||||||
@@ -61,6 +63,8 @@ class DesktopSettings::Private : public BLocker {
|
|||||||
mode_mouse fMouseMode;
|
mode_mouse fMouseMode;
|
||||||
int32 fWorkspacesCount;
|
int32 fWorkspacesCount;
|
||||||
BMessage fWorkspaceMessages[kMaxWorkspaces];
|
BMessage fWorkspaceMessages[kMaxWorkspaces];
|
||||||
|
|
||||||
|
server_read_only_memory& fShared;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DESKTOP_SETTINGS_PRIVATE_H */
|
#endif /* DESKTOP_SETTINGS_PRIVATE_H */
|
||||||
|
|||||||
@@ -220,7 +220,8 @@ ServerApp::Run()
|
|||||||
|
|
||||||
// Let's tell the client how to talk with us
|
// Let's tell the client how to talk with us
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
fLink.Attach<int32>(fMessagePort);
|
fLink.Attach<port_id>(fMessagePort);
|
||||||
|
fLink.Attach<area_id>(fDesktop->SharedReadOnlyArea());
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user