Some cleanup:

* look/feel are now window_look/window_feel instead of int32.
* removed the level stuff, I don't think this is needed.
* some other minor stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15261 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-12-01 12:07:28 +00:00
parent 649e929c7a
commit 85096c8acb
7 changed files with 44 additions and 103 deletions
+1 -2
View File
@@ -43,8 +43,7 @@ OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
WindowLayer* WindowLayer*
OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name, OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, window_look look, window_feel feel, uint32 flags, uint32 workspace)
uint32 workspace)
{ {
return new OffscreenWindowLayer(fBitmap, name, this); return new OffscreenWindowLayer(fBitmap, name, this);
} }
+1 -1
View File
@@ -28,7 +28,7 @@ class OffscreenServerWindow : public ServerWindow {
bool usePreferred = false) const; bool usePreferred = false) const;
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name, virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, window_look look, window_feel feel, uint32 flags,
uint32 workspace); uint32 workspace);
private: private:
+5 -3
View File
@@ -479,15 +479,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
} }
} else { } else {
window = new ServerWindow(title, this, clientReplyPort, looperPort, token); window = new ServerWindow(title, this, clientReplyPort, looperPort, token);
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n", STRACE(("\nServerApp %s: New Window %s (%g:%g, %g:%g)\n",
fSignature(), title, frame.left, frame.top, frame.right, frame.bottom)); fSignature(), title, frame.left, frame.top,
frame.right, frame.bottom));
} }
free(title); free(title);
// NOTE: the reply to the client is handled in ServerWindow::Run() // NOTE: the reply to the client is handled in ServerWindow::Run()
if (window != NULL) { if (window != NULL) {
status = window->Init(frame, look, feel, flags, workspaces); status = window->Init(frame, (window_look)look, (window_feel)feel,
flags, workspaces);
if (status == B_OK && !window->Run()) if (status == B_OK && !window->Run())
status = B_ERROR; status = B_ERROR;
+4 -3
View File
@@ -198,7 +198,8 @@ ServerWindow::~ServerWindow()
status_t status_t
ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 workspace) ServerWindow::Init(BRect frame, window_look look, window_feel feel,
uint32 flags, uint32 workspace)
{ {
if (fTitle == NULL) if (fTitle == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -2175,10 +2176,10 @@ ServerWindow::SendMessageToClient(const BMessage* msg, int32 target) const
WindowLayer* WindowLayer*
ServerWindow::MakeWindowLayer(BRect frame, const char* name, ServerWindow::MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, uint32 workspace) window_look look, window_feel feel, uint32 flags, 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) WindowLayer(frame, name, look, feel, flags, return new (nothrow) WindowLayer(frame, name, look, feel, flags,
workspace, this, fDesktop->GetDrawingEngine()); workspace, this, fDesktop->GetDrawingEngine());
} }
+3 -3
View File
@@ -54,8 +54,8 @@ public:
int32 clientToken); int32 clientToken);
virtual ~ServerWindow(); virtual ~ServerWindow();
status_t Init(BRect frame, uint32 look, status_t Init(BRect frame, window_look look,
uint32 feel, uint32 flags, window_feel feel, uint32 flags,
uint32 workspace); uint32 workspace);
virtual bool Run(); virtual bool Run();
virtual port_id MessagePort() const { return fMessagePort; } virtual port_id MessagePort() const { return fMessagePort; }
@@ -79,7 +79,7 @@ public:
int32 target = B_NULL_TOKEN) const; int32 target = B_NULL_TOKEN) const;
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name, virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
uint32 look, uint32 feel, uint32 flags, window_look look, window_feel feel, uint32 flags,
uint32 workspace); uint32 workspace);
// TODO: Ouch, that's not exactly a nice name // TODO: Ouch, that's not exactly a nice name
+7 -52
View File
@@ -50,13 +50,9 @@
WindowLayer::WindowLayer(const BRect &frame, WindowLayer::WindowLayer(const BRect &frame,
const char *name, const char *name, window_look look, window_feel feel,
const uint32 look, uint32 flags, uint32 workspaces,
const uint32 feel, ServerWindow *window, DrawingEngine *driver)
const uint32 flags,
const uint32 workspaces,
ServerWindow *window,
DrawingEngine *driver)
: Layer(frame, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver), : Layer(frame, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
fDecorator(NULL), fDecorator(NULL),
fTopLayer(NULL), fTopLayer(NULL),
@@ -84,7 +80,7 @@ WindowLayer::WindowLayer(const BRect &frame,
fRequestSent(false), fRequestSent(false),
fLook(look), fLook(look),
fLevel(-100), fFeel(feel),
fWindowFlags(flags), fWindowFlags(flags),
fWorkspaces(workspaces), fWorkspaces(workspaces),
@@ -98,9 +94,7 @@ WindowLayer::WindowLayer(const BRect &frame,
fWindow = window; fWindow = window;
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE; fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
QuietlySetFeel(feel); if (fLook != B_NO_BORDER_WINDOW_LOOK) {
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
fDecorator = gDecorManager.AllocateDecorator(window->App()->GetDesktop(), frame, fDecorator = gDecorManager.AllocateDecorator(window->App()->GetDesktop(), frame,
name, fLook, fFeel, fWindowFlags); name, fLook, fFeel, fWindowFlags);
if (fDecorator) if (fDecorator)
@@ -673,48 +667,11 @@ WindowLayer::SupportsFront()
void void
WindowLayer::QuietlySetFeel(int32 feel) WindowLayer::SetFeel(window_feel feel)
{ {
fFeel = feel; fFeel = feel;
switch (fFeel) { // TODO: this shouldn't be necessary, but we'll see :)
case B_FLOATING_SUBSET_WINDOW_FEEL:
case B_FLOATING_APP_WINDOW_FEEL:
fLevel = B_FLOATING_APP;
break;
case B_MODAL_SUBSET_WINDOW_FEEL:
case B_MODAL_APP_WINDOW_FEEL:
fLevel = B_MODAL_APP;
break;
case B_NORMAL_WINDOW_FEEL:
fLevel = B_NORMAL;
break;
case B_FLOATING_ALL_WINDOW_FEEL:
fLevel = B_FLOATING_ALL;
break;
case B_MODAL_ALL_WINDOW_FEEL:
fLevel = B_MODAL_ALL;
break;
// TODO: This case is bogus, since I'm sure "feel"
// is being represented by uint32 somewhere before
// this function is used. And B_SYSTEM_LAST is defined -10. -Stephan
case B_SYSTEM_LAST:
case kDesktopWindowFeel:
fLevel = B_SYSTEM_LAST;
break;
case B_SYSTEM_FIRST:
fLevel = B_SYSTEM_FIRST;
break;
default:
fLevel = B_NORMAL;
}
// floating and modal windows must appear in every workspace where // floating and modal windows must appear in every workspace where
// their main window is present. Thus their fWorkspaces will be set to // their main window is present. Thus their fWorkspaces will be set to
@@ -729,8 +686,6 @@ WindowLayer::QuietlySetFeel(int32 feel)
break; break;
case B_MODAL_ALL_WINDOW_FEEL: case B_MODAL_ALL_WINDOW_FEEL:
case B_FLOATING_ALL_WINDOW_FEEL: case B_FLOATING_ALL_WINDOW_FEEL:
case B_SYSTEM_LAST:
case B_SYSTEM_FIRST:
fWorkspaces = 0xffffffffUL; fWorkspaces = 0xffffffffUL;
break; break;
case B_NORMAL_WINDOW_FEEL: case B_NORMAL_WINDOW_FEEL:
+17 -33
View File
@@ -18,19 +18,6 @@
#include <String.h> #include <String.h>
// these are used by window manager to properly place window.
enum {
B_SYSTEM_LAST = -10L,
B_FLOATING_APP = 0L,
B_MODAL_APP = 1L,
B_NORMAL = 2L,
B_FLOATING_ALL = 3L,
B_MODAL_ALL = 4L,
B_SYSTEM_FIRST = 10L,
};
class ServerWindow; class ServerWindow;
class Decorator; class Decorator;
class DrawingEngine; class DrawingEngine;
@@ -39,12 +26,9 @@ class Desktop;
class WindowLayer : public Layer { class WindowLayer : public Layer {
public: public:
WindowLayer(const BRect &frame, WindowLayer(const BRect &frame,
const char *name, const char *name, window_look look,
const uint32 look, window_feel feel, uint32 flags,
const uint32 feel, uint32 workspaces, ServerWindow *window,
const uint32 flags,
const uint32 workspaces,
ServerWindow *window,
DrawingEngine *driver); DrawingEngine *driver);
virtual ~WindowLayer(); virtual ~WindowLayer();
@@ -84,9 +68,9 @@ class WindowLayer : public Layer {
float* minHeight, float* minHeight,
float* maxHeight) const; float* maxHeight) const;
virtual void MouseDown(BMessage *msg, BPoint where, int32* _viewToken); virtual void MouseDown(BMessage* message, BPoint where, int32* _viewToken);
virtual void MouseUp(BMessage *msg, BPoint where, int32* _viewToken); virtual void MouseUp(BMessage* message, BPoint where, int32* _viewToken);
virtual void MouseMoved(BMessage *msg, BPoint where, int32* _viewToken); virtual void MouseMoved(BMessage* message, BPoint where, int32* _viewToken);
// click_type ActionFor(const BMessage *msg) // click_type ActionFor(const BMessage *msg)
// { return _ActionFor(evt); } // { return _ActionFor(evt); }
@@ -105,10 +89,9 @@ class WindowLayer : public Layer {
inline Decorator* GetDecorator() const { return fDecorator; } inline Decorator* GetDecorator() const { return fDecorator; }
inline int32 Look() const { return fLook; } window_look Look() const { return fLook; }
inline int32 Feel() const { return fFeel; } window_feel Feel() const { return fFeel; }
inline int32 Level() const { return fLevel; } uint32 WindowFlags() const { return fWindowFlags; }
inline uint32 WindowFlags() const { return fWindowFlags; }
uint32 Workspaces() const { return fWorkspaces; } uint32 Workspaces() const { return fWorkspaces; }
void SetWorkspaces(uint32 workspaces) void SetWorkspaces(uint32 workspaces)
@@ -124,18 +107,20 @@ class WindowLayer : public Layer {
void HighlightDecorator(bool active); void HighlightDecorator(bool active);
inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; } void SetFeel(window_feel feel);
void QuietlySetFeel(int32 feel); void SetLook(window_look look);
SubWindowList fSubWindowList; SubWindowList fSubWindowList;
void RequestClientRedraw(const BRegion& invalid); void RequestClientRedraw(const BRegion& invalid);
virtual void _AllRedraw(const BRegion& invalid);
void SetTopLayer(Layer* layer); void SetTopLayer(Layer* layer);
inline Layer* TopLayer() const inline Layer* TopLayer() const
{ return fTopLayer; } { return fTopLayer; }
protected:
virtual void _AllRedraw(const BRegion& invalid);
private: private:
void set_decorator_region(BRect frame); void set_decorator_region(BRect frame);
virtual void _ReserveRegions(BRegion &reg); virtual void _ReserveRegions(BRegion &reg);
@@ -172,10 +157,9 @@ class WindowLayer : public Layer {
bool fInUpdate; bool fInUpdate;
bool fRequestSent; bool fRequestSent;
int32 fLook; window_look fLook;
int32 fFeel; window_feel fFeel;
int32 fLevel; uint32 fWindowFlags;
int32 fWindowFlags;
uint32 fWorkspaces; uint32 fWorkspaces;
float fMinWidth; float fMinWidth;