Converted numerous printf() calls to STRACE(()) calls

Added some mouse click handling code to WinBorder
Made WinBorder mouse hooks simpler
Added some mouse handling code to ServerWindow


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-01-21 02:58:39 +00:00
parent 2120f0b38d
commit 31b34533a7
7 changed files with 259 additions and 190 deletions
+27 -4
View File
@@ -322,9 +322,14 @@ void Desktop::MouseEventHandler(PortMessage *msg){
BPoint pt; BPoint pt;
int64 dummy; int64 dummy;
int32 mod;
int32 buttons;
msg->Read<int64>(&dummy); msg->Read<int64>(&dummy);
msg->Read<float>(&pt.x); msg->Read<float>(&pt.x);
msg->Read<float>(&pt.y); msg->Read<float>(&pt.y);
msg->Read<int32>(&mod);
msg->Read<int32>(&buttons);
// printf("MOUSE DOWN: at (%f, %f)\n", pt.x, pt.y); // printf("MOUSE DOWN: at (%f, %f)\n", pt.x, pt.y);
@@ -340,7 +345,9 @@ void Desktop::MouseEventHandler(PortMessage *msg){
ws->SearchAndSetNewFront(target); ws->SearchAndSetNewFront(target);
ws->SetFocusLayer(target); ws->SetFocusLayer(target);
target->MouseDown(pt,buttons,mod);
rl->fMainLock.Unlock(); rl->fMainLock.Unlock();
fGeneralLock.Unlock(); fGeneralLock.Unlock();
} }
@@ -353,12 +360,19 @@ void Desktop::MouseEventHandler(PortMessage *msg){
// 3) float - y coordinate of mouse click // 3) float - y coordinate of mouse click
// 4) int32 - modifier keys down // 4) int32 - modifier keys down
BPoint pt; BPoint pt;
int64 dummy; int64 dummy;
int32 mod;
msg->Read<int64>(&dummy); msg->Read<int64>(&dummy);
msg->Read<float>(&pt.x); msg->Read<float>(&pt.x);
msg->Read<float>(&pt.y); msg->Read<float>(&pt.y);
msg->Read<int32>(&mod);
WinBorder *target=ActiveRootLayer()->ActiveWorkspace()->SearchLayerUnderPoint(pt);
if(target)
target->MouseUp(pt,mod);
// printf("MOUSE UP: at (%f, %f)\n", pt.x, pt.y); // printf("MOUSE UP: at (%f, %f)\n", pt.x, pt.y);
break; break;
@@ -371,16 +385,25 @@ void Desktop::MouseEventHandler(PortMessage *msg){
// 4) int32 - buttons down // 4) int32 - buttons down
int64 dummy; int64 dummy;
float x,y; float x,y;
int32 buttons;
msg->Read<int64>(&dummy); msg->Read<int64>(&dummy);
msg->Read<float>(&x); msg->Read<float>(&x);
msg->Read<float>(&y); msg->Read<float>(&y);
msg->Read<int32>(&buttons);
// We need this so that we can see the cursor on the screen // We need this so that we can see the cursor on the screen
if(fActiveScreen) if(fActiveScreen)
fActiveScreen->DDriver()->MoveCursorTo(x,y); fActiveScreen->DDriver()->MoveCursorTo(x,y);
BPoint pt;
WinBorder *target=ActiveRootLayer()->ActiveWorkspace()->SearchLayerUnderPoint(pt);
if(target)
target->MouseMoved(pt,buttons);
break; break;
} }
case B_MOUSE_WHEEL_CHANGED:{ case B_MOUSE_WHEEL_CHANGED:{
// TODO: Later on, this will need to be passed onto the client ServerWindow
break; break;
} }
default:{ default:{
+3 -3
View File
@@ -394,7 +394,7 @@ void Layer::MouseTransit(uint32 transit)
void Layer::DoInvalidate(const BRegion &reg, Layer *start){ void Layer::DoInvalidate(const BRegion &reg, Layer *start){
//TODO: REMOVE this! For Test purposes only! //TODO: REMOVE this! For Test purposes only!
printf("**********Layer::DoInvalidate()\n"); STRACE(("**********Layer::DoInvalidate()\n"));
if (GetRootLayer()) if (GetRootLayer())
GetRootLayer()->Draw(GetRootLayer()->Bounds()); GetRootLayer()->Draw(GetRootLayer()->Bounds());
else{ else{
@@ -568,7 +568,7 @@ void Layer::Show(void)
_hidden = false; _hidden = false;
//TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only! //TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only!
printf("**********Layer::Show()\n"); STRACE(("**********Layer::Show()\n"));
DoInvalidate(BRegion(Bounds()), NULL); DoInvalidate(BRegion(Bounds()), NULL);
return; return;
//---------------- //----------------
@@ -596,7 +596,7 @@ void Layer::Hide(void)
_hidden = true; _hidden = true;
//TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only! //TODO: *****!*!*!*!*!*!*!**!***REMOVE this! For Test purposes only!
printf("**********Layer::Hide()\n"); STRACE(("**********Layer::Hide()\n"));
DoInvalidate(BRegion(Bounds()), NULL); DoInvalidate(BRegion(Bounds()), NULL);
return; return;
//---------------- //----------------
+2 -2
View File
@@ -57,7 +57,7 @@
#include "LayerData.h" #include "LayerData.h"
#include "Utils.h" #include "Utils.h"
#define DEBUG_SERVERAPP //#define DEBUG_SERVERAPP
#ifdef DEBUG_SERVERAPP #ifdef DEBUG_SERVERAPP
# include <stdio.h> # include <stdio.h>
@@ -517,7 +517,7 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
msg->Read<port_id>(&looperPort); msg->Read<port_id>(&looperPort);
msg->ReadString(&title); msg->ReadString(&title);
msg->Read<port_id>(&replyport); msg->Read<port_id>(&replyport);
STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",fSignature.String())); STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",fSignature.String()));
// ServerWindow constructor will reply with port_id of a newly created port // ServerWindow constructor will reply with port_id of a newly created port
+1 -1
View File
@@ -48,7 +48,7 @@
#include "CursorManager.h" #include "CursorManager.h"
#include "Workspace.h" #include "Workspace.h"
#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW
//#define DEBUG_SERVERWINDOW_MOUSE //#define DEBUG_SERVERWINDOW_MOUSE
//#define DEBUG_SERVERWINDOW_KEYBOARD //#define DEBUG_SERVERWINDOW_KEYBOARD
+156 -110
View File
@@ -49,7 +49,7 @@
// toggle // toggle
//#define DEBUG_WINBORDER_MOUSE //#define DEBUG_WINBORDER_MOUSE
//#define DEBUG_WINBORDER_CLICK #define DEBUG_WINBORDER_CLICK
#ifdef DEBUG_WINBORDER #ifdef DEBUG_WINBORDER
# include <stdio.h> # include <stdio.h>
@@ -95,31 +95,33 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
fMainWinBorder = NULL; fMainWinBorder = NULL;
_decorator = NULL; _decorator = NULL;
if (feel == B_NO_BORDER_WINDOW_LOOK){ if (feel == B_NO_BORDER_WINDOW_LOOK)
{
_full = _win->fTopLayer->_full; _full = _win->fTopLayer->_full;
fDecFull = NULL; fDecFull = NULL;
fDecFullVisible = NULL; fDecFullVisible = NULL;
fDecVisible = NULL; fDecVisible = NULL;
} }
else{ else
{
_decorator = new_decorator(r, name, look, feel, flags, fDriver); _decorator = new_decorator(r, name, look, feel, flags, fDriver);
fDecFull = new BRegion(); fDecFull = new BRegion();
fDecVisible = new BRegion(); fDecVisible = new BRegion();
fDecFullVisible = fDecVisible; fDecFullVisible = fDecVisible;
_decorator->GetFootprint( fDecFull ); _decorator->GetFootprint( fDecFull );
// our full region is the union between decorator's region and fTopLayer's region // our full region is the union between decorator's region and fTopLayer's region
_full = _win->fTopLayer->_full; _full = _win->fTopLayer->_full;
_full.Include( fDecFull ); _full.Include( fDecFull );
} }
// get a token // get a token
_view_token = border_token_handler.GetToken(); _view_token = border_token_handler.GetToken();
STRACE(("WinBorder %s:\n",GetName())); STRACE(("WinBorder %s:\n",GetName()));
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
STRACE(("\tWindow %s\n",win?win->Title():"NULL")); STRACE(("\tWindow %s\n",win?win->Title():"NULL"));
} }
WinBorder::~WinBorder(void) WinBorder::~WinBorder(void)
@@ -138,30 +140,37 @@ STRACE(("WinBorder %s:~WinBorder()\n",GetName()));
} }
} }
void WinBorder::MouseDown(int8 *buffer) void WinBorder::MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers)
{ {
// Buffer data: // user clicked on decorator
// 1) int64 - time of mouse click if (fDecFullVisible->Contains(pt))
// 2) float - x coordinate of mouse click {
// 3) float - y coordinate of mouse click
// 4) int32 - modifier keys down
// 5) int32 - buttons down
// 6) int32 - clicks
int8 *index = buffer; index+=sizeof(int64);
float x = *((float*)index); index+=sizeof(float);
float y = *((float*)index); index+=sizeof(float);
int32 modifiers = *((int32*)index); index+=sizeof(int32);
int32 buttons = *((int32*)index);
BPoint pt(x,y);
// user clicked on decorator
if (fDecFullVisible->Contains(pt)){
click_type click; click_type click;
// TODO: modify this!!! _decorator->MouseDown(...); click = _decorator->Clicked(pt, buttons, modifiers);
click = _decorator->Clicked(pt, buttons, modifiers);
switch(click){ switch(click)
{
case DEC_CLOSE:
{
STRACE_CLICK(("WinBorder: Push Close Button\n"));
_decorator->SetClose(true);
_decorator->DrawClose();
break;
}
case DEC_ZOOM:
{
STRACE_CLICK(("WinBorder: Push Zoom Button\n"));
_decorator->SetZoom(true);
_decorator->DrawZoom();
break;
}
case DEC_MINIMIZE:
{
STRACE_CLICK(("WinBorder: Push Close Button\n"));
_decorator->SetMinimize(true);
_decorator->DrawMinimize();
break;
}
case DEC_MOVETOBACK: case DEC_MOVETOBACK:
{ {
STRACE_CLICK(("WinBorder: MoveToBack\n")); STRACE_CLICK(("WinBorder: MoveToBack\n"));
@@ -175,53 +184,75 @@ void WinBorder::MouseDown(int8 *buffer)
} }
} }
} }
// user clicked in window's area // user clicked in window's area
else{ else
{
STRACE_CLICK(("WinBorder: MoveToFront 2\n")); STRACE_CLICK(("WinBorder: MoveToFront 2\n"));
bool sendMessage = true; bool sendMessage = true;
if (1 /* TODO: uncomment: ActiveLayer() != this*/){ if (1 /* TODO: uncomment: ActiveLayer() != this*/)
{
MoveToFront(); MoveToFront();
if (0 /* B_FIRST_CLICK? what's the name of that flaaaag ??? */){ if (0 /* B_FIRST_CLICK? what's the name of that flaaaag ??? */){
sendMessage = false; sendMessage = false;
} }
} }
if (sendMessage){ if (sendMessage)
BMessage msg; {
// a tweak for converting a point into local coords. :-) Layer *targetLayer=_win->fTopLayer->LayerAt(pt);
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); if(targetLayer)
msg.what = B_MOUSE_DOWN; {
msg.AddInt64("when", real_time_clock_usecs()); BMessage msg;
msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
msg.AddInt32("modifiers", modifiers); // a tweak for converting a point into local coords. :-)
msg.AddInt32("buttons", buttons); BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
msg.AddInt32("clicks", 1); msg.what = B_MOUSE_DOWN;
msg.AddInt64("when", real_time_clock_usecs());
_win->SendMessageToClient( &msg ); msg.AddPoint("where", (targetLayer->ConvertFromTop(helpRect)).LeftTop() );
msg.AddInt32("modifiers", modifiers);
msg.AddInt32("buttons", buttons);
msg.AddInt32("clicks", 1);
_win->SendMessageToClient( &msg );
}
} }
} }
// this is important to determine how much we should resize or move the Layer(WinBorder)(window) // this is important to determine how much we should resize or move the Layer(WinBorder)(window)
fLastMousePosition = pt; fLastMousePosition = pt;
} }
void WinBorder::MouseMoved(int8 *buffer) void WinBorder::MouseMoved(const BPoint &pt, const int32 &buttons)
{ {
// Buffer data: // Buffer data:
// 1) int64 - time of mouse click // 1) int64 - time of mouse click
// 2) float - x coordinate of mouse click // 2) float - x coordinate of mouse click
// 3) float - y coordinate of mouse click // 3) float - y coordinate of mouse click
// 4) int32 - buttons down // 4) int32 - buttons down
int8 *index = buffer; index+=sizeof(int64);
float x = *((float*)index); index+=sizeof(float); click_type action = _decorator->Clicked(pt, _mbuttons, _kmodifiers);
float y = *((float*)index); index+=sizeof(float);
int32 buttons = *((int32*)index);
// If the user clicked a button and then moused away without lifting the button,
BPoint pt(x,y); // we don't want to trigger the button. Instead, we reset it to its original up state
// TODO: modify this!!! _decorator->MouseMoved(...); if(_decorator->GetClose() && action!=DEC_CLOSE)
click_type action = _decorator->Clicked(pt, _mbuttons, _kmodifiers); {
_decorator->SetClose(false);
switch (action){ _decorator->DrawClose();
}
if(_decorator->GetZoom() && action!=DEC_ZOOM)
{
_decorator->SetZoom(false);
_decorator->DrawZoom();
}
if(_decorator->GetMinimize() && action!=DEC_MINIMIZE)
{
_decorator->SetMinimize(false);
_decorator->DrawMinimize();
}
switch (action)
{
case DEC_DRAG: case DEC_DRAG:
{ {
STRACE_CLICK(("WinBorder: Drag\n")); STRACE_CLICK(("WinBorder: Drag\n"));
@@ -240,11 +271,13 @@ void WinBorder::MouseMoved(int8 *buffer)
ResizeBy( difference.x, difference.y ); ResizeBy( difference.x, difference.y );
break; break;
} }
default:{ default:
BMessage msg; {
// a tweak for converting a point into local coords. :-) BMessage msg;
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
msg.what = B_MOUSE_MOVED; // a tweak for converting a point into local coords. :-)
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
msg.what = B_MOUSE_MOVED;
msg.AddInt64("when", real_time_clock_usecs()); msg.AddInt64("when", real_time_clock_usecs());
msg.AddPoint("where", (_win->fTopLayer->ConvertFromTop(helpRect)).LeftTop() ); msg.AddPoint("where", (_win->fTopLayer->ConvertFromTop(helpRect)).LeftTop() );
msg.AddInt32("buttons", buttons); msg.AddInt32("buttons", buttons);
@@ -252,69 +285,82 @@ void WinBorder::MouseMoved(int8 *buffer)
_win->SendMessageToClient( &msg ); _win->SendMessageToClient( &msg );
} }
} }
// this is important to determine how much we should resize or move the Layer(WinBorder)(window) // this is important to determine how much we should resize or move the
// Layer(WinBorder)(window)
fLastMousePosition = pt; fLastMousePosition = pt;
} }
void WinBorder::MouseUp(int8 *buffer) void WinBorder::MouseUp(const BPoint &pt, const int32 &modifiers)
{ {
STRACE_MOUSE(("WinBorder %s: MouseUp() \n",GetName())); STRACE_MOUSE(("WinBorder %s: MouseUp() \n",GetName()));
// buffer data: // buffer data:
// 1) int64 - time of mouse click // 1) int64 - time of mouse click
// 2) float - x coordinate of mouse click // 2) float - x coordinate of mouse click
// 3) float - y coordinate of mouse click // 3) float - y coordinate of mouse click
// 4) int32 - modifier keys down // 4) int32 - modifier keys down
int8 *index = buffer; index+=sizeof(int64);
float x = *((float*)index); index+=sizeof(float);
float y = *((float*)index); index+=sizeof(float);
int32 modifiers = *((int32*)index);
BPoint pt(x,y);
// TODO: modify this!!! _decorator->MouseUp(...);
click_type action =_decorator->Clicked(pt, _mbuttons, _kmodifiers); click_type action =_decorator->Clicked(pt, _mbuttons, _kmodifiers);
switch (action){ switch (action)
{
case DEC_CLOSE: case DEC_CLOSE:
{ {
STRACE_CLICK(("WinBorder: Close\n")); STRACE_CLICK(("WinBorder: Close\n"));
/* NOTE: I think you better put this code in... ServerWindow::Close()
* and call that here!!! if(_decorator->GetClose())
* SW::Close() must send B_QUIT_REQUESTED and wait for an answer first. {
*/ _decorator->SetClose(false);
_decorator->DrawClose();
RemoveSelf();
delete this; BMessage msg(B_QUIT_REQUESTED);
_win->SendMessageToClient(&msg);
}
break; break;
} }
case DEC_ZOOM: case DEC_ZOOM:
{ {
STRACE_CLICK(("WinBorder: Zoom\n")); STRACE_CLICK(("WinBorder: Zoom\n"));
/* NOTE: I think you better put this code in... ServerWindow::Zoom()
* and call that here!!! if(_decorator->GetZoom())
*/ {
// TODO: implement _decorator->SetZoom(false);
// if (actual_coods != max_zoom_coords) _decorator->DrawZoom();
// MoveBy(X, Y);
// ResizeBy(X, Y); BMessage msg(B_ZOOM);
// TODO: send B_ZOOM to client; _win->SendMessageToClient(&msg);
}
break; break;
} }
case DEC_MINIMIZE: case DEC_MINIMIZE:
{ {
STRACE_CLICK(("WinBoder: Minimize\n")); STRACE_CLICK(("WinBoder: Minimize\n"));
_win->Minimize(true); if(_decorator->GetMinimize())
{
_decorator->SetMinimize(false);
_decorator->DrawMinimize();
BMessage msg(B_MINIMIZE);
_win->SendMessageToClient(&msg);
}
break; break;
} }
default:{ default:
BMessage msg; {
// a tweak for converting a point into local coords. :-) Layer *targetLayer=_win->fTopLayer->LayerAt(pt);
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1); if(targetLayer)
msg.what = B_MOUSE_UP; {
msg.AddInt64("when", real_time_clock_usecs()); BMessage msg;
msg.AddPoint("where", (_win->fTopLayer->LayerAt(pt)->ConvertFromTop(helpRect)).LeftTop() );
msg.AddInt32("modifiers", modifiers); // a tweak for converting a point into local coords. :-)
BRect helpRect(pt.x, pt.y, pt.x+1, pt.y+1);
_win->SendMessageToClient( &msg ); msg.what = B_MOUSE_UP;
msg.AddInt64("when", real_time_clock_usecs());
msg.AddPoint("where", (targetLayer->ConvertFromTop(helpRect)).LeftTop() );
msg.AddInt32("modifiers", modifiers);
_win->SendMessageToClient( &msg );
}
} }
} }
} }
@@ -414,9 +460,9 @@ void WinBorder::RebuildRegions( const BRect& r ){
void WinBorder::Draw(const BRect &r) void WinBorder::Draw(const BRect &r)
{ {
//TODO: REMOVE this! For Test purposes only! //TODO: REMOVE this! For Test purposes only!
printf("*WinBorder(%s)::Draw()\n", GetName()); STRACE(("*WinBorder(%s)::Draw()\n", GetName()));
_decorator->Draw(); _decorator->Draw();
printf("#WinBorder(%s)::Draw() ENDED\n", GetName()); STRACE(("#WinBorder(%s)::Draw() ENDED\n", GetName()));
return; return;
//---------------- //----------------
@@ -736,9 +782,9 @@ void WinBorder::AddToSubsetOf(WinBorder* main){
RootLayer *rl = main->GetRootLayer(); RootLayer *rl = main->GetRootLayer();
desktop->fGeneralLock.Lock(); desktop->fGeneralLock.Lock();
printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()));
rl->fMainLock.Lock(); rl->fMainLock.Lock();
printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()));
for(int32 i = 0; i < rl->WorkspaceCount(); i++){ for(int32 i = 0; i < rl->WorkspaceCount(); i++){
Workspace *ws = rl->WorkspaceAt(i+1); Workspace *ws = rl->WorkspaceAt(i+1);
@@ -747,9 +793,9 @@ printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), mai
} }
rl->fMainLock.Unlock(); rl->fMainLock.Unlock();
printf("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()));
desktop->fGeneralLock.Unlock(); desktop->fGeneralLock.Unlock();
printf("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName()));
} }
} }
} }
@@ -758,9 +804,9 @@ void WinBorder::RemoveFromSubsetOf(WinBorder* main){
RootLayer *rl = main->GetRootLayer(); RootLayer *rl = main->GetRootLayer();
desktop->fGeneralLock.Lock(); desktop->fGeneralLock.Lock();
printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()));
rl->fMainLock.Lock(); rl->fMainLock.Lock();
printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()));
// remove from main window's subset list. // remove from main window's subset list.
if(main->Window()->fWinFMWList.RemoveItem(this)){ if(main->Window()->fWinFMWList.RemoveItem(this)){
int32 count = main->GetRootLayer()->WorkspaceCount(); int32 count = main->GetRootLayer()->WorkspaceCount();
@@ -776,9 +822,9 @@ printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName()
fMainWinBorder = NULL; fMainWinBorder = NULL;
rl->fMainLock.Unlock(); rl->fMainLock.Unlock();
printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()));
desktop->fGeneralLock.Unlock(); desktop->fGeneralLock.Unlock();
printf("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock released\n", GetName(), main->GetName()); STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock released\n", GetName(), main->GetName()));
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::PrintToStream(){ void WinBorder::PrintToStream(){
+59 -59
View File
@@ -38,69 +38,69 @@ class DisplayDriver;
class WinBorder : public Layer class WinBorder : public Layer
{ {
public: public:
WinBorder(const BRect &r, const char *name, const int32 look, WinBorder(const BRect &r, const char *name, const int32 look,
const int32 feel, const int32 flags, ServerWindow *win); const int32 feel, const int32 flags, ServerWindow *win);
virtual ~WinBorder(void); virtual ~WinBorder(void);
virtual void RebuildRegions( const BRect& r ); virtual void RebuildRegions( const BRect& r );
virtual void Draw(const BRect &r); virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y); virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y); virtual void ResizeBy(float x, float y);
bool HasPoint(BPoint pt) const; bool HasPoint(BPoint pt) const;
void MoveToBack();
void MoveToFront();
void MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers);
void MouseMoved(const BPoint &pt, const int32 &buttons);
void MouseUp(const BPoint &pt, const int32 &modifiers);
virtual void Hide();
virtual void Show();
void UpdateColors(void);
void UpdateDecorator(void);
void UpdateFont(void);
void UpdateScreen(void);
void SetFocus(const bool &active);
ServerWindow* Window(void) const { return _win; }
Decorator* GetDecorator(void) const { return _decorator; }
WinBorder* MainWinBorder() const;
void SetLevel();
void AddToSubsetOf(WinBorder* main);
void RemoveFromSubsetOf(WinBorder* main);
void PrintToStream();
// Server "private" :-) - should not be used
void SetMainWinBorder(WinBorder *newMain);
void MoveToBack();
void MoveToFront();
void MouseDown(int8 *buffer);
void MouseMoved(int8 *buffer);
void MouseUp(int8 *buffer);
virtual void Hide();
virtual void Show();
void UpdateColors(void);
void UpdateDecorator(void);
void UpdateFont(void);
void UpdateScreen(void);
void SetFocus(const bool &active);
ServerWindow* Window(void) const { return _win; }
Decorator* GetDecorator(void) const { return _decorator; }
WinBorder* MainWinBorder() const;
void SetLevel();
void AddToSubsetOf(WinBorder* main);
void RemoveFromSubsetOf(WinBorder* main);
void PrintToStream();
// Server "private" :-) - should not be used
void SetMainWinBorder(WinBorder *newMain);
protected: protected:
ServerWindow *_win; ServerWindow *_win;
//BString *_title; //BString *_title;
Decorator *_decorator; Decorator *_decorator;
int32 _flags; int32 _flags;
BRect _clientframe; BRect _clientframe;
int32 _mbuttons, int32 _mbuttons,
_kmodifiers; _kmodifiers;
BPoint fLastMousePosition; BPoint fLastMousePosition;
bool _update; bool _update;
bool _hresizewin,_vresizewin; bool _hresizewin,_vresizewin;
BRegion *fDecFull, BRegion *fDecFull,
*fDecFullVisible, *fDecFullVisible,
*fDecVisible; *fDecVisible;
WinBorder* fMainWinBorder; WinBorder *fMainWinBorder;
/* bool fIsMoving; /* bool fIsMoving;
bool fIsResizing; bool fIsResizing;
bool fIsClosing; bool fIsClosing;
bool fIsMinimizing; bool fIsMinimizing;
bool fIsZooming bool fIsZooming
*/ */
}; };
+11 -11
View File
@@ -38,7 +38,7 @@
#include "RootLayer.h" #include "RootLayer.h"
#include "Desktop.h" #include "Desktop.h"
#define DEBUG_WORKSPACE //#define DEBUG_WORKSPACE
#ifdef DEBUG_WORKSPACE #ifdef DEBUG_WORKSPACE
# include <stdio.h> # include <stdio.h>
@@ -167,14 +167,14 @@ STRACESTREAM();
RemoveItem(item); RemoveItem(item);
delete item; delete item;
STRACESTREAM(); STRACESTREAM();
opLock.Unlock(); opLock.Unlock();
// reset some internal variables // reset some internal variables
layer->SetMainWinBorder(NULL); layer->SetMainWinBorder(NULL);
// its RootLayer is set to NULL by Layer::RemoveChild(layer); // its RootLayer is set to NULL by Layer::RemoveChild(layer);
printf("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), ID()); STRACE(("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), ID()));
if (wasFocus) if (wasFocus)
SetFocusLayer(nextItem? nextItem->layerPtr: NULL); SetFocusLayer(nextItem? nextItem->layerPtr: NULL);
@@ -184,7 +184,7 @@ printf("Layer %s found and removed from Workspace No %ld\n", layer->GetName(), I
return true; return true;
} }
else{ else{
printf("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID()); STRACE(("Layer %s NOT found in Workspace No %ld\n", layer->GetName(), ID()));
opLock.Unlock(); opLock.Unlock();
return false; return false;
} }
@@ -337,11 +337,11 @@ WinBorder* Workspace::SearchLayerUnderPoint(BPoint pt){
// For the moment, take windows from front to back and see in witch one 'pt' falls // For the moment, take windows from front to back and see in witch one 'pt' falls
WinBorder *target = NULL; WinBorder *target = NULL;
opLock.Lock(); opLock.Lock();
printf("Searching (%f,%f) in...\n", pt.x, pt.y); STRACE(("Searching (%f,%f) in...\n", pt.x, pt.y));
for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){ for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem()){
wb->PrintToStream(); // wb->PrintToStream();
if (!wb->IsHidden() && wb->HasPoint(pt)){ if (!wb->IsHidden() && wb->HasPoint(pt)){
printf("%s - SELECTED!\n", wb->GetName()); STRACE(("%s - SELECTED!\n", wb->GetName()));
target = wb; target = wb;
break; break;
} }
@@ -461,7 +461,7 @@ ListData* Workspace::FindPlace(ListData* pref){
while(pref && item->lowerItem != pref && (pref->upperItem || pref->lowerItem)){ while(pref && item->lowerItem != pref && (pref->upperItem || pref->lowerItem)){
if ( !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT) && !(item->layerPtr->IsHidden()) ) if ( !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT) && !(item->layerPtr->IsHidden()) )
break; break;
printf("item: %s - pref: %s\n", item->layerPtr->GetName(), pref->layerPtr->GetName()); STRACE(("item: %s - pref: %s\n", item->layerPtr->GetName(), pref->layerPtr->GetName()));
if (item == fTopItem) if (item == fTopItem)
item = fBottomItem; item = fBottomItem;
else else
@@ -612,10 +612,10 @@ STRACE(("#WS(%ld)::SASNF(%s) ENDED 2\n", ID(), preferred? preferred->GetName():
} }
if(!lastInserted){ if(!lastInserted){
printf("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n"); STRACE(("PAAAAANIC: Workspace::SASNF(): 'lastInserted' IS NULL\n"));
} }
else{ else{
printf("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName()); STRACE(("\n&&&&Processing for: %s\n", lastInserted->layerPtr->GetName()));
} }
if (lastInserted && !(lastInserted->layerPtr->IsHidden())){ if (lastInserted && !(lastInserted->layerPtr->IsHidden())){
@@ -987,7 +987,7 @@ STRACE((" MODAL ALL/SYSTEM FIRST Window '%s'\n", preferred? preferred->GetName()
} }
else{ else{
// We ***should NOT*** reach this point! // We ***should NOT*** reach this point!
printf("SERVER: PANIC: \"%s\": What kind of window is this???\n", preferred? preferred->GetName(): "NULL"); STRACE(("SERVER: PANIC: \"%s\": What kind of window is this???\n", preferred? preferred->GetName(): "NULL"));
} }
} }
else else