MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13450 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-07-05 16:30:53 +00:00
parent b2086a9ba0
commit 2e6a5805ba
14 changed files with 227 additions and 108 deletions

View File

@ -286,11 +286,11 @@ private:
BWindow(BWindow&);
BWindow &operator=(BWindow&);
BWindow(BRect frame, color_space depth,
uint32 bitmapFlags, int32 rowBytes);
BWindow(BRect frame, int32 bitmapToken);
void InitData(BRect frame, const char* title,
window_look look, window_feel feel,
uint32 flags, uint32 workspace);
uint32 flags, uint32 workspace,
int32 bitmapToken = -1);
status_t ArchiveChildren(BMessage* data, bool deep) const;
status_t UnarchiveChildren(BMessage* data);
void BitmapClose(); // to be implemented

View File

@ -25,6 +25,7 @@ enum {
AS_SET_SERVER_PORT,
AS_CREATE_WINDOW,
AS_CREATE_OFFSCREEN_WINDOW,
AS_DELETE_WINDOW,
AS_CREATE_BITMAP,
AS_DELETE_BITMAP,

View File

@ -93,6 +93,7 @@ virtual ~_BMCMenuBar_();
static BArchivable *Instantiate(BMessage *data);
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* msg);
virtual void MakeFocus(bool focused = true);

View File

@ -7,7 +7,6 @@ static inline bool
IsInsideGlyph(uchar ch)
{
return (ch & 0xC0) == 0x80;
// return (ch & 0x80);
}
static inline uint32

View File

@ -31,6 +31,7 @@
#include <MenuField.h>
#include <MenuItem.h>
#include <Message.h>
#include <Region.h>
#include <Window.h>
// Project Includes ------------------------------------------------------------
@ -171,6 +172,37 @@ void _BMCMenuBar_::AttachedToWindow()
Window()->SetKeyMenuBar(menuBar);
}
//------------------------------------------------------------------------------
void _BMCMenuBar_::Draw(BRect updateRect)
{
// TODO: The commented code locks up the
// window thread.
// draw the right and bottom line here in a darker tint
BRegion oldClipping;
GetClippingRegion(&oldClipping);
BRect bounds(Bounds());
bounds.right -= 2.0;
bounds.bottom -= 1.0;
bounds = bounds & updateRect;
BRegion clipping(bounds);
ConstrainClippingRegion(&clipping);
BMenuBar::Draw(updateRect);
bounds.right += 2.0;
bounds.bottom += 1.0;
ConstrainClippingRegion(&oldClipping);
//BRect bounds(Bounds());
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT));
StrokeLine(BPoint(bounds.left, bounds.bottom),
BPoint(bounds.right, bounds.bottom));
StrokeLine(BPoint(bounds.right, bounds.bottom - 1),
BPoint(bounds.right, bounds.top));
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT));
StrokeLine(BPoint(bounds.right - 1, bounds.bottom - 2),
BPoint(bounds.right - 1, bounds.top + 1));
}
//------------------------------------------------------------------------------
void _BMCMenuBar_::FrameResized(float width, float height)
{
// TODO:
@ -226,7 +258,7 @@ void _BMCMenuBar_::MakeFocus(bool focused)
BRect bounds(fMenuField->Bounds());
fMenuField->Draw(BRect(bounds.left, bounds.top, fMenuField->fDivider,
fMenuField->Invalidate(BRect(bounds.left, bounds.top, fMenuField->fDivider,
bounds.bottom));
}
//------------------------------------------------------------------------------

View File

@ -15,6 +15,7 @@
#include <algorithm>
#include <limits.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <Application.h>
@ -2299,8 +2300,13 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags,
// dependent on color space.
if (fInitError == B_OK) {
if (flags & B_BITMAP_ACCEPTS_VIEWS)
fWindow = new BWindow(Bounds(), fColorSpace, flags, fBytesPerRow);
if (flags & B_BITMAP_ACCEPTS_VIEWS) {
fWindow = new BWindow(Bounds(), fServerToken);
// A BWindow starts life locked and is unlocked
// in Show(), but this window is never shown and
// it's message loop is never started.
fWindow->Unlock();
}
}
}

View File

@ -1171,10 +1171,13 @@ BMenu::_AddItem(BMenuItem *item, int32 index)
item->SetSuper(this);
BWindow* window = Window();
// Make sure we update the layout in case we are already attached.
if (Window() && fResizeToFit) {
if (fResizeToFit && window && window->Lock()) {
LayoutItems(index);
Invalidate();
window->Unlock();
}
// Find the root menu window, so we can install this item.
@ -1182,8 +1185,11 @@ BMenu::_AddItem(BMenuItem *item, int32 index)
while (root->Supermenu())
root = root->Supermenu();
if (root->Window())
item->Install(root->Window());
window = root->Window();
if (window && window->Lock()) {
item->Install(window);
window->Unlock();
}
return true;
}

View File

@ -25,6 +25,7 @@
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -55,7 +56,7 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
InitMenu(menu);
frame.OffsetTo(0.0f, 0.0f);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 2.0f,
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1.0,
frame.top + kVMargin, frame.right - 2.0f, frame.bottom - kVMargin),
false, this);
@ -80,7 +81,7 @@ BMenuField::BMenuField(BRect frame, const char *name, const char *label,
fFixedSizeMB = fixed_size;
frame.OffsetTo(0.0f, 0.0f);
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 2.0f,
fMenuBar = new _BMCMenuBar_(BRect(frame.left + fDivider + 1.0,
frame.top + kVMargin, frame.right - 2.0f, frame.bottom - kVMargin),
fixed_size, this);
@ -194,10 +195,8 @@ void BMenuField::Draw(BRect update)
if (IsFocus())
active = Window()->IsActive();
/*
SetHighColor(0, 255, 0);
FillRect(bounds);
*/
//SetHighColor(255, 0, 0);
//FillRect(bounds);
DrawLabel(bounds, update);
@ -286,7 +285,7 @@ void BMenuField::KeyDown(const char *bytes, int32 numBytes)
bounds = Bounds();
bounds.right = fDivider;
Draw(bounds);
Invalidate(bounds);
}
default:
BView::KeyDown(bytes, numBytes);
@ -300,8 +299,8 @@ void BMenuField::MakeFocus(bool state)
BView::MakeFocus(state);
if(Window())
Draw(Bounds()); // TODO: use fStringWidth
if (Window())
Invalidate(); // TODO: use fStringWidth
}
//------------------------------------------------------------------------------
void BMenuField::MessageReceived(BMessage *msg)
@ -314,7 +313,7 @@ void BMenuField::WindowActivated(bool state)
BView::WindowActivated(state);
if (IsFocus())
Draw(Bounds());
Invalidate();
}
//------------------------------------------------------------------------------
void BMenuField::MouseUp(BPoint pt)
@ -417,15 +416,19 @@ alignment BMenuField::Alignment() const
return fAlign;
}
//------------------------------------------------------------------------------
void BMenuField::SetDivider(float dividing_line)
void BMenuField::SetDivider(float divider)
{
if (fDivider - dividing_line == 0.0f)
divider = floorf(divider + 0.5);
float dx = fDivider - divider;
if (dx == 0.0f)
return;
MenuBar()->MoveBy(dividing_line - fDivider, 0.0f);
MenuBar()->ResizeBy(fDivider - dividing_line, 0.0f);
fDivider = divider;
fDivider = dividing_line;
MenuBar()->MoveBy(-dx, 0.0f);
MenuBar()->ResizeBy(dx, 0.0f);
}
//------------------------------------------------------------------------------
float BMenuField::Divider() const
@ -560,14 +563,13 @@ long BMenuField::MenuTask(void *arg)
menuField->fSelected = true;
menuField->fTransition = true;
menuField->Draw(menuField->Bounds());
menuField->Invalidate();
menuField->UnlockLooper();
bool tracking;
do
{
do {
snooze(20000);
if (!menuField->LockLooper())
@ -583,7 +585,7 @@ long BMenuField::MenuTask(void *arg)
menuField->fSelected = false;
menuField->fTransition = true;
menuField->Draw(menuField->Bounds());
menuField->Invalidate();
menuField->UnlockLooper();

View File

@ -160,7 +160,7 @@ BPrivateScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha)
blue == B_TRANSPARENT_COLOR.blue && alpha == B_TRANSPARENT_COLOR.alpha)
return B_TRANSPARENT_8_BIT;
uint8 index = ((red & 0xf8) << 7) | ((green & 0xf8) << 2) | (blue >> 3);
uint16 index = ((blue & 0xf8) << 7) | ((green & 0xf8) << 2) | (red >> 3);
if (fColorMap)
return fColorMap->index_map[index];

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include <stdio.h>
#include <ScrollView.h>
#include <Message.h>
@ -23,35 +24,58 @@ BScrollView::BScrollView(const char *name, BView *target, uint32 resizingMode,
fBorder(border),
fHighlighted(false)
{
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (border != B_NO_BORDER)
fTarget->MoveBy(BorderSize(border), BorderSize(border));
AddChild(fTarget);
BRect frame = fTarget->Frame();
if (horizontal) {
BRect rect = frame;
rect.top = rect.bottom + 1;
rect.bottom += B_H_SCROLL_BAR_HEIGHT + 1;
if (border != B_NO_BORDER || vertical)
rect.right++;
BRect targetFrame;
if (fTarget) {
// layout target and add it
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (border != B_NO_BORDER)
fTarget->MoveBy(BorderSize(border), BorderSize(border));
AddChild(fTarget);
targetFrame = fTarget->Frame();
} else {
// no target specified
targetFrame = Bounds();
if (horizontal)
targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1;
if (vertical)
targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
if (border == B_FANCY_BORDER) {
targetFrame.bottom--;
targetFrame.right--;
}
}
if (horizontal) {
BRect rect = targetFrame;
rect.top = rect.bottom + 1;
rect.bottom = rect.top + B_H_SCROLL_BAR_HEIGHT;
if (border != B_NO_BORDER || vertical) {
// extend scrollbar so that it overlaps one pixel with vertical scrollbar
rect.right++;
}
if (border != B_NO_BORDER) {
// the scrollbar draws part of the surrounding frame on the left
rect.left--;
}
fHorizontalScrollBar = new BScrollBar(rect, "_HSB_", fTarget, 0, 1000, B_HORIZONTAL);
AddChild(fHorizontalScrollBar);
}
if (vertical) {
BRect rect = frame;
BRect rect = targetFrame;
rect.left = rect.right + 1;
rect.right += B_V_SCROLL_BAR_WIDTH + 1;
if (border != B_NO_BORDER || horizontal)
rect.right = rect.left + B_V_SCROLL_BAR_WIDTH;
if (border != B_NO_BORDER || horizontal) {
// extend scrollbar so that it overlaps one pixel with vertical scrollbar
rect.bottom++;
if (border != B_NO_BORDER)
}
if (border != B_NO_BORDER) {
// the scrollbar draws part of the surrounding frame on the left
rect.top--;
}
fVerticalScrollBar = new BScrollBar(rect, "_VSB_", fTarget, 0, 1000, B_VERTICAL);
AddChild(fVerticalScrollBar);
}
@ -486,7 +510,7 @@ BScrollView::GetPreferredSize(float *_width, float *_height)
BRect
BScrollView::CalcFrame(BView *target, bool horizontal, bool vertical, border_style border)
{
BRect frame = target != NULL ? frame = target->Frame() : BRect(0, 0, 80, 80);
BRect frame = target != NULL ? target->Frame() : BRect(0, 0, 80, 80);
if (vertical)
frame.right += B_V_SCROLL_BAR_WIDTH;

View File

@ -680,8 +680,22 @@ BSlider::Draw(BRect updateRect)
if (Style() == B_BLOCK_THUMB)
background.Exclude(ThumbFrame());
if (background.Frame().IsValid())
OffscreenView()->FillRegion(&background, B_SOLID_LOW);
#if USE_OFF_SCREEN_VIEW
if (!fOffScreenBits)
return;
if (fOffScreenBits->Lock()) {
#endif
if (background.Frame().IsValid())
OffscreenView()->FillRegion(&background, B_SOLID_LOW);
#if USE_OFF_SCREEN_VIEW
fOffScreenView->Sync();
fOffScreenBits->Unlock();
}
#endif
DrawSlider();
}
@ -693,9 +707,6 @@ BSlider::DrawSlider()
#if USE_OFF_SCREEN_VIEW
if (!fOffScreenBits)
return;
#endif
#if USE_OFF_SCREEN_VIEW
if (fOffScreenBits->Lock()) {
#endif
DrawBar();
@ -705,10 +716,10 @@ BSlider::DrawSlider()
DrawText();
#if USE_OFF_SCREEN_VIEW
fOffscreenView->Sync();
DrawBitmap(fOffScreenBits, B_ORIGIN);
fOffScreenView->Sync();
fOffScreenBits->Unlock();
DrawBitmap(fOffScreenBits, B_ORIGIN);
}
#endif
}
@ -1100,6 +1111,8 @@ BSlider::ThumbFrame() const
if (Orientation() == B_HORIZONTAL) {
frame.left = (float)floor(Position() * (_MaxPosition() - _MinPosition()) +
_MinPosition()) - 6;
// TODO: seems this was removed...
// frame.top = 8.0f + (Label() ? textHeight + 4.0f : 0.0f);
frame.right = frame.left + 12.0f;
frame.bottom = frame.bottom - 2.0f -
(MinLimitLabel() || MaxLimitLabel() ? textHeight + 4.0f : 0.0f);
@ -1586,37 +1599,40 @@ BSlider::_DrawTriangleThumb()
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR),
lighten1 = tint_color(no_tint, B_LIGHTEN_1_TINT),
// lighten2 = tint_color(no_tint, B_LIGHTEN_2_TINT),
// lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT),
lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT),
// darken1 = tint_color(no_tint, B_DARKEN_1_TINT),
darken2 = tint_color(no_tint, B_DARKEN_2_TINT),
// darken3 = tint_color(no_tint, B_DARKEN_3_TINT),
darken3 = tint_color(no_tint, B_DARKEN_3_TINT),
darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT);
view->SetDrawingMode(B_OP_OVER);
if (Orientation() == B_HORIZONTAL) {
view->SetHighColor(lighten1);
view->FillTriangle(BPoint(frame.left, frame.bottom - 2.0f),
BPoint(frame.left + 6.0f, frame.top),
BPoint(frame.right, frame.bottom - 2.0f));
view->SetHighColor(darkenmax);
view->StrokeLine(BPoint(frame.right, frame.bottom),
BPoint(frame.left, frame.bottom));
view->StrokeLine(BPoint(frame.right, frame.bottom - 1),
BPoint(frame.left + 6.0f, frame.top));
view->SetHighColor(darken2);
view->StrokeLine(BPoint(frame.right - 1, frame.bottom - 1),
BPoint(frame.left, frame.bottom - 1));
view->StrokeLine(BPoint(frame.left, frame.bottom - 1),
BPoint(frame.left + 5.0f, frame.top + 1));
view->FillTriangle(BPoint(frame.left + 1.0, frame.bottom - 2.0),
BPoint(frame.left + 6.0, frame.top + 1.0),
BPoint(frame.right - 1.0, frame.bottom - 2.0));
view->SetHighColor(no_tint);
view->StrokeLine(BPoint(frame.right - 2, frame.bottom - 2.0f),
BPoint(frame.left + 3.0f, frame.bottom - 2.0f));
view->StrokeLine(BPoint(frame.right - 3, frame.bottom - 3.0f),
BPoint(frame.left + 6.0f, frame.top + 1));
view->StrokeLine(BPoint(frame.right - 2.0, frame.bottom - 2.0),
BPoint(frame.left + 3.0, frame.bottom - 2.0));
view->SetHighColor(darkenmax);
view->StrokeLine(BPoint(frame.left, frame.bottom),
BPoint(frame.right, frame.bottom));
view->StrokeLine(BPoint(frame.right, frame.bottom - 1.0),
BPoint(frame.left + 6.0, frame.top + 1.0));
view->SetHighColor(darken2);
view->StrokeLine(BPoint(frame.right - 1.0, frame.bottom - 1.0),
BPoint(frame.left + 1.0, frame.bottom - 1.0));
view->SetHighColor(darken3);
view->StrokeLine(BPoint(frame.left, frame.bottom - 1.0),
BPoint(frame.left + 5.0, frame.top + 2.0));
view->SetHighColor(lightenmax);
view->StrokeLine(BPoint(frame.left + 2.0, frame.bottom - 2.0),
BPoint(frame.left + 6.0, frame.top + 2.0));
} else {
view->SetHighColor(lighten1);
view->FillTriangle(BPoint(frame.left + 1.0f, frame.top),

View File

@ -195,6 +195,8 @@ BTextControl::GetAlignment(alignment *label, alignment *text) const
void
BTextControl::SetDivider(float dividingLine)
{
dividingLine = floorf(dividingLine + 0.5);
float dx = fDivider - dividingLine;
fDivider = dividingLine;
@ -597,7 +599,7 @@ BTextControl::InitData(const char *label, const char *initial_text,
SetFont(&font, flags);
if (label)
fDivider = bounds.Width() / 2.0f;
fDivider = floorf(bounds.Width() / 2.0f);
if (Flags() & B_NAVIGABLE) {
fSkipSetFlags = true;
@ -608,8 +610,12 @@ BTextControl::InitData(const char *label, const char *initial_text,
if (data)
fText = static_cast<_BTextInput_ *>(FindView("_input_"));
else {
BRect frame(fDivider, bounds.top + 2.0f,
bounds.right - 2.0f, bounds.bottom - 2.0f);
BRect frame(fDivider, bounds.top,
bounds.right, bounds.bottom);
// we are stroking the frame arround the text view, which
// is 2 pixels wide
frame.InsetBy(2.0, 2.0);
BRect textRect(frame.OffsetToCopy(0.0f, 0.0f));
textRect.InsetBy(2.0, 2.0);

View File

@ -61,6 +61,14 @@
#define MAX_ATTACHMENT_SIZE 49152
static inline float
roundf(float v)
{
if (v >= 0.0)
return floorf(v + 0.5);
else
return ceilf(v - 0.5);
}
static property_info sViewPropInfo[] = {
{ "Frame", { B_GET_PROPERTY, 0 },
@ -1429,6 +1437,10 @@ BView::ScrollBar(orientation posture) const
void
BView::ScrollBy(float dh, float dv)
{
// scrolling by fractional values is not supported, is it?
dh = roundf(dh);
dv = roundf(dv);
// no reason to process this further if no scroll is intended.
if (dh == 0 && dv == 0)
return;
@ -1448,6 +1460,7 @@ BView::ScrollBy(float dh, float dv)
// we modify our bounds rectangle by dh/dv coord units hor/ver.
fBounds.OffsetBy(dh, dv);
// fState->coordSysOrigin += BPoint(dh, dv);
// then set the new values of the scrollbars
if (fHorScroller)
@ -2141,6 +2154,13 @@ BView::GetClippingRegion(BRegion* region) const
if (!region)
return;
// TODO: I think this implementation is wrong,
// since on R5, you really get the currently active
// clipping region, overlapping windows and all.
// I don't think we inform the client in the app_server
// when the clipping changes, so that B_VIEW_CLIP_REGION_BIT
// is set. -Stephan
if (!fState->IsValid(B_VIEW_CLIP_REGION_BIT) && do_owner_check()) {
fOwner->fLink->StartMessage(AS_LAYER_GET_CLIP_REGION);
@ -2181,7 +2201,6 @@ BView::ConstrainClippingRegion(BRegion* region)
// TODO: note this in the specs
fOwner->fLink->Attach<int32>(count);
for (int32 i = 0; i < count; i++)
fOwner->fLink->Attach<BRect>(region->RectAt(i));
@ -3436,9 +3455,9 @@ BView::MoveTo(float x, float y)
if (x == fParentOffset.x && y == fParentOffset.y)
return;
// BeBook says we should do this. We'll do it without. So...
// x = roundf(x);
// y = roundf(y);
// BeBook says we should do this. And it makes sense.
x = roundf(x);
y = roundf(y);
if (fOwner) {
check_lock();
@ -3473,9 +3492,9 @@ BView::ResizeTo(float width, float height)
if (width == fBounds.Width() && height == fBounds.Height())
return;
// BeBook says we should do this. We'll do it without. So...
// width = roundf(width);
// height = roundf(height);
// BeBook says we should do this. And it makes sense.
width = floorf(width + 0.5);
height = floorf(height + 0.5);
if (fOwner) {
check_lock();

View File

@ -5,6 +5,7 @@
* Authors:
* Adrian Oanca <adioanca@cotty.iren.ro>
* Axel Dörfler, axeld@pinc-software.de
* Stephan Aßmus, <superstippi@gmx.de>
*/
@ -189,14 +190,13 @@ BWindow::BWindow(BMessage* data)
}
BWindow::BWindow(BRect frame, color_space depth,
uint32 bitmapFlags, int32 rowBytes)
BWindow::BWindow(BRect frame, int32 bitmapToken)
:
BLooper("offscreen bitmap")
{
// TODO: Implement for real
decomposeType(B_UNTYPED_WINDOW, &fLook, &fFeel);
InitData(frame, "offscreen", fLook, fFeel, 0, 0);
InitData(frame, "offscreen", fLook, fFeel, 0, 0, bitmapToken);
}
@ -1418,12 +1418,12 @@ BWindow::Title() const
void
BWindow::SetTitle(const char *title)
{
free(fTitle);
fTitle = strdup(title);
if (title == NULL)
title = "";
free(fTitle);
fTitle = strdup(title);
// we will change BWindow's thread name to "w>window title"
char threadName[B_OS_NAME_LENGTH];
@ -1437,19 +1437,20 @@ BWindow::SetTitle(const char *title)
threadName[length + 2] = '\0';
#endif
// change the handler's name
SetName(threadName);
// if the message loop has been started...
if (Thread() >= B_OK) {
rename_thread(Thread(), threadName);
// we notify the app_server so we can actually see the change
Lock();
fLink->StartMessage(AS_WINDOW_TITLE);
fLink->AttachString(title);
fLink->Flush();
Unlock();
if (Lock()) {
fLink->StartMessage(AS_WINDOW_TITLE);
fLink->AttachString(fTitle);
fLink->Flush();
Unlock();
}
}
}
@ -1964,7 +1965,7 @@ BWindow::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
void
BWindow::InitData(BRect frame, const char* title, window_look look,
window_feel feel, uint32 flags, uint32 workspace)
window_feel feel, uint32 flags, uint32 workspace, int32 bitmapToken)
{
STRACE(("BWindow::InitData()\n"));
@ -2042,10 +2043,6 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
STRACE(("BWindow::InitData(): contacting app_server...\n"));
// let app_server to know that a window has been created.
fLink = new BPrivate::PortLink(
BApplication::Private::ServerLink()->SenderPort(), receivePort);
// HERE we are in BApplication's thread, so for locking we use be_app variable
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
bool locked = false;
@ -2054,7 +2051,17 @@ BWindow::InitData(BRect frame, const char* title, window_look look,
locked = true;
}
fLink->StartMessage(AS_CREATE_WINDOW);
// let app_server to know that a window has been created.
fLink = new BPrivate::PortLink(
BApplication::Private::ServerLink()->SenderPort(), receivePort);
if (bitmapToken < 0) {
fLink->StartMessage(AS_CREATE_WINDOW);
} else {
fLink->StartMessage(AS_CREATE_OFFSCREEN_WINDOW);
fLink->Attach<int32>(bitmapToken);
}
fLink->Attach<BRect>(fFrame);
fLink->Attach<int32>((int32)fLook);
fLink->Attach<int32>((int32)fFeel);
@ -2850,7 +2857,7 @@ BWindow::DoUpdate(BView *view, BRect &area)
} else {
// The code below is certainly not correct, because
// it redoes what the app_server already did
// Find out what happens if a view has ViewColor() =
// Find out what happens on R5 if a view has ViewColor() =
// B_TRANSPARENT_COLOR but not B_WILL_DRAW
/* rgb_color c = aView->HighColor();
aView->SetHighColor(aView->ViewColor());