Renamed WinBorder to WindowLayer, and OffscreenWinBorder to OffscreenWindowLayer.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-24 17:45:26 +00:00
parent 2430abdd9a
commit 4b813bf267
24 changed files with 565 additions and 585 deletions

View File

@ -31,7 +31,6 @@
#include "ServerProtocol.h"
#include "ServerWindow.h"
#include "SystemPalette.h"
#include "WinBorder.h"
#include <Accelerant.h>
#include <AppDefs.h>

View File

@ -212,7 +212,7 @@ DefaultDecorator::GetFootprint(BRegion *region)
{
STRACE(("DefaultDecorator: Get Footprint\n"));
// This function calculates the decorator's footprint in coordinates
// relative to the layer. This is most often used to set a WinBorder
// relative to the layer. This is most often used to set a WindowLayer
// object's visible region.
if (!region)
return;

View File

@ -24,7 +24,7 @@
#include "ServerConfig.h"
#include "ServerScreen.h"
#include "ServerWindow.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Workspace.h"
#include <WindowInfo.h>
@ -147,7 +147,7 @@ Desktop::Desktop(uid_t userID)
fSettings(new DesktopSettings::Private()),
fAppListLock("application list"),
fShutdownSemaphore(-1),
fWinBorderList(64),
fWindowLayerList(64),
fActiveScreen(NULL),
fCursorManager()
{
@ -165,8 +165,8 @@ Desktop::Desktop(uid_t userID)
Desktop::~Desktop()
{
// root layer only knows the visible WinBorders, so we delete them all over here
for (int32 i = 0; WinBorder *border = (WinBorder *)fWinBorderList.ItemAt(i); i++)
// root layer only knows the visible WindowLayers, so we delete them all over here
for (int32 i = 0; WindowLayer *border = (WindowLayer *)fWindowLayerList.ItemAt(i); i++)
delete border;
delete fRootLayer;
@ -435,8 +435,8 @@ Desktop::_ActivateApp(team_id team)
// search for an unhidden window to give focus to
int32 windowCount = WindowList().CountItems();
for (int32 i = 0; i < windowCount; ++i) {
// is this layer in fact a WinBorder?
WinBorder *winBorder = WindowList().ItemAt(i);
// is this layer in fact a WindowLayer?
WindowLayer *winBorder = WindowList().ItemAt(i);
// if winBorder is valid and not hidden, then we've found our target
if (winBorder != NULL && !winBorder->IsHidden()
@ -480,11 +480,11 @@ Desktop::BroadcastToAllApps(int32 code)
}
// #pragma mark - Methods for WinBorder manipulation
// #pragma mark - Methods for WindowLayer manipulation
void
Desktop::AddWinBorder(WinBorder *winBorder)
Desktop::AddWindowLayer(WindowLayer *winBorder)
{
if (!winBorder)
return;
@ -497,45 +497,45 @@ Desktop::AddWinBorder(WinBorder *winBorder)
// we're playing with window list. lock first.
Lock();
if (fWinBorderList.HasItem(winBorder)) {
if (fWindowLayerList.HasItem(winBorder)) {
Unlock();
RootLayer()->Unlock();
debugger("AddWinBorder: WinBorder already in Desktop list\n");
debugger("AddWindowLayer: WindowLayer already in Desktop list\n");
return;
}
// we have a new window. store a record of it.
fWinBorderList.AddItem(winBorder);
fWindowLayerList.AddItem(winBorder);
// add FLOATING_APP windows to the local list of all normal windows.
// This is to keep the order all floating windows (app or subset) when we go from
// one normal window to another.
if (feel == B_FLOATING_APP_WINDOW_FEEL || feel == B_NORMAL_WINDOW_FEEL) {
WinBorder *wb = NULL;
int32 count = fWinBorderList.CountItems();
WindowLayer *wb = NULL;
int32 count = fWindowLayerList.CountItems();
int32 feelToLookFor = (feel == B_NORMAL_WINDOW_FEEL ?
B_FLOATING_APP_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
for (int32 i = 0; i < count; i++) {
wb = (WinBorder *)fWinBorderList.ItemAt(i);
wb = (WindowLayer *)fWindowLayerList.ItemAt(i);
if (wb->App()->ClientTeam() == winBorder->App()->ClientTeam()
&& wb->Feel() == feelToLookFor) {
// R2: RootLayer comparison is needed.
feel == B_NORMAL_WINDOW_FEEL ?
winBorder->fSubWindowList.AddWinBorder(wb) :
wb->fSubWindowList.AddWinBorder(winBorder);
winBorder->fSubWindowList.AddWindowLayer(wb) :
wb->fSubWindowList.AddWindowLayer(winBorder);
}
}
}
// add application's list of modal windows.
if (feel == B_MODAL_APP_WINDOW_FEEL) {
winBorder->App()->fAppSubWindowList.AddWinBorder(winBorder);
winBorder->App()->fAppSubWindowList.AddWindowLayer(winBorder);
}
// send WinBorder to be added to workspaces
RootLayer()->AddWinBorder(winBorder);
// send WindowLayer to be added to workspaces
RootLayer()->AddWindowLayer(winBorder);
// hey, unlock!
Unlock();
@ -545,7 +545,7 @@ Desktop::AddWinBorder(WinBorder *winBorder)
void
Desktop::RemoveWinBorder(WinBorder *winBorder)
Desktop::RemoveWindowLayer(WindowLayer *winBorder)
{
if (!winBorder)
return;
@ -556,8 +556,8 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
// we're playing with window list. lock first.
Lock();
// remove from main WinBorder list.
if (fWinBorderList.RemoveItem(winBorder)) {
// remove from main WindowLayer list.
if (fWindowLayerList.RemoveItem(winBorder)) {
int32 feel = winBorder->Feel();
// floating app/subset and modal_subset windows require special atention because
@ -566,11 +566,11 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
|| feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_FLOATING_APP_WINDOW_FEEL)
{
WinBorder *wb = NULL;
int32 count = fWinBorderList.CountItems();
WindowLayer *wb = NULL;
int32 count = fWindowLayerList.CountItems();
for (int32 i = 0; i < count; i++) {
wb = (WinBorder*)fWinBorderList.ItemAt(i);
wb = (WindowLayer*)fWindowLayerList.ItemAt(i);
if (wb->Feel() == B_NORMAL_WINDOW_FEEL
&& wb->App()->ClientTeam() == winBorder->App()->ClientTeam()) {
@ -587,12 +587,12 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
} else {
Unlock();
RootLayer()->Unlock();
debugger("RemoveWinBorder: WinBorder not found in Desktop list\n");
debugger("RemoveWindowLayer: WindowLayer not found in Desktop list\n");
return;
}
// Tell to winBorder's RootLayer about this.
RootLayer()->RemoveWinBorder(winBorder);
RootLayer()->RemoveWindowLayer(winBorder);
Unlock();
RootLayer()->Unlock();
@ -600,7 +600,7 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
void
Desktop::AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder)
Desktop::AddWindowLayerToSubset(WindowLayer *winBorder, WindowLayer *toWindowLayer)
{
// NOTE: we can safely lock the entire method body, because this method is called from
// RootLayer's thread only.
@ -608,36 +608,36 @@ Desktop::AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder)
// we're playing with window list. lock first.
Lock();
if (!winBorder || !toWinBorder
|| !fWinBorderList.HasItem(winBorder)
|| !fWinBorderList.HasItem(toWinBorder)) {
if (!winBorder || !toWindowLayer
|| !fWindowLayerList.HasItem(winBorder)
|| !fWindowLayerList.HasItem(toWindowLayer)) {
Unlock();
debugger("AddWinBorderToSubset: NULL WinBorder or not found in Desktop list\n");
debugger("AddWindowLayerToSubset: NULL WindowLayer or not found in Desktop list\n");
return;
}
if ((winBorder->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL
|| winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
&& toWinBorder->Feel() == B_NORMAL_WINDOW_FEEL
&& toWinBorder->App()->ClientTeam() == winBorder->App()->ClientTeam()
&& !toWinBorder->fSubWindowList.HasItem(winBorder)) {
&& toWindowLayer->Feel() == B_NORMAL_WINDOW_FEEL
&& toWindowLayer->App()->ClientTeam() == winBorder->App()->ClientTeam()
&& !toWindowLayer->fSubWindowList.HasItem(winBorder)) {
// add to normal_window's list
toWinBorder->fSubWindowList.AddWinBorder(winBorder);
toWindowLayer->fSubWindowList.AddWindowLayer(winBorder);
} else {
Unlock();
debugger("AddWinBorderToSubset: you must add a subset_window to a normal_window's subset with the same team_id\n");
debugger("AddWindowLayerToSubset: you must add a subset_window to a normal_window's subset with the same team_id\n");
return;
}
// send WinBorder to be added to workspaces, if not already in there.
RootLayer()->AddSubsetWinBorder(winBorder, toWinBorder);
// send WindowLayer to be added to workspaces, if not already in there.
RootLayer()->AddSubsetWindowLayer(winBorder, toWindowLayer);
Unlock();
}
void
Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder)
Desktop::RemoveWindowLayerFromSubset(WindowLayer *winBorder, WindowLayer *fromWindowLayer)
{
// NOTE: we can safely lock the entire method body, because this method is called from
// RootLayer's thread only.
@ -645,23 +645,23 @@ Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorde
// we're playing with window list. lock first.
Lock();
if (!winBorder || !fromWinBorder
|| !fWinBorderList.HasItem(winBorder)
|| !fWinBorderList.HasItem(fromWinBorder)) {
if (!winBorder || !fromWindowLayer
|| !fWindowLayerList.HasItem(winBorder)
|| !fWindowLayerList.HasItem(fromWindowLayer)) {
Unlock();
debugger("RemoveWinBorderFromSubset: NULL WinBorder or not found in Desktop list\n");
debugger("RemoveWindowLayerFromSubset: NULL WindowLayer or not found in Desktop list\n");
return;
}
// remove WinBorder from workspace, if needed - some other windows may still have it in their subset
RootLayer()->RemoveSubsetWinBorder(winBorder, fromWinBorder);
// remove WindowLayer from workspace, if needed - some other windows may still have it in their subset
RootLayer()->RemoveSubsetWindowLayer(winBorder, fromWindowLayer);
if (fromWinBorder->Feel() == B_NORMAL_WINDOW_FEEL) {
if (fromWindowLayer->Feel() == B_NORMAL_WINDOW_FEEL) {
//remove from this normal_window's subset.
fromWinBorder->fSubWindowList.RemoveItem(winBorder);
fromWindowLayer->fSubWindowList.RemoveItem(winBorder);
} else {
Unlock();
debugger("RemoveWinBorderFromSubset: you must remove a subset_window from a normal_window's subset\n");
debugger("RemoveWindowLayerFromSubset: you must remove a subset_window from a normal_window's subset\n");
return;
}
@ -670,28 +670,28 @@ Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorde
void
Desktop::SetWinBorderFeel(WinBorder *winBorder, uint32 feel)
Desktop::SetWindowLayerFeel(WindowLayer *winBorder, uint32 feel)
{
// NOTE: this method is called from RootLayer thread only
// we're playing with window list. lock first.
Lock();
RemoveWinBorder(winBorder);
RemoveWindowLayer(winBorder);
winBorder->QuietlySetFeel(feel);
AddWinBorder(winBorder);
AddWindowLayer(winBorder);
Unlock();
}
WinBorder *
Desktop::FindWinBorderByClientToken(int32 token, team_id teamID)
WindowLayer *
Desktop::FindWindowLayerByClientToken(int32 token, team_id teamID)
{
BAutolock locker(this);
WinBorder *wb;
for (int32 i = 0; (wb = (WinBorder *)fWinBorderList.ItemAt(i)); i++) {
WindowLayer *wb;
for (int32 i = 0; (wb = (WindowLayer *)fWindowLayerList.ItemAt(i)); i++) {
if (wb->Window()->ClientToken() == token
&& wb->Window()->ClientTeam() == teamID)
return wb;
@ -701,13 +701,13 @@ Desktop::FindWinBorderByClientToken(int32 token, team_id teamID)
}
const BObjectList<WinBorder> &
const BObjectList<WindowLayer> &
Desktop::WindowList() const
{
if (!IsLocked())
debugger("You must lock before getting registered windows list\n");
return fWinBorderList;
return fWindowLayerList;
}
@ -720,22 +720,22 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
int32 count = 0;
if (team >= B_OK) {
for (int32 i = 0; i < fWinBorderList.CountItems(); i++) {
WinBorder* border = fWinBorderList.ItemAt(i);
for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WindowLayer* border = fWindowLayerList.ItemAt(i);
if (border->Window()->ClientTeam() == team)
count++;
}
} else
count = fWinBorderList.CountItems();
count = fWindowLayerList.CountItems();
// write list
sender.StartMessage(SERVER_TRUE);
sender.Attach<int32>(count);
for (int32 i = 0; i < fWinBorderList.CountItems(); i++) {
WinBorder* border = fWinBorderList.ItemAt(i);
for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WindowLayer* border = fWindowLayerList.ItemAt(i);
if (team >= B_OK && border->Window()->ClientTeam() != team)
continue;

View File

@ -33,7 +33,7 @@ class DrawingEngine;
class HWInterface;
class Layer;
class RootLayer;
class WinBorder;
class WindowLayer;
namespace BPrivate {
class LinkSender;
@ -73,21 +73,21 @@ class Desktop : public MessageLooper, public ScreenOwner {
inline ::HWInterface* HWInterface() const
{ return fVirtualScreen.HWInterface(); }
// Methods for layer(WinBorder) manipulation.
void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder);
void SetWinBorderFeel(WinBorder *winBorder,
// Methods for layer(WindowLayer) manipulation.
void AddWindowLayer(WindowLayer *winBorder);
void RemoveWindowLayer(WindowLayer *winBorder);
void SetWindowLayerFeel(WindowLayer *winBorder,
uint32 feel);
void AddWinBorderToSubset(WinBorder *winBorder,
WinBorder *toWinBorder);
void RemoveWinBorderFromSubset(WinBorder *winBorder,
WinBorder *fromWinBorder);
void AddWindowLayerToSubset(WindowLayer *winBorder,
WindowLayer *toWindowLayer);
void RemoveWindowLayerFromSubset(WindowLayer *winBorder,
WindowLayer *fromWindowLayer);
WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID);
//WinBorder* FindWinBorderByServerToken(int32 token);
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
//WindowLayer* FindWindowLayerByServerToken(int32 token);
// get list of registed windows
const BObjectList<WinBorder>& WindowList() const;
const BObjectList<WindowLayer>& WindowList() const;
void WriteWindowList(team_id team, BPrivate::LinkSender& sender);
void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender);
@ -114,7 +114,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
sem_id fShutdownSemaphore;
int32 fShutdownCount;
BObjectList<WinBorder> fWinBorderList;
BObjectList<WindowLayer> fWindowLayerList;
::RootLayer* fRootLayer;
Screen* fActiveScreen;

View File

@ -35,7 +35,7 @@ Server app_server :
MessageLooper.cpp
MultiLocker.cpp
OffscreenServerWindow.cpp
OffscreenWinBorder.cpp
OffscreenWindowLayer.cpp
PNGDump.cpp
PicturePlayer.cpp
RAMLinkMsgReader.cpp
@ -52,7 +52,7 @@ Server app_server :
SubWindowList.cpp
SystemPalette.cpp
VirtualScreen.cpp
WinBorder.cpp
WindowLayer.cpp
Workspace.cpp
WorkspacesLayer.cpp

View File

@ -29,7 +29,7 @@
#include "ServerApp.h"
#include "ServerProtocol.h"
#include "ServerWindow.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Layer.h"
#include "ServerBitmap.h"
@ -1440,9 +1440,9 @@ void
Layer::_AllRedraw(const BRegion &invalid)
{
// couldn't find a simpler way to send _UPDATE_ message to client.
WinBorder *wb = dynamic_cast<WinBorder*>(this);
if (wb)
wb->RequestClientRedraw(invalid);
WindowLayer *windowLayer = dynamic_cast<WindowLayer*>(this);
if (windowLayer)
windowLayer->RequestClientRedraw(invalid);
if (fVisible.CountRects() > 0) {
BRegion updateReg(fVisible);

View File

@ -170,7 +170,7 @@ class Layer {
{ return fWindow; }
ServerApp* App() const
{ return fWindow ? fWindow->App() : NULL; }
inline WinBorder* Owner() const
inline WindowLayer* Owner() const
{ return fOwner; }
RootLayer* GetRootLayer() const
{ return fRootLayer; }
@ -208,9 +208,8 @@ class Layer {
virtual void Draw(const BRect& r);
void _AllRedraw(const BRegion &invalid);
private:
friend class RootLayer;
friend class WinBorder;
protected:
friend class RootLayer;
friend class ServerWindow;
// private clipping stuff
@ -241,7 +240,7 @@ class Layer {
DrawingEngine* fDriver;
RootLayer* fRootLayer;
ServerWindow* fWindow;
WinBorder* fOwner;
WindowLayer* fOwner;
DrawState* fDrawState;

View File

@ -6,12 +6,13 @@
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "OffscreenWinBorder.h"
#include "OffscreenWindowLayer.h"
#include "ServerBitmap.h"
#include "OffscreenServerWindow.h"
// constructor
OffscreenServerWindow::OffscreenServerWindow(const char *title,
ServerApp *app,
port_id clientPort,
@ -39,11 +40,11 @@ OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
// don't do anything in this implementation.
}
// MakeWinBorder
WinBorder*
OffscreenServerWindow::MakeWinBorder(BRect frame, const char* name,
WindowLayer*
OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags,
uint32 workspace)
{
return new OffscreenWinBorder(fBitmap, name, this);
return new OffscreenWindowLayer(fBitmap, name, this);
}

View File

@ -11,6 +11,7 @@
#include "ServerWindow.h"
class OffscreenServerWindow : public ServerWindow {
public:
OffscreenServerWindow(const char *title,
@ -26,10 +27,10 @@ class OffscreenServerWindow : public ServerWindow {
int32 target = B_NULL_TOKEN,
bool usePreferred = false) const;
virtual WinBorder* MakeWinBorder(BRect frame,
const char* name,
uint32 look, uint32 feel,
uint32 flags, uint32 workspace);
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags,
uint32 workspace);
private:
ServerBitmap* fBitmap;
};

View File

@ -2,30 +2,27 @@
* Copyright 2005, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Author: Stephan Aßmus <superstippi@gmx.de>
* Author:
* Stephan Aßmus <superstippi@gmx.de>
*/
#include <stdio.h>
#include "BitmapHWInterface.h"
#include "DrawingEngine.h"
#include "OffscreenWindowLayer.h"
#include "ServerBitmap.h"
#include <Debug.h>
#include "DebugInfoManager.h"
#include "BitmapHWInterface.h"
#include "DrawingEngine.h"
#include "ServerBitmap.h"
#include "OffscreenWinBorder.h"
#include <stdio.h>
// constructor
OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap,
const char* name,
ServerWindow* window)
: WinBorder(bitmap->Bounds(), name,
B_NO_BORDER_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,
0, 0, window,
new DrawingEngine()),
OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap,
const char* name, ServerWindow* window)
: WindowLayer(bitmap->Bounds(), name,
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
0, 0, window, new DrawingEngine()),
fBitmap(bitmap),
fHWInterface(new BitmapHWInterface(fBitmap))
{
@ -34,8 +31,8 @@ OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap,
GetDrawingEngine()->Update();
}
// destructor
OffscreenWinBorder::~OffscreenWinBorder()
OffscreenWindowLayer::~OffscreenWindowLayer()
{
fHWInterface->WriteLock();
// Unlike normal Layers, we own the DrawingEngine instance
@ -46,28 +43,24 @@ OffscreenWinBorder::~OffscreenWinBorder()
delete fHWInterface;
}
void
OffscreenWinBorder::Draw(const BRect &r)
OffscreenWindowLayer::Draw(const BRect &r)
{
// Nothing to do here
}
void
OffscreenWinBorder::MoveBy(float x, float y)
OffscreenWindowLayer::MoveBy(float x, float y)
{
// Nothing to do here
}
void
OffscreenWinBorder::ResizeBy(float x, float y)
OffscreenWindowLayer::ResizeBy(float x, float y)
{
// Nothing to do here
}
// SetTopLayer
void
OffscreenWinBorder::SetTopLayer(Layer* layer)
{
WinBorder::SetTopLayer(layer);
}

View File

@ -2,23 +2,25 @@
* Copyright 2005, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Author: Stephan Aßmus <superstippi@gmx.de>
* Author:
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef OFFSCREEN_WINBORDER_H
#define OFFSCREEN_WINBORDER_H
#include "WinBorder.h"
#include "WindowLayer.h"
class BitmapHWInterface;
class ServerBitmap;
class OffscreenWinBorder : public WinBorder {
class OffscreenWindowLayer : public WindowLayer {
public:
OffscreenWinBorder(ServerBitmap* bitmap,
OffscreenWindowLayer(ServerBitmap* bitmap,
const char* name,
ServerWindow* window);
virtual ~OffscreenWinBorder();
virtual ~OffscreenWindowLayer();
virtual void Draw(const BRect &r);
@ -28,11 +30,9 @@ class OffscreenWinBorder : public WinBorder {
virtual bool IsOffscreenWindow() const
{ return true; }
virtual void SetTopLayer(Layer* layer);
private:
ServerBitmap* fBitmap;
BitmapHWInterface* fHWInterface;
};
#endif
#endif // OFFSCREEN_WINBORDER_H

View File

@ -23,7 +23,7 @@
#include "ServerProtocol.h"
#include "ServerScreen.h"
#include "ServerWindow.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Workspace.h"
#include "WorkspacesLayer.h"
@ -181,46 +181,45 @@ RootLayer::ResizeBy(float x, float y)
void
RootLayer::AddWinBorder(WinBorder* winBorder)
RootLayer::AddWindowLayer(WindowLayer* windowLayer)
{
if (!winBorder->IsHidden())
{
CRITICAL("RootLayer::AddWinBorder - winBorder must be hidden\n");
if (!windowLayer->IsHidden()) {
CRITICAL("RootLayer::AddWindowLayer - windowLayer must be hidden\n");
return;
}
// Subset modals also need to have a main window before appearing in workspace list.
int32 feel = winBorder->Feel();
int32 feel = windowLayer->Feel();
if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL) {
uint32 workspaces = winBorder->Workspaces();
uint32 workspaces = windowLayer->Workspaces();
// add to current workspace
if (workspaces == 0)
fWorkspace[fActiveWksIndex]->AddWinBorder(winBorder);
fWorkspace[fActiveWksIndex]->AddWindowLayer(windowLayer);
else {
// add to desired workspaces
for (int32 i = 0; i < fWsCount; i++) {
if (fWorkspace[i] && (workspaces & (0x00000001UL << i)))
fWorkspace[i]->AddWinBorder(winBorder);
fWorkspace[i]->AddWindowLayer(windowLayer);
}
}
}
// we _DO_NOT_ need to invalidate here. At this point our WinBorder is hidden!
// we _DO_NOT_ need to invalidate here. At this point our WindowLayer is hidden!
// set some internals
winBorder->SetRootLayer(this);
winBorder->fParent = this;
windowLayer->SetRootLayer(this);
windowLayer->fParent = this;
}
void
RootLayer::RemoveWinBorder(WinBorder* winBorder)
RootLayer::RemoveWindowLayer(WindowLayer* windowLayer)
{
// Note: removing a subset window is also permited/performed.
if (!winBorder->IsHidden())
if (!windowLayer->IsHidden())
{
CRITICAL("RootLayer::RemoveWinBorder - winBorder must be hidden\n");
CRITICAL("RootLayer::RemoveWindowLayer - windowLayer must be hidden\n");
return;
}
@ -229,32 +228,32 @@ RootLayer::RemoveWinBorder(WinBorder* winBorder)
// windows have 0 as a workspace index, this action is fully justified.
for (int32 i = 0; i < fWsCount; i++) {
if (fWorkspace[i])
fWorkspace[i]->RemoveWinBorder(winBorder);
fWorkspace[i]->RemoveWindowLayer(windowLayer);
}
// we _DO_NOT_ need to invalidate here. At this point our WinBorder is hidden!
// we _DO_NOT_ need to invalidate here. At this point our WindowLayer is hidden!
LayerRemoved(winBorder);
LayerRemoved(windowLayer);
// set some internals
winBorder->SetRootLayer(NULL);
winBorder->fParent = NULL;
windowLayer->SetRootLayer(NULL);
windowLayer->fParent = NULL;
}
void
RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
RootLayer::AddSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *toWindowLayer)
{
// SUBSET windows _must_ have their workspaceIndex set to 0x0
if (winBorder->Workspaces() != 0UL)
if (windowLayer->Workspaces() != 0UL)
{
CRITICAL("SUBSET windows _must_ have their workspaceIndex set to 0x0\n");
return;
}
// there is no point in continuing - this subset window won't be shown,
// from 'toWinBorder's point of view
if (winBorder->IsHidden() || toWinBorder->IsHidden())
// from 'toWindowLayer's point of view
if (windowLayer->IsHidden() || toWindowLayer->IsHidden())
{
return;
}
@ -264,13 +263,13 @@ RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState);
// we try to add WinBorders to all workspaces. If they are not needed, nothing will be done.
// we try to add WindowLayers to all workspaces. If they are not needed, nothing will be done.
// If they are needed, Workspace automaticaly allocates space and inserts them.
for (int32 i = 0; i < fWsCount; i++) {
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(toWinBorder))
invalid = fWorkspace[i]->ShowWinBorder(winBorder, false);
if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(toWindowLayer))
invalid = fWorkspace[i]->ShowWindowLayer(windowLayer, false);
if (fActiveWksIndex == i)
invalidate = invalid;
@ -282,11 +281,11 @@ RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
void
RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder)
RootLayer::RemoveSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *fromWindowLayer)
{
// there is no point in continuing - this subset window is not visible
// at least not visible from 'fromWinBorder's point of view.
if (winBorder->IsHidden() || fromWinBorder->IsHidden())
// at least not visible from 'fromWindowLayer's point of view.
if (windowLayer->IsHidden() || fromWindowLayer->IsHidden())
return;
bool invalidate = false;
@ -294,12 +293,12 @@ RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder)
Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState);
// we try to remove from all workspaces. If winBorder is not in there, nothing will be done.
// we try to remove from all workspaces. If windowLayer is not in there, nothing will be done.
for (int32 i = 0; i < fWsCount; i++) {
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(fromWinBorder))
invalid = fWorkspace[i]->HideWinBorder(winBorder);
if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(fromWindowLayer))
invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
if (fActiveWksIndex == i)
invalidate = invalid;
@ -323,17 +322,17 @@ bool RootLayer::SetActiveWorkspace(int32 index)
// return false;
// if you're dragging something you are allowed to change workspaces only if
// the Layer being dragged is a B_NORMAL_WINDOW_FEEL WinBorder.
WinBorder *draggedWinBorder = dynamic_cast<WinBorder*>(fMouseEventLayer);
// the Layer being dragged is a B_NORMAL_WINDOW_FEEL WindowLayer.
WindowLayer *draggedWindowLayer = dynamic_cast<WindowLayer*>(fMouseEventLayer);
if (fMouseEventLayer != NULL) {
if (draggedWinBorder) {
if (draggedWinBorder->Feel() != B_NORMAL_WINDOW_FEEL)
if (draggedWindowLayer) {
if (draggedWindowLayer->Feel() != B_NORMAL_WINDOW_FEEL)
return false;
} else
return false;
}
// if fWorkspace[index] object does not exist, create and add allowed WinBorders
// if fWorkspace[index] object does not exist, create and add allowed WindowLayers
if (!fWorkspace[index]) {
// TODO: we NEED datas from a file!!!
fWorkspace[index] = new Workspace(index, 0xFF00FF00, kDefaultWorkspaceColor);
@ -341,18 +340,18 @@ bool RootLayer::SetActiveWorkspace(int32 index)
// we need to lock the window list here so no other window can be created
fDesktop->Lock();
const BObjectList<WinBorder>& windowList = fDesktop->WindowList();
const BObjectList<WindowLayer>& windowList = fDesktop->WindowList();
int32 windowCount = windowList.CountItems();
for (int32 i = 0; i < windowCount; i++) {
WinBorder* winBorder = windowList.ItemAt(i);
WindowLayer* windowLayer = windowList.ItemAt(i);
// is WinBorder on this workspace?
if (winBorder->Workspaces() & (0x00000001UL << index)) {
fWorkspace[index]->AddWinBorder(winBorder);
// is WindowLayer on this workspace?
if (windowLayer->Workspaces() & (0x00000001UL << index)) {
fWorkspace[index]->AddWindowLayer(windowLayer);
if (!winBorder->IsHidden())
fWorkspace[index]->ShowWinBorder(winBorder);
if (!windowLayer->IsHidden())
fWorkspace[index]->ShowWindowLayer(windowLayer);
}
}
@ -381,28 +380,28 @@ bool RootLayer::SetActiveWorkspace(int32 index)
fActiveWksIndex = index;
if (draggedWinBorder && !ActiveWorkspace()->HasWinBorder(draggedWinBorder)) {
if (draggedWindowLayer && !ActiveWorkspace()->HasWindowLayer(draggedWindowLayer)) {
// Workspace class expects a window to be hidden when it's about to be removed.
// As we surely know this windows is visible, we simply set fHidden to true and then
// change it back when adding winBorder to the current workspace.
draggedWinBorder->fHidden = true;
fWorkspace[exIndex]->HideWinBorder(draggedWinBorder);
fWorkspace[exIndex]->RemoveWinBorder(draggedWinBorder);
// change it back when adding windowLayer to the current workspace.
draggedWindowLayer->fHidden = true;
fWorkspace[exIndex]->HideWindowLayer(draggedWindowLayer);
fWorkspace[exIndex]->RemoveWindowLayer(draggedWindowLayer);
draggedWinBorder->fHidden = false;
ActiveWorkspace()->AddWinBorder(draggedWinBorder);
ActiveWorkspace()->ShowWinBorder(draggedWinBorder);
draggedWindowLayer->fHidden = false;
ActiveWorkspace()->AddWindowLayer(draggedWindowLayer);
ActiveWorkspace()->ShowWindowLayer(draggedWindowLayer);
// TODO: can you call SetWinBorderWorskpaces() instead of this?
uint32 wks = draggedWinBorder->Workspaces();
// TODO: can you call SetWindowLayerWorskpaces() instead of this?
uint32 wks = draggedWindowLayer->Workspaces();
BMessage changedMsg(B_WORKSPACES_CHANGED);
changedMsg.AddInt64("when", real_time_clock_usecs());
changedMsg.AddInt32("old", wks);
wks &= ~(0x00000001 << exIndex);
wks |= (0x00000001 << fActiveWksIndex);
changedMsg.AddInt32("new", wks);
draggedWinBorder->QuietlySetWorkspaces(wks);
draggedWinBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN);
draggedWindowLayer->QuietlySetWorkspaces(wks);
draggedWindowLayer->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN);
}
RevealNewWMState(oldWMState);
@ -421,12 +420,12 @@ bool RootLayer::SetActiveWorkspace(int32 index)
void
RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32 newIndex)
RootLayer::SetWindowLayerWorskpaces(WindowLayer *windowLayer, uint32 oldIndex, uint32 newIndex)
{
// if the active notify Layer is somehow related to winBorder, then
// this window/WinBorder is not allowed to leave this workspace.
// if the active notify Layer is somehow related to windowLayer, then
// this window/WindowLayer is not allowed to leave this workspace.
// TODO: this looks wrong: I doubt the window is supposed to open in two workspaces then
// if (fNotifyLayer && (fNotifyLayer == winBorder || fNotifyLayer->Owner() == winBorder))
// if (fNotifyLayer && (fNotifyLayer == windowLayer || fNotifyLayer->Owner() == windowLayer))
// newIndex |= (0x00000001UL << fActiveWksIndex);
uint32 localOldIndex = oldIndex;
@ -442,7 +441,7 @@ RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32
// you *cannot* set workspaces index for a window other than a normal one!
// Note: See ServerWindow class.
if (winBorder->Feel() != B_NORMAL_WINDOW_FEEL || localOldIndex == localNewIndex)
if (windowLayer->Feel() != B_NORMAL_WINDOW_FEEL || localOldIndex == localNewIndex)
return;
Workspace::State oldWMState;
@ -452,20 +451,20 @@ RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32
if (fWorkspace[i]) {
invalid = false;
if (!(localNewIndex & (0x00000001UL << i)) && fWorkspace[i]->HasWinBorder(winBorder)) {
if (!winBorder->IsHidden()) {
if (!(localNewIndex & (0x00000001UL << i)) && fWorkspace[i]->HasWindowLayer(windowLayer)) {
if (!windowLayer->IsHidden()) {
// a little trick to force Workspace to properly pick the next front.
winBorder->fHidden = true;
invalid = fWorkspace[i]->HideWinBorder(winBorder);
winBorder->fHidden = false;
windowLayer->fHidden = true;
invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
windowLayer->fHidden = false;
}
fWorkspace[i]->RemoveWinBorder(winBorder);
fWorkspace[i]->RemoveWindowLayer(windowLayer);
}
if ((localNewIndex & (0x00000001UL << i)) && !fWorkspace[i]->HasWinBorder(winBorder)) {
fWorkspace[i]->AddWinBorder(winBorder);
if (!winBorder->IsHidden())
invalid = fWorkspace[i]->ShowWinBorder(winBorder);
if ((localNewIndex & (0x00000001UL << i)) && !fWorkspace[i]->HasWindowLayer(windowLayer)) {
fWorkspace[i]->AddWindowLayer(windowLayer);
if (!windowLayer->IsHidden())
invalid = fWorkspace[i]->ShowWindowLayer(windowLayer);
}
if (fActiveWksIndex == i)
@ -473,7 +472,7 @@ RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32
}
}
winBorder->WorkspacesChanged(oldIndex, newIndex);
windowLayer->WorkspacesChanged(oldIndex, newIndex);
if (invalidate)
RevealNewWMState(oldWMState);
@ -581,7 +580,7 @@ RootLayer::SaveWorkspaceData(const char *path)
void
RootLayer::HideWinBorder(WinBorder* winBorder)
RootLayer::HideWindowLayer(WindowLayer* windowLayer)
{
BAutolock _(fAllRegionsLock);
@ -590,18 +589,18 @@ RootLayer::HideWinBorder(WinBorder* winBorder)
Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState);
winBorder->Hide(false);
windowLayer->Hide(false);
for (int32 i = 0; i < fWsCount; i++) {
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(winBorder))
invalid = fWorkspace[i]->HideWinBorder(winBorder);
if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(windowLayer))
invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
if (fActiveWksIndex == i) {
invalidate = invalid;
if (dynamic_cast<class WorkspacesLayer *>(winBorder->FirstChild()) != NULL)
if (dynamic_cast<class WorkspacesLayer *>(windowLayer->FirstChild()) != NULL)
SetWorkspacesLayer(NULL);
}
}
@ -612,7 +611,7 @@ RootLayer::HideWinBorder(WinBorder* winBorder)
void
RootLayer::ShowWinBorder(WinBorder* winBorder)
RootLayer::ShowWindowLayer(WindowLayer* windowLayer)
{
BAutolock _(fAllRegionsLock);
@ -621,32 +620,32 @@ RootLayer::ShowWinBorder(WinBorder* winBorder)
Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState);
winBorder->Show(false);
windowLayer->Show(false);
for (int32 i = 0; i < fWsCount; i++) {
invalid = false;
if (fWorkspace[i]
&& (fWorkspace[i]->HasWinBorder(winBorder)
|| winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL
&& (fWorkspace[i]->HasWindowLayer(windowLayer)
|| windowLayer->Feel() == B_MODAL_SUBSET_WINDOW_FEEL
// subset modals are a bit like floating windows, they are being added
// and removed from workspace when there's at least a normal window
// that uses them.
|| winBorder->Level() == B_FLOATING_APP))
|| windowLayer->Level() == B_FLOATING_APP))
// floating windows are inserted/removed on-the-fly so this window,
// although needed may not be in workspace's list.
{
invalid = fWorkspace[i]->ShowWinBorder(winBorder);
invalid = fWorkspace[i]->ShowWindowLayer(windowLayer);
// ToDo: this won't work with FFM
fWorkspace[i]->AttemptToSetFocus(winBorder);
fWorkspace[i]->AttemptToSetFocus(windowLayer);
}
if (fActiveWksIndex == i) {
invalidate = invalid;
if (dynamic_cast<class WorkspacesLayer *>(winBorder->FirstChild()) != NULL)
SetWorkspacesLayer(winBorder->FirstChild());
if (dynamic_cast<class WorkspacesLayer *>(windowLayer->FirstChild()) != NULL)
SetWorkspacesLayer(windowLayer->FirstChild());
}
}
@ -656,7 +655,7 @@ RootLayer::ShowWinBorder(WinBorder* winBorder)
void
RootLayer::ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel)
RootLayer::ChangeWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel)
{
BAutolock _(fAllRegionsLock);
@ -666,30 +665,30 @@ RootLayer::ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel)
Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState);
if (!winBorder->IsHidden()) {
if (!windowLayer->IsHidden()) {
isVisible = true;
isVisibleInActiveWorkspace = ActiveWorkspace()->HasWinBorder(winBorder);
isVisibleInActiveWorkspace = ActiveWorkspace()->HasWindowLayer(windowLayer);
// just hide, don't invalidate
winBorder->Hide(false);
windowLayer->Hide(false);
// all workspaces must be up-to-date with this change of feel.
for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
if (fWorkspace[i]) {
fWorkspace[i]->HideWinBorder(winBorder);
fWorkspace[i]->RemoveWinBorder(winBorder);
fWorkspace[i]->HideWindowLayer(windowLayer);
fWorkspace[i]->RemoveWindowLayer(windowLayer);
}
}
}
fDesktop->SetWinBorderFeel(winBorder, newFeel);
fDesktop->SetWindowLayerFeel(windowLayer, newFeel);
if (isVisible) {
// just show, don't invalidate
winBorder->Show(false);
windowLayer->Show(false);
// all workspaces must be up-to-date with this change of feel.
for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
if (fWorkspace[i]) {
fWorkspace[i]->AddWinBorder(winBorder);
fWorkspace[i]->ShowWinBorder(winBorder);
fWorkspace[i]->AddWindowLayer(windowLayer);
fWorkspace[i]->ShowWindowLayer(windowLayer);
}
}
@ -857,7 +856,7 @@ GetDrawingEngine()->ConstrainClippingRegion(NULL);
bool
RootLayer::SetActive(WinBorder* newActive, bool activate)
RootLayer::SetActive(WindowLayer* newActive, bool activate)
{
bool returnValue = false;
uint32 workspaceIndex = newActive->Workspaces();
@ -884,7 +883,7 @@ RootLayer::SetActive(WinBorder* newActive, bool activate)
}
}
// If this WinBorder does not appear in current workspace,
// If this WindowLayer does not appear in current workspace,
// change to the first one who does.
if (activate && !(workspaceIndex & (0x00000001UL << fActiveWksIndex))) {
// find an workspace index in which this Layer appears

View File

@ -9,11 +9,9 @@
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef ROOT_LAYER_H
#define ROOT_LAYER_H
/** Class used for the top layer of each workspace's Layer tree */
#ifndef _ROOTLAYER_H_
#define _ROOTLAYER_H_
#include <List.h>
#include <Locker.h>
@ -28,7 +26,7 @@ class DrawingEngine;
class HWInterface;
class RGBColor;
class Screen;
class WinBorder;
class WindowLayer;
namespace BPrivate {
class PortLink;
@ -63,17 +61,17 @@ public:
virtual void ScrollBy(float x, float y)
{ /* not allowed */ }
void HideWinBorder(WinBorder* winBorder);
void ShowWinBorder(WinBorder* winBorder);
void SetWinBorderWorskpaces(WinBorder *winBorder,
void HideWindowLayer(WindowLayer* windowLayer);
void ShowWindowLayer(WindowLayer* windowLayer);
void SetWindowLayerWorskpaces(WindowLayer *windowLayer,
uint32 oldIndex, uint32 newIndex);
void RevealNewWMState(Workspace::State &oldWMState);
// TODO: we need to replace Winborder* with Layer*
inline WinBorder* Focus() const { return fWMState.Focus; }
inline WinBorder* Front() const { return fWMState.Front; }
inline WinBorder* Active() const { return fWMState.Active; }
bool SetActive(WinBorder* newActive, bool activate = true);
inline WindowLayer* Focus() const { return fWMState.Focus; }
inline WindowLayer* Front() const { return fWMState.Front; }
inline WindowLayer* Active() const { return fWMState.Active; }
bool SetActive(WindowLayer* newActive, bool activate = true);
inline void SetWorkspaceCount(int32 wksCount);
inline int32 WorkspaceCount() const { return fWsCount; }
@ -103,7 +101,7 @@ public:
void Unlock() { fAllRegionsLock.Unlock(); }
bool IsLocked() { return fAllRegionsLock.IsLocked(); }
void ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel);
void ChangeWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel);
void MarkForRedraw(const BRegion &dirty);
void TriggerRedraw();
@ -116,10 +114,10 @@ private:
friend class Desktop;
// these are meant for Desktop class only!
void AddWinBorder(WinBorder* winBorder);
void RemoveWinBorder(WinBorder* winBorder);
void AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder);
void RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder);
void AddWindowLayer(WindowLayer* windowLayer);
void RemoveWindowLayer(WindowLayer* windowLayer);
void AddSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *toWindowLayer);
void RemoveSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *fromWindowLayer);
void MouseEventHandler(BMessage *msg);
Layer* _ChildAt(BPoint where);
@ -155,4 +153,4 @@ friend class Desktop;
#endif
};
#endif
#endif // ROOT_LAYER_H

View File

@ -56,7 +56,7 @@
#include "ServerTokenSpace.h"
#include "ServerWindow.h"
#include "SystemPalette.h"
#include "WinBorder.h"
#include "WindowLayer.h"
//#define DEBUG_SERVERAPP
@ -535,7 +535,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for(int32 i = 0; i < fWindowList.CountItems(); i++) {
win=(ServerWindow*)fWindowList.ItemAt(i);
win->GetWinBorder()->UpdateColors();
win->GetWindowLayer()->UpdateColors();
win->SendMessageToClient(AS_UPDATE_COLORS, msg);
}
*/ break;
@ -552,7 +552,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for(int32 i=0; i<fSWindowList->CountItems(); i++)
{
win=(ServerWindow*)fSWindowList->ItemAt(i);
win->GetWinBorder()->UpdateFont();
win->GetWindowLayer()->UpdateFont();
win->SendMessageToClient(AS_UPDATE_FONTS, msg);
}
*/ break;
@ -666,7 +666,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for (int32 i = 0; i < fWindowList.CountItems(); i++) {
ServerWindow *window = fWindowList.ItemAt(i);
window->Lock();
const_cast<WinBorder *>(window->GetWinBorder())->UpdateDecorator();
const_cast<WindowLayer *>(window->GetWindowLayer())->UpdateDecorator();
window->Unlock();
}
break;

View File

@ -16,7 +16,7 @@
A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are
too many tasks to list as being done by them, but they include handling View transactions,
coordinating and linking a window's WinBorder half with its messaging half, dispatching
coordinating and linking a window's WindowLayer half with its messaging half, dispatching
mouse and key events from the server to its window, and other such things.
*/
@ -51,7 +51,7 @@
#include "ServerBitmap.h"
#include "ServerPicture.h"
#include "ServerProtocol.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Workspace.h"
#include "WorkspacesLayer.h"
@ -123,11 +123,10 @@ struct dw_sync_data {
sem_id disableSemAck;
};
/*!
\brief Constructor
Does a lot of stuff to set up for the window - new decorator, new winborder, spawn a
monitor thread.
Sets up the basic BWindow counterpart - you have to call Init() before
you can actually use it, though.
*/
ServerWindow::ServerWindow(const char *title, ServerApp *app,
port_id clientPort, port_id looperPort, int32 clientToken)
@ -135,7 +134,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app,
fTitle(NULL),
fDesktop(app->GetDesktop()),
fServerApp(app),
fWinBorder(NULL),
fWindowLayer(NULL),
fClientTeam(app->ClientTeam()),
fMessagePort(-1),
fClientReplyPort(clientPort),
@ -162,10 +161,10 @@ ServerWindow::~ServerWindow()
{
STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this));
if (!fWinBorder->IsOffscreenWindow())
fDesktop->RemoveWinBorder(fWinBorder);
if (!fWindowLayer->IsOffscreenWindow())
fDesktop->RemoveWindowLayer(fWindowLayer);
delete fWinBorder;
delete fWindowLayer;
free(fTitle);
delete_port(fMessagePort);
@ -191,13 +190,13 @@ ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 w
fLink.SetSenderPort(fClientReplyPort);
fLink.SetReceiverPort(fMessagePort);
// We cannot call MakeWinBorder in the constructor, since it
fWinBorder = MakeWinBorder(frame, fTitle, look, feel, flags, workspace);
if (!fWinBorder)
// We cannot call MakeWindowLayer in the constructor, since it
fWindowLayer = MakeWindowLayer(frame, fTitle, look, feel, flags, workspace);
if (!fWindowLayer)
return B_NO_MEMORY;
if (!fWinBorder->IsOffscreenWindow())
fDesktop->AddWinBorder(fWinBorder);
if (!fWindowLayer->IsOffscreenWindow())
fDesktop->AddWindowLayer(fWindowLayer);
return B_OK;
}
@ -216,9 +215,9 @@ ServerWindow::Run()
fLink.Attach<port_id>(fMessagePort);
float minWidth, maxWidth, minHeight, maxHeight;
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
fWindowLayer->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
fLink.Attach<BRect>(fWinBorder->Frame());
fLink.Attach<BRect>(fWindowLayer->Frame());
fLink.Attach<float>(minWidth);
fLink.Attach<float>(maxWidth);
fLink.Attach<float>(minHeight);
@ -253,7 +252,7 @@ ServerWindow::_GetLooperName(char* name, size_t length)
}
//! Forces the window border to update its decorator
//! Forces the window layer to update its decorator
void
ServerWindow::ReplaceDecorator()
{
@ -261,23 +260,23 @@ ServerWindow::ReplaceDecorator()
debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n");
STRACE(("ServerWindow %s: Replace Decorator\n", fTitle));
fWinBorder->UpdateDecorator();
fWindowLayer->UpdateDecorator();
}
//! Shows the window's WinBorder
//! Shows the window's WindowLayer
void
ServerWindow::Show()
{
// NOTE: if you do something else, other than sending a port message, PLEASE lock
STRACE(("ServerWindow %s: Show\n", Title()));
if (fQuitting || !fWinBorder->IsHidden())
if (fQuitting || !fWindowLayer->IsHidden())
return;
RootLayer* rootLayer = fWinBorder->GetRootLayer();
RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer && rootLayer->Lock()) {
rootLayer->ShowWinBorder(fWinBorder);
rootLayer->ShowWindowLayer(fWindowLayer);
rootLayer->Unlock();
}
@ -286,22 +285,22 @@ ServerWindow::Show()
}
//! Hides the window's WinBorder
//! Hides the window's WindowLayer
void
ServerWindow::Hide()
{
// NOTE: if you do something else, other than sending a port message, PLEASE lock
STRACE(("ServerWindow %s: Hide\n", Title()));
if (fWinBorder->IsHidden())
if (fWindowLayer->IsHidden())
return;
if (fDirectWindowData != NULL)
HandleDirectConnection(B_DIRECT_STOP);
RootLayer* rootLayer = fWinBorder->GetRootLayer();
RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer && rootLayer->Lock()) {
rootLayer->HideWinBorder(fWinBorder);
rootLayer->HideWindowLayer(fWindowLayer);
rootLayer->Unlock();
}
}
@ -330,8 +329,8 @@ ServerWindow::SetTitle(const char* newTitle)
rename_thread(Thread(), name);
}
if (fWinBorder != NULL)
fWinBorder->SetName(newTitle);
if (fWindowLayer != NULL)
fWindowLayer->SetName(newTitle);
}
@ -357,12 +356,12 @@ ServerWindow::NotifyMinimize(bool minimize)
bool sendMessages = false;
if (minimize) {
if (!fWinBorder->IsHidden()) {
if (!fWindowLayer->IsHidden()) {
Hide();
sendMessages = true;
}
} else {
if (fWinBorder->IsHidden()) {
if (fWindowLayer->IsHidden()) {
Show();
sendMessages = true;
}
@ -413,18 +412,18 @@ ServerWindow::GetInfo(window_info& info)
info.thread = Thread();
info.client_token = ClientToken();
info.client_port = fClientLooperPort;
info.workspaces = fWinBorder->Workspaces();
info.workspaces = fWindowLayer->Workspaces();
info.layer = 0; // ToDo: what is this???
info.feel = fWinBorder->Feel();
info.flags = fWinBorder->WindowFlags();
info.window_left = (int)floor(fWinBorder->Frame().left);
info.window_top = (int)floor(fWinBorder->Frame().top);
info.window_right = (int)floor(fWinBorder->Frame().right);
info.window_bottom = (int)floor(fWinBorder->Frame().bottom);
info.feel = fWindowLayer->Feel();
info.flags = fWindowLayer->WindowFlags();
info.window_left = (int)floor(fWindowLayer->Frame().left);
info.window_top = (int)floor(fWindowLayer->Frame().top);
info.window_right = (int)floor(fWindowLayer->Frame().right);
info.window_bottom = (int)floor(fWindowLayer->Frame().bottom);
info.show_hide_level = fWinBorder->IsHidden() ? 1 : -1; // ???
info.is_mini = fWinBorder->IsHidden();
info.show_hide_level = fWindowLayer->IsHidden() ? 1 : -1; // ???
info.is_mini = fWindowLayer->IsHidden();
}
@ -488,13 +487,13 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
Layer *newLayer;
if (link.Code() == AS_LAYER_CREATE_ROOT
&& (fWinBorder->WindowFlags() & kWorkspacesWindowFlag) != 0) {
&& (fWindowLayer->WindowFlags() & kWorkspacesWindowFlag) != 0) {
// this is a workspaces window!
newLayer = new (nothrow) WorkspacesLayer(frame, name, token, resizeMask,
flags, fWinBorder->GetDrawingEngine());
flags, fWindowLayer->GetDrawingEngine());
} else {
newLayer = new (nothrow) Layer(frame, name, token, resizeMask, flags,
fWinBorder->GetDrawingEngine());
fWindowLayer->GetDrawingEngine());
}
if (newLayer == NULL)
@ -507,7 +506,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
newLayer->fHidden = hidden;
newLayer->fEventMask = eventMask;
newLayer->fEventOptions = eventOptions;
newLayer->fOwner = fWinBorder;
newLayer->fOwner = fWindowLayer;
DesktopSettings settings(fDesktop);
ServerFont font;
@ -516,7 +515,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
// TODO: rework the clipping stuff to remove RootLayer dependency and then
// remove this hack:
if (fWinBorder->IsOffscreenWindow()) {
if (fWindowLayer->IsOffscreenWindow()) {
newLayer->fVisible.Set(newLayer->fFrame);
newLayer->fDrawingRegion.Set(newLayer->fFrame);
}
@ -550,8 +549,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
return;
}
RootLayer *rootLayer = fWinBorder->GetRootLayer();
// NOTE: is NULL when fWinBorder is offscreen!
RootLayer *rootLayer = fWindowLayer->GetRootLayer();
// NOTE: is NULL when fWindowLayer is offscreen!
if (rootLayer)
rootLayer->Lock();
@ -618,8 +617,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
if (fCurrentLayer != NULL)
break;
fWinBorder->SetTopLayer(CreateLayerTree(link, NULL));
fCurrentLayer = fWinBorder->TopLayer();
fWindowLayer->SetTopLayer(CreateLayerTree(link, NULL));
fCurrentLayer = fWindowLayer->TopLayer();
break;
}
@ -777,7 +776,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<float>(&newHeight);
// TODO: If fCurrentLayer is a window, check for minimum size allowed.
// Need WinBorder::GetSizeLimits
// Need WindowLayer::GetSizeLimits
float deltaWidth = newWidth - fCurrentLayer->fFrame.Width();
float deltaHeight = newHeight - fCurrentLayer->fFrame.Height();
@ -1082,7 +1081,7 @@ if (rootLayer)
fCurrentLayer->CurrentState()->SetClippingRegion(region);
if (rootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) {
if (rootLayer && !(fCurrentLayer->IsHidden()) && !fWindowLayer->InUpdate()) {
BRegion invalidRegion;
fCurrentLayer->GetOnScreenRegion(invalidRegion);
@ -1192,13 +1191,13 @@ if (rootLayer)
case AS_BEGIN_UPDATE:
{
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title()));
fWinBorder->UpdateStart();
fWindowLayer->UpdateStart();
break;
}
case AS_END_UPDATE:
{
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title()));
fWinBorder->UpdateEnd();
fWindowLayer->UpdateEnd();
break;
}
@ -1235,12 +1234,12 @@ if (rootLayer)
link.Read<int32>(&token);
link.Read<team_id>(&teamID);
WinBorder *behindOf;
if ((behindOf = fDesktop->FindWinBorderByClientToken(token, teamID)) != NULL) {
fWinBorder->GetRootLayer()->Lock();
WindowLayer *behindOf;
if ((behindOf = fDesktop->FindWindowLayerByClientToken(token, teamID)) != NULL) {
fWindowLayer->GetRootLayer()->Lock();
// TODO: move to back ATM. Fix this later!
fWinBorder->GetRootLayer()->SetActive(fWinBorder, false);
fWinBorder->GetRootLayer()->Unlock();
fWindowLayer->GetRootLayer()->SetActive(fWindowLayer, false);
fWindowLayer->GetRootLayer()->Unlock();
status = B_OK;
}
@ -1253,34 +1252,34 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_BEGIN_TRANSACTION unimplemented\n",
Title()));
// TODO: we could probably do a bit more here...
fWinBorder->DisableUpdateRequests();
fWindowLayer->DisableUpdateRequests();
break;
}
case AS_END_TRANSACTION:
{
STRACE(("ServerWindow %s: Message AS_END_TRANSACTION unimplemented\n",
Title()));
fWinBorder->EnableUpdateRequests();
fWindowLayer->EnableUpdateRequests();
break;
}
case AS_ENABLE_UPDATES:
{
STRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES unimplemented\n",
Title()));
fWinBorder->EnableUpdateRequests();
fWindowLayer->EnableUpdateRequests();
break;
}
case AS_DISABLE_UPDATES:
{
STRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES unimplemented\n",
Title()));
fWinBorder->DisableUpdateRequests();
fWindowLayer->DisableUpdateRequests();
break;
}
case AS_NEEDS_UPDATE:
{
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title()));
if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid())
if (fWindowLayer->CulmulatedUpdateRegion().Frame().IsValid())
fLink.StartMessage(B_OK);
else
fLink.StartMessage(B_ERROR);
@ -1300,21 +1299,21 @@ if (rootLayer)
case AS_ADD_TO_SUBSET:
{
STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title()));
WinBorder *windowBorder;
WindowLayer *windowLayer;
int32 mainToken;
team_id teamID;
link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id));
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
if (windowBorder) {
windowLayer = fDesktop->FindWindowLayerByClientToken(mainToken, teamID);
if (windowLayer) {
fLink.StartMessage(SERVER_TRUE);
fLink.Flush();
fWinBorder->GetRootLayer()->Lock();
fDesktop->AddWinBorderToSubset(fWinBorder, windowBorder);
fWinBorder->GetRootLayer()->Unlock();
fWindowLayer->GetRootLayer()->Lock();
fDesktop->AddWindowLayerToSubset(fWindowLayer, windowLayer);
fWindowLayer->GetRootLayer()->Unlock();
} else {
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
@ -1324,21 +1323,21 @@ if (rootLayer)
case AS_REM_FROM_SUBSET:
{
STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title()));
WinBorder *windowBorder;
WindowLayer *windowLayer;
int32 mainToken;
team_id teamID;
link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id));
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
if (windowBorder) {
windowLayer = fDesktop->FindWindowLayerByClientToken(mainToken, teamID);
if (windowLayer) {
fLink.StartMessage(SERVER_TRUE);
fLink.Flush();
fWinBorder->GetRootLayer()->Lock();
fDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder);
fWinBorder->GetRootLayer()->Unlock();
fWindowLayer->GetRootLayer()->Lock();
fDesktop->RemoveWindowLayerFromSubset(fWindowLayer, windowLayer);
fWindowLayer->GetRootLayer()->Unlock();
} else {
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
@ -1364,7 +1363,7 @@ if (rootLayer)
int32 newFeel;
link.Read<int32>(&newFeel);
fWinBorder->GetRootLayer()->ChangeWinBorderFeel(winBorder, newFeel);
fWindowLayer->GetRootLayer()->ChangeWindowLayerFeel(winLayer, newFeel);
break;
}
case AS_SET_ALIGNMENT:
@ -1384,7 +1383,7 @@ if (rootLayer)
{
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title()));
fLink.StartMessage(SERVER_TRUE);
fLink.Attach<uint32>(fWinBorder->Workspaces());
fLink.Attach<uint32>(fWindowLayer->Workspaces());
fLink.Flush();
break;
}
@ -1394,11 +1393,10 @@ if (rootLayer)
uint32 newWorkspaces;
link.Read<uint32>(&newWorkspaces);
fWinBorder->GetRootLayer()->Lock();
fWinBorder->GetRootLayer()->SetWinBorderWorskpaces( fWinBorder,
fWinBorder->Workspaces(),
newWorkspaces);
fWinBorder->GetRootLayer()->Unlock();
fWindowLayer->GetRootLayer()->Lock();
fWindowLayer->GetRootLayer()->SetWindowLayerWorskpaces(fWindowLayer,
fWindowLayer->Workspaces(), newWorkspaces);
fWindowLayer->GetRootLayer()->Unlock();
break;
}
case AS_WINDOW_RESIZE:
@ -1411,7 +1409,7 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
fWinBorder->ResizeBy(xResizeBy, yResizeBy);
fWindowLayer->ResizeBy(xResizeBy, yResizeBy);
break;
}
case AS_WINDOW_MOVE:
@ -1424,7 +1422,7 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
fWinBorder->MoveBy(xMoveBy, yMoveBy);
fWindowLayer->MoveBy(xMoveBy, yMoveBy);
break;
}
case AS_SET_SIZE_LIMITS:
@ -1445,13 +1443,13 @@ if (rootLayer)
link.Read<float>(&minHeight);
link.Read<float>(&maxHeight);
fWinBorder->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
fWindowLayer->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
// and now, sync the client to the limits that we were able to enforce
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
fWindowLayer->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
fLink.StartMessage(SERVER_TRUE);
fLink.Attach<BRect>(fWinBorder->Frame());
fLink.Attach<BRect>(fWindowLayer->Frame());
fLink.Attach<float>(minWidth);
fLink.Attach<float>(maxWidth);
fLink.Attach<float>(minHeight);
@ -1468,7 +1466,7 @@ if (rootLayer)
link.Read<bool>(&activate);
if (rootLayer && rootLayer->Lock()) {
rootLayer->SetActive(fWinBorder, activate);
rootLayer->SetActive(fWindowLayer, activate);
rootLayer->Unlock();
}
break;
@ -1663,10 +1661,10 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
// checks both these conditions
BRegion rreg(fCurrentLayer->DrawingRegion());
if (fWinBorder->InUpdate())
rreg.IntersectWith(&fWinBorder->RegionToBeUpdated());
if (fWindowLayer->InUpdate())
rreg.IntersectWith(&fWindowLayer->RegionToBeUpdated());
DrawingEngine* driver = fWinBorder->GetDrawingEngine();
DrawingEngine* driver = fWindowLayer->GetDrawingEngine();
if (!driver) {
// ?!?
DTRACE(("ServerWindow %s: no display driver!!\n", Title()));
@ -2077,11 +2075,11 @@ ServerWindow::_MessageLooper()
quitLoop = true;
// ToDo: what's this?
//RootLayer *rootLayer = fWinBorder->GetRootLayer();
//RootLayer *rootLayer = fWindowLayer->GetRootLayer();
// we are preparing to delete a ServerWindow, RootLayer should be aware
// of that and stop for a moment.
// also we must wait a bit for the associated WinBorder to become hidden
// also we must wait a bit for the associated WindowLayer to become hidden
//while(1) {
// rootLayer->Lock();
// if (IsHidden())
@ -2091,7 +2089,7 @@ ServerWindow::_MessageLooper()
//}
// ServerWindow's destructor takes care of pulling this object off the desktop.
if (!fWinBorder->IsHidden())
if (!fWindowLayer->IsHidden())
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
break;
@ -2144,13 +2142,12 @@ ServerWindow::SendMessageToClient(const BMessage* msg, int32 target) const
}
WinBorder*
ServerWindow::MakeWinBorder(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags,
uint32 workspace)
WindowLayer*
ServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, uint32 workspace)
{
// The non-offscreen ServerWindow uses the DrawingEngine instance from the desktop.
return new(nothrow) WinBorder(frame, name, look, feel, flags,
return new(nothrow) WindowLayer(frame, name, look, feel, flags,
workspace, this, fDesktop->GetDrawingEngine());
}
@ -2198,28 +2195,30 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
fDirectWindowData->direct_info->layout = B_BUFFER_NONINTERLEAVED;
fDirectWindowData->direct_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO
WinBorder *border = const_cast<WinBorder *>(GetWinBorder());
fDirectWindowData->direct_info->window_bounds = to_clipping_rect(border->Frame());
WindowLayer *layer = const_cast<WindowLayer *>(GetWindowLayer());
fDirectWindowData->direct_info->window_bounds = to_clipping_rect(layer->Frame());
// TODO: Review this
const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info)) / sizeof(clipping_rect);
const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info))
/ sizeof(clipping_rect);
// TODO: Is there a simpler way to obtain this result ?
// We just want the region INSIDE the window, border excluded.
BRegion clipRegion = const_cast<BRegion &>(border->FullVisible());
BRegion exclude = const_cast<BRegion &>(border->VisibleRegion());
BRegion clipRegion = const_cast<BRegion &>(layer->FullVisible());
BRegion exclude = const_cast<BRegion &>(layer->VisibleRegion());
clipRegion.Exclude(&exclude);
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount);
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(),
kMaxClipRectsCount);
fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
for (uint32 i = 0; i < fDirectWindowData->direct_info->clip_list_count; i++)
fDirectWindowData->direct_info->clip_list[i] = clipRegion.RectAtInt(i);
}
// Releasing this sem causes the client to call BDirectWindow::DirectConnected()
release_sem(fDirectWindowData->direct_sem);
// TODO: Waiting half a second in this thread is not a problem,
// but since we are called from the RootLayer's thread too, very bad things could happen.
// Find some way to call this method only within ServerWindow's thread (messaging ?)
@ -2229,7 +2228,7 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
// Test, but I think half a second is enough.
status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 500000);
} while (status == B_INTERRUPTED);
if (status < B_OK) {
// The client application didn't release the semaphore
// within the given timeout. Or something else went wrong.
@ -2242,7 +2241,7 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
status_t
ServerWindow::PictureToRegion(ServerPicture *picture, BRegion &region,
bool inverse, BPoint where)
bool inverse, BPoint where)
{
fprintf(stderr, "ServerWindow::PictureToRegion() not implemented\n");
region.MakeEmpty();

View File

@ -35,7 +35,7 @@ class BMessage;
class Desktop;
class ServerApp;
class Decorator;
class WinBorder;
class WindowLayer;
class Workspace;
class RootLayer;
class Layer;
@ -78,11 +78,9 @@ public:
status_t SendMessageToClient(const BMessage* msg,
int32 target = B_NULL_TOKEN) const;
virtual WinBorder* MakeWinBorder(BRect frame,
const char* name,
uint32 look, uint32 feel,
uint32 flags, uint32 workspace);
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags,
uint32 workspace);
// TODO: Ouch, that's not exactly a nice name
inline BMessage &ClientViewsWithInvalidCoords()
@ -90,7 +88,7 @@ public:
// to who we belong. who do we own. our title.
inline ServerApp* App() const { return fServerApp; }
inline const WinBorder* GetWinBorder() const { return fWinBorder; }
inline const WindowLayer* GetWindowLayer() const { return fWindowLayer; }
void SetTitle(const char* newTitle);
inline const char* Title() const { return fTitle; }
@ -134,7 +132,7 @@ private:
Desktop* fDesktop;
ServerApp* fServerApp;
WinBorder* fWinBorder;
WindowLayer* fWindowLayer;
team_id fClientTeam;

View File

@ -8,48 +8,49 @@
/** List class for tracking floating and modal windows */
#include <stdio.h>
#include <List.h>
#include "SubWindowList.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "ServerWindow.h"
#include <List.h>
SubWindowList::SubWindowList(void)
#include <stdio.h>
SubWindowList::SubWindowList()
{
}
SubWindowList::~SubWindowList(void)
SubWindowList::~SubWindowList()
{
}
void
SubWindowList::AddWinBorder(WinBorder *border)
SubWindowList::AddWindowLayer(WindowLayer *windowLayer)
{
if (HasItem(border))
if (HasItem(windowLayer))
return;
int32 borderFeel = border->Feel();;
int32 borderFeel = windowLayer->Feel();;
int32 location = 0;
for (; location < CountItems(); location++) {
int32 feelTemp = ((WinBorder*)ItemAt(location))->Feel();
int32 feelTemp = ((WindowLayer*)ItemAt(location))->Feel();
// in short: if 'border' is a floating window and 'temp' a modal one
// in short: if 'windowLayer' is a floating window and 'temp' a modal one
if ((borderFeel == B_FLOATING_SUBSET_WINDOW_FEEL
|| borderFeel == B_FLOATING_APP_WINDOW_FEEL
|| borderFeel == B_FLOATING_ALL_WINDOW_FEEL)
&& (feelTemp == B_MODAL_SUBSET_WINDOW_FEEL
|| feelTemp == B_MODAL_APP_WINDOW_FEEL
|| feelTemp == B_MODAL_ALL_WINDOW_FEEL)) {
// means we found the place for our window('wb')
// means we found the place for our window('windowLayer')
break;
}
}
AddItem(border, location);
AddItem(windowLayer, location);
}
@ -58,7 +59,7 @@ SubWindowList::AddSubWindowList(SubWindowList *list)
{
int32 i = 0;
for (; i < CountItems(); i++) {
int32 feel = ((WinBorder*)ItemAt(i))->Feel();
int32 feel = ((WindowLayer*)ItemAt(i))->Feel();
if (feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_MODAL_APP_WINDOW_FEEL
|| feel == B_MODAL_ALL_WINDOW_FEEL)
@ -67,7 +68,7 @@ SubWindowList::AddSubWindowList(SubWindowList *list)
for (int32 j = 0; j < list->CountItems(); j++) {
void *item = list->ItemAt(j);
int32 feel = ((WinBorder*)item)->Feel();
int32 feel = ((WindowLayer*)item)->Feel();
if (feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_MODAL_APP_WINDOW_FEEL
|| feel == B_MODAL_ALL_WINDOW_FEEL) {
@ -84,33 +85,33 @@ void
SubWindowList::PrintToStream() const
{
printf("Floating and modal windows list:\n");
WinBorder* wb = NULL;
WindowLayer* windowLayer = NULL;
for (int32 i=0; i<CountItems(); i++) {
wb = (WinBorder*)ItemAt(i);
windowLayer = (WindowLayer*)ItemAt(i);
printf("\t%s", wb->Name());
printf("\t%s", windowLayer->Name());
if (wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
if (windowLayer->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
if (wb->Feel() == B_FLOATING_APP_WINDOW_FEEL)
if (windowLayer->Feel() == B_FLOATING_APP_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
if (wb->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
if (windowLayer->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
if (wb->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
if (windowLayer->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
if (wb->Feel() == B_MODAL_APP_WINDOW_FEEL)
if (windowLayer->Feel() == B_MODAL_APP_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
if (wb->Feel() == B_MODAL_ALL_WINDOW_FEEL)
if (windowLayer->Feel() == B_MODAL_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
// this should NOT happen
if (wb->Feel() == B_NORMAL_WINDOW_FEEL)
if (windowLayer->Feel() == B_NORMAL_WINDOW_FEEL)
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
}
}

View File

@ -13,14 +13,14 @@
#include <Window.h>
class WinBorder;
class WindowLayer;
class SubWindowList : public BList {
public:
SubWindowList(void);
virtual ~SubWindowList(void);
void AddWinBorder(WinBorder *border);
void AddWindowLayer(WindowLayer *windowLayer);
// special
void AddSubWindowList(SubWindowList *list);

View File

@ -26,16 +26,12 @@
#include "RootLayer.h"
#include "ServerApp.h"
#include "ServerWindow.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Workspace.h"
// Toggle general function call output
// Toggle debug output
//#define DEBUG_WINBORDER
// toggle
//#define DEBUG_WINBORDER_MOUSE
//#define DEBUG_WINBORDER_CLICK
#ifdef DEBUG_WINBORDER
@ -45,13 +41,6 @@
# define STRACE(x) ;
#endif
#ifdef DEBUG_WINBORDER_MOUSE
# include <stdio.h>
# define STRACE_MOUSE(x) printf x
#else
# define STRACE_MOUSE(x) ;
#endif
#ifdef DEBUG_WINBORDER_CLICK
# include <stdio.h>
# define STRACE_CLICK(x) printf x
@ -59,7 +48,8 @@
# define STRACE_CLICK(x) ;
#endif
WinBorder::WinBorder(const BRect &frame,
WindowLayer::WindowLayer(const BRect &frame,
const char *name,
const uint32 look,
const uint32 feel,
@ -127,20 +117,20 @@ WinBorder::WinBorder(const BRect &frame,
if (window->App()->GetDesktop()->ScreenAt(0)) {
window->App()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
// TODO: MOVE THIS AWAY!!! RemoveBy contains calls to virtual methods! Also, there is not TopLayer()!
WinBorder::ResizeBy(width - frame.Width(), height - frame.Height());
WindowLayer::ResizeBy(width - frame.Width(), height - frame.Height());
}
}
STRACE(("WinBorder %p, %s:\n", this, Name()));
STRACE(("WindowLayer %p, %s:\n", this, Name()));
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
fFrame.right, fFrame.bottom));
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
}
WinBorder::~WinBorder()
WindowLayer::~WindowLayer()
{
STRACE(("WinBorder(%s)::~WinBorder()\n", Name()));
STRACE(("WindowLayer(%s)::~WindowLayer()\n", Name()));
delete fDecorator;
}
@ -148,10 +138,10 @@ WinBorder::~WinBorder()
//! redraws a certain section of the window border
void
WinBorder::Draw(const BRect& updateRect)
WindowLayer::Draw(const BRect& updateRect)
{
#ifdef DEBUG_WINBORDER
printf("WinBorder(%s)::Draw() : ", Name());
printf("WindowLayer(%s)::Draw() : ", Name());
r.PrintToStream();
#endif
@ -165,7 +155,7 @@ WinBorder::Draw(const BRect& updateRect)
//! Moves the winborder with redraw
void
WinBorder::MoveBy(float x, float y)
WindowLayer::MoveBy(float x, float y)
{
if (x == 0.0f && y == 0.0f)
return;
@ -215,7 +205,7 @@ WinBorder::MoveBy(float x, float y)
void
WinBorder::ResizeBy(float x, float y)
WindowLayer::ResizeBy(float x, float y)
{
float wantWidth = fFrame.Width() + x;
float wantHeight = fFrame.Height() + y;
@ -272,7 +262,7 @@ WinBorder::ResizeBy(float x, float y)
void
WinBorder::SetName(const char* name)
WindowLayer::SetName(const char* name)
{
Layer::SetName(name);
@ -294,7 +284,7 @@ WinBorder::SetName(const char* name)
void
WinBorder::UpdateStart()
WindowLayer::UpdateStart()
{
// During updates we only want to draw what's in the update region
fInUpdate = true;
@ -303,7 +293,7 @@ WinBorder::UpdateStart()
void
WinBorder::UpdateEnd()
WindowLayer::UpdateEnd()
{
// The usual case. Drawing is permitted in the whole visible area.
@ -319,7 +309,7 @@ WinBorder::UpdateEnd()
void
WinBorder::EnableUpdateRequests()
WindowLayer::EnableUpdateRequests()
{
fUpdateRequestsEnabled = true;
if (fCumulativeRegion.CountRects() > 0) {
@ -331,7 +321,7 @@ WinBorder::EnableUpdateRequests()
//! Sets the minimum and maximum sizes of the window
void
WinBorder::SetSizeLimits(float minWidth, float maxWidth,
WindowLayer::SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight)
{
if (minWidth < 0)
@ -387,7 +377,7 @@ WinBorder::SetSizeLimits(float minWidth, float maxWidth,
void
WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
WindowLayer::GetSizeLimits(float* minWidth, float* maxWidth,
float* minHeight, float* maxHeight) const
{
*minWidth = fMinWidth;
@ -398,12 +388,12 @@ WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
void
WinBorder::MouseDown(BMessage *msg, BPoint where)
WindowLayer::MouseDown(BMessage *msg, BPoint where)
{
// default action is to drag the WinBorder
// default action is to drag the WindowLayer
Layer *target = LayerAt(where);
if (target == this) {
// clicking WinBorder visible area
// clicking WindowLayer visible area
click_type action = DEC_DRAG;
@ -484,7 +474,7 @@ WinBorder::MouseDown(BMessage *msg, BPoint where)
void
WinBorder::MouseUp(BMessage *msg, BPoint where)
WindowLayer::MouseUp(BMessage *msg, BPoint where)
{
bool invalidate = false;
if (fDecorator) {
@ -532,7 +522,7 @@ WinBorder::MouseUp(BMessage *msg, BPoint where)
void
WinBorder::MouseMoved(BMessage *msg, BPoint where)
WindowLayer::MouseMoved(BMessage *msg, BPoint where)
{
if (fDecorator) {
// TODO: present behavior is not fine!
@ -566,10 +556,10 @@ WinBorder::MouseMoved(BMessage *msg, BPoint where)
// change focus in FFM mode
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
WinBorder* exFocus = GetRootLayer()->Focus();
WindowLayer* exFocus = GetRootLayer()->Focus();
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && exFocus != this) {
GetRootLayer()->ActiveWorkspace()->AttemptToSetFocus(this);
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
// Workspace::SetFocus() *attempts* to set a new focus WindowLayer, it may not succeed
// if (exFocus != Focus()) {
// TODO: invalidate border area and send message to client for the widgets to light up
// What message? Is there a message on Focus change?
@ -585,7 +575,7 @@ WinBorder::MouseMoved(BMessage *msg, BPoint where)
void
WinBorder::WorkspaceActivated(int32 index, bool active)
WindowLayer::WorkspaceActivated(int32 index, bool active)
{
BMessage activatedMsg(B_WORKSPACE_ACTIVATED);
activatedMsg.AddInt64("when", real_time_clock_usecs());
@ -597,7 +587,7 @@ WinBorder::WorkspaceActivated(int32 index, bool active)
void
WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
{
fWorkspaces = newWorkspaces;
@ -611,7 +601,7 @@ WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
void
WinBorder::Activated(bool active)
WindowLayer::Activated(bool active)
{
BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", active);
@ -620,7 +610,7 @@ WinBorder::Activated(bool active)
void
WinBorder::SetTabLocation(float location)
WindowLayer::SetTabLocation(float location)
{
if (fDecorator)
fDecorator->SetTabLocation(location);
@ -628,7 +618,7 @@ WinBorder::SetTabLocation(float location)
float
WinBorder::TabLocation() const
WindowLayer::TabLocation() const
{
if (fDecorator)
return fDecorator->TabLocation();
@ -638,7 +628,7 @@ WinBorder::TabLocation() const
//! Sets the decorator focus to active or inactive colors
void
WinBorder::HighlightDecorator(bool active)
WindowLayer::HighlightDecorator(bool active)
{
STRACE(("Decorator->Highlight\n"));
if (fDecorator)
@ -647,39 +637,39 @@ WinBorder::HighlightDecorator(bool active)
void
WinBorder::UpdateColors()
WindowLayer::UpdateColors()
{
// Unimplemented. Hook function for handling when system GUI colors change
STRACE(("WinBorder %s: UpdateColors unimplemented\n", Name()));
STRACE(("WindowLayer %s: UpdateColors unimplemented\n", Name()));
}
void
WinBorder::UpdateDecorator()
WindowLayer::UpdateDecorator()
{
// Unimplemented. Hook function for handling when the system decorator changes
STRACE(("WinBorder %s: UpdateDecorator unimplemented\n", Name()));
STRACE(("WindowLayer %s: UpdateDecorator unimplemented\n", Name()));
}
void
WinBorder::UpdateFont()
WindowLayer::UpdateFont()
{
// Unimplemented. Hook function for handling when a system font changes
STRACE(("WinBorder %s: UpdateFont unimplemented\n", Name()));
STRACE(("WindowLayer %s: UpdateFont unimplemented\n", Name()));
}
void
WinBorder::UpdateScreen()
WindowLayer::UpdateScreen()
{
// Unimplemented. Hook function for handling when the screen resolution changes
STRACE(("WinBorder %s: UpdateScreen unimplemented\n", Name()));
STRACE(("WindowLayer %s: UpdateScreen unimplemented\n", Name()));
}
void
WinBorder::QuietlySetFeel(int32 feel)
WindowLayer::QuietlySetFeel(int32 feel)
{
fFeel = feel;
@ -746,7 +736,7 @@ WinBorder::QuietlySetFeel(int32 feel)
click_type
WinBorder::_ActionFor(const BMessage *msg) const
WindowLayer::_ActionFor(const BMessage *msg) const
{
BPoint where(0,0);
int32 buttons = 0;
@ -764,7 +754,7 @@ WinBorder::_ActionFor(const BMessage *msg) const
void
WinBorder::set_decorator_region(BRect bounds)
WindowLayer::set_decorator_region(BRect bounds)
{
fRebuildDecRegion = false;
@ -776,7 +766,7 @@ WinBorder::set_decorator_region(BRect bounds)
void
WinBorder::_ReserveRegions(BRegion &reg)
WindowLayer::_ReserveRegions(BRegion &reg)
{
BRegion reserve(reg);
reserve.IntersectWith(&fDecRegion);
@ -786,7 +776,7 @@ WinBorder::_ReserveRegions(BRegion &reg)
void
WinBorder::GetOnScreenRegion(BRegion& region)
WindowLayer::GetOnScreenRegion(BRegion& region)
{
if (fRebuildDecRegion)
set_decorator_region(Bounds());
@ -803,7 +793,7 @@ WinBorder::GetOnScreenRegion(BRegion& region)
void
WinBorder::RequestClientRedraw(const BRegion &invalid)
WindowLayer::RequestClientRedraw(const BRegion &invalid)
{
BRegion updateReg(fTopLayer->FullVisible());
updateReg.IntersectWith(&invalid);
@ -835,7 +825,7 @@ WinBorder::RequestClientRedraw(const BRegion &invalid)
void
WinBorder::SetTopLayer(Layer* layer)
WindowLayer::SetTopLayer(Layer* layer)
{
if (fTopLayer != NULL) {
RemoveChild(fTopLayer);

View File

@ -6,14 +6,17 @@
* Adi Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef _WINBORDER_H_
#define _WINBORDER_H_
#ifndef WINDOW_LAYER_H
#define WINDOW_LAYER_H
#include "Decorator.h"
#include "Layer.h"
#include "SubWindowList.h"
#include <Rect.h>
#include <String.h>
#include "Layer.h"
#include "SubWindowList.h"
#include "Decorator.h"
// these are used by window manager to properly place window.
enum {
@ -33,9 +36,9 @@ class Decorator;
class DrawingEngine;
class Desktop;
class WinBorder : public Layer {
class WindowLayer : public Layer {
public:
WinBorder(const BRect &frame,
WindowLayer(const BRect &frame,
const char *name,
const uint32 look,
const uint32 feel,
@ -43,7 +46,7 @@ class WinBorder : public Layer {
const uint32 workspaces,
ServerWindow *window,
DrawingEngine *driver);
virtual ~WinBorder();
virtual ~WindowLayer();
virtual void Draw(const BRect &r);
@ -168,4 +171,4 @@ class WinBorder : public Layer {
float fMaxHeight;
};
#endif
#endif // WINDOW_LAYER_H

View File

@ -37,7 +37,7 @@
// system last windows which will always be behind all other kind of windows.
//
// Normal windows will always be in Workspace's list, be it they are hidden
// or not. They are added by hand (AddWinBorder()) only. Same goes for system last
// or not. They are added by hand (AddWindowLayer()) only. Same goes for system last
// windows, system first, modall all and floating all windows. Those remaining
// are: modal subset, modal app, floating subset and floating app. Those will be
// added and removed on-the-fly as they are needed.
@ -69,7 +69,7 @@
#include "Workspace.h"
#include "Layer.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "ServerWindow.h"
#include "ServerApp.h"
#include "RGBColor.h"
@ -148,12 +148,12 @@ STRACE(("~Workspace(%ld) - say bye bye\n", fID));
/*!
\brief Adds layer ptr to workspace's list of WinBorders.
\brief Adds layer ptr to workspace's list of WindowLayers.
*/
void
Workspace::AddWinBorder(WinBorder *winBorder)
Workspace::AddWindowLayer(WindowLayer *winBorder)
{
STRACE(("W(%ld)::AddWinBorder(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
STRACE(("W(%ld)::AddWindowLayer(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
if (winBorder->Level() == B_FLOATING_APP) {
// floating windows are automaticaly added when needed
// you cannot add one by hand.
@ -162,7 +162,7 @@ STRACE(("W(%ld)::AddWinBorder(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
if (HasItem(winBorder)) {
// NOTE: you may remove 'debugger' at Release Candidate time
debugger("WinBorder ALREADY in Workspace's list\n");
debugger("WindowLayer ALREADY in Workspace's list\n");
return;
}
@ -176,12 +176,12 @@ STRACE(("W(%ld)::AddWinBorder(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
/*
\brief Removes a WinBorder from workspace's list.
\brief Removes a WindowLayer from workspace's list.
*/
void
Workspace::RemoveWinBorder(WinBorder *winBorder)
Workspace::RemoveWindowLayer(WindowLayer *winBorder)
{
STRACE(("W(%ld)::RemoveWinBorder(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
STRACE(("W(%ld)::RemoveWindowLayer(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
ListData* item = HasItem(winBorder);
if (item) {
@ -192,27 +192,27 @@ Workspace::RemoveWinBorder(WinBorder *winBorder)
bool
Workspace::HasWinBorder(const WinBorder* winBorder) const
Workspace::HasWindowLayer(const WindowLayer* winBorder) const
{
return HasItem(winBorder) ? true: false;
}
WinBorder *
WindowLayer *
Workspace::Focus() const
{
return fFocusItem ? fFocusItem->layerPtr : NULL;
}
WinBorder *
WindowLayer *
Workspace::Front() const
{
return fFrontItem ? fFrontItem->layerPtr: NULL;
}
WinBorder *
WindowLayer *
Workspace::Active() const
{
// in case of a normal or modal window
@ -251,13 +251,13 @@ Workspace::GetState(Workspace::State *state) const
}
}
bool
Workspace::AttemptToSetFront(WinBorder *newFront)
Workspace::AttemptToSetFront(WindowLayer *newFront)
{
return MoveToFront(newFront);
}
int32
Workspace::AttemptToSetFocus(WinBorder *newFocus)
Workspace::AttemptToSetFocus(WindowLayer *newFocus)
{
ListData* newFocusItem = HasItem(newFocus);
@ -265,13 +265,13 @@ Workspace::AttemptToSetFocus(WinBorder *newFocus)
}
bool
Workspace::AttemptToMoveToBack(WinBorder *newBack)
Workspace::AttemptToMoveToBack(WindowLayer *newBack)
{
return MoveToBack(newBack);
}
bool
Workspace::AttemptToActivate(WinBorder *toActivate)
Workspace::AttemptToActivate(WindowLayer *toActivate)
{
MoveToFront(toActivate);
AttemptToSetFocus(toActivate);
@ -279,11 +279,11 @@ Workspace::AttemptToActivate(WinBorder *toActivate)
}
/*
\brief This method provides you the list of visible windows in this workspace.
\param list The list of visible WinBorders found in this workspace.
\param itemCount Number of WinBorder pointers found in the list.
\param list The list of visible WindowLayers found in this workspace.
\param itemCount Number of WindowLayer pointers found in the list.
*/
bool
Workspace::GetWinBorderList(void **list, int32 *itemCount ) const
Workspace::GetWindowLayerList(void **list, int32 *itemCount ) const
{
int32 count = 0;
ListData* cursor;
@ -318,14 +318,14 @@ Workspace::GetWinBorderList(void **list, int32 *itemCount ) const
}
/*!
\brief Makes the specified WinBorder the focus one.
\param newFocus WinBorder which will try to take focus state.
\brief Makes the specified WindowLayer the focus one.
\param newFocus WindowLayer which will try to take focus state.
\return 0 - setting focus failed, focus did not change.
1 - the new focus WinBorder is \a winBorder
1 - the new focus WindowLayer is \a winBorder
2 - focus changed but not to \a winBorder because in front of it there
are other modal windows.
Set a new focus WinBorder if possible.
Set a new focus WindowLayer if possible.
*/
int32
@ -336,7 +336,7 @@ Workspace::_SetFocus(ListData *newFocusItem)
&& newFocusItem->layerPtr->WindowFlags() & B_AVOID_FOCUS))
return 0L;
WinBorder *newFocus = newFocusItem->layerPtr;
WindowLayer *newFocus = newFocusItem->layerPtr;
bool rv = 1;
switch(newFocus->Level()) {
@ -384,13 +384,13 @@ Workspace::_SetFocus(ListData *newFocusItem)
}
/*!
\brief Makes the specified WinBorder the front one.
\param newFront WinBorder which will try to take front state.
\brief Makes the specified WindowLayer the front one.
\param newFront WindowLayer which will try to take front state.
\param doNotDisturb In case user is busy typing something, don't bring \a newFront
in front stealing front&focus, but place imediately after.
\return True if the list of WinBorders has changed, false otherwise.
\return True if the list of WindowLayers has changed, false otherwise.
This method tries to make \a newFront the new front WinBorder. "It tries" because
This method tries to make \a newFront the new front WindowLayer. "It tries" because
if this a B_NORMAL window with subset or application modals those will be displayed
in front and get the front state. If no subset or application modals exist, then this
B_NORMAL window will get front (and focus) state and subset and application floating
@ -398,7 +398,7 @@ Workspace::_SetFocus(ListData *newFocusItem)
Note that floating windows cannot get/have front state.
*/
bool
Workspace::MoveToFront(WinBorder *newFront, bool doNotDisturb)
Workspace::MoveToFront(WindowLayer *newFront, bool doNotDisturb)
{
STRACE(("\nWks(%ld)::MoveToFront ~%s~ \n", fID, newFront?newFront->Name():"NULL"));
if (!newFront)
@ -412,16 +412,16 @@ Workspace::MoveToFront(WinBorder *newFront, bool doNotDisturb)
return false;
}
return ShowWinBorder(newFront);
return ShowWindowLayer(newFront);
}
/*!
\brief Moves the specified WinBorder in the back as it is possible.
\param newLast WinBorder which will be placed in the back.
\return True if the list of WinBorders has changed, false otherwise.
\brief Moves the specified WindowLayer in the back as it is possible.
\param newLast WindowLayer which will be placed in the back.
\return True if the list of WindowLayers has changed, false otherwise.
WinBorder \a newLast will go in the back as much as possible. Note that this
WindowLayer \a newLast will go in the back as much as possible. Note that this
action is tricky. While normal windows will always go into the back, front modal windows
won't go into the back if the next front window will be a B_NORMAL or B_MODAL_APP part
of the same team which was previously created. If it were possible it would
@ -430,7 +430,7 @@ Workspace::MoveToFront(WinBorder *newFront, bool doNotDisturb)
B_NORMAL window in front of which they appear.
*/
bool
Workspace::MoveToBack(WinBorder *newLast)
Workspace::MoveToBack(WindowLayer *newLast)
{
STRACE(("Wks(%ld)::MoveToBack(%s) \n", fID, newLast? newLast->Name(): "NULL"));
if (newLast->IsHidden())
@ -586,19 +586,19 @@ Workspace::MoveToBack(WinBorder *newLast)
/*!
\brief Hides a WinBorder.
\param winBorder WinBorder to be hidden.
\return True if the list of WinBorders has changed, false otherwise.
\brief Hides a WindowLayer.
\param winBorder WindowLayer to be hidden.
\return True if the list of WindowLayers has changed, false otherwise.
WinBorder \a winBorder will be hidden. Some, like floating or subset modals
WindowLayer \a winBorder will be hidden. Some, like floating or subset modals
may also be removed from Workspace's list.
If \a winBorder if the front WinBorder, another one (or none) will be automaticaly
If \a winBorder if the front WindowLayer, another one (or none) will be automaticaly
chosen. Same goes for focus.
*/
bool
Workspace::HideWinBorder(WinBorder *winBorder)
Workspace::HideWindowLayer(WindowLayer *winBorder)
{
STRACE(("W(%ld)::HideWinBorder(%s) \n", fID, winBorder? winBorder->Name(): "NULL"));
STRACE(("W(%ld)::HideWindowLayer(%s) \n", fID, winBorder? winBorder->Name(): "NULL"));
bool returnValue = false;
int32 level = winBorder->Level();
bool changeFront = false;
@ -629,7 +629,7 @@ Workspace::HideWinBorder(WinBorder *winBorder)
if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL) {
ListData* item = HasItem(winBorder);
if (item) {
fFrontItem->layerPtr->fSubWindowList.AddWinBorder(winBorder);
fFrontItem->layerPtr->fSubWindowList.AddWindowLayer(winBorder);
RemoveItem(item);
fPool.ReleaseMemory(item);
@ -699,7 +699,7 @@ Workspace::HideWinBorder(WinBorder *winBorder)
}
default:
debugger("HideWinBorder: what kind of window is this?\n");
debugger("HideWindowLayer: what kind of window is this?\n");
}
// select a new Front if needed
@ -740,18 +740,18 @@ Workspace::HideWinBorder(WinBorder *winBorder)
}
/*!
\brief Shows a WinBorder.
\param winBorder WinBorder to be show.
\return True if the list of WinBorders has changed, false otherwise.
\brief Shows a WindowLayer.
\param winBorder WindowLayer to be show.
\return True if the list of WindowLayers has changed, false otherwise.
WinBorder \a winBorder will be shown. Other windows like floating or modal
WindowLayer \a winBorder will be shown. Other windows like floating or modal
ones will be placed in front if needed. Front & Focus state will be given to \a winBorder
unless a modal windows steals both.
*/
bool
Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
Workspace::ShowWindowLayer(WindowLayer *winBorder, bool userBusy)
{
STRACE(("W(%ld)::ShowWinBorder(%s) \n", fID, winBorder? winBorder->Name(): "NULL"));
STRACE(("W(%ld)::ShowWindowLayer(%s) \n", fID, winBorder? winBorder->Name(): "NULL"));
bool returnValue = false;
int32 level = winBorder->Level();
if (level > B_SYSTEM_FIRST)
@ -845,7 +845,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
ListData* itemThis = HasItem(winBorder);
if (!itemThis) {
debugger("ShowWinBorder: B_NORMAL window - cannot find specified window in workspace's list\n");
debugger("ShowWindowLayer: B_NORMAL window - cannot find specified window in workspace's list\n");
return false;
}
@ -900,7 +900,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
userBusy = false;
} else {
// SUBSET modal
WinBorder *mainWindow = searchFirstMainWindow(winBorder);
WindowLayer *mainWindow = searchFirstMainWindow(winBorder);
if (mainWindow) {
// add both mainWindow's subset modals and application's modals
tempList.AddList(&mainWindow->fSubWindowList);
@ -921,7 +921,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL)
saveFloatingWindows(fFrontItem);
// find and remove the Workspace's entry for this WinBorder.
// find and remove the Workspace's entry for this WindowLayer.
ListData *itemThis;
itemThis = HasItem(winBorder);
if (itemThis) {
@ -944,16 +944,16 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
{
ListData* before = itemThis->lowerItem;
int32 i, count;
WinBorder** wbList;
WindowLayer** wbList;
ListData* itemX;
int32 indexThisInTempList;
indexThisInTempList = tempList.IndexOf(winBorder);
if (indexThisInTempList < 0)
debugger("ShowWinBorder: modal window: design flaw!!!\n");
debugger("ShowWindowLayer: modal window: design flaw!!!\n");
count = tempList.CountItems();
wbList = (WinBorder**)tempList.Items();
wbList = (WindowLayer**)tempList.Items();
for (i = indexThisInTempList; i < count; i++) {
if (!wbList[i]->IsHidden()) {
itemX = HasItem(wbList[i], &revIndexItem);
@ -1237,7 +1237,7 @@ Workspace::PrintToStream() const
printf("Workspace %ld hierarchy shown from back to front:\n", fID);
for (ListData *item = fTopItem; item != NULL; item = item->lowerItem)
{
WinBorder *wb = (WinBorder*)item->layerPtr;
WindowLayer *wb = (WindowLayer*)item->layerPtr;
printf("\tName: %s\t%s", wb->Name(), wb->IsHidden()?"Hidden\t": "Visible\t");
if(wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
@ -1270,7 +1270,7 @@ Workspace::PrintItem(ListData *item) const
printf("ListData members:\n");
if(item)
{
printf("WinBorder:\t%s\n", item->layerPtr? item->layerPtr->Name(): "NULL");
printf("WindowLayer:\t%s\n", item->layerPtr? item->layerPtr->Name(): "NULL");
printf("UpperItem:\t%s\n", item->upperItem? item->upperItem->layerPtr->Name(): "NULL");
printf("LowerItem:\t%s\n", item->lowerItem? item->lowerItem->layerPtr->Name(): "NULL");
}
@ -1364,7 +1364,7 @@ Workspace::HasItem(const ListData *item, int32 *index) const
ListData*
Workspace::HasItem(const WinBorder *layer, int32 *index) const
Workspace::HasItem(const WindowLayer *layer, int32 *index) const
{
int32 idx = 0;
ListData* itemX;
@ -1485,7 +1485,7 @@ Workspace::placeToBack(ListData *newLast)
//----------------------------------------------------------------------------------
/*!
\brief Based on it's WinBorder type, places this item in front as it is possible.
\brief Based on it's WindowLayer type, places this item in front as it is possible.
*/
void
Workspace::placeInFront(ListData *item, const bool userBusy)
@ -1548,19 +1548,19 @@ Workspace::removeAndPlaceBefore(ListData *item, ListData *beforeItem)
}
/*!
\brief Insert the specified WinBorder before given item. First search the
specified WinBorder in Workspace's list an remove it.
\brief Insert the specified WindowLayer before given item. First search the
specified WindowLayer in Workspace's list an remove it.
\resolution: private
*/
inline bool
Workspace::removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem)
Workspace::removeAndPlaceBefore(const WindowLayer *wb, ListData *beforeItem)
{
return removeAndPlaceBefore(HasItem(wb), beforeItem);
}
inline WinBorder*
Workspace::searchANormalWindow(WinBorder *wb) const
inline WindowLayer*
Workspace::searchANormalWindow(WindowLayer *wb) const
{
ListData* listItem = fBottomItem;
while (listItem) {
@ -1574,8 +1574,8 @@ Workspace::searchANormalWindow(WinBorder *wb) const
}
inline WinBorder*
Workspace::searchFirstMainWindow(WinBorder *wb) const
inline WindowLayer*
Workspace::searchFirstMainWindow(WindowLayer *wb) const
{
ListData* listItem = fBottomItem;
while (listItem) {
@ -1592,14 +1592,14 @@ Workspace::searchFirstMainWindow(WinBorder *wb) const
//----------------------------------------------------------------------------------
inline
bool Workspace::windowHasVisibleModals(const WinBorder *winBorder) const
bool Workspace::windowHasVisibleModals(const WindowLayer *winBorder) const
{
int32 i, count;
WinBorder **wbList;
WindowLayer **wbList;
// check window's list
count = winBorder->fSubWindowList.CountItems();
wbList = (WinBorder**)winBorder->fSubWindowList.Items();
wbList = (WindowLayer**)winBorder->fSubWindowList.Items();
for(i = 0; i < count; i++)
{
if (wbList[i]->Level() == B_MODAL_APP && !wbList[i]->IsHidden())
@ -1608,7 +1608,7 @@ bool Workspace::windowHasVisibleModals(const WinBorder *winBorder) const
// application's list only has modal windows.
count = winBorder->App()->fAppSubWindowList.CountItems();
wbList = (WinBorder**)winBorder->App()->fAppSubWindowList.Items();
wbList = (WindowLayer**)winBorder->App()->fAppSubWindowList.Items();
for(i = 0; i < count; i++)
{
if (!wbList[i]->IsHidden())
@ -1624,7 +1624,7 @@ inline
ListData* Workspace::putModalsInFront(ListData *item)
{
int32 i, count, revIndex, revIndexItem;
WinBorder **wbList;
WindowLayer **wbList;
ListData *itemX;
ListData *lastPlaced = NULL;
ListData *before = item->lowerItem;
@ -1633,7 +1633,7 @@ ListData* Workspace::putModalsInFront(ListData *item)
// check window's list
count = item->layerPtr->fSubWindowList.CountItems();
wbList = (WinBorder**)item->layerPtr->fSubWindowList.Items();
wbList = (WindowLayer**)item->layerPtr->fSubWindowList.Items();
for(i = 0; i < count; i++)
{
if (wbList[i]->Level() == B_MODAL_APP && !wbList[i]->IsHidden())
@ -1656,7 +1656,7 @@ ListData* Workspace::putModalsInFront(ListData *item)
// application's list only has modal windows.
count = item->layerPtr->App()->fAppSubWindowList.CountItems();
wbList = (WinBorder**)item->layerPtr->App()->fAppSubWindowList.Items();
wbList = (WindowLayer**)item->layerPtr->App()->fAppSubWindowList.Items();
for(i = 0; i < count; i++)
{
if (!wbList[i]->IsHidden())
@ -1680,18 +1680,17 @@ ListData* Workspace::putModalsInFront(ListData *item)
return lastPlaced;
}
//----------------------------------------------------------------------------------
inline
void Workspace::putFloatingInFront(ListData *item)
void
Workspace::putFloatingInFront(ListData *item)
{
int32 i;
ListData *newItem;
ListData *before = item->lowerItem;
WinBorder *wb;
WindowLayer *wb;
i = 0;
while ((wb = (WinBorder*)item->layerPtr->fSubWindowList.ItemAt(i)))
while ((wb = (WindowLayer*)item->layerPtr->fSubWindowList.ItemAt(i)))
{
if (wb->Level() == B_MODAL_APP)
{
@ -1721,7 +1720,7 @@ void Workspace::saveFloatingWindows(ListData *itemNormal)
{
if (item->layerPtr->Level() == B_FLOATING_APP)
{
itemNormal->layerPtr->fSubWindowList.AddWinBorder(item->layerPtr);
itemNormal->layerPtr->fSubWindowList.AddWindowLayer(item->layerPtr);
toast = item;
item = item->lowerItem;
@ -1782,7 +1781,7 @@ Workspace::MemoryPool::~MemoryPool()
}
inline
ListData* Workspace::MemoryPool::GetCleanMemory(WinBorder *winBorder)
ListData* Workspace::MemoryPool::GetCleanMemory(WindowLayer *winBorder)
{
ListData *item = (ListData*)malloc(sizeof(ListData));
item->layerPtr = winBorder;

View File

@ -37,12 +37,12 @@
#include "RGBColor.h"
class WinBorder;
class WindowLayer;
struct ListData
{
bool isFree;
WinBorder *layerPtr;
WindowLayer *layerPtr;
ListData *upperItem;
ListData *lowerItem;
};
@ -55,9 +55,9 @@ class Workspace {
void PrintToStream();
WinBorder* Front;
WinBorder* Focus;
WinBorder* Active;
WindowLayer* Front;
WindowLayer* Focus;
WindowLayer* Active;
BList WindowList;
};
Workspace( const int32 ID,
@ -67,26 +67,26 @@ class Workspace {
int32 ID() const { return fID; }
void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder);
bool HasWinBorder(const WinBorder *winBorder) const;
void AddWindowLayer(WindowLayer *winBorder);
void RemoveWindowLayer(WindowLayer *winBorder);
bool HasWindowLayer(const WindowLayer *winBorder) const;
WinBorder* Focus() const;
WinBorder* Front() const;
WinBorder* Active() const;
WindowLayer* Focus() const;
WindowLayer* Front() const;
WindowLayer* Active() const;
void GetState(Workspace::State *state) const;
bool AttemptToSetFront(WinBorder *newFront);
int32 AttemptToSetFocus(WinBorder *newFocus);
bool AttemptToMoveToBack(WinBorder *newBack);
bool AttemptToActivate(WinBorder *toActivate);
bool AttemptToSetFront(WindowLayer *newFront);
int32 AttemptToSetFocus(WindowLayer *newFocus);
bool AttemptToMoveToBack(WindowLayer *newBack);
bool AttemptToActivate(WindowLayer *toActivate);
bool GetWinBorderList(void **list, int32 *itemCount ) const;
bool GetWindowLayerList(void **list, int32 *itemCount ) const;
bool MoveToBack(WinBorder *newLast);
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
bool MoveToBack(WindowLayer *newLast);
bool MoveToFront(WindowLayer *newFront, bool doNotDisturb = false);
bool HideWinBorder(WinBorder *winBorder);
bool ShowWinBorder(WinBorder *winBorder, bool userBusy = false);
bool HideWindowLayer(WindowLayer *winBorder);
bool ShowWindowLayer(WindowLayer *winBorder, bool userBusy = false);
// resolution related methods.
status_t SetDisplayMode(const display_mode &mode);
@ -109,7 +109,7 @@ private:
void InsertItem(ListData *item, ListData *before);
void RemoveItem(ListData *item);
ListData* HasItem(const ListData *item, int32 *index = NULL) const;
ListData* HasItem(const WinBorder *layer, int32 *index = NULL) const;
ListData* HasItem(const WindowLayer *layer, int32 *index = NULL) const;
int32 IndexOf(const ListData *item) const;
bool placeToBack(ListData *newLast);
@ -117,13 +117,13 @@ private:
int32 _SetFocus(ListData *newFocusItem);
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
bool removeAndPlaceBefore(const WindowLayer *wb, ListData *beforeItem);
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
WinBorder* searchFirstMainWindow(WinBorder *wb) const;
WinBorder* searchANormalWindow(WinBorder *wb) const;
WindowLayer* searchFirstMainWindow(WindowLayer *wb) const;
WindowLayer* searchANormalWindow(WindowLayer *wb) const;
bool windowHasVisibleModals(const WinBorder *winBorder) const;
bool windowHasVisibleModals(const WindowLayer *winBorder) const;
ListData* putModalsInFront(ListData *item);
void putFloatingInFront(ListData *item);
void saveFloatingWindows(ListData *itemNormal);
@ -135,7 +135,7 @@ private:
public:
MemoryPool();
~MemoryPool();
ListData* GetCleanMemory(WinBorder* winborder);
ListData* GetCleanMemory(WindowLayer* winborder);
void ReleaseMemory(ListData* mem);
private:
void expandBuffer(int32 start);
@ -152,7 +152,7 @@ private:
// the last visible(or covered by other Layers)
ListData *fTopItem;
// the focus WinBorder - for keyboard events
// the focus WindowLayer - for keyboard events
ListData *fFocusItem;
// pointer for which "big" actions are intended

View File

@ -14,7 +14,7 @@
#include "AppServer.h"
#include "DrawingEngine.h"
#include "RootLayer.h"
#include "WinBorder.h"
#include "WindowLayer.h"
#include "Workspace.h"
#include "WorkspacesLayer.h"
@ -94,7 +94,7 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
void
WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window,
const BRect& screenFrame, WindowLayer* window,
BRegion& backgroundRegion, bool active)
{
if (window->Feel() == kDesktopWindowFeel)
@ -170,9 +170,9 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
// ToDo: would be nice to get the real update region here
if (workspace != NULL) {
WinBorder* windows[256];
WindowLayer* windows[256];
int32 count = 256;
if (!workspace->GetWinBorderList((void **)&windows, &count))
if (!workspace->GetWindowLayerList((void **)&windows, &count))
return;
uint16 width, height;

View File

@ -11,7 +11,7 @@
#include "Layer.h"
class WinBorder;
class WindowLayer;
class WorkspacesLayer : public Layer {
@ -29,7 +29,7 @@ class WorkspacesLayer : public Layer {
const BRect& screenFrame, const BRect& windowFrame);
void _DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window,
const BRect& screenFrame, WindowLayer* window,
BRegion& backgroundRegion, bool active);
void _DrawWorkspace(int32 index);