* Ingo broke binary compatibility of Window.h in r18649, thanks to Stefano

for finding this. This should fix bug #1734.
* Removed unused BWindow members and the temporary PrintToStream() method.
* Indentation cleanup (DirectWindow.h had some spaces instead of tabs).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23863 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-02-04 15:01:34 +00:00
parent 4d67ea42f3
commit 7cb9337835
3 changed files with 265 additions and 375 deletions
+13 -13
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2007, Haiku. * Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -68,11 +68,13 @@ class BDirectWindow : public BWindow {
virtual void DispatchMessage(BMessage *message, BHandler *handler); virtual void DispatchMessage(BMessage *message, BHandler *handler);
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual void FrameMoved(BPoint newPosition); virtual void FrameMoved(BPoint newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces); virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces);
virtual void WorkspaceActivated(int32 workspaceIndex, bool state); virtual void WorkspaceActivated(int32 workspaceIndex, bool state);
virtual void FrameResized(float newWidth, float newHeight); virtual void FrameResized(float newWidth, float newHeight);
virtual void Minimize(bool minimize); virtual void Minimize(bool minimize);
virtual void Zoom(BPoint recPosition, float recWidth, float recHeight); virtual void Zoom(BPoint recPosition, float recWidth,
float recHeight);
virtual void ScreenChanged(BRect screenFrame, color_space depth); virtual void ScreenChanged(BRect screenFrame, color_space depth);
virtual void MenusBeginning(); virtual void MenusBeginning();
virtual void MenusEnded(); virtual void MenusEnded();
@@ -89,18 +91,16 @@ class BDirectWindow : public BWindow {
virtual void task_looper(); virtual void task_looper();
virtual BMessage* ConvertToMessage(void *raw, int32 code); virtual BMessage* ConvertToMessage(void *raw, int32 code);
public: public:
virtual void DirectConnected(direct_buffer_info *info); virtual void DirectConnected(direct_buffer_info *info);
status_t GetClippingRegion(BRegion *region, BPoint *origin = NULL) const; status_t GetClippingRegion(BRegion *region,
BPoint *origin = NULL) const;
status_t SetFullScreen(bool enable); status_t SetFullScreen(bool enable);
bool IsFullScreen() const; bool IsFullScreen() const;
static bool SupportsWindowMode(screen_id id = B_MAIN_SCREEN_ID); static bool SupportsWindowMode(screen_id id = B_MAIN_SCREEN_ID);
private: private:
typedef BWindow inherited; typedef BWindow inherited;
virtual void _ReservedDirectWindow1(); virtual void _ReservedDirectWindow1();
@@ -109,10 +109,10 @@ class BDirectWindow : public BWindow {
virtual void _ReservedDirectWindow4(); virtual void _ReservedDirectWindow4();
BDirectWindow(); BDirectWindow();
BDirectWindow(BDirectWindow &); BDirectWindow(BDirectWindow& other);
BDirectWindow &operator=(BDirectWindow &); BDirectWindow& operator=(BDirectWindow& other);
static int32 _daemon_thread(void *arg); static int32 _daemon_thread(void* arg);
int32 _DirectDaemon(); int32 _DirectDaemon();
bool _LockDirect() const; bool _LockDirect() const;
void _UnlockDirect() const; void _UnlockDirect() const;
@@ -130,7 +130,7 @@ class BDirectWindow : public BWindow {
sem_id fDirectSem; sem_id fDirectSem;
uint32 fDirectLockCount; uint32 fDirectLockCount;
thread_id fDirectLockOwner; thread_id fDirectLockOwner;
char *fDirectLockStack; char* fDirectLockStack;
sem_id fDisableSem; sem_id fDisableSem;
sem_id fDisableSemAck; sem_id fDisableSemAck;
@@ -143,9 +143,9 @@ class BDirectWindow : public BWindow {
area_id fClonedClippingArea; area_id fClonedClippingArea;
area_id fSourceClippingArea; area_id fSourceClippingArea;
thread_id fDirectDaemonId; thread_id fDirectDaemonId;
direct_buffer_info *fBufferDesc; direct_buffer_info* fBufferDesc;
uint32 _more_reserved_[17]; uint32 _more_reserved_[17];
}; };
#endif #endif // _DIRECT_WINDOW_H
+23 -44
View File
@@ -96,13 +96,11 @@ public:
window_type type, uint32 flags, window_type type, uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE); uint32 workspace = B_CURRENT_WORKSPACE);
BWindow(BRect frame, const char* title, BWindow(BRect frame, const char* title,
window_look look, window_feel feel, window_look look, window_feel feel, uint32 flags,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE); uint32 workspace = B_CURRENT_WORKSPACE);
virtual ~BWindow(); virtual ~BWindow();
BWindow(BMessage* data); BWindow(BMessage* data);
static BArchivable* Instantiate(BMessage* data); static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const; virtual status_t Archive(BMessage* data, bool deep = true) const;
@@ -117,27 +115,24 @@ public:
virtual void DispatchMessage(BMessage* message, virtual void DispatchMessage(BMessage* message,
BHandler* handler); BHandler* handler);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void FrameMoved(BPoint new_position); virtual void FrameMoved(BPoint newPosition);
virtual void WorkspacesChanged(uint32 oldWorkspaces, virtual void WorkspacesChanged(uint32 oldWorkspaces,
uint32 newWorkspaces); uint32 newWorkspaces);
virtual void WorkspaceActivated(int32 workspace, virtual void WorkspaceActivated(int32 workspace, bool state);
bool state);
virtual void FrameResized(float newWidth, float newHeight); virtual void FrameResized(float newWidth, float newHeight);
virtual void Minimize(bool minimize); virtual void Minimize(bool minimize);
virtual void Zoom(BPoint origin, float width, float height); virtual void Zoom(BPoint origin, float width, float height);
void Zoom(); void Zoom();
void SetZoomLimits(float maxWidth, float maxHeight); void SetZoomLimits(float maxWidth, float maxHeight);
virtual void ScreenChanged(BRect screenSize, virtual void ScreenChanged(BRect screenSize, color_space format);
color_space format);
void SetPulseRate(bigtime_t rate); void SetPulseRate(bigtime_t rate);
bigtime_t PulseRate() const; bigtime_t PulseRate() const;
void AddShortcut(uint32 key, uint32 modifiers, void AddShortcut(uint32 key, uint32 modifiers,
BMessage *message); BMessage* message);
void AddShortcut(uint32 key, uint32 modifiers, void AddShortcut(uint32 key, uint32 modifiers,
BMessage *message, BMessage* message, BHandler* target);
BHandler *target);
void RemoveShortcut(uint32 key, uint32 modifiers); void RemoveShortcut(uint32 key, uint32 modifiers);
void SetDefaultButton(BButton* button); void SetDefaultButton(BButton* button);
@@ -237,22 +232,15 @@ public:
bool IsModal() const; bool IsModal() const;
bool IsFloating() const; bool IsFloating() const;
status_t SetWindowAlignment(window_alignment mode, status_t SetWindowAlignment(window_alignment mode, int32 h,
int32 h, int32 hOffset = 0, int32 width = 0,
int32 hOffset = 0, int32 widthOffset = 0, int32 v = 0,
int32 width = 0, int32 vOffset = 0, int32 height = 0,
int32 widthOffset = 0,
int32 v = 0,
int32 vOffset = 0,
int32 height = 0,
int32 heightOffset = 0); int32 heightOffset = 0);
status_t GetWindowAlignment(window_alignment* mode = NULL, status_t GetWindowAlignment(window_alignment* mode = NULL,
int32* h = NULL, int32* h = NULL, int32* hOffset = NULL,
int32* hOffset = NULL, int32* width = NULL, int32* widthOffset = NULL,
int32* width = NULL, int32* v = NULL, int32* vOffset = NULL,
int32* widthOffset = NULL,
int32* v = NULL,
int32* vOffset = NULL,
int32* height = NULL, int32* height = NULL,
int32* heightOffset = NULL) const; int32* heightOffset = NULL) const;
@@ -282,7 +270,6 @@ private:
friend void _set_menu_sem_(BWindow* w, sem_id sem); friend void _set_menu_sem_(BWindow* w, sem_id sem);
friend status_t _safe_get_server_token_(const BLooper*, int32*); friend status_t _safe_get_server_token_(const BLooper*, int32*);
virtual void _ReservedWindow1();
virtual void _ReservedWindow2(); virtual void _ReservedWindow2();
virtual void _ReservedWindow3(); virtual void _ReservedWindow3();
virtual void _ReservedWindow4(); virtual void _ReservedWindow4();
@@ -301,7 +288,6 @@ private:
uint32 flags, uint32 workspace, uint32 flags, uint32 workspace,
int32 bitmapToken = -1); int32 bitmapToken = -1);
void BitmapClose(); // to be implemented
virtual void task_looper(); virtual void task_looper();
virtual BMessage* ConvertToMessage(void* raw, int32 code); virtual BMessage* ConvertToMessage(void* raw, int32 code);
@@ -311,12 +297,10 @@ private:
BHandler* _DetermineTarget(BMessage* message, BHandler* _DetermineTarget(BMessage* message,
BHandler* target); BHandler* target);
bool _UnpackMessage(unpack_cookie& state, bool _UnpackMessage(unpack_cookie& state,
BMessage** _message, BMessage** _message, BHandler** _target,
BHandler** _target,
bool* _usePreferred); bool* _usePreferred);
void _SanitizeMessage(BMessage* message, void _SanitizeMessage(BMessage* message,
BHandler* target, BHandler* target, bool usePreferred);
bool usePreferred);
bool _StealMouseMessage(BMessage* message, bool _StealMouseMessage(BMessage* message,
bool& deleteMessage); bool& deleteMessage);
@@ -324,8 +308,7 @@ private:
void _DequeueAll(); void _DequeueAll();
window_type _ComposeType(window_look look, window_type _ComposeType(window_look look,
window_feel feel) const; window_feel feel) const;
void _DecomposeType(window_type type, void _DecomposeType(window_type type, window_look* look,
window_look* look,
window_feel* feel) const; window_feel* feel) const;
void SetIsFilePanel(bool yes); void SetIsFilePanel(bool yes);
@@ -343,17 +326,13 @@ private:
BView* _LastViewChild(BView* parent); BView* _LastViewChild(BView* parent);
BView* _FindNextNavigable(BView *focus, uint32 flags); BView* _FindNextNavigable(BView *focus, uint32 flags);
BView* _FindPreviousNavigable(BView *focus, BView* _FindPreviousNavigable(BView *focus, uint32 flags);
uint32 flags);
bool _HandleKeyDown(BMessage* event); bool _HandleKeyDown(BMessage* event);
void _KeyboardNavigation(); void _KeyboardNavigation();
// Debug (TODO: to be removed)
void PrintToStream() const;
private: private:
char* fTitle; char* fTitle;
int32 server_token; // not yet used int32 _unused0;
bool fInTransaction; bool fInTransaction;
bool fActive; bool fActive;
short fShowLevel; short fShowLevel;
@@ -367,15 +346,15 @@ private:
BButton* fDefaultButton; BButton* fDefaultButton;
BList fShortcuts; BList fShortcuts;
int32 fTopViewToken; int32 fTopViewToken;
bool _unused2; // was fPulseEnabled bool _unused2;
bool fViewsNeedPulse; // not yet used bool _unused3;
bool fIsFilePanel; bool fIsFilePanel;
bool fMaskActivated; bool _unused4;
bigtime_t fPulseRate; bigtime_t fPulseRate;
bool fWaitingForMenu; bool _unused5;
bool fMinimized; bool fMinimized;
bool fNoQuitShortcut; bool fNoQuitShortcut;
bool _unused3; bool _unused6;
sem_id fMenuSem; sem_id fMenuSem;
float fMaxZoomHeight; float fMaxZoomHeight;
float fMaxZoomWidth; float fMaxZoomWidth;
+21 -110
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2007, Haiku. * Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -9,6 +9,12 @@
*/ */
#include <Window.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <Application.h> #include <Application.h>
#include <Autolock.h> #include <Autolock.h>
#include <Button.h> #include <Button.h>
@@ -20,13 +26,12 @@
#include <Roster.h> #include <Roster.h>
#include <Screen.h> #include <Screen.h>
#include <String.h> #include <String.h>
#include <Window.h>
#include <input_globals.h>
#include <AppMisc.h> #include <AppMisc.h>
#include <ApplicationPrivate.h>
#include <AppServerLink.h> #include <AppServerLink.h>
#include <ApplicationPrivate.h>
#include <DirectMessageTarget.h> #include <DirectMessageTarget.h>
#include <input_globals.h>
#include <InputServerTypes.h> #include <InputServerTypes.h>
#include <MenuPrivate.h> #include <MenuPrivate.h>
#include <MessagePrivate.h> #include <MessagePrivate.h>
@@ -36,10 +41,6 @@
#include <tracker_private.h> #include <tracker_private.h>
#include <WindowPrivate.h> #include <WindowPrivate.h>
#include <ctype.h>
#include <stdio.h>
#include <math.h>
//#define DEBUG_WIN //#define DEBUG_WIN
#ifdef DEBUG_WIN #ifdef DEBUG_WIN
@@ -69,7 +70,8 @@ struct BWindow::unpack_cookie {
class BWindow::Shortcut { class BWindow::Shortcut {
public: public:
Shortcut(uint32 key, uint32 modifiers, BMenuItem* item); Shortcut(uint32 key, uint32 modifiers, BMenuItem* item);
Shortcut(uint32 key, uint32 modifiers, BMessage* message, BHandler* target); Shortcut(uint32 key, uint32 modifiers, BMessage* message,
BHandler* target);
~Shortcut(); ~Shortcut();
bool Matches(uint32 key, uint32 modifiers) const; bool Matches(uint32 key, uint32 modifiers) const;
@@ -2480,15 +2482,8 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
fPulseRate = 500000; fPulseRate = 500000;
fPulseRunner = NULL; fPulseRunner = NULL;
// TODO: see if you can use 'fViewsNeedPulse'
fIsFilePanel = false; fIsFilePanel = false;
// TODO: see WHEN is this used!
fMaskActivated = false;
// TODO: see WHEN is this used!
fWaitingForMenu = false;
fMenuSem = -1; fMenuSem = -1;
fMinimized = false; fMinimized = false;
@@ -3213,11 +3208,7 @@ BWindow::_HandleKeyDown(BMessage* event)
modifiers = 0; modifiers = 0;
// handle BMenuBar key // handle BMenuBar key
if (key == B_ESCAPE && (modifiers & B_COMMAND_KEY) != 0 if (key == B_ESCAPE && (modifiers & B_COMMAND_KEY) != 0 && fKeyMenuBar) {
&& fKeyMenuBar) {
// TODO: ask Marc about 'fWaitingForMenu' member!
// fWaitingForMenu = true;
fKeyMenuBar->StartMenuBar(0, true, false, NULL); fKeyMenuBar->StartMenuBar(0, true, false, NULL);
return true; return true;
} }
@@ -3513,10 +3504,16 @@ BWindow::IsFilePanel() const
} }
//------------------------------------------------------------------------------ // #pragma mark - C++ binary compatibility kludge
// Virtual reserved Functions
extern "C" void
_ReservedWindow1__7BWindow()
{
// SetLayout()
}
void BWindow::_ReservedWindow1() {}
void BWindow::_ReservedWindow2() {} void BWindow::_ReservedWindow2() {}
void BWindow::_ReservedWindow3() {} void BWindow::_ReservedWindow3() {}
void BWindow::_ReservedWindow4() {} void BWindow::_ReservedWindow4() {}
@@ -3525,89 +3522,3 @@ void BWindow::_ReservedWindow6() {}
void BWindow::_ReservedWindow7() {} void BWindow::_ReservedWindow7() {}
void BWindow::_ReservedWindow8() {} void BWindow::_ReservedWindow8() {}
void
BWindow::PrintToStream() const
{
printf("BWindow '%s' data:\
Title = %s\
Token = %ld\
InTransaction = %s\
Active = %s\
fShowLevel = %d\
Flags = %lx\
send_port = %ld\
receive_port = %ld\
fTopView name = %s\
focus view name = %s\
lastMouseMoved = %s\
fLink = %p\
KeyMenuBar name = %s\
DefaultButton = %s\
# of shortcuts = %ld",
Name(), fTitle,
_get_object_token_(this),
fInTransaction == true ? "yes" : "no",
fActive == true ? "yes" : "no",
fShowLevel,
fFlags,
fLink->SenderPort(),
fLink->ReceiverPort(),
fTopView != NULL ? fTopView->Name() : "NULL",
fFocus != NULL ? fFocus->Name() : "NULL",
fLastMouseMovedView != NULL ? fLastMouseMovedView->Name() : "NULL",
fLink,
fKeyMenuBar != NULL ? fKeyMenuBar->Name() : "NULL",
fDefaultButton != NULL ? fDefaultButton->Name() : "NULL",
fShortcuts.CountItems());
/*
for( int32 i=0; i<accelList.CountItems(); i++){
_BCmdKey *key = (_BCmdKey*)accelList.ItemAt(i);
printf("\tShortCut %ld: char %s\n\t\t message: \n", i, (key->key > 127)?"ASCII":"UNICODE");
key->message->PrintToStream();
}
*/
printf("\
topViewToken = %ld\
isFilePanel = %s\
MaskActivated = %s\
pulseRate = %lld\
waitingForMenu = %s\
minimized = %s\
Menu semaphore = %ld\
maxZoomHeight = %f\
maxZoomWidth = %f\
minWindHeight = %f\
minWindWidth = %f\
maxWindHeight = %f\
maxWindWidth = %f\
frame = ( %f, %f, %f, %f )\
look = %d\
feel = %d\
lastViewToken = %ld\
pulseRunner = %s\n",
fTopViewToken,
fIsFilePanel==true?"Yes":"No",
fMaskActivated==true?"Yes":"No",
fPulseRate,
fWaitingForMenu==true?"Yes":"No",
fMinimized==true?"Yes":"No",
fMenuSem,
fMaxZoomHeight,
fMaxZoomWidth,
fMinHeight,
fMinWidth,
fMaxHeight,
fMaxWidth,
fFrame.left, fFrame.top, fFrame.right, fFrame.bottom,
(int16)fLook,
(int16)fFeel,
fLastViewToken,
fPulseRunner != NULL ? "In place" : "NULL");
}
/*
TODO list:
*) test arguments for SetWindowAligment
*) call hook functions: MenusBeginning, MenusEnded. Add menu activation code.
*/