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
-1
View File
@@ -31,7 +31,6 @@
#include "ServerProtocol.h" #include "ServerProtocol.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "SystemPalette.h" #include "SystemPalette.h"
#include "WinBorder.h"
#include <Accelerant.h> #include <Accelerant.h>
#include <AppDefs.h> #include <AppDefs.h>
+1 -1
View File
@@ -212,7 +212,7 @@ DefaultDecorator::GetFootprint(BRegion *region)
{ {
STRACE(("DefaultDecorator: Get Footprint\n")); STRACE(("DefaultDecorator: Get Footprint\n"));
// This function calculates the decorator's footprint in coordinates // 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. // object's visible region.
if (!region) if (!region)
return; return;
+63 -63
View File
@@ -24,7 +24,7 @@
#include "ServerConfig.h" #include "ServerConfig.h"
#include "ServerScreen.h" #include "ServerScreen.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Workspace.h" #include "Workspace.h"
#include <WindowInfo.h> #include <WindowInfo.h>
@@ -147,7 +147,7 @@ Desktop::Desktop(uid_t userID)
fSettings(new DesktopSettings::Private()), fSettings(new DesktopSettings::Private()),
fAppListLock("application list"), fAppListLock("application list"),
fShutdownSemaphore(-1), fShutdownSemaphore(-1),
fWinBorderList(64), fWindowLayerList(64),
fActiveScreen(NULL), fActiveScreen(NULL),
fCursorManager() fCursorManager()
{ {
@@ -165,8 +165,8 @@ Desktop::Desktop(uid_t userID)
Desktop::~Desktop() Desktop::~Desktop()
{ {
// root layer only knows the visible WinBorders, so we delete them all over here // root layer only knows the visible WindowLayers, so we delete them all over here
for (int32 i = 0; WinBorder *border = (WinBorder *)fWinBorderList.ItemAt(i); i++) for (int32 i = 0; WindowLayer *border = (WindowLayer *)fWindowLayerList.ItemAt(i); i++)
delete border; delete border;
delete fRootLayer; delete fRootLayer;
@@ -435,8 +435,8 @@ Desktop::_ActivateApp(team_id team)
// search for an unhidden window to give focus to // search for an unhidden window to give focus to
int32 windowCount = WindowList().CountItems(); int32 windowCount = WindowList().CountItems();
for (int32 i = 0; i < windowCount; ++i) { for (int32 i = 0; i < windowCount; ++i) {
// is this layer in fact a WinBorder? // is this layer in fact a WindowLayer?
WinBorder *winBorder = WindowList().ItemAt(i); WindowLayer *winBorder = WindowList().ItemAt(i);
// if winBorder is valid and not hidden, then we've found our target // if winBorder is valid and not hidden, then we've found our target
if (winBorder != NULL && !winBorder->IsHidden() 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 void
Desktop::AddWinBorder(WinBorder *winBorder) Desktop::AddWindowLayer(WindowLayer *winBorder)
{ {
if (!winBorder) if (!winBorder)
return; return;
@@ -497,45 +497,45 @@ Desktop::AddWinBorder(WinBorder *winBorder)
// we're playing with window list. lock first. // we're playing with window list. lock first.
Lock(); Lock();
if (fWinBorderList.HasItem(winBorder)) { if (fWindowLayerList.HasItem(winBorder)) {
Unlock(); Unlock();
RootLayer()->Unlock(); RootLayer()->Unlock();
debugger("AddWinBorder: WinBorder already in Desktop list\n"); debugger("AddWindowLayer: WindowLayer already in Desktop list\n");
return; return;
} }
// we have a new window. store a record of it. // 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. // 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 // This is to keep the order all floating windows (app or subset) when we go from
// one normal window to another. // one normal window to another.
if (feel == B_FLOATING_APP_WINDOW_FEEL || feel == B_NORMAL_WINDOW_FEEL) { if (feel == B_FLOATING_APP_WINDOW_FEEL || feel == B_NORMAL_WINDOW_FEEL) {
WinBorder *wb = NULL; WindowLayer *wb = NULL;
int32 count = fWinBorderList.CountItems(); int32 count = fWindowLayerList.CountItems();
int32 feelToLookFor = (feel == B_NORMAL_WINDOW_FEEL ? int32 feelToLookFor = (feel == B_NORMAL_WINDOW_FEEL ?
B_FLOATING_APP_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL); B_FLOATING_APP_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
wb = (WinBorder *)fWinBorderList.ItemAt(i); wb = (WindowLayer *)fWindowLayerList.ItemAt(i);
if (wb->App()->ClientTeam() == winBorder->App()->ClientTeam() if (wb->App()->ClientTeam() == winBorder->App()->ClientTeam()
&& wb->Feel() == feelToLookFor) { && wb->Feel() == feelToLookFor) {
// R2: RootLayer comparison is needed. // R2: RootLayer comparison is needed.
feel == B_NORMAL_WINDOW_FEEL ? feel == B_NORMAL_WINDOW_FEEL ?
winBorder->fSubWindowList.AddWinBorder(wb) : winBorder->fSubWindowList.AddWindowLayer(wb) :
wb->fSubWindowList.AddWinBorder(winBorder); wb->fSubWindowList.AddWindowLayer(winBorder);
} }
} }
} }
// add application's list of modal windows. // add application's list of modal windows.
if (feel == B_MODAL_APP_WINDOW_FEEL) { if (feel == B_MODAL_APP_WINDOW_FEEL) {
winBorder->App()->fAppSubWindowList.AddWinBorder(winBorder); winBorder->App()->fAppSubWindowList.AddWindowLayer(winBorder);
} }
// send WinBorder to be added to workspaces // send WindowLayer to be added to workspaces
RootLayer()->AddWinBorder(winBorder); RootLayer()->AddWindowLayer(winBorder);
// hey, unlock! // hey, unlock!
Unlock(); Unlock();
@@ -545,7 +545,7 @@ Desktop::AddWinBorder(WinBorder *winBorder)
void void
Desktop::RemoveWinBorder(WinBorder *winBorder) Desktop::RemoveWindowLayer(WindowLayer *winBorder)
{ {
if (!winBorder) if (!winBorder)
return; return;
@@ -556,8 +556,8 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
// we're playing with window list. lock first. // we're playing with window list. lock first.
Lock(); Lock();
// remove from main WinBorder list. // remove from main WindowLayer list.
if (fWinBorderList.RemoveItem(winBorder)) { if (fWindowLayerList.RemoveItem(winBorder)) {
int32 feel = winBorder->Feel(); int32 feel = winBorder->Feel();
// floating app/subset and modal_subset windows require special atention because // 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_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_FLOATING_APP_WINDOW_FEEL) || feel == B_FLOATING_APP_WINDOW_FEEL)
{ {
WinBorder *wb = NULL; WindowLayer *wb = NULL;
int32 count = fWinBorderList.CountItems(); int32 count = fWindowLayerList.CountItems();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
wb = (WinBorder*)fWinBorderList.ItemAt(i); wb = (WindowLayer*)fWindowLayerList.ItemAt(i);
if (wb->Feel() == B_NORMAL_WINDOW_FEEL if (wb->Feel() == B_NORMAL_WINDOW_FEEL
&& wb->App()->ClientTeam() == winBorder->App()->ClientTeam()) { && wb->App()->ClientTeam() == winBorder->App()->ClientTeam()) {
@@ -587,12 +587,12 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
} else { } else {
Unlock(); Unlock();
RootLayer()->Unlock(); RootLayer()->Unlock();
debugger("RemoveWinBorder: WinBorder not found in Desktop list\n"); debugger("RemoveWindowLayer: WindowLayer not found in Desktop list\n");
return; return;
} }
// Tell to winBorder's RootLayer about this. // Tell to winBorder's RootLayer about this.
RootLayer()->RemoveWinBorder(winBorder); RootLayer()->RemoveWindowLayer(winBorder);
Unlock(); Unlock();
RootLayer()->Unlock(); RootLayer()->Unlock();
@@ -600,7 +600,7 @@ Desktop::RemoveWinBorder(WinBorder *winBorder)
void 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 // NOTE: we can safely lock the entire method body, because this method is called from
// RootLayer's thread only. // RootLayer's thread only.
@@ -608,36 +608,36 @@ Desktop::AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder)
// we're playing with window list. lock first. // we're playing with window list. lock first.
Lock(); Lock();
if (!winBorder || !toWinBorder if (!winBorder || !toWindowLayer
|| !fWinBorderList.HasItem(winBorder) || !fWindowLayerList.HasItem(winBorder)
|| !fWinBorderList.HasItem(toWinBorder)) { || !fWindowLayerList.HasItem(toWindowLayer)) {
Unlock(); Unlock();
debugger("AddWinBorderToSubset: NULL WinBorder or not found in Desktop list\n"); debugger("AddWindowLayerToSubset: NULL WindowLayer or not found in Desktop list\n");
return; return;
} }
if ((winBorder->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL if ((winBorder->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL
|| winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) || winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
&& toWinBorder->Feel() == B_NORMAL_WINDOW_FEEL && toWindowLayer->Feel() == B_NORMAL_WINDOW_FEEL
&& toWinBorder->App()->ClientTeam() == winBorder->App()->ClientTeam() && toWindowLayer->App()->ClientTeam() == winBorder->App()->ClientTeam()
&& !toWinBorder->fSubWindowList.HasItem(winBorder)) { && !toWindowLayer->fSubWindowList.HasItem(winBorder)) {
// add to normal_window's list // add to normal_window's list
toWinBorder->fSubWindowList.AddWinBorder(winBorder); toWindowLayer->fSubWindowList.AddWindowLayer(winBorder);
} else { } else {
Unlock(); 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; return;
} }
// send WinBorder to be added to workspaces, if not already in there. // send WindowLayer to be added to workspaces, if not already in there.
RootLayer()->AddSubsetWinBorder(winBorder, toWinBorder); RootLayer()->AddSubsetWindowLayer(winBorder, toWindowLayer);
Unlock(); Unlock();
} }
void 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 // NOTE: we can safely lock the entire method body, because this method is called from
// RootLayer's thread only. // RootLayer's thread only.
@@ -645,23 +645,23 @@ Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorde
// we're playing with window list. lock first. // we're playing with window list. lock first.
Lock(); Lock();
if (!winBorder || !fromWinBorder if (!winBorder || !fromWindowLayer
|| !fWinBorderList.HasItem(winBorder) || !fWindowLayerList.HasItem(winBorder)
|| !fWinBorderList.HasItem(fromWinBorder)) { || !fWindowLayerList.HasItem(fromWindowLayer)) {
Unlock(); Unlock();
debugger("RemoveWinBorderFromSubset: NULL WinBorder or not found in Desktop list\n"); debugger("RemoveWindowLayerFromSubset: NULL WindowLayer or not found in Desktop list\n");
return; return;
} }
// remove WinBorder from workspace, if needed - some other windows may still have it in their subset // remove WindowLayer from workspace, if needed - some other windows may still have it in their subset
RootLayer()->RemoveSubsetWinBorder(winBorder, fromWinBorder); 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. //remove from this normal_window's subset.
fromWinBorder->fSubWindowList.RemoveItem(winBorder); fromWindowLayer->fSubWindowList.RemoveItem(winBorder);
} else { } else {
Unlock(); 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; return;
} }
@@ -670,28 +670,28 @@ Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorde
void void
Desktop::SetWinBorderFeel(WinBorder *winBorder, uint32 feel) Desktop::SetWindowLayerFeel(WindowLayer *winBorder, uint32 feel)
{ {
// NOTE: this method is called from RootLayer thread only // NOTE: this method is called from RootLayer thread only
// we're playing with window list. lock first. // we're playing with window list. lock first.
Lock(); Lock();
RemoveWinBorder(winBorder); RemoveWindowLayer(winBorder);
winBorder->QuietlySetFeel(feel); winBorder->QuietlySetFeel(feel);
AddWinBorder(winBorder); AddWindowLayer(winBorder);
Unlock(); Unlock();
} }
WinBorder * WindowLayer *
Desktop::FindWinBorderByClientToken(int32 token, team_id teamID) Desktop::FindWindowLayerByClientToken(int32 token, team_id teamID)
{ {
BAutolock locker(this); BAutolock locker(this);
WinBorder *wb; WindowLayer *wb;
for (int32 i = 0; (wb = (WinBorder *)fWinBorderList.ItemAt(i)); i++) { for (int32 i = 0; (wb = (WindowLayer *)fWindowLayerList.ItemAt(i)); i++) {
if (wb->Window()->ClientToken() == token if (wb->Window()->ClientToken() == token
&& wb->Window()->ClientTeam() == teamID) && wb->Window()->ClientTeam() == teamID)
return wb; return wb;
@@ -701,13 +701,13 @@ Desktop::FindWinBorderByClientToken(int32 token, team_id teamID)
} }
const BObjectList<WinBorder> & const BObjectList<WindowLayer> &
Desktop::WindowList() const Desktop::WindowList() const
{ {
if (!IsLocked()) if (!IsLocked())
debugger("You must lock before getting registered windows list\n"); 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; int32 count = 0;
if (team >= B_OK) { if (team >= B_OK) {
for (int32 i = 0; i < fWinBorderList.CountItems(); i++) { for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WinBorder* border = fWinBorderList.ItemAt(i); WindowLayer* border = fWindowLayerList.ItemAt(i);
if (border->Window()->ClientTeam() == team) if (border->Window()->ClientTeam() == team)
count++; count++;
} }
} else } else
count = fWinBorderList.CountItems(); count = fWindowLayerList.CountItems();
// write list // write list
sender.StartMessage(SERVER_TRUE); sender.StartMessage(SERVER_TRUE);
sender.Attach<int32>(count); sender.Attach<int32>(count);
for (int32 i = 0; i < fWinBorderList.CountItems(); i++) { for (int32 i = 0; i < fWindowLayerList.CountItems(); i++) {
WinBorder* border = fWinBorderList.ItemAt(i); WindowLayer* border = fWindowLayerList.ItemAt(i);
if (team >= B_OK && border->Window()->ClientTeam() != team) if (team >= B_OK && border->Window()->ClientTeam() != team)
continue; continue;
+13 -13
View File
@@ -33,7 +33,7 @@ class DrawingEngine;
class HWInterface; class HWInterface;
class Layer; class Layer;
class RootLayer; class RootLayer;
class WinBorder; class WindowLayer;
namespace BPrivate { namespace BPrivate {
class LinkSender; class LinkSender;
@@ -73,21 +73,21 @@ class Desktop : public MessageLooper, public ScreenOwner {
inline ::HWInterface* HWInterface() const inline ::HWInterface* HWInterface() const
{ return fVirtualScreen.HWInterface(); } { return fVirtualScreen.HWInterface(); }
// Methods for layer(WinBorder) manipulation. // Methods for layer(WindowLayer) manipulation.
void AddWinBorder(WinBorder *winBorder); void AddWindowLayer(WindowLayer *winBorder);
void RemoveWinBorder(WinBorder *winBorder); void RemoveWindowLayer(WindowLayer *winBorder);
void SetWinBorderFeel(WinBorder *winBorder, void SetWindowLayerFeel(WindowLayer *winBorder,
uint32 feel); uint32 feel);
void AddWinBorderToSubset(WinBorder *winBorder, void AddWindowLayerToSubset(WindowLayer *winBorder,
WinBorder *toWinBorder); WindowLayer *toWindowLayer);
void RemoveWinBorderFromSubset(WinBorder *winBorder, void RemoveWindowLayerFromSubset(WindowLayer *winBorder,
WinBorder *fromWinBorder); WindowLayer *fromWindowLayer);
WinBorder* FindWinBorderByClientToken(int32 token, team_id teamID); WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
//WinBorder* FindWinBorderByServerToken(int32 token); //WindowLayer* FindWindowLayerByServerToken(int32 token);
// get list of registed windows // get list of registed windows
const BObjectList<WinBorder>& WindowList() const; const BObjectList<WindowLayer>& WindowList() const;
void WriteWindowList(team_id team, BPrivate::LinkSender& sender); void WriteWindowList(team_id team, BPrivate::LinkSender& sender);
void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender); void WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender);
@@ -114,7 +114,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
sem_id fShutdownSemaphore; sem_id fShutdownSemaphore;
int32 fShutdownCount; int32 fShutdownCount;
BObjectList<WinBorder> fWinBorderList; BObjectList<WindowLayer> fWindowLayerList;
::RootLayer* fRootLayer; ::RootLayer* fRootLayer;
Screen* fActiveScreen; Screen* fActiveScreen;
+2 -2
View File
@@ -35,7 +35,7 @@ Server app_server :
MessageLooper.cpp MessageLooper.cpp
MultiLocker.cpp MultiLocker.cpp
OffscreenServerWindow.cpp OffscreenServerWindow.cpp
OffscreenWinBorder.cpp OffscreenWindowLayer.cpp
PNGDump.cpp PNGDump.cpp
PicturePlayer.cpp PicturePlayer.cpp
RAMLinkMsgReader.cpp RAMLinkMsgReader.cpp
@@ -52,7 +52,7 @@ Server app_server :
SubWindowList.cpp SubWindowList.cpp
SystemPalette.cpp SystemPalette.cpp
VirtualScreen.cpp VirtualScreen.cpp
WinBorder.cpp WindowLayer.cpp
Workspace.cpp Workspace.cpp
WorkspacesLayer.cpp WorkspacesLayer.cpp
+4 -4
View File
@@ -29,7 +29,7 @@
#include "ServerApp.h" #include "ServerApp.h"
#include "ServerProtocol.h" #include "ServerProtocol.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Layer.h" #include "Layer.h"
#include "ServerBitmap.h" #include "ServerBitmap.h"
@@ -1440,9 +1440,9 @@ void
Layer::_AllRedraw(const BRegion &invalid) Layer::_AllRedraw(const BRegion &invalid)
{ {
// couldn't find a simpler way to send _UPDATE_ message to client. // couldn't find a simpler way to send _UPDATE_ message to client.
WinBorder *wb = dynamic_cast<WinBorder*>(this); WindowLayer *windowLayer = dynamic_cast<WindowLayer*>(this);
if (wb) if (windowLayer)
wb->RequestClientRedraw(invalid); windowLayer->RequestClientRedraw(invalid);
if (fVisible.CountRects() > 0) { if (fVisible.CountRects() > 0) {
BRegion updateReg(fVisible); BRegion updateReg(fVisible);
+4 -5
View File
@@ -170,7 +170,7 @@ class Layer {
{ return fWindow; } { return fWindow; }
ServerApp* App() const ServerApp* App() const
{ return fWindow ? fWindow->App() : NULL; } { return fWindow ? fWindow->App() : NULL; }
inline WinBorder* Owner() const inline WindowLayer* Owner() const
{ return fOwner; } { return fOwner; }
RootLayer* GetRootLayer() const RootLayer* GetRootLayer() const
{ return fRootLayer; } { return fRootLayer; }
@@ -208,9 +208,8 @@ class Layer {
virtual void Draw(const BRect& r); virtual void Draw(const BRect& r);
void _AllRedraw(const BRegion &invalid); void _AllRedraw(const BRegion &invalid);
private: protected:
friend class RootLayer; friend class RootLayer;
friend class WinBorder;
friend class ServerWindow; friend class ServerWindow;
// private clipping stuff // private clipping stuff
@@ -241,7 +240,7 @@ class Layer {
DrawingEngine* fDriver; DrawingEngine* fDriver;
RootLayer* fRootLayer; RootLayer* fRootLayer;
ServerWindow* fWindow; ServerWindow* fWindow;
WinBorder* fOwner; WindowLayer* fOwner;
DrawState* fDrawState; DrawState* fDrawState;
+7 -6
View File
@@ -6,12 +6,13 @@
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
*/ */
#include "OffscreenWinBorder.h"
#include "OffscreenWindowLayer.h"
#include "ServerBitmap.h" #include "ServerBitmap.h"
#include "OffscreenServerWindow.h" #include "OffscreenServerWindow.h"
// constructor
OffscreenServerWindow::OffscreenServerWindow(const char *title, OffscreenServerWindow::OffscreenServerWindow(const char *title,
ServerApp *app, ServerApp *app,
port_id clientPort, port_id clientPort,
@@ -39,11 +40,11 @@ OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
// don't do anything in this implementation. // don't do anything in this implementation.
} }
// MakeWinBorder
WinBorder* WindowLayer*
OffscreenServerWindow::MakeWinBorder(BRect frame, const char* name, OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, uint32 look, uint32 feel, uint32 flags,
uint32 workspace) uint32 workspace)
{ {
return new OffscreenWinBorder(fBitmap, name, this); return new OffscreenWindowLayer(fBitmap, name, this);
} }
+5 -4
View File
@@ -11,6 +11,7 @@
#include "ServerWindow.h" #include "ServerWindow.h"
class OffscreenServerWindow : public ServerWindow { class OffscreenServerWindow : public ServerWindow {
public: public:
OffscreenServerWindow(const char *title, OffscreenServerWindow(const char *title,
@@ -26,10 +27,10 @@ class OffscreenServerWindow : public ServerWindow {
int32 target = B_NULL_TOKEN, int32 target = B_NULL_TOKEN,
bool usePreferred = false) const; bool usePreferred = false) const;
virtual WinBorder* MakeWinBorder(BRect frame, virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
const char* name, uint32 look, uint32 feel, uint32 flags,
uint32 look, uint32 feel, uint32 workspace);
uint32 flags, uint32 workspace);
private: private:
ServerBitmap* fBitmap; ServerBitmap* fBitmap;
}; };
@@ -2,30 +2,27 @@
* Copyright 2005, Haiku, Inc. All rights reserved. * Copyright 2005, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * 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 <Debug.h>
#include "DebugInfoManager.h" #include "DebugInfoManager.h"
#include "BitmapHWInterface.h" #include <stdio.h>
#include "DrawingEngine.h"
#include "ServerBitmap.h"
#include "OffscreenWinBorder.h"
// constructor OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap,
OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap, const char* name, ServerWindow* window)
const char* name, : WindowLayer(bitmap->Bounds(), name,
ServerWindow* window) B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
: WinBorder(bitmap->Bounds(), name, 0, 0, window, new DrawingEngine()),
B_NO_BORDER_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,
0, 0, window,
new DrawingEngine()),
fBitmap(bitmap), fBitmap(bitmap),
fHWInterface(new BitmapHWInterface(fBitmap)) fHWInterface(new BitmapHWInterface(fBitmap))
{ {
@@ -34,8 +31,8 @@ OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap,
GetDrawingEngine()->Update(); GetDrawingEngine()->Update();
} }
// destructor
OffscreenWinBorder::~OffscreenWinBorder() OffscreenWindowLayer::~OffscreenWindowLayer()
{ {
fHWInterface->WriteLock(); fHWInterface->WriteLock();
// Unlike normal Layers, we own the DrawingEngine instance // Unlike normal Layers, we own the DrawingEngine instance
@@ -46,28 +43,24 @@ OffscreenWinBorder::~OffscreenWinBorder()
delete fHWInterface; delete fHWInterface;
} }
void void
OffscreenWinBorder::Draw(const BRect &r) OffscreenWindowLayer::Draw(const BRect &r)
{ {
// Nothing to do here // Nothing to do here
} }
void void
OffscreenWinBorder::MoveBy(float x, float y) OffscreenWindowLayer::MoveBy(float x, float y)
{ {
// Nothing to do here // Nothing to do here
} }
void void
OffscreenWinBorder::ResizeBy(float x, float y) OffscreenWindowLayer::ResizeBy(float x, float y)
{ {
// Nothing to do here // Nothing to do here
} }
// SetTopLayer
void
OffscreenWinBorder::SetTopLayer(Layer* layer)
{
WinBorder::SetTopLayer(layer);
}
@@ -2,23 +2,25 @@
* Copyright 2005, Haiku, Inc. All rights reserved. * Copyright 2005, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * 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 #ifndef OFFSCREEN_WINBORDER_H
#define OFFSCREEN_WINBORDER_H #define OFFSCREEN_WINBORDER_H
#include "WinBorder.h"
#include "WindowLayer.h"
class BitmapHWInterface; class BitmapHWInterface;
class ServerBitmap; class ServerBitmap;
class OffscreenWinBorder : public WinBorder { class OffscreenWindowLayer : public WindowLayer {
public: public:
OffscreenWinBorder(ServerBitmap* bitmap, OffscreenWindowLayer(ServerBitmap* bitmap,
const char* name, const char* name,
ServerWindow* window); ServerWindow* window);
virtual ~OffscreenWinBorder(); virtual ~OffscreenWindowLayer();
virtual void Draw(const BRect &r); virtual void Draw(const BRect &r);
@@ -28,11 +30,9 @@ class OffscreenWinBorder : public WinBorder {
virtual bool IsOffscreenWindow() const virtual bool IsOffscreenWindow() const
{ return true; } { return true; }
virtual void SetTopLayer(Layer* layer);
private: private:
ServerBitmap* fBitmap; ServerBitmap* fBitmap;
BitmapHWInterface* fHWInterface; BitmapHWInterface* fHWInterface;
}; };
#endif #endif // OFFSCREEN_WINBORDER_H
+98 -99
View File
@@ -23,7 +23,7 @@
#include "ServerProtocol.h" #include "ServerProtocol.h"
#include "ServerScreen.h" #include "ServerScreen.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Workspace.h" #include "Workspace.h"
#include "WorkspacesLayer.h" #include "WorkspacesLayer.h"
@@ -181,46 +181,45 @@ RootLayer::ResizeBy(float x, float y)
void void
RootLayer::AddWinBorder(WinBorder* winBorder) RootLayer::AddWindowLayer(WindowLayer* windowLayer)
{ {
if (!winBorder->IsHidden()) if (!windowLayer->IsHidden()) {
{ CRITICAL("RootLayer::AddWindowLayer - windowLayer must be hidden\n");
CRITICAL("RootLayer::AddWinBorder - winBorder must be hidden\n");
return; return;
} }
// Subset modals also need to have a main window before appearing in workspace list. // 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) { 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 // add to current workspace
if (workspaces == 0) if (workspaces == 0)
fWorkspace[fActiveWksIndex]->AddWinBorder(winBorder); fWorkspace[fActiveWksIndex]->AddWindowLayer(windowLayer);
else { else {
// add to desired workspaces // add to desired workspaces
for (int32 i = 0; i < fWsCount; i++) { for (int32 i = 0; i < fWsCount; i++) {
if (fWorkspace[i] && (workspaces & (0x00000001UL << 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 // set some internals
winBorder->SetRootLayer(this); windowLayer->SetRootLayer(this);
winBorder->fParent = this; windowLayer->fParent = this;
} }
void void
RootLayer::RemoveWinBorder(WinBorder* winBorder) RootLayer::RemoveWindowLayer(WindowLayer* windowLayer)
{ {
// Note: removing a subset window is also permited/performed. // 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; return;
} }
@@ -229,32 +228,32 @@ RootLayer::RemoveWinBorder(WinBorder* winBorder)
// windows have 0 as a workspace index, this action is fully justified. // windows have 0 as a workspace index, this action is fully justified.
for (int32 i = 0; i < fWsCount; i++) { for (int32 i = 0; i < fWsCount; i++) {
if (fWorkspace[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 // set some internals
winBorder->SetRootLayer(NULL); windowLayer->SetRootLayer(NULL);
winBorder->fParent = NULL; windowLayer->fParent = NULL;
} }
void void
RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder) RootLayer::AddSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *toWindowLayer)
{ {
// SUBSET windows _must_ have their workspaceIndex set to 0x0 // 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"); CRITICAL("SUBSET windows _must_ have their workspaceIndex set to 0x0\n");
return; return;
} }
// there is no point in continuing - this subset window won't be shown, // there is no point in continuing - this subset window won't be shown,
// from 'toWinBorder's point of view // from 'toWindowLayer's point of view
if (winBorder->IsHidden() || toWinBorder->IsHidden()) if (windowLayer->IsHidden() || toWindowLayer->IsHidden())
{ {
return; return;
} }
@@ -264,13 +263,13 @@ RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
Workspace::State oldWMState; Workspace::State oldWMState;
ActiveWorkspace()->GetState(&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. // If they are needed, Workspace automaticaly allocates space and inserts them.
for (int32 i = 0; i < fWsCount; i++) { for (int32 i = 0; i < fWsCount; i++) {
invalid = false; invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(toWinBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(toWindowLayer))
invalid = fWorkspace[i]->ShowWinBorder(winBorder, false); invalid = fWorkspace[i]->ShowWindowLayer(windowLayer, false);
if (fActiveWksIndex == i) if (fActiveWksIndex == i)
invalidate = invalid; invalidate = invalid;
@@ -282,11 +281,11 @@ RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
void 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 // there is no point in continuing - this subset window is not visible
// at least not visible from 'fromWinBorder's point of view. // at least not visible from 'fromWindowLayer's point of view.
if (winBorder->IsHidden() || fromWinBorder->IsHidden()) if (windowLayer->IsHidden() || fromWindowLayer->IsHidden())
return; return;
bool invalidate = false; bool invalidate = false;
@@ -294,12 +293,12 @@ RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder)
Workspace::State oldWMState; Workspace::State oldWMState;
ActiveWorkspace()->GetState(&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++) { for (int32 i = 0; i < fWsCount; i++) {
invalid = false; invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(fromWinBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(fromWindowLayer))
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
if (fActiveWksIndex == i) if (fActiveWksIndex == i)
invalidate = invalid; invalidate = invalid;
@@ -323,17 +322,17 @@ bool RootLayer::SetActiveWorkspace(int32 index)
// return false; // return false;
// if you're dragging something you are allowed to change workspaces only if // if you're dragging something you are allowed to change workspaces only if
// the Layer being dragged is a B_NORMAL_WINDOW_FEEL WinBorder. // the Layer being dragged is a B_NORMAL_WINDOW_FEEL WindowLayer.
WinBorder *draggedWinBorder = dynamic_cast<WinBorder*>(fMouseEventLayer); WindowLayer *draggedWindowLayer = dynamic_cast<WindowLayer*>(fMouseEventLayer);
if (fMouseEventLayer != NULL) { if (fMouseEventLayer != NULL) {
if (draggedWinBorder) { if (draggedWindowLayer) {
if (draggedWinBorder->Feel() != B_NORMAL_WINDOW_FEEL) if (draggedWindowLayer->Feel() != B_NORMAL_WINDOW_FEEL)
return false; return false;
} else } else
return false; 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]) { if (!fWorkspace[index]) {
// TODO: we NEED datas from a file!!! // TODO: we NEED datas from a file!!!
fWorkspace[index] = new Workspace(index, 0xFF00FF00, kDefaultWorkspaceColor); 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 // we need to lock the window list here so no other window can be created
fDesktop->Lock(); fDesktop->Lock();
const BObjectList<WinBorder>& windowList = fDesktop->WindowList(); const BObjectList<WindowLayer>& windowList = fDesktop->WindowList();
int32 windowCount = windowList.CountItems(); int32 windowCount = windowList.CountItems();
for (int32 i = 0; i < windowCount; i++) { for (int32 i = 0; i < windowCount; i++) {
WinBorder* winBorder = windowList.ItemAt(i); WindowLayer* windowLayer = windowList.ItemAt(i);
// is WinBorder on this workspace? // is WindowLayer on this workspace?
if (winBorder->Workspaces() & (0x00000001UL << index)) { if (windowLayer->Workspaces() & (0x00000001UL << index)) {
fWorkspace[index]->AddWinBorder(winBorder); fWorkspace[index]->AddWindowLayer(windowLayer);
if (!winBorder->IsHidden()) if (!windowLayer->IsHidden())
fWorkspace[index]->ShowWinBorder(winBorder); fWorkspace[index]->ShowWindowLayer(windowLayer);
} }
} }
@@ -381,28 +380,28 @@ bool RootLayer::SetActiveWorkspace(int32 index)
fActiveWksIndex = 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. // 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 // 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. // change it back when adding windowLayer to the current workspace.
draggedWinBorder->fHidden = true; draggedWindowLayer->fHidden = true;
fWorkspace[exIndex]->HideWinBorder(draggedWinBorder); fWorkspace[exIndex]->HideWindowLayer(draggedWindowLayer);
fWorkspace[exIndex]->RemoveWinBorder(draggedWinBorder); fWorkspace[exIndex]->RemoveWindowLayer(draggedWindowLayer);
draggedWinBorder->fHidden = false; draggedWindowLayer->fHidden = false;
ActiveWorkspace()->AddWinBorder(draggedWinBorder); ActiveWorkspace()->AddWindowLayer(draggedWindowLayer);
ActiveWorkspace()->ShowWinBorder(draggedWinBorder); ActiveWorkspace()->ShowWindowLayer(draggedWindowLayer);
// TODO: can you call SetWinBorderWorskpaces() instead of this? // TODO: can you call SetWindowLayerWorskpaces() instead of this?
uint32 wks = draggedWinBorder->Workspaces(); uint32 wks = draggedWindowLayer->Workspaces();
BMessage changedMsg(B_WORKSPACES_CHANGED); BMessage changedMsg(B_WORKSPACES_CHANGED);
changedMsg.AddInt64("when", real_time_clock_usecs()); changedMsg.AddInt64("when", real_time_clock_usecs());
changedMsg.AddInt32("old", wks); changedMsg.AddInt32("old", wks);
wks &= ~(0x00000001 << exIndex); wks &= ~(0x00000001 << exIndex);
wks |= (0x00000001 << fActiveWksIndex); wks |= (0x00000001 << fActiveWksIndex);
changedMsg.AddInt32("new", wks); changedMsg.AddInt32("new", wks);
draggedWinBorder->QuietlySetWorkspaces(wks); draggedWindowLayer->QuietlySetWorkspaces(wks);
draggedWinBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN); draggedWindowLayer->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN);
} }
RevealNewWMState(oldWMState); RevealNewWMState(oldWMState);
@@ -421,12 +420,12 @@ bool RootLayer::SetActiveWorkspace(int32 index)
void 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 // if the active notify Layer is somehow related to windowLayer, then
// this window/WinBorder is not allowed to leave this workspace. // 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 // 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); // newIndex |= (0x00000001UL << fActiveWksIndex);
uint32 localOldIndex = oldIndex; 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! // you *cannot* set workspaces index for a window other than a normal one!
// Note: See ServerWindow class. // Note: See ServerWindow class.
if (winBorder->Feel() != B_NORMAL_WINDOW_FEEL || localOldIndex == localNewIndex) if (windowLayer->Feel() != B_NORMAL_WINDOW_FEEL || localOldIndex == localNewIndex)
return; return;
Workspace::State oldWMState; Workspace::State oldWMState;
@@ -452,20 +451,20 @@ RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32
if (fWorkspace[i]) { if (fWorkspace[i]) {
invalid = false; invalid = false;
if (!(localNewIndex & (0x00000001UL << i)) && fWorkspace[i]->HasWinBorder(winBorder)) { if (!(localNewIndex & (0x00000001UL << i)) && fWorkspace[i]->HasWindowLayer(windowLayer)) {
if (!winBorder->IsHidden()) { if (!windowLayer->IsHidden()) {
// a little trick to force Workspace to properly pick the next front. // a little trick to force Workspace to properly pick the next front.
winBorder->fHidden = true; windowLayer->fHidden = true;
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
winBorder->fHidden = false; windowLayer->fHidden = false;
} }
fWorkspace[i]->RemoveWinBorder(winBorder); fWorkspace[i]->RemoveWindowLayer(windowLayer);
} }
if ((localNewIndex & (0x00000001UL << i)) && !fWorkspace[i]->HasWinBorder(winBorder)) { if ((localNewIndex & (0x00000001UL << i)) && !fWorkspace[i]->HasWindowLayer(windowLayer)) {
fWorkspace[i]->AddWinBorder(winBorder); fWorkspace[i]->AddWindowLayer(windowLayer);
if (!winBorder->IsHidden()) if (!windowLayer->IsHidden())
invalid = fWorkspace[i]->ShowWinBorder(winBorder); invalid = fWorkspace[i]->ShowWindowLayer(windowLayer);
} }
if (fActiveWksIndex == i) if (fActiveWksIndex == i)
@@ -473,7 +472,7 @@ RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldIndex, uint32
} }
} }
winBorder->WorkspacesChanged(oldIndex, newIndex); windowLayer->WorkspacesChanged(oldIndex, newIndex);
if (invalidate) if (invalidate)
RevealNewWMState(oldWMState); RevealNewWMState(oldWMState);
@@ -581,7 +580,7 @@ RootLayer::SaveWorkspaceData(const char *path)
void void
RootLayer::HideWinBorder(WinBorder* winBorder) RootLayer::HideWindowLayer(WindowLayer* windowLayer)
{ {
BAutolock _(fAllRegionsLock); BAutolock _(fAllRegionsLock);
@@ -590,18 +589,18 @@ RootLayer::HideWinBorder(WinBorder* winBorder)
Workspace::State oldWMState; Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState); ActiveWorkspace()->GetState(&oldWMState);
winBorder->Hide(false); windowLayer->Hide(false);
for (int32 i = 0; i < fWsCount; i++) { for (int32 i = 0; i < fWsCount; i++) {
invalid = false; invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(winBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWindowLayer(windowLayer))
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWindowLayer(windowLayer);
if (fActiveWksIndex == i) { if (fActiveWksIndex == i) {
invalidate = invalid; invalidate = invalid;
if (dynamic_cast<class WorkspacesLayer *>(winBorder->FirstChild()) != NULL) if (dynamic_cast<class WorkspacesLayer *>(windowLayer->FirstChild()) != NULL)
SetWorkspacesLayer(NULL); SetWorkspacesLayer(NULL);
} }
} }
@@ -612,7 +611,7 @@ RootLayer::HideWinBorder(WinBorder* winBorder)
void void
RootLayer::ShowWinBorder(WinBorder* winBorder) RootLayer::ShowWindowLayer(WindowLayer* windowLayer)
{ {
BAutolock _(fAllRegionsLock); BAutolock _(fAllRegionsLock);
@@ -621,32 +620,32 @@ RootLayer::ShowWinBorder(WinBorder* winBorder)
Workspace::State oldWMState; Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState); ActiveWorkspace()->GetState(&oldWMState);
winBorder->Show(false); windowLayer->Show(false);
for (int32 i = 0; i < fWsCount; i++) { for (int32 i = 0; i < fWsCount; i++) {
invalid = false; invalid = false;
if (fWorkspace[i] if (fWorkspace[i]
&& (fWorkspace[i]->HasWinBorder(winBorder) && (fWorkspace[i]->HasWindowLayer(windowLayer)
|| winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL || windowLayer->Feel() == B_MODAL_SUBSET_WINDOW_FEEL
// subset modals are a bit like floating windows, they are being added // subset modals are a bit like floating windows, they are being added
// and removed from workspace when there's at least a normal window // and removed from workspace when there's at least a normal window
// that uses them. // that uses them.
|| winBorder->Level() == B_FLOATING_APP)) || windowLayer->Level() == B_FLOATING_APP))
// floating windows are inserted/removed on-the-fly so this window, // floating windows are inserted/removed on-the-fly so this window,
// although needed may not be in workspace's list. // 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 // ToDo: this won't work with FFM
fWorkspace[i]->AttemptToSetFocus(winBorder); fWorkspace[i]->AttemptToSetFocus(windowLayer);
} }
if (fActiveWksIndex == i) { if (fActiveWksIndex == i) {
invalidate = invalid; invalidate = invalid;
if (dynamic_cast<class WorkspacesLayer *>(winBorder->FirstChild()) != NULL) if (dynamic_cast<class WorkspacesLayer *>(windowLayer->FirstChild()) != NULL)
SetWorkspacesLayer(winBorder->FirstChild()); SetWorkspacesLayer(windowLayer->FirstChild());
} }
} }
@@ -656,7 +655,7 @@ RootLayer::ShowWinBorder(WinBorder* winBorder)
void void
RootLayer::ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel) RootLayer::ChangeWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel)
{ {
BAutolock _(fAllRegionsLock); BAutolock _(fAllRegionsLock);
@@ -666,30 +665,30 @@ RootLayer::ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel)
Workspace::State oldWMState; Workspace::State oldWMState;
ActiveWorkspace()->GetState(&oldWMState); ActiveWorkspace()->GetState(&oldWMState);
if (!winBorder->IsHidden()) { if (!windowLayer->IsHidden()) {
isVisible = true; isVisible = true;
isVisibleInActiveWorkspace = ActiveWorkspace()->HasWinBorder(winBorder); isVisibleInActiveWorkspace = ActiveWorkspace()->HasWindowLayer(windowLayer);
// just hide, don't invalidate // just hide, don't invalidate
winBorder->Hide(false); windowLayer->Hide(false);
// all workspaces must be up-to-date with this change of feel. // all workspaces must be up-to-date with this change of feel.
for (int32 i = 0; i < kMaxWorkspaceCount; i++) { for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
if (fWorkspace[i]) { if (fWorkspace[i]) {
fWorkspace[i]->HideWinBorder(winBorder); fWorkspace[i]->HideWindowLayer(windowLayer);
fWorkspace[i]->RemoveWinBorder(winBorder); fWorkspace[i]->RemoveWindowLayer(windowLayer);
} }
} }
} }
fDesktop->SetWinBorderFeel(winBorder, newFeel); fDesktop->SetWindowLayerFeel(windowLayer, newFeel);
if (isVisible) { if (isVisible) {
// just show, don't invalidate // just show, don't invalidate
winBorder->Show(false); windowLayer->Show(false);
// all workspaces must be up-to-date with this change of feel. // all workspaces must be up-to-date with this change of feel.
for (int32 i = 0; i < kMaxWorkspaceCount; i++) { for (int32 i = 0; i < kMaxWorkspaceCount; i++) {
if (fWorkspace[i]) { if (fWorkspace[i]) {
fWorkspace[i]->AddWinBorder(winBorder); fWorkspace[i]->AddWindowLayer(windowLayer);
fWorkspace[i]->ShowWinBorder(winBorder); fWorkspace[i]->ShowWindowLayer(windowLayer);
} }
} }
@@ -857,7 +856,7 @@ GetDrawingEngine()->ConstrainClippingRegion(NULL);
bool bool
RootLayer::SetActive(WinBorder* newActive, bool activate) RootLayer::SetActive(WindowLayer* newActive, bool activate)
{ {
bool returnValue = false; bool returnValue = false;
uint32 workspaceIndex = newActive->Workspaces(); 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. // change to the first one who does.
if (activate && !(workspaceIndex & (0x00000001UL << fActiveWksIndex))) { if (activate && !(workspaceIndex & (0x00000001UL << fActiveWksIndex))) {
// find an workspace index in which this Layer appears // find an workspace index in which this Layer appears
+16 -18
View File
@@ -9,11 +9,9 @@
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.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 <List.h>
#include <Locker.h> #include <Locker.h>
@@ -28,7 +26,7 @@ class DrawingEngine;
class HWInterface; class HWInterface;
class RGBColor; class RGBColor;
class Screen; class Screen;
class WinBorder; class WindowLayer;
namespace BPrivate { namespace BPrivate {
class PortLink; class PortLink;
@@ -63,17 +61,17 @@ public:
virtual void ScrollBy(float x, float y) virtual void ScrollBy(float x, float y)
{ /* not allowed */ } { /* not allowed */ }
void HideWinBorder(WinBorder* winBorder); void HideWindowLayer(WindowLayer* windowLayer);
void ShowWinBorder(WinBorder* winBorder); void ShowWindowLayer(WindowLayer* windowLayer);
void SetWinBorderWorskpaces(WinBorder *winBorder, void SetWindowLayerWorskpaces(WindowLayer *windowLayer,
uint32 oldIndex, uint32 newIndex); uint32 oldIndex, uint32 newIndex);
void RevealNewWMState(Workspace::State &oldWMState); void RevealNewWMState(Workspace::State &oldWMState);
// TODO: we need to replace Winborder* with Layer* // TODO: we need to replace Winborder* with Layer*
inline WinBorder* Focus() const { return fWMState.Focus; } inline WindowLayer* Focus() const { return fWMState.Focus; }
inline WinBorder* Front() const { return fWMState.Front; } inline WindowLayer* Front() const { return fWMState.Front; }
inline WinBorder* Active() const { return fWMState.Active; } inline WindowLayer* Active() const { return fWMState.Active; }
bool SetActive(WinBorder* newActive, bool activate = true); bool SetActive(WindowLayer* newActive, bool activate = true);
inline void SetWorkspaceCount(int32 wksCount); inline void SetWorkspaceCount(int32 wksCount);
inline int32 WorkspaceCount() const { return fWsCount; } inline int32 WorkspaceCount() const { return fWsCount; }
@@ -103,7 +101,7 @@ public:
void Unlock() { fAllRegionsLock.Unlock(); } void Unlock() { fAllRegionsLock.Unlock(); }
bool IsLocked() { return fAllRegionsLock.IsLocked(); } bool IsLocked() { return fAllRegionsLock.IsLocked(); }
void ChangeWinBorderFeel(WinBorder *winBorder, int32 newFeel); void ChangeWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel);
void MarkForRedraw(const BRegion &dirty); void MarkForRedraw(const BRegion &dirty);
void TriggerRedraw(); void TriggerRedraw();
@@ -116,10 +114,10 @@ private:
friend class Desktop; friend class Desktop;
// these are meant for Desktop class only! // these are meant for Desktop class only!
void AddWinBorder(WinBorder* winBorder); void AddWindowLayer(WindowLayer* windowLayer);
void RemoveWinBorder(WinBorder* winBorder); void RemoveWindowLayer(WindowLayer* windowLayer);
void AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder); void AddSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *toWindowLayer);
void RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder); void RemoveSubsetWindowLayer(WindowLayer *windowLayer, WindowLayer *fromWindowLayer);
void MouseEventHandler(BMessage *msg); void MouseEventHandler(BMessage *msg);
Layer* _ChildAt(BPoint where); Layer* _ChildAt(BPoint where);
@@ -155,4 +153,4 @@ friend class Desktop;
#endif #endif
}; };
#endif #endif // ROOT_LAYER_H
+4 -4
View File
@@ -56,7 +56,7 @@
#include "ServerTokenSpace.h" #include "ServerTokenSpace.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "SystemPalette.h" #include "SystemPalette.h"
#include "WinBorder.h" #include "WindowLayer.h"
//#define DEBUG_SERVERAPP //#define DEBUG_SERVERAPP
@@ -535,7 +535,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for(int32 i = 0; i < fWindowList.CountItems(); i++) { for(int32 i = 0; i < fWindowList.CountItems(); i++) {
win=(ServerWindow*)fWindowList.ItemAt(i); win=(ServerWindow*)fWindowList.ItemAt(i);
win->GetWinBorder()->UpdateColors(); win->GetWindowLayer()->UpdateColors();
win->SendMessageToClient(AS_UPDATE_COLORS, msg); win->SendMessageToClient(AS_UPDATE_COLORS, msg);
} }
*/ break; */ break;
@@ -552,7 +552,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for(int32 i=0; i<fSWindowList->CountItems(); i++) for(int32 i=0; i<fSWindowList->CountItems(); i++)
{ {
win=(ServerWindow*)fSWindowList->ItemAt(i); win=(ServerWindow*)fSWindowList->ItemAt(i);
win->GetWinBorder()->UpdateFont(); win->GetWindowLayer()->UpdateFont();
win->SendMessageToClient(AS_UPDATE_FONTS, msg); win->SendMessageToClient(AS_UPDATE_FONTS, msg);
} }
*/ break; */ break;
@@ -666,7 +666,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
for (int32 i = 0; i < fWindowList.CountItems(); i++) { for (int32 i = 0; i < fWindowList.CountItems(); i++) {
ServerWindow *window = fWindowList.ItemAt(i); ServerWindow *window = fWindowList.ItemAt(i);
window->Lock(); window->Lock();
const_cast<WinBorder *>(window->GetWinBorder())->UpdateDecorator(); const_cast<WindowLayer *>(window->GetWindowLayer())->UpdateDecorator();
window->Unlock(); window->Unlock();
} }
break; break;
+112 -113
View File
@@ -16,7 +16,7 @@
A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are 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, 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. mouse and key events from the server to its window, and other such things.
*/ */
@@ -51,7 +51,7 @@
#include "ServerBitmap.h" #include "ServerBitmap.h"
#include "ServerPicture.h" #include "ServerPicture.h"
#include "ServerProtocol.h" #include "ServerProtocol.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Workspace.h" #include "Workspace.h"
#include "WorkspacesLayer.h" #include "WorkspacesLayer.h"
@@ -123,11 +123,10 @@ struct dw_sync_data {
sem_id disableSemAck; sem_id disableSemAck;
}; };
/*! /*!
\brief Constructor Sets up the basic BWindow counterpart - you have to call Init() before
you can actually use it, though.
Does a lot of stuff to set up for the window - new decorator, new winborder, spawn a
monitor thread.
*/ */
ServerWindow::ServerWindow(const char *title, ServerApp *app, ServerWindow::ServerWindow(const char *title, ServerApp *app,
port_id clientPort, port_id looperPort, int32 clientToken) port_id clientPort, port_id looperPort, int32 clientToken)
@@ -135,7 +134,7 @@ ServerWindow::ServerWindow(const char *title, ServerApp *app,
fTitle(NULL), fTitle(NULL),
fDesktop(app->GetDesktop()), fDesktop(app->GetDesktop()),
fServerApp(app), fServerApp(app),
fWinBorder(NULL), fWindowLayer(NULL),
fClientTeam(app->ClientTeam()), fClientTeam(app->ClientTeam()),
fMessagePort(-1), fMessagePort(-1),
fClientReplyPort(clientPort), fClientReplyPort(clientPort),
@@ -162,10 +161,10 @@ ServerWindow::~ServerWindow()
{ {
STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this)); STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this));
if (!fWinBorder->IsOffscreenWindow()) if (!fWindowLayer->IsOffscreenWindow())
fDesktop->RemoveWinBorder(fWinBorder); fDesktop->RemoveWindowLayer(fWindowLayer);
delete fWinBorder; delete fWindowLayer;
free(fTitle); free(fTitle);
delete_port(fMessagePort); delete_port(fMessagePort);
@@ -191,13 +190,13 @@ ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 w
fLink.SetSenderPort(fClientReplyPort); fLink.SetSenderPort(fClientReplyPort);
fLink.SetReceiverPort(fMessagePort); fLink.SetReceiverPort(fMessagePort);
// We cannot call MakeWinBorder in the constructor, since it // We cannot call MakeWindowLayer in the constructor, since it
fWinBorder = MakeWinBorder(frame, fTitle, look, feel, flags, workspace); fWindowLayer = MakeWindowLayer(frame, fTitle, look, feel, flags, workspace);
if (!fWinBorder) if (!fWindowLayer)
return B_NO_MEMORY; return B_NO_MEMORY;
if (!fWinBorder->IsOffscreenWindow()) if (!fWindowLayer->IsOffscreenWindow())
fDesktop->AddWinBorder(fWinBorder); fDesktop->AddWindowLayer(fWindowLayer);
return B_OK; return B_OK;
} }
@@ -216,9 +215,9 @@ ServerWindow::Run()
fLink.Attach<port_id>(fMessagePort); fLink.Attach<port_id>(fMessagePort);
float minWidth, maxWidth, minHeight, maxHeight; 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>(minWidth);
fLink.Attach<float>(maxWidth); fLink.Attach<float>(maxWidth);
fLink.Attach<float>(minHeight); 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 void
ServerWindow::ReplaceDecorator() ServerWindow::ReplaceDecorator()
{ {
@@ -261,23 +260,23 @@ ServerWindow::ReplaceDecorator()
debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n"); debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n");
STRACE(("ServerWindow %s: Replace Decorator\n", fTitle)); STRACE(("ServerWindow %s: Replace Decorator\n", fTitle));
fWinBorder->UpdateDecorator(); fWindowLayer->UpdateDecorator();
} }
//! Shows the window's WinBorder //! Shows the window's WindowLayer
void void
ServerWindow::Show() ServerWindow::Show()
{ {
// NOTE: if you do something else, other than sending a port message, PLEASE lock // NOTE: if you do something else, other than sending a port message, PLEASE lock
STRACE(("ServerWindow %s: Show\n", Title())); STRACE(("ServerWindow %s: Show\n", Title()));
if (fQuitting || !fWinBorder->IsHidden()) if (fQuitting || !fWindowLayer->IsHidden())
return; return;
RootLayer* rootLayer = fWinBorder->GetRootLayer(); RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer && rootLayer->Lock()) { if (rootLayer && rootLayer->Lock()) {
rootLayer->ShowWinBorder(fWinBorder); rootLayer->ShowWindowLayer(fWindowLayer);
rootLayer->Unlock(); rootLayer->Unlock();
} }
@@ -286,22 +285,22 @@ ServerWindow::Show()
} }
//! Hides the window's WinBorder //! Hides the window's WindowLayer
void void
ServerWindow::Hide() ServerWindow::Hide()
{ {
// NOTE: if you do something else, other than sending a port message, PLEASE lock // NOTE: if you do something else, other than sending a port message, PLEASE lock
STRACE(("ServerWindow %s: Hide\n", Title())); STRACE(("ServerWindow %s: Hide\n", Title()));
if (fWinBorder->IsHidden()) if (fWindowLayer->IsHidden())
return; return;
if (fDirectWindowData != NULL) if (fDirectWindowData != NULL)
HandleDirectConnection(B_DIRECT_STOP); HandleDirectConnection(B_DIRECT_STOP);
RootLayer* rootLayer = fWinBorder->GetRootLayer(); RootLayer* rootLayer = fWindowLayer->GetRootLayer();
if (rootLayer && rootLayer->Lock()) { if (rootLayer && rootLayer->Lock()) {
rootLayer->HideWinBorder(fWinBorder); rootLayer->HideWindowLayer(fWindowLayer);
rootLayer->Unlock(); rootLayer->Unlock();
} }
} }
@@ -330,8 +329,8 @@ ServerWindow::SetTitle(const char* newTitle)
rename_thread(Thread(), name); rename_thread(Thread(), name);
} }
if (fWinBorder != NULL) if (fWindowLayer != NULL)
fWinBorder->SetName(newTitle); fWindowLayer->SetName(newTitle);
} }
@@ -357,12 +356,12 @@ ServerWindow::NotifyMinimize(bool minimize)
bool sendMessages = false; bool sendMessages = false;
if (minimize) { if (minimize) {
if (!fWinBorder->IsHidden()) { if (!fWindowLayer->IsHidden()) {
Hide(); Hide();
sendMessages = true; sendMessages = true;
} }
} else { } else {
if (fWinBorder->IsHidden()) { if (fWindowLayer->IsHidden()) {
Show(); Show();
sendMessages = true; sendMessages = true;
} }
@@ -413,18 +412,18 @@ ServerWindow::GetInfo(window_info& info)
info.thread = Thread(); info.thread = Thread();
info.client_token = ClientToken(); info.client_token = ClientToken();
info.client_port = fClientLooperPort; info.client_port = fClientLooperPort;
info.workspaces = fWinBorder->Workspaces(); info.workspaces = fWindowLayer->Workspaces();
info.layer = 0; // ToDo: what is this??? info.layer = 0; // ToDo: what is this???
info.feel = fWinBorder->Feel(); info.feel = fWindowLayer->Feel();
info.flags = fWinBorder->WindowFlags(); info.flags = fWindowLayer->WindowFlags();
info.window_left = (int)floor(fWinBorder->Frame().left); info.window_left = (int)floor(fWindowLayer->Frame().left);
info.window_top = (int)floor(fWinBorder->Frame().top); info.window_top = (int)floor(fWindowLayer->Frame().top);
info.window_right = (int)floor(fWinBorder->Frame().right); info.window_right = (int)floor(fWindowLayer->Frame().right);
info.window_bottom = (int)floor(fWinBorder->Frame().bottom); info.window_bottom = (int)floor(fWindowLayer->Frame().bottom);
info.show_hide_level = fWinBorder->IsHidden() ? 1 : -1; // ??? info.show_hide_level = fWindowLayer->IsHidden() ? 1 : -1; // ???
info.is_mini = fWinBorder->IsHidden(); info.is_mini = fWindowLayer->IsHidden();
} }
@@ -488,13 +487,13 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
Layer *newLayer; Layer *newLayer;
if (link.Code() == AS_LAYER_CREATE_ROOT if (link.Code() == AS_LAYER_CREATE_ROOT
&& (fWinBorder->WindowFlags() & kWorkspacesWindowFlag) != 0) { && (fWindowLayer->WindowFlags() & kWorkspacesWindowFlag) != 0) {
// this is a workspaces window! // this is a workspaces window!
newLayer = new (nothrow) WorkspacesLayer(frame, name, token, resizeMask, newLayer = new (nothrow) WorkspacesLayer(frame, name, token, resizeMask,
flags, fWinBorder->GetDrawingEngine()); flags, fWindowLayer->GetDrawingEngine());
} else { } else {
newLayer = new (nothrow) Layer(frame, name, token, resizeMask, flags, newLayer = new (nothrow) Layer(frame, name, token, resizeMask, flags,
fWinBorder->GetDrawingEngine()); fWindowLayer->GetDrawingEngine());
} }
if (newLayer == NULL) if (newLayer == NULL)
@@ -507,7 +506,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
newLayer->fHidden = hidden; newLayer->fHidden = hidden;
newLayer->fEventMask = eventMask; newLayer->fEventMask = eventMask;
newLayer->fEventOptions = eventOptions; newLayer->fEventOptions = eventOptions;
newLayer->fOwner = fWinBorder; newLayer->fOwner = fWindowLayer;
DesktopSettings settings(fDesktop); DesktopSettings settings(fDesktop);
ServerFont font; ServerFont font;
@@ -516,7 +515,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
// TODO: rework the clipping stuff to remove RootLayer dependency and then // TODO: rework the clipping stuff to remove RootLayer dependency and then
// remove this hack: // remove this hack:
if (fWinBorder->IsOffscreenWindow()) { if (fWindowLayer->IsOffscreenWindow()) {
newLayer->fVisible.Set(newLayer->fFrame); newLayer->fVisible.Set(newLayer->fFrame);
newLayer->fDrawingRegion.Set(newLayer->fFrame); newLayer->fDrawingRegion.Set(newLayer->fFrame);
} }
@@ -550,8 +549,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
return; return;
} }
RootLayer *rootLayer = fWinBorder->GetRootLayer(); RootLayer *rootLayer = fWindowLayer->GetRootLayer();
// NOTE: is NULL when fWinBorder is offscreen! // NOTE: is NULL when fWindowLayer is offscreen!
if (rootLayer) if (rootLayer)
rootLayer->Lock(); rootLayer->Lock();
@@ -618,8 +617,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
if (fCurrentLayer != NULL) if (fCurrentLayer != NULL)
break; break;
fWinBorder->SetTopLayer(CreateLayerTree(link, NULL)); fWindowLayer->SetTopLayer(CreateLayerTree(link, NULL));
fCurrentLayer = fWinBorder->TopLayer(); fCurrentLayer = fWindowLayer->TopLayer();
break; break;
} }
@@ -777,7 +776,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
link.Read<float>(&newHeight); link.Read<float>(&newHeight);
// TODO: If fCurrentLayer is a window, check for minimum size allowed. // TODO: If fCurrentLayer is a window, check for minimum size allowed.
// Need WinBorder::GetSizeLimits // Need WindowLayer::GetSizeLimits
float deltaWidth = newWidth - fCurrentLayer->fFrame.Width(); float deltaWidth = newWidth - fCurrentLayer->fFrame.Width();
float deltaHeight = newHeight - fCurrentLayer->fFrame.Height(); float deltaHeight = newHeight - fCurrentLayer->fFrame.Height();
@@ -1082,7 +1081,7 @@ if (rootLayer)
fCurrentLayer->CurrentState()->SetClippingRegion(region); fCurrentLayer->CurrentState()->SetClippingRegion(region);
if (rootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) { if (rootLayer && !(fCurrentLayer->IsHidden()) && !fWindowLayer->InUpdate()) {
BRegion invalidRegion; BRegion invalidRegion;
fCurrentLayer->GetOnScreenRegion(invalidRegion); fCurrentLayer->GetOnScreenRegion(invalidRegion);
@@ -1192,13 +1191,13 @@ if (rootLayer)
case AS_BEGIN_UPDATE: case AS_BEGIN_UPDATE:
{ {
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title())); DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title()));
fWinBorder->UpdateStart(); fWindowLayer->UpdateStart();
break; break;
} }
case AS_END_UPDATE: case AS_END_UPDATE:
{ {
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title())); DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title()));
fWinBorder->UpdateEnd(); fWindowLayer->UpdateEnd();
break; break;
} }
@@ -1235,12 +1234,12 @@ if (rootLayer)
link.Read<int32>(&token); link.Read<int32>(&token);
link.Read<team_id>(&teamID); link.Read<team_id>(&teamID);
WinBorder *behindOf; WindowLayer *behindOf;
if ((behindOf = fDesktop->FindWinBorderByClientToken(token, teamID)) != NULL) { if ((behindOf = fDesktop->FindWindowLayerByClientToken(token, teamID)) != NULL) {
fWinBorder->GetRootLayer()->Lock(); fWindowLayer->GetRootLayer()->Lock();
// TODO: move to back ATM. Fix this later! // TODO: move to back ATM. Fix this later!
fWinBorder->GetRootLayer()->SetActive(fWinBorder, false); fWindowLayer->GetRootLayer()->SetActive(fWindowLayer, false);
fWinBorder->GetRootLayer()->Unlock(); fWindowLayer->GetRootLayer()->Unlock();
status = B_OK; status = B_OK;
} }
@@ -1253,34 +1252,34 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_BEGIN_TRANSACTION unimplemented\n", STRACE(("ServerWindow %s: Message AS_BEGIN_TRANSACTION unimplemented\n",
Title())); Title()));
// TODO: we could probably do a bit more here... // TODO: we could probably do a bit more here...
fWinBorder->DisableUpdateRequests(); fWindowLayer->DisableUpdateRequests();
break; break;
} }
case AS_END_TRANSACTION: case AS_END_TRANSACTION:
{ {
STRACE(("ServerWindow %s: Message AS_END_TRANSACTION unimplemented\n", STRACE(("ServerWindow %s: Message AS_END_TRANSACTION unimplemented\n",
Title())); Title()));
fWinBorder->EnableUpdateRequests(); fWindowLayer->EnableUpdateRequests();
break; break;
} }
case AS_ENABLE_UPDATES: case AS_ENABLE_UPDATES:
{ {
STRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES unimplemented\n", STRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES unimplemented\n",
Title())); Title()));
fWinBorder->EnableUpdateRequests(); fWindowLayer->EnableUpdateRequests();
break; break;
} }
case AS_DISABLE_UPDATES: case AS_DISABLE_UPDATES:
{ {
STRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES unimplemented\n", STRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES unimplemented\n",
Title())); Title()));
fWinBorder->DisableUpdateRequests(); fWindowLayer->DisableUpdateRequests();
break; break;
} }
case AS_NEEDS_UPDATE: case AS_NEEDS_UPDATE:
{ {
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title())); STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title()));
if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid()) if (fWindowLayer->CulmulatedUpdateRegion().Frame().IsValid())
fLink.StartMessage(B_OK); fLink.StartMessage(B_OK);
else else
fLink.StartMessage(B_ERROR); fLink.StartMessage(B_ERROR);
@@ -1300,21 +1299,21 @@ if (rootLayer)
case AS_ADD_TO_SUBSET: case AS_ADD_TO_SUBSET:
{ {
STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title())); STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title()));
WinBorder *windowBorder; WindowLayer *windowLayer;
int32 mainToken; int32 mainToken;
team_id teamID; team_id teamID;
link.Read<int32>(&mainToken); link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id)); link.Read(&teamID, sizeof(team_id));
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID); windowLayer = fDesktop->FindWindowLayerByClientToken(mainToken, teamID);
if (windowBorder) { if (windowLayer) {
fLink.StartMessage(SERVER_TRUE); fLink.StartMessage(SERVER_TRUE);
fLink.Flush(); fLink.Flush();
fWinBorder->GetRootLayer()->Lock(); fWindowLayer->GetRootLayer()->Lock();
fDesktop->AddWinBorderToSubset(fWinBorder, windowBorder); fDesktop->AddWindowLayerToSubset(fWindowLayer, windowLayer);
fWinBorder->GetRootLayer()->Unlock(); fWindowLayer->GetRootLayer()->Unlock();
} else { } else {
fLink.StartMessage(SERVER_FALSE); fLink.StartMessage(SERVER_FALSE);
fLink.Flush(); fLink.Flush();
@@ -1324,21 +1323,21 @@ if (rootLayer)
case AS_REM_FROM_SUBSET: case AS_REM_FROM_SUBSET:
{ {
STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title())); STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title()));
WinBorder *windowBorder; WindowLayer *windowLayer;
int32 mainToken; int32 mainToken;
team_id teamID; team_id teamID;
link.Read<int32>(&mainToken); link.Read<int32>(&mainToken);
link.Read(&teamID, sizeof(team_id)); link.Read(&teamID, sizeof(team_id));
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID); windowLayer = fDesktop->FindWindowLayerByClientToken(mainToken, teamID);
if (windowBorder) { if (windowLayer) {
fLink.StartMessage(SERVER_TRUE); fLink.StartMessage(SERVER_TRUE);
fLink.Flush(); fLink.Flush();
fWinBorder->GetRootLayer()->Lock(); fWindowLayer->GetRootLayer()->Lock();
fDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder); fDesktop->RemoveWindowLayerFromSubset(fWindowLayer, windowLayer);
fWinBorder->GetRootLayer()->Unlock(); fWindowLayer->GetRootLayer()->Unlock();
} else { } else {
fLink.StartMessage(SERVER_FALSE); fLink.StartMessage(SERVER_FALSE);
fLink.Flush(); fLink.Flush();
@@ -1364,7 +1363,7 @@ if (rootLayer)
int32 newFeel; int32 newFeel;
link.Read<int32>(&newFeel); link.Read<int32>(&newFeel);
fWinBorder->GetRootLayer()->ChangeWinBorderFeel(winBorder, newFeel); fWindowLayer->GetRootLayer()->ChangeWindowLayerFeel(winLayer, newFeel);
break; break;
} }
case AS_SET_ALIGNMENT: case AS_SET_ALIGNMENT:
@@ -1384,7 +1383,7 @@ if (rootLayer)
{ {
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title())); STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title()));
fLink.StartMessage(SERVER_TRUE); fLink.StartMessage(SERVER_TRUE);
fLink.Attach<uint32>(fWinBorder->Workspaces()); fLink.Attach<uint32>(fWindowLayer->Workspaces());
fLink.Flush(); fLink.Flush();
break; break;
} }
@@ -1394,11 +1393,10 @@ if (rootLayer)
uint32 newWorkspaces; uint32 newWorkspaces;
link.Read<uint32>(&newWorkspaces); link.Read<uint32>(&newWorkspaces);
fWinBorder->GetRootLayer()->Lock(); fWindowLayer->GetRootLayer()->Lock();
fWinBorder->GetRootLayer()->SetWinBorderWorskpaces( fWinBorder, fWindowLayer->GetRootLayer()->SetWindowLayerWorskpaces(fWindowLayer,
fWinBorder->Workspaces(), fWindowLayer->Workspaces(), newWorkspaces);
newWorkspaces); fWindowLayer->GetRootLayer()->Unlock();
fWinBorder->GetRootLayer()->Unlock();
break; break;
} }
case AS_WINDOW_RESIZE: case AS_WINDOW_RESIZE:
@@ -1411,7 +1409,7 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy)); STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
fWinBorder->ResizeBy(xResizeBy, yResizeBy); fWindowLayer->ResizeBy(xResizeBy, yResizeBy);
break; break;
} }
case AS_WINDOW_MOVE: case AS_WINDOW_MOVE:
@@ -1424,7 +1422,7 @@ if (rootLayer)
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy)); STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
fWinBorder->MoveBy(xMoveBy, yMoveBy); fWindowLayer->MoveBy(xMoveBy, yMoveBy);
break; break;
} }
case AS_SET_SIZE_LIMITS: case AS_SET_SIZE_LIMITS:
@@ -1445,13 +1443,13 @@ if (rootLayer)
link.Read<float>(&minHeight); link.Read<float>(&minHeight);
link.Read<float>(&maxHeight); 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 // 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.StartMessage(SERVER_TRUE);
fLink.Attach<BRect>(fWinBorder->Frame()); fLink.Attach<BRect>(fWindowLayer->Frame());
fLink.Attach<float>(minWidth); fLink.Attach<float>(minWidth);
fLink.Attach<float>(maxWidth); fLink.Attach<float>(maxWidth);
fLink.Attach<float>(minHeight); fLink.Attach<float>(minHeight);
@@ -1468,7 +1466,7 @@ if (rootLayer)
link.Read<bool>(&activate); link.Read<bool>(&activate);
if (rootLayer && rootLayer->Lock()) { if (rootLayer && rootLayer->Lock()) {
rootLayer->SetActive(fWinBorder, activate); rootLayer->SetActive(fWindowLayer, activate);
rootLayer->Unlock(); rootLayer->Unlock();
} }
break; break;
@@ -1663,10 +1661,10 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
// checks both these conditions // checks both these conditions
BRegion rreg(fCurrentLayer->DrawingRegion()); BRegion rreg(fCurrentLayer->DrawingRegion());
if (fWinBorder->InUpdate()) if (fWindowLayer->InUpdate())
rreg.IntersectWith(&fWinBorder->RegionToBeUpdated()); rreg.IntersectWith(&fWindowLayer->RegionToBeUpdated());
DrawingEngine* driver = fWinBorder->GetDrawingEngine(); DrawingEngine* driver = fWindowLayer->GetDrawingEngine();
if (!driver) { if (!driver) {
// ?!? // ?!?
DTRACE(("ServerWindow %s: no display driver!!\n", Title())); DTRACE(("ServerWindow %s: no display driver!!\n", Title()));
@@ -2077,11 +2075,11 @@ ServerWindow::_MessageLooper()
quitLoop = true; quitLoop = true;
// ToDo: what's this? // ToDo: what's this?
//RootLayer *rootLayer = fWinBorder->GetRootLayer(); //RootLayer *rootLayer = fWindowLayer->GetRootLayer();
// we are preparing to delete a ServerWindow, RootLayer should be aware // we are preparing to delete a ServerWindow, RootLayer should be aware
// of that and stop for a moment. // 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) { //while(1) {
// rootLayer->Lock(); // rootLayer->Lock();
// if (IsHidden()) // if (IsHidden())
@@ -2091,7 +2089,7 @@ ServerWindow::_MessageLooper()
//} //}
// ServerWindow's destructor takes care of pulling this object off the desktop. // 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"); CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
break; break;
@@ -2144,13 +2142,12 @@ ServerWindow::SendMessageToClient(const BMessage* msg, int32 target) const
} }
WinBorder* WindowLayer*
ServerWindow::MakeWinBorder(BRect frame, const char* name, ServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, uint32 look, uint32 feel, uint32 flags, uint32 workspace)
uint32 workspace)
{ {
// The non-offscreen ServerWindow uses the DrawingEngine instance from the desktop. // 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()); workspace, this, fDesktop->GetDrawingEngine());
} }
@@ -2198,28 +2195,30 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
fDirectWindowData->direct_info->layout = B_BUFFER_NONINTERLEAVED; fDirectWindowData->direct_info->layout = B_BUFFER_NONINTERLEAVED;
fDirectWindowData->direct_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO fDirectWindowData->direct_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO
WinBorder *border = const_cast<WinBorder *>(GetWinBorder()); WindowLayer *layer = const_cast<WindowLayer *>(GetWindowLayer());
fDirectWindowData->direct_info->window_bounds = to_clipping_rect(border->Frame()); fDirectWindowData->direct_info->window_bounds = to_clipping_rect(layer->Frame());
// TODO: Review this // 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 ? // TODO: Is there a simpler way to obtain this result ?
// We just want the region INSIDE the window, border excluded. // We just want the region INSIDE the window, border excluded.
BRegion clipRegion = const_cast<BRegion &>(border->FullVisible()); BRegion clipRegion = const_cast<BRegion &>(layer->FullVisible());
BRegion exclude = const_cast<BRegion &>(border->VisibleRegion()); BRegion exclude = const_cast<BRegion &>(layer->VisibleRegion());
clipRegion.Exclude(&exclude); 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(); fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
for (uint32 i = 0; i < fDirectWindowData->direct_info->clip_list_count; i++) for (uint32 i = 0; i < fDirectWindowData->direct_info->clip_list_count; i++)
fDirectWindowData->direct_info->clip_list[i] = clipRegion.RectAtInt(i); fDirectWindowData->direct_info->clip_list[i] = clipRegion.RectAtInt(i);
} }
// Releasing this sem causes the client to call BDirectWindow::DirectConnected() // Releasing this sem causes the client to call BDirectWindow::DirectConnected()
release_sem(fDirectWindowData->direct_sem); release_sem(fDirectWindowData->direct_sem);
// TODO: Waiting half a second in this thread is not a problem, // 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. // 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 ?) // 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. // Test, but I think half a second is enough.
status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 500000); status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 500000);
} while (status == B_INTERRUPTED); } while (status == B_INTERRUPTED);
if (status < B_OK) { if (status < B_OK) {
// The client application didn't release the semaphore // The client application didn't release the semaphore
// within the given timeout. Or something else went wrong. // within the given timeout. Or something else went wrong.
@@ -2242,7 +2241,7 @@ ServerWindow::HandleDirectConnection(int bufferState, int driverState)
status_t status_t
ServerWindow::PictureToRegion(ServerPicture *picture, BRegion &region, ServerWindow::PictureToRegion(ServerPicture *picture, BRegion &region,
bool inverse, BPoint where) bool inverse, BPoint where)
{ {
fprintf(stderr, "ServerWindow::PictureToRegion() not implemented\n"); fprintf(stderr, "ServerWindow::PictureToRegion() not implemented\n");
region.MakeEmpty(); region.MakeEmpty();
+6 -8
View File
@@ -35,7 +35,7 @@ class BMessage;
class Desktop; class Desktop;
class ServerApp; class ServerApp;
class Decorator; class Decorator;
class WinBorder; class WindowLayer;
class Workspace; class Workspace;
class RootLayer; class RootLayer;
class Layer; class Layer;
@@ -78,11 +78,9 @@ public:
status_t SendMessageToClient(const BMessage* msg, status_t SendMessageToClient(const BMessage* msg,
int32 target = B_NULL_TOKEN) const; int32 target = B_NULL_TOKEN) const;
virtual WinBorder* MakeWinBorder(BRect frame, virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
const char* name, uint32 look, uint32 feel, uint32 flags,
uint32 look, uint32 feel, uint32 workspace);
uint32 flags, uint32 workspace);
// TODO: Ouch, that's not exactly a nice name // TODO: Ouch, that's not exactly a nice name
inline BMessage &ClientViewsWithInvalidCoords() inline BMessage &ClientViewsWithInvalidCoords()
@@ -90,7 +88,7 @@ public:
// to who we belong. who do we own. our title. // to who we belong. who do we own. our title.
inline ServerApp* App() const { return fServerApp; } 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); void SetTitle(const char* newTitle);
inline const char* Title() const { return fTitle; } inline const char* Title() const { return fTitle; }
@@ -134,7 +132,7 @@ private:
Desktop* fDesktop; Desktop* fDesktop;
ServerApp* fServerApp; ServerApp* fServerApp;
WinBorder* fWinBorder; WindowLayer* fWindowLayer;
team_id fClientTeam; team_id fClientTeam;
+26 -25
View File
@@ -8,48 +8,49 @@
/** List class for tracking floating and modal windows */ /** List class for tracking floating and modal windows */
#include <stdio.h>
#include <List.h>
#include "SubWindowList.h" #include "SubWindowList.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include <List.h>
SubWindowList::SubWindowList(void) #include <stdio.h>
SubWindowList::SubWindowList()
{ {
} }
SubWindowList::~SubWindowList(void) SubWindowList::~SubWindowList()
{ {
} }
void void
SubWindowList::AddWinBorder(WinBorder *border) SubWindowList::AddWindowLayer(WindowLayer *windowLayer)
{ {
if (HasItem(border)) if (HasItem(windowLayer))
return; return;
int32 borderFeel = border->Feel();; int32 borderFeel = windowLayer->Feel();;
int32 location = 0; int32 location = 0;
for (; location < CountItems(); location++) { 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 if ((borderFeel == B_FLOATING_SUBSET_WINDOW_FEEL
|| borderFeel == B_FLOATING_APP_WINDOW_FEEL || borderFeel == B_FLOATING_APP_WINDOW_FEEL
|| borderFeel == B_FLOATING_ALL_WINDOW_FEEL) || borderFeel == B_FLOATING_ALL_WINDOW_FEEL)
&& (feelTemp == B_MODAL_SUBSET_WINDOW_FEEL && (feelTemp == B_MODAL_SUBSET_WINDOW_FEEL
|| feelTemp == B_MODAL_APP_WINDOW_FEEL || feelTemp == B_MODAL_APP_WINDOW_FEEL
|| feelTemp == B_MODAL_ALL_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; break;
} }
} }
AddItem(border, location); AddItem(windowLayer, location);
} }
@@ -58,7 +59,7 @@ SubWindowList::AddSubWindowList(SubWindowList *list)
{ {
int32 i = 0; int32 i = 0;
for (; i < CountItems(); i++) { for (; i < CountItems(); i++) {
int32 feel = ((WinBorder*)ItemAt(i))->Feel(); int32 feel = ((WindowLayer*)ItemAt(i))->Feel();
if (feel == B_MODAL_SUBSET_WINDOW_FEEL if (feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_MODAL_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL
|| feel == B_MODAL_ALL_WINDOW_FEEL) || feel == B_MODAL_ALL_WINDOW_FEEL)
@@ -67,7 +68,7 @@ SubWindowList::AddSubWindowList(SubWindowList *list)
for (int32 j = 0; j < list->CountItems(); j++) { for (int32 j = 0; j < list->CountItems(); j++) {
void *item = list->ItemAt(j); void *item = list->ItemAt(j);
int32 feel = ((WinBorder*)item)->Feel(); int32 feel = ((WindowLayer*)item)->Feel();
if (feel == B_MODAL_SUBSET_WINDOW_FEEL if (feel == B_MODAL_SUBSET_WINDOW_FEEL
|| feel == B_MODAL_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL
|| feel == B_MODAL_ALL_WINDOW_FEEL) { || feel == B_MODAL_ALL_WINDOW_FEEL) {
@@ -84,33 +85,33 @@ void
SubWindowList::PrintToStream() const SubWindowList::PrintToStream() const
{ {
printf("Floating and modal windows list:\n"); printf("Floating and modal windows list:\n");
WinBorder* wb = NULL; WindowLayer* windowLayer = NULL;
for (int32 i=0; i<CountItems(); i++) { 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"); 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"); 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"); 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"); 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"); 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"); printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
// this should NOT happen // 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"); printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
} }
} }
+2 -2
View File
@@ -13,14 +13,14 @@
#include <Window.h> #include <Window.h>
class WinBorder; class WindowLayer;
class SubWindowList : public BList { class SubWindowList : public BList {
public: public:
SubWindowList(void); SubWindowList(void);
virtual ~SubWindowList(void); virtual ~SubWindowList(void);
void AddWinBorder(WinBorder *border); void AddWindowLayer(WindowLayer *windowLayer);
// special // special
void AddSubWindowList(SubWindowList *list); void AddSubWindowList(SubWindowList *list);
@@ -26,16 +26,12 @@
#include "RootLayer.h" #include "RootLayer.h"
#include "ServerApp.h" #include "ServerApp.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Workspace.h" #include "Workspace.h"
// Toggle debug output
// Toggle general function call output
//#define DEBUG_WINBORDER //#define DEBUG_WINBORDER
// toggle
//#define DEBUG_WINBORDER_MOUSE
//#define DEBUG_WINBORDER_CLICK //#define DEBUG_WINBORDER_CLICK
#ifdef DEBUG_WINBORDER #ifdef DEBUG_WINBORDER
@@ -45,13 +41,6 @@
# define STRACE(x) ; # define STRACE(x) ;
#endif #endif
#ifdef DEBUG_WINBORDER_MOUSE
# include <stdio.h>
# define STRACE_MOUSE(x) printf x
#else
# define STRACE_MOUSE(x) ;
#endif
#ifdef DEBUG_WINBORDER_CLICK #ifdef DEBUG_WINBORDER_CLICK
# include <stdio.h> # include <stdio.h>
# define STRACE_CLICK(x) printf x # define STRACE_CLICK(x) printf x
@@ -59,7 +48,8 @@
# define STRACE_CLICK(x) ; # define STRACE_CLICK(x) ;
#endif #endif
WinBorder::WinBorder(const BRect &frame,
WindowLayer::WindowLayer(const BRect &frame,
const char *name, const char *name,
const uint32 look, const uint32 look,
const uint32 feel, const uint32 feel,
@@ -127,20 +117,20 @@ WinBorder::WinBorder(const BRect &frame,
if (window->App()->GetDesktop()->ScreenAt(0)) { if (window->App()->GetDesktop()->ScreenAt(0)) {
window->App()->GetDesktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency); 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()! // 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, STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
fFrame.right, fFrame.bottom)); fFrame.right, fFrame.bottom));
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL")); 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; delete fDecorator;
} }
@@ -148,10 +138,10 @@ WinBorder::~WinBorder()
//! redraws a certain section of the window border //! redraws a certain section of the window border
void void
WinBorder::Draw(const BRect& updateRect) WindowLayer::Draw(const BRect& updateRect)
{ {
#ifdef DEBUG_WINBORDER #ifdef DEBUG_WINBORDER
printf("WinBorder(%s)::Draw() : ", Name()); printf("WindowLayer(%s)::Draw() : ", Name());
r.PrintToStream(); r.PrintToStream();
#endif #endif
@@ -165,7 +155,7 @@ WinBorder::Draw(const BRect& updateRect)
//! Moves the winborder with redraw //! Moves the winborder with redraw
void void
WinBorder::MoveBy(float x, float y) WindowLayer::MoveBy(float x, float y)
{ {
if (x == 0.0f && y == 0.0f) if (x == 0.0f && y == 0.0f)
return; return;
@@ -215,7 +205,7 @@ WinBorder::MoveBy(float x, float y)
void void
WinBorder::ResizeBy(float x, float y) WindowLayer::ResizeBy(float x, float y)
{ {
float wantWidth = fFrame.Width() + x; float wantWidth = fFrame.Width() + x;
float wantHeight = fFrame.Height() + y; float wantHeight = fFrame.Height() + y;
@@ -272,7 +262,7 @@ WinBorder::ResizeBy(float x, float y)
void void
WinBorder::SetName(const char* name) WindowLayer::SetName(const char* name)
{ {
Layer::SetName(name); Layer::SetName(name);
@@ -294,7 +284,7 @@ WinBorder::SetName(const char* name)
void void
WinBorder::UpdateStart() WindowLayer::UpdateStart()
{ {
// During updates we only want to draw what's in the update region // During updates we only want to draw what's in the update region
fInUpdate = true; fInUpdate = true;
@@ -303,7 +293,7 @@ WinBorder::UpdateStart()
void void
WinBorder::UpdateEnd() WindowLayer::UpdateEnd()
{ {
// The usual case. Drawing is permitted in the whole visible area. // The usual case. Drawing is permitted in the whole visible area.
@@ -319,7 +309,7 @@ WinBorder::UpdateEnd()
void void
WinBorder::EnableUpdateRequests() WindowLayer::EnableUpdateRequests()
{ {
fUpdateRequestsEnabled = true; fUpdateRequestsEnabled = true;
if (fCumulativeRegion.CountRects() > 0) { if (fCumulativeRegion.CountRects() > 0) {
@@ -331,7 +321,7 @@ WinBorder::EnableUpdateRequests()
//! Sets the minimum and maximum sizes of the window //! Sets the minimum and maximum sizes of the window
void void
WinBorder::SetSizeLimits(float minWidth, float maxWidth, WindowLayer::SetSizeLimits(float minWidth, float maxWidth,
float minHeight, float maxHeight) float minHeight, float maxHeight)
{ {
if (minWidth < 0) if (minWidth < 0)
@@ -387,7 +377,7 @@ WinBorder::SetSizeLimits(float minWidth, float maxWidth,
void void
WinBorder::GetSizeLimits(float* minWidth, float* maxWidth, WindowLayer::GetSizeLimits(float* minWidth, float* maxWidth,
float* minHeight, float* maxHeight) const float* minHeight, float* maxHeight) const
{ {
*minWidth = fMinWidth; *minWidth = fMinWidth;
@@ -398,12 +388,12 @@ WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
void 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); Layer *target = LayerAt(where);
if (target == this) { if (target == this) {
// clicking WinBorder visible area // clicking WindowLayer visible area
click_type action = DEC_DRAG; click_type action = DEC_DRAG;
@@ -484,7 +474,7 @@ WinBorder::MouseDown(BMessage *msg, BPoint where)
void void
WinBorder::MouseUp(BMessage *msg, BPoint where) WindowLayer::MouseUp(BMessage *msg, BPoint where)
{ {
bool invalidate = false; bool invalidate = false;
if (fDecorator) { if (fDecorator) {
@@ -532,7 +522,7 @@ WinBorder::MouseUp(BMessage *msg, BPoint where)
void void
WinBorder::MouseMoved(BMessage *msg, BPoint where) WindowLayer::MouseMoved(BMessage *msg, BPoint where)
{ {
if (fDecorator) { if (fDecorator) {
// TODO: present behavior is not fine! // TODO: present behavior is not fine!
@@ -566,10 +556,10 @@ WinBorder::MouseMoved(BMessage *msg, BPoint where)
// change focus in FFM mode // change focus in FFM mode
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop()); DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!! // 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) { if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && exFocus != this) {
GetRootLayer()->ActiveWorkspace()->AttemptToSetFocus(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()) { // if (exFocus != Focus()) {
// TODO: invalidate border area and send message to client for the widgets to light up // TODO: invalidate border area and send message to client for the widgets to light up
// What message? Is there a message on Focus change? // What message? Is there a message on Focus change?
@@ -585,7 +575,7 @@ WinBorder::MouseMoved(BMessage *msg, BPoint where)
void void
WinBorder::WorkspaceActivated(int32 index, bool active) WindowLayer::WorkspaceActivated(int32 index, bool active)
{ {
BMessage activatedMsg(B_WORKSPACE_ACTIVATED); BMessage activatedMsg(B_WORKSPACE_ACTIVATED);
activatedMsg.AddInt64("when", real_time_clock_usecs()); activatedMsg.AddInt64("when", real_time_clock_usecs());
@@ -597,7 +587,7 @@ WinBorder::WorkspaceActivated(int32 index, bool active)
void void
WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces) WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
{ {
fWorkspaces = newWorkspaces; fWorkspaces = newWorkspaces;
@@ -611,7 +601,7 @@ WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
void void
WinBorder::Activated(bool active) WindowLayer::Activated(bool active)
{ {
BMessage msg(B_WINDOW_ACTIVATED); BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", active); msg.AddBool("active", active);
@@ -620,7 +610,7 @@ WinBorder::Activated(bool active)
void void
WinBorder::SetTabLocation(float location) WindowLayer::SetTabLocation(float location)
{ {
if (fDecorator) if (fDecorator)
fDecorator->SetTabLocation(location); fDecorator->SetTabLocation(location);
@@ -628,7 +618,7 @@ WinBorder::SetTabLocation(float location)
float float
WinBorder::TabLocation() const WindowLayer::TabLocation() const
{ {
if (fDecorator) if (fDecorator)
return fDecorator->TabLocation(); return fDecorator->TabLocation();
@@ -638,7 +628,7 @@ WinBorder::TabLocation() const
//! Sets the decorator focus to active or inactive colors //! Sets the decorator focus to active or inactive colors
void void
WinBorder::HighlightDecorator(bool active) WindowLayer::HighlightDecorator(bool active)
{ {
STRACE(("Decorator->Highlight\n")); STRACE(("Decorator->Highlight\n"));
if (fDecorator) if (fDecorator)
@@ -647,39 +637,39 @@ WinBorder::HighlightDecorator(bool active)
void void
WinBorder::UpdateColors() WindowLayer::UpdateColors()
{ {
// Unimplemented. Hook function for handling when system GUI colors change // 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 void
WinBorder::UpdateDecorator() WindowLayer::UpdateDecorator()
{ {
// Unimplemented. Hook function for handling when the system decorator changes // 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 void
WinBorder::UpdateFont() WindowLayer::UpdateFont()
{ {
// Unimplemented. Hook function for handling when a system font changes // 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 void
WinBorder::UpdateScreen() WindowLayer::UpdateScreen()
{ {
// Unimplemented. Hook function for handling when the screen resolution changes // 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 void
WinBorder::QuietlySetFeel(int32 feel) WindowLayer::QuietlySetFeel(int32 feel)
{ {
fFeel = feel; fFeel = feel;
@@ -746,7 +736,7 @@ WinBorder::QuietlySetFeel(int32 feel)
click_type click_type
WinBorder::_ActionFor(const BMessage *msg) const WindowLayer::_ActionFor(const BMessage *msg) const
{ {
BPoint where(0,0); BPoint where(0,0);
int32 buttons = 0; int32 buttons = 0;
@@ -764,7 +754,7 @@ WinBorder::_ActionFor(const BMessage *msg) const
void void
WinBorder::set_decorator_region(BRect bounds) WindowLayer::set_decorator_region(BRect bounds)
{ {
fRebuildDecRegion = false; fRebuildDecRegion = false;
@@ -776,7 +766,7 @@ WinBorder::set_decorator_region(BRect bounds)
void void
WinBorder::_ReserveRegions(BRegion &reg) WindowLayer::_ReserveRegions(BRegion &reg)
{ {
BRegion reserve(reg); BRegion reserve(reg);
reserve.IntersectWith(&fDecRegion); reserve.IntersectWith(&fDecRegion);
@@ -786,7 +776,7 @@ WinBorder::_ReserveRegions(BRegion &reg)
void void
WinBorder::GetOnScreenRegion(BRegion& region) WindowLayer::GetOnScreenRegion(BRegion& region)
{ {
if (fRebuildDecRegion) if (fRebuildDecRegion)
set_decorator_region(Bounds()); set_decorator_region(Bounds());
@@ -803,7 +793,7 @@ WinBorder::GetOnScreenRegion(BRegion& region)
void void
WinBorder::RequestClientRedraw(const BRegion &invalid) WindowLayer::RequestClientRedraw(const BRegion &invalid)
{ {
BRegion updateReg(fTopLayer->FullVisible()); BRegion updateReg(fTopLayer->FullVisible());
updateReg.IntersectWith(&invalid); updateReg.IntersectWith(&invalid);
@@ -835,7 +825,7 @@ WinBorder::RequestClientRedraw(const BRegion &invalid)
void void
WinBorder::SetTopLayer(Layer* layer) WindowLayer::SetTopLayer(Layer* layer)
{ {
if (fTopLayer != NULL) { if (fTopLayer != NULL) {
RemoveChild(fTopLayer); RemoveChild(fTopLayer);
@@ -6,14 +6,17 @@
* Adi Oanca <adioanca@gmail.com> * Adi Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de> * Stephan Aßmus <superstippi@gmx.de>
*/ */
#ifndef _WINBORDER_H_ #ifndef WINDOW_LAYER_H
#define _WINBORDER_H_ #define WINDOW_LAYER_H
#include "Decorator.h"
#include "Layer.h"
#include "SubWindowList.h"
#include <Rect.h> #include <Rect.h>
#include <String.h> #include <String.h>
#include "Layer.h"
#include "SubWindowList.h"
#include "Decorator.h"
// these are used by window manager to properly place window. // these are used by window manager to properly place window.
enum { enum {
@@ -33,9 +36,9 @@ class Decorator;
class DrawingEngine; class DrawingEngine;
class Desktop; class Desktop;
class WinBorder : public Layer { class WindowLayer : public Layer {
public: public:
WinBorder(const BRect &frame, WindowLayer(const BRect &frame,
const char *name, const char *name,
const uint32 look, const uint32 look,
const uint32 feel, const uint32 feel,
@@ -43,7 +46,7 @@ class WinBorder : public Layer {
const uint32 workspaces, const uint32 workspaces,
ServerWindow *window, ServerWindow *window,
DrawingEngine *driver); DrawingEngine *driver);
virtual ~WinBorder(); virtual ~WindowLayer();
virtual void Draw(const BRect &r); virtual void Draw(const BRect &r);
@@ -168,4 +171,4 @@ class WinBorder : public Layer {
float fMaxHeight; float fMaxHeight;
}; };
#endif #endif // WINDOW_LAYER_H
+81 -82
View File
@@ -37,7 +37,7 @@
// system last windows which will always be behind all other kind of windows. // 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 // 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 // windows, system first, modall all and floating all windows. Those remaining
// are: modal subset, modal app, floating subset and floating app. Those will be // are: modal subset, modal app, floating subset and floating app. Those will be
// added and removed on-the-fly as they are needed. // added and removed on-the-fly as they are needed.
@@ -69,7 +69,7 @@
#include "Workspace.h" #include "Workspace.h"
#include "Layer.h" #include "Layer.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "ServerWindow.h" #include "ServerWindow.h"
#include "ServerApp.h" #include "ServerApp.h"
#include "RGBColor.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 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) { if (winBorder->Level() == B_FLOATING_APP) {
// floating windows are automaticaly added when needed // floating windows are automaticaly added when needed
// you cannot add one by hand. // you cannot add one by hand.
@@ -162,7 +162,7 @@ STRACE(("W(%ld)::AddWinBorder(%s)\n", fID, winBorder?winBorder->Name():"NULL"));
if (HasItem(winBorder)) { if (HasItem(winBorder)) {
// NOTE: you may remove 'debugger' at Release Candidate time // 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; 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 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); ListData* item = HasItem(winBorder);
if (item) { if (item) {
@@ -192,27 +192,27 @@ Workspace::RemoveWinBorder(WinBorder *winBorder)
bool bool
Workspace::HasWinBorder(const WinBorder* winBorder) const Workspace::HasWindowLayer(const WindowLayer* winBorder) const
{ {
return HasItem(winBorder) ? true: false; return HasItem(winBorder) ? true: false;
} }
WinBorder * WindowLayer *
Workspace::Focus() const Workspace::Focus() const
{ {
return fFocusItem ? fFocusItem->layerPtr : NULL; return fFocusItem ? fFocusItem->layerPtr : NULL;
} }
WinBorder * WindowLayer *
Workspace::Front() const Workspace::Front() const
{ {
return fFrontItem ? fFrontItem->layerPtr: NULL; return fFrontItem ? fFrontItem->layerPtr: NULL;
} }
WinBorder * WindowLayer *
Workspace::Active() const Workspace::Active() const
{ {
// in case of a normal or modal window // in case of a normal or modal window
@@ -251,13 +251,13 @@ Workspace::GetState(Workspace::State *state) const
} }
} }
bool bool
Workspace::AttemptToSetFront(WinBorder *newFront) Workspace::AttemptToSetFront(WindowLayer *newFront)
{ {
return MoveToFront(newFront); return MoveToFront(newFront);
} }
int32 int32
Workspace::AttemptToSetFocus(WinBorder *newFocus) Workspace::AttemptToSetFocus(WindowLayer *newFocus)
{ {
ListData* newFocusItem = HasItem(newFocus); ListData* newFocusItem = HasItem(newFocus);
@@ -265,13 +265,13 @@ Workspace::AttemptToSetFocus(WinBorder *newFocus)
} }
bool bool
Workspace::AttemptToMoveToBack(WinBorder *newBack) Workspace::AttemptToMoveToBack(WindowLayer *newBack)
{ {
return MoveToBack(newBack); return MoveToBack(newBack);
} }
bool bool
Workspace::AttemptToActivate(WinBorder *toActivate) Workspace::AttemptToActivate(WindowLayer *toActivate)
{ {
MoveToFront(toActivate); MoveToFront(toActivate);
AttemptToSetFocus(toActivate); AttemptToSetFocus(toActivate);
@@ -279,11 +279,11 @@ Workspace::AttemptToActivate(WinBorder *toActivate)
} }
/* /*
\brief This method provides you the list of visible windows in this workspace. \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 list The list of visible WindowLayers found in this workspace.
\param itemCount Number of WinBorder pointers found in the list. \param itemCount Number of WindowLayer pointers found in the list.
*/ */
bool bool
Workspace::GetWinBorderList(void **list, int32 *itemCount ) const Workspace::GetWindowLayerList(void **list, int32 *itemCount ) const
{ {
int32 count = 0; int32 count = 0;
ListData* cursor; ListData* cursor;
@@ -318,14 +318,14 @@ Workspace::GetWinBorderList(void **list, int32 *itemCount ) const
} }
/*! /*!
\brief Makes the specified WinBorder the focus one. \brief Makes the specified WindowLayer the focus one.
\param newFocus WinBorder which will try to take focus state. \param newFocus WindowLayer which will try to take focus state.
\return 0 - setting focus failed, focus did not change. \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 2 - focus changed but not to \a winBorder because in front of it there
are other modal windows. are other modal windows.
Set a new focus WinBorder if possible. Set a new focus WindowLayer if possible.
*/ */
int32 int32
@@ -336,7 +336,7 @@ Workspace::_SetFocus(ListData *newFocusItem)
&& newFocusItem->layerPtr->WindowFlags() & B_AVOID_FOCUS)) && newFocusItem->layerPtr->WindowFlags() & B_AVOID_FOCUS))
return 0L; return 0L;
WinBorder *newFocus = newFocusItem->layerPtr; WindowLayer *newFocus = newFocusItem->layerPtr;
bool rv = 1; bool rv = 1;
switch(newFocus->Level()) { switch(newFocus->Level()) {
@@ -384,13 +384,13 @@ Workspace::_SetFocus(ListData *newFocusItem)
} }
/*! /*!
\brief Makes the specified WinBorder the front one. \brief Makes the specified WindowLayer the front one.
\param newFront WinBorder which will try to take front state. \param newFront WindowLayer which will try to take front state.
\param doNotDisturb In case user is busy typing something, don't bring \a newFront \param doNotDisturb In case user is busy typing something, don't bring \a newFront
in front stealing front&focus, but place imediately after. 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 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 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 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. Note that floating windows cannot get/have front state.
*/ */
bool bool
Workspace::MoveToFront(WinBorder *newFront, bool doNotDisturb) Workspace::MoveToFront(WindowLayer *newFront, bool doNotDisturb)
{ {
STRACE(("\nWks(%ld)::MoveToFront ~%s~ \n", fID, newFront?newFront->Name():"NULL")); STRACE(("\nWks(%ld)::MoveToFront ~%s~ \n", fID, newFront?newFront->Name():"NULL"));
if (!newFront) if (!newFront)
@@ -412,16 +412,16 @@ Workspace::MoveToFront(WinBorder *newFront, bool doNotDisturb)
return false; return false;
} }
return ShowWinBorder(newFront); return ShowWindowLayer(newFront);
} }
/*! /*!
\brief Moves the specified WinBorder in the back as it is possible. \brief Moves the specified WindowLayer in the back as it is possible.
\param newLast WinBorder which will be placed in the back. \param newLast WindowLayer which will be placed in the back.
\return True if the list of WinBorders has changed, false otherwise. \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 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 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 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. B_NORMAL window in front of which they appear.
*/ */
bool bool
Workspace::MoveToBack(WinBorder *newLast) Workspace::MoveToBack(WindowLayer *newLast)
{ {
STRACE(("Wks(%ld)::MoveToBack(%s) \n", fID, newLast? newLast->Name(): "NULL")); STRACE(("Wks(%ld)::MoveToBack(%s) \n", fID, newLast? newLast->Name(): "NULL"));
if (newLast->IsHidden()) if (newLast->IsHidden())
@@ -586,19 +586,19 @@ Workspace::MoveToBack(WinBorder *newLast)
/*! /*!
\brief Hides a WinBorder. \brief Hides a WindowLayer.
\param winBorder WinBorder to be hidden. \param winBorder WindowLayer to be hidden.
\return True if the list of WinBorders has changed, false otherwise. \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. 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. chosen. Same goes for focus.
*/ */
bool 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; bool returnValue = false;
int32 level = winBorder->Level(); int32 level = winBorder->Level();
bool changeFront = false; bool changeFront = false;
@@ -629,7 +629,7 @@ Workspace::HideWinBorder(WinBorder *winBorder)
if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL) { if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL) {
ListData* item = HasItem(winBorder); ListData* item = HasItem(winBorder);
if (item) { if (item) {
fFrontItem->layerPtr->fSubWindowList.AddWinBorder(winBorder); fFrontItem->layerPtr->fSubWindowList.AddWindowLayer(winBorder);
RemoveItem(item); RemoveItem(item);
fPool.ReleaseMemory(item); fPool.ReleaseMemory(item);
@@ -699,7 +699,7 @@ Workspace::HideWinBorder(WinBorder *winBorder)
} }
default: 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 // select a new Front if needed
@@ -740,18 +740,18 @@ Workspace::HideWinBorder(WinBorder *winBorder)
} }
/*! /*!
\brief Shows a WinBorder. \brief Shows a WindowLayer.
\param winBorder WinBorder to be show. \param winBorder WindowLayer to be show.
\return True if the list of WinBorders has changed, false otherwise. \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 ones will be placed in front if needed. Front & Focus state will be given to \a winBorder
unless a modal windows steals both. unless a modal windows steals both.
*/ */
bool 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; bool returnValue = false;
int32 level = winBorder->Level(); int32 level = winBorder->Level();
if (level > B_SYSTEM_FIRST) if (level > B_SYSTEM_FIRST)
@@ -845,7 +845,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
ListData* itemThis = HasItem(winBorder); ListData* itemThis = HasItem(winBorder);
if (!itemThis) { 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; return false;
} }
@@ -900,7 +900,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
userBusy = false; userBusy = false;
} else { } else {
// SUBSET modal // SUBSET modal
WinBorder *mainWindow = searchFirstMainWindow(winBorder); WindowLayer *mainWindow = searchFirstMainWindow(winBorder);
if (mainWindow) { if (mainWindow) {
// add both mainWindow's subset modals and application's modals // add both mainWindow's subset modals and application's modals
tempList.AddList(&mainWindow->fSubWindowList); tempList.AddList(&mainWindow->fSubWindowList);
@@ -921,7 +921,7 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL) if (fFrontItem && fFrontItem->layerPtr->Level() == B_NORMAL)
saveFloatingWindows(fFrontItem); saveFloatingWindows(fFrontItem);
// find and remove the Workspace's entry for this WinBorder. // find and remove the Workspace's entry for this WindowLayer.
ListData *itemThis; ListData *itemThis;
itemThis = HasItem(winBorder); itemThis = HasItem(winBorder);
if (itemThis) { if (itemThis) {
@@ -944,16 +944,16 @@ Workspace::ShowWinBorder(WinBorder *winBorder, bool userBusy)
{ {
ListData* before = itemThis->lowerItem; ListData* before = itemThis->lowerItem;
int32 i, count; int32 i, count;
WinBorder** wbList; WindowLayer** wbList;
ListData* itemX; ListData* itemX;
int32 indexThisInTempList; int32 indexThisInTempList;
indexThisInTempList = tempList.IndexOf(winBorder); indexThisInTempList = tempList.IndexOf(winBorder);
if (indexThisInTempList < 0) if (indexThisInTempList < 0)
debugger("ShowWinBorder: modal window: design flaw!!!\n"); debugger("ShowWindowLayer: modal window: design flaw!!!\n");
count = tempList.CountItems(); count = tempList.CountItems();
wbList = (WinBorder**)tempList.Items(); wbList = (WindowLayer**)tempList.Items();
for (i = indexThisInTempList; i < count; i++) { for (i = indexThisInTempList; i < count; i++) {
if (!wbList[i]->IsHidden()) { if (!wbList[i]->IsHidden()) {
itemX = HasItem(wbList[i], &revIndexItem); itemX = HasItem(wbList[i], &revIndexItem);
@@ -1237,7 +1237,7 @@ Workspace::PrintToStream() const
printf("Workspace %ld hierarchy shown from back to front:\n", fID); printf("Workspace %ld hierarchy shown from back to front:\n", fID);
for (ListData *item = fTopItem; item != NULL; item = item->lowerItem) 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"); printf("\tName: %s\t%s", wb->Name(), wb->IsHidden()?"Hidden\t": "Visible\t");
if(wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) if(wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "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"); printf("ListData members:\n");
if(item) 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("UpperItem:\t%s\n", item->upperItem? item->upperItem->layerPtr->Name(): "NULL");
printf("LowerItem:\t%s\n", item->lowerItem? item->lowerItem->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* ListData*
Workspace::HasItem(const WinBorder *layer, int32 *index) const Workspace::HasItem(const WindowLayer *layer, int32 *index) const
{ {
int32 idx = 0; int32 idx = 0;
ListData* itemX; 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 void
Workspace::placeInFront(ListData *item, const bool userBusy) 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 \brief Insert the specified WindowLayer before given item. First search the
specified WinBorder in Workspace's list an remove it. specified WindowLayer in Workspace's list an remove it.
\resolution: private \resolution: private
*/ */
inline bool inline bool
Workspace::removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem) Workspace::removeAndPlaceBefore(const WindowLayer *wb, ListData *beforeItem)
{ {
return removeAndPlaceBefore(HasItem(wb), beforeItem); return removeAndPlaceBefore(HasItem(wb), beforeItem);
} }
inline WinBorder* inline WindowLayer*
Workspace::searchANormalWindow(WinBorder *wb) const Workspace::searchANormalWindow(WindowLayer *wb) const
{ {
ListData* listItem = fBottomItem; ListData* listItem = fBottomItem;
while (listItem) { while (listItem) {
@@ -1574,8 +1574,8 @@ Workspace::searchANormalWindow(WinBorder *wb) const
} }
inline WinBorder* inline WindowLayer*
Workspace::searchFirstMainWindow(WinBorder *wb) const Workspace::searchFirstMainWindow(WindowLayer *wb) const
{ {
ListData* listItem = fBottomItem; ListData* listItem = fBottomItem;
while (listItem) { while (listItem) {
@@ -1592,14 +1592,14 @@ Workspace::searchFirstMainWindow(WinBorder *wb) const
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
inline inline
bool Workspace::windowHasVisibleModals(const WinBorder *winBorder) const bool Workspace::windowHasVisibleModals(const WindowLayer *winBorder) const
{ {
int32 i, count; int32 i, count;
WinBorder **wbList; WindowLayer **wbList;
// check window's list // check window's list
count = winBorder->fSubWindowList.CountItems(); count = winBorder->fSubWindowList.CountItems();
wbList = (WinBorder**)winBorder->fSubWindowList.Items(); wbList = (WindowLayer**)winBorder->fSubWindowList.Items();
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{ {
if (wbList[i]->Level() == B_MODAL_APP && !wbList[i]->IsHidden()) 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. // application's list only has modal windows.
count = winBorder->App()->fAppSubWindowList.CountItems(); count = winBorder->App()->fAppSubWindowList.CountItems();
wbList = (WinBorder**)winBorder->App()->fAppSubWindowList.Items(); wbList = (WindowLayer**)winBorder->App()->fAppSubWindowList.Items();
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{ {
if (!wbList[i]->IsHidden()) if (!wbList[i]->IsHidden())
@@ -1624,7 +1624,7 @@ inline
ListData* Workspace::putModalsInFront(ListData *item) ListData* Workspace::putModalsInFront(ListData *item)
{ {
int32 i, count, revIndex, revIndexItem; int32 i, count, revIndex, revIndexItem;
WinBorder **wbList; WindowLayer **wbList;
ListData *itemX; ListData *itemX;
ListData *lastPlaced = NULL; ListData *lastPlaced = NULL;
ListData *before = item->lowerItem; ListData *before = item->lowerItem;
@@ -1633,7 +1633,7 @@ ListData* Workspace::putModalsInFront(ListData *item)
// check window's list // check window's list
count = item->layerPtr->fSubWindowList.CountItems(); count = item->layerPtr->fSubWindowList.CountItems();
wbList = (WinBorder**)item->layerPtr->fSubWindowList.Items(); wbList = (WindowLayer**)item->layerPtr->fSubWindowList.Items();
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{ {
if (wbList[i]->Level() == B_MODAL_APP && !wbList[i]->IsHidden()) 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. // application's list only has modal windows.
count = item->layerPtr->App()->fAppSubWindowList.CountItems(); 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++) for(i = 0; i < count; i++)
{ {
if (!wbList[i]->IsHidden()) if (!wbList[i]->IsHidden())
@@ -1680,18 +1680,17 @@ ListData* Workspace::putModalsInFront(ListData *item)
return lastPlaced; return lastPlaced;
} }
//----------------------------------------------------------------------------------
inline void
void Workspace::putFloatingInFront(ListData *item) Workspace::putFloatingInFront(ListData *item)
{ {
int32 i; int32 i;
ListData *newItem; ListData *newItem;
ListData *before = item->lowerItem; ListData *before = item->lowerItem;
WinBorder *wb; WindowLayer *wb;
i = 0; i = 0;
while ((wb = (WinBorder*)item->layerPtr->fSubWindowList.ItemAt(i))) while ((wb = (WindowLayer*)item->layerPtr->fSubWindowList.ItemAt(i)))
{ {
if (wb->Level() == B_MODAL_APP) if (wb->Level() == B_MODAL_APP)
{ {
@@ -1721,7 +1720,7 @@ void Workspace::saveFloatingWindows(ListData *itemNormal)
{ {
if (item->layerPtr->Level() == B_FLOATING_APP) if (item->layerPtr->Level() == B_FLOATING_APP)
{ {
itemNormal->layerPtr->fSubWindowList.AddWinBorder(item->layerPtr); itemNormal->layerPtr->fSubWindowList.AddWindowLayer(item->layerPtr);
toast = item; toast = item;
item = item->lowerItem; item = item->lowerItem;
@@ -1782,7 +1781,7 @@ Workspace::MemoryPool::~MemoryPool()
} }
inline inline
ListData* Workspace::MemoryPool::GetCleanMemory(WinBorder *winBorder) ListData* Workspace::MemoryPool::GetCleanMemory(WindowLayer *winBorder)
{ {
ListData *item = (ListData*)malloc(sizeof(ListData)); ListData *item = (ListData*)malloc(sizeof(ListData));
item->layerPtr = winBorder; item->layerPtr = winBorder;
+27 -27
View File
@@ -37,12 +37,12 @@
#include "RGBColor.h" #include "RGBColor.h"
class WinBorder; class WindowLayer;
struct ListData struct ListData
{ {
bool isFree; bool isFree;
WinBorder *layerPtr; WindowLayer *layerPtr;
ListData *upperItem; ListData *upperItem;
ListData *lowerItem; ListData *lowerItem;
}; };
@@ -55,9 +55,9 @@ class Workspace {
void PrintToStream(); void PrintToStream();
WinBorder* Front; WindowLayer* Front;
WinBorder* Focus; WindowLayer* Focus;
WinBorder* Active; WindowLayer* Active;
BList WindowList; BList WindowList;
}; };
Workspace( const int32 ID, Workspace( const int32 ID,
@@ -67,26 +67,26 @@ class Workspace {
int32 ID() const { return fID; } int32 ID() const { return fID; }
void AddWinBorder(WinBorder *winBorder); void AddWindowLayer(WindowLayer *winBorder);
void RemoveWinBorder(WinBorder *winBorder); void RemoveWindowLayer(WindowLayer *winBorder);
bool HasWinBorder(const WinBorder *winBorder) const; bool HasWindowLayer(const WindowLayer *winBorder) const;
WinBorder* Focus() const; WindowLayer* Focus() const;
WinBorder* Front() const; WindowLayer* Front() const;
WinBorder* Active() const; WindowLayer* Active() const;
void GetState(Workspace::State *state) const; void GetState(Workspace::State *state) const;
bool AttemptToSetFront(WinBorder *newFront); bool AttemptToSetFront(WindowLayer *newFront);
int32 AttemptToSetFocus(WinBorder *newFocus); int32 AttemptToSetFocus(WindowLayer *newFocus);
bool AttemptToMoveToBack(WinBorder *newBack); bool AttemptToMoveToBack(WindowLayer *newBack);
bool AttemptToActivate(WinBorder *toActivate); bool AttemptToActivate(WindowLayer *toActivate);
bool GetWinBorderList(void **list, int32 *itemCount ) const; bool GetWindowLayerList(void **list, int32 *itemCount ) const;
bool MoveToBack(WinBorder *newLast); bool MoveToBack(WindowLayer *newLast);
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false); bool MoveToFront(WindowLayer *newFront, bool doNotDisturb = false);
bool HideWinBorder(WinBorder *winBorder); bool HideWindowLayer(WindowLayer *winBorder);
bool ShowWinBorder(WinBorder *winBorder, bool userBusy = false); bool ShowWindowLayer(WindowLayer *winBorder, bool userBusy = false);
// resolution related methods. // resolution related methods.
status_t SetDisplayMode(const display_mode &mode); status_t SetDisplayMode(const display_mode &mode);
@@ -109,7 +109,7 @@ private:
void InsertItem(ListData *item, ListData *before); void InsertItem(ListData *item, ListData *before);
void RemoveItem(ListData *item); void RemoveItem(ListData *item);
ListData* HasItem(const ListData *item, int32 *index = NULL) const; 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; int32 IndexOf(const ListData *item) const;
bool placeToBack(ListData *newLast); bool placeToBack(ListData *newLast);
@@ -117,13 +117,13 @@ private:
int32 _SetFocus(ListData *newFocusItem); int32 _SetFocus(ListData *newFocusItem);
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem); bool removeAndPlaceBefore(const WindowLayer *wb, ListData *beforeItem);
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem); bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
WinBorder* searchFirstMainWindow(WinBorder *wb) const; WindowLayer* searchFirstMainWindow(WindowLayer *wb) const;
WinBorder* searchANormalWindow(WinBorder *wb) const; WindowLayer* searchANormalWindow(WindowLayer *wb) const;
bool windowHasVisibleModals(const WinBorder *winBorder) const; bool windowHasVisibleModals(const WindowLayer *winBorder) const;
ListData* putModalsInFront(ListData *item); ListData* putModalsInFront(ListData *item);
void putFloatingInFront(ListData *item); void putFloatingInFront(ListData *item);
void saveFloatingWindows(ListData *itemNormal); void saveFloatingWindows(ListData *itemNormal);
@@ -135,7 +135,7 @@ private:
public: public:
MemoryPool(); MemoryPool();
~MemoryPool(); ~MemoryPool();
ListData* GetCleanMemory(WinBorder* winborder); ListData* GetCleanMemory(WindowLayer* winborder);
void ReleaseMemory(ListData* mem); void ReleaseMemory(ListData* mem);
private: private:
void expandBuffer(int32 start); void expandBuffer(int32 start);
@@ -152,7 +152,7 @@ private:
// the last visible(or covered by other Layers) // the last visible(or covered by other Layers)
ListData *fTopItem; ListData *fTopItem;
// the focus WinBorder - for keyboard events // the focus WindowLayer - for keyboard events
ListData *fFocusItem; ListData *fFocusItem;
// pointer for which "big" actions are intended // pointer for which "big" actions are intended
+4 -4
View File
@@ -14,7 +14,7 @@
#include "AppServer.h" #include "AppServer.h"
#include "DrawingEngine.h" #include "DrawingEngine.h"
#include "RootLayer.h" #include "RootLayer.h"
#include "WinBorder.h" #include "WindowLayer.h"
#include "Workspace.h" #include "Workspace.h"
#include "WorkspacesLayer.h" #include "WorkspacesLayer.h"
@@ -94,7 +94,7 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
void void
WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame, WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window, const BRect& screenFrame, WindowLayer* window,
BRegion& backgroundRegion, bool active) BRegion& backgroundRegion, bool active)
{ {
if (window->Feel() == kDesktopWindowFeel) if (window->Feel() == kDesktopWindowFeel)
@@ -170,9 +170,9 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
// ToDo: would be nice to get the real update region here // ToDo: would be nice to get the real update region here
if (workspace != NULL) { if (workspace != NULL) {
WinBorder* windows[256]; WindowLayer* windows[256];
int32 count = 256; int32 count = 256;
if (!workspace->GetWinBorderList((void **)&windows, &count)) if (!workspace->GetWindowLayerList((void **)&windows, &count))
return; return;
uint16 width, height; uint16 width, height;
+2 -2
View File
@@ -11,7 +11,7 @@
#include "Layer.h" #include "Layer.h"
class WinBorder; class WindowLayer;
class WorkspacesLayer : public Layer { class WorkspacesLayer : public Layer {
@@ -29,7 +29,7 @@ class WorkspacesLayer : public Layer {
const BRect& screenFrame, const BRect& windowFrame); const BRect& screenFrame, const BRect& windowFrame);
void _DrawWindow(const BRect& workspaceFrame, void _DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window, const BRect& screenFrame, WindowLayer* window,
BRegion& backgroundRegion, bool active); BRegion& backgroundRegion, bool active);
void _DrawWorkspace(int32 index); void _DrawWorkspace(int32 index);