Modified some classes to succesfully comunicate with BWindow/BView. the default decorator has been impoved. From now borders are build ARROUND the window area.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4432 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,6 +30,9 @@
|
|||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <PortMessage.h>
|
#include <PortMessage.h>
|
||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
|
|
||||||
|
#include <Session.h>
|
||||||
|
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
@@ -88,10 +91,10 @@ AppServer::AppServer(void)
|
|||||||
// Used for testing purposes
|
// Used for testing purposes
|
||||||
|
|
||||||
// TODO: Uncomment when actually put to use. Commented out for speed
|
// TODO: Uncomment when actually put to use. Commented out for speed
|
||||||
// fontserver->ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
|
fontserver->ScanDirectory("/boot/beos/etc/fonts/ttfonts/");
|
||||||
// fontserver->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/");
|
// fontserver->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/");
|
||||||
fontserver->ScanDirectory("/boot/home/config/fonts/ttfonts/");
|
// fontserver->ScanDirectory("/boot/home/config/fonts/ttfonts/");
|
||||||
fontserver->ScanDirectory("/boot/home/config/fonts/psfonts/");
|
// fontserver->ScanDirectory("/boot/home/config/fonts/psfonts/");
|
||||||
fontserver->SaveList();
|
fontserver->SaveList();
|
||||||
|
|
||||||
if(!fontserver->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE))
|
if(!fontserver->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE))
|
||||||
@@ -641,6 +644,10 @@ void AppServer::Broadcast(int32 code)
|
|||||||
{
|
{
|
||||||
int32 i;
|
int32 i;
|
||||||
ServerApp *app;
|
ServerApp *app;
|
||||||
|
|
||||||
|
int32 buffer[2];
|
||||||
|
buffer[0] = 8; // 4 for buffer size + 4 for our message
|
||||||
|
buffer[1] = AS_QUIT_APP;
|
||||||
|
|
||||||
acquire_sem(_applist_lock);
|
acquire_sem(_applist_lock);
|
||||||
for(i=0;i<_applist->CountItems(); i++)
|
for(i=0;i<_applist->CountItems(); i++)
|
||||||
@@ -648,7 +655,8 @@ void AppServer::Broadcast(int32 code)
|
|||||||
app=(ServerApp*)_applist->ItemAt(i);
|
app=(ServerApp*)_applist->ItemAt(i);
|
||||||
if(!app)
|
if(!app)
|
||||||
continue;
|
continue;
|
||||||
app->PostMessage(code);
|
//app->PostMessage(code);
|
||||||
|
app->PostMessage(AS_SESSION_MSG, 2*sizeof(int32), (int8*)&buffer);
|
||||||
}
|
}
|
||||||
release_sem(_applist_lock);
|
release_sem(_applist_lock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#include "Decorator.h"
|
#include "Decorator.h"
|
||||||
#include "DisplayDriver.h"
|
#include "DisplayDriver.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor
|
\brief Constructor
|
||||||
\param rect Size of client area
|
\param rect Size of client area
|
||||||
@@ -48,12 +50,20 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
|||||||
_title_string=new BString;
|
_title_string=new BString;
|
||||||
_driver=NULL;
|
_driver=NULL;
|
||||||
|
|
||||||
_closerect.Set(0,0,1,1);
|
/// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that
|
||||||
_zoomrect.Set(0,0,1,1);
|
// WILL be drawn on screen. We so not want that... so...
|
||||||
_minimizerect.Set(0,0,1,1);
|
// [ A BRect when instantiated is made invalid, so, no need for: ]
|
||||||
_resizerect.Set(0,0,1,1);
|
/* _closerect.Set( 0, 0, -1, -1);
|
||||||
|
_zoomrect.Set( 0, 0, -1, -1);
|
||||||
|
_minimizerect.Set( 0, 0, -1, -1);
|
||||||
|
_resizerect.Set( 0, 0, -1, -1);
|
||||||
|
*/
|
||||||
_frame=rect;
|
_frame=rect;
|
||||||
_tabrect.Set(rect.left,rect.top,rect.right, rect.top+((rect.bottom-rect.top)/4));
|
// !!! rect rectangle MUST remain intact - it is top_view's area !!!
|
||||||
|
// Decorator drawing MUST be done arround that area !!!
|
||||||
|
//_tabrect.Set(rect.left,rect.top,rect.right, rect.top+((rect.bottom-rect.top)/4));
|
||||||
|
// [ A BRect when instantiated is made invalid, so, no need for: ]
|
||||||
|
/* _tabrect.Set( 0, 0, -1, -1 ); */
|
||||||
|
|
||||||
_look=wlook;
|
_look=wlook;
|
||||||
_feel=wfeel;
|
_feel=wfeel;
|
||||||
@@ -260,6 +270,24 @@ const char *Decorator::GetTitle(void)
|
|||||||
return _title_string->String();
|
return _title_string->String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Returns the decorator's border rectangle
|
||||||
|
\return the decorator's border rectangle
|
||||||
|
*/
|
||||||
|
|
||||||
|
BRect Decorator::GetBorderRect(void){
|
||||||
|
return _borderrect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Returns the decorator's tab rectangle
|
||||||
|
\return the decorator's tab rectangle
|
||||||
|
*/
|
||||||
|
|
||||||
|
BRect Decorator::GetTabRect(void){
|
||||||
|
return _tabrect;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Changes the focus value of the decorator
|
\brief Changes the focus value of the decorator
|
||||||
\param is_active True if active, false if not
|
\param is_active True if active, false if not
|
||||||
@@ -284,13 +312,15 @@ int32 Decorator::_ClipTitle(float width)
|
|||||||
{
|
{
|
||||||
int32 strlength=_title_string->CountChars();
|
int32 strlength=_title_string->CountChars();
|
||||||
float pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
float pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||||
|
// printf("Initial width = %f\n", width );
|
||||||
|
// printf("DEC: strlen = %ld\t pixwidth = %f\n", strlength, pixwidth);
|
||||||
while(strlength>=0)
|
while(strlength>=0)
|
||||||
{
|
{
|
||||||
if(pixwidth<width)
|
if(pixwidth<width)
|
||||||
break;
|
break;
|
||||||
strlength--;
|
strlength--;
|
||||||
pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||||
|
// printf("DEC: strlen = %ld\t pixwidth = %f\n", strlength, pixwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
return strlength;
|
return strlength;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
#define USE_VIEW_FILL_HACK
|
#define USE_VIEW_FILL_HACK
|
||||||
|
|
||||||
|
//#define DEBUG_DECORATOR
|
||||||
|
|
||||||
#ifdef DEBUG_DECORATOR
|
#ifdef DEBUG_DECORATOR
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -171,16 +173,7 @@ printf("DefaultDecorator: Do Layout\n");
|
|||||||
#endif
|
#endif
|
||||||
// Here we determine the size of every rectangle that we use
|
// Here we determine the size of every rectangle that we use
|
||||||
// internally when we are given the size of the client rectangle.
|
// internally when we are given the size of the client rectangle.
|
||||||
|
|
||||||
// Current version simply makes everything fit inside the rect
|
|
||||||
// instead of building around it. This will change.
|
|
||||||
|
|
||||||
_tabrect=_frame;
|
|
||||||
_resizerect=_frame;
|
|
||||||
_borderrect=_frame;
|
|
||||||
_closerect=_frame;
|
|
||||||
|
|
||||||
|
|
||||||
switch(GetLook())
|
switch(GetLook())
|
||||||
{
|
{
|
||||||
case B_FLOATING_WINDOW_LOOK:
|
case B_FLOATING_WINDOW_LOOK:
|
||||||
@@ -194,11 +187,98 @@ printf("DefaultDecorator: Do Layout\n");
|
|||||||
case B_BORDERED_WINDOW_LOOK:
|
case B_BORDERED_WINDOW_LOOK:
|
||||||
case B_TITLED_WINDOW_LOOK:
|
case B_TITLED_WINDOW_LOOK:
|
||||||
case B_DOCUMENT_WINDOW_LOOK:
|
case B_DOCUMENT_WINDOW_LOOK:
|
||||||
borderwidth=5;
|
borderwidth = 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
borderwidth=0;
|
borderwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Current version simply makes everything fit inside the rect
|
||||||
|
// instead of building around it. This will change.
|
||||||
|
|
||||||
|
// IT did :-)
|
||||||
|
// distance from one item of the tab bar to another. In this case the text and close/zoom rects
|
||||||
|
textoffset = (_look==B_FLOATING_WINDOW_LOOK) ? 7 : 10;
|
||||||
|
|
||||||
|
// calculate or tab rect
|
||||||
|
_tabrect.Set( _frame.left - borderwidth,
|
||||||
|
_frame.top - borderwidth - 19.0,
|
||||||
|
((_frame.right - _frame.left) < 35.0 ?
|
||||||
|
_frame.left + 35.0 : _frame.right) + borderwidth,
|
||||||
|
_frame.top - (borderwidth-1) );
|
||||||
|
|
||||||
|
// make it text width sensitive
|
||||||
|
if(strlen(GetTitle())>1)
|
||||||
|
{
|
||||||
|
if(_driver)
|
||||||
|
titlepixelwidth=_driver->StringWidth(GetTitle(),_TitleWidth(), &_layerdata);
|
||||||
|
else
|
||||||
|
titlepixelwidth=10;
|
||||||
|
|
||||||
|
int32 tabLength = 14 + // _closerect width
|
||||||
|
textoffset + titlepixelwidth + textoffset +
|
||||||
|
14 + // _zoomrect width
|
||||||
|
8; // margins
|
||||||
|
int32 tabWidth = (int32)_tabrect.Width();
|
||||||
|
if ( tabLength < tabWidth )
|
||||||
|
_tabrect.right = _tabrect.left + tabLength;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_tabrect.right = _tabrect.left + _tabrect.Width()/2;
|
||||||
|
|
||||||
|
// calculate left/top/right/bottom borders
|
||||||
|
if ( borderwidth != 0 ){
|
||||||
|
_borderrect = _frame.InsetByCopy( -borderwidth, -borderwidth );
|
||||||
|
leftborder.Set( _borderrect.left, _frame.top - borderwidth,
|
||||||
|
_frame.left, _frame.bottom + borderwidth );
|
||||||
|
rightborder.Set( _frame.right, _frame.top - borderwidth,
|
||||||
|
_borderrect.right, _frame.bottom + borderwidth );
|
||||||
|
topborder.Set( _borderrect.left, _borderrect.top,
|
||||||
|
_borderrect.right, _frame.top );
|
||||||
|
bottomborder.Set( _borderrect.left, _frame.bottom,
|
||||||
|
_borderrect.right, _borderrect.bottom );
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// no border ... (?) useful when displaying windows that are just images
|
||||||
|
_borderrect = _frame;
|
||||||
|
leftborder.Set( 0.0, 0.0, -1.0, -1.0 );
|
||||||
|
rightborder.Set( 0.0, 0.0, -1.0, -1.0 );
|
||||||
|
topborder.Set( 0.0, 0.0, -1.0, -1.0 );
|
||||||
|
bottomborder.Set( 0.0, 0.0, -1.0, -1.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate resize rect
|
||||||
|
_resizerect.Set( _borderrect.right - 19.0, _borderrect.bottom - 19.0,
|
||||||
|
_borderrect.right, _borderrect.bottom);
|
||||||
|
|
||||||
|
// format tab rect for a floating window - make te rect smaller
|
||||||
|
if ( _look == B_FLOATING_WINDOW_LOOK ){
|
||||||
|
_tabrect.InsetBy( 0, 2 );
|
||||||
|
_tabrect.OffsetBy( 0, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// calulate close rect based on the tab rectangle
|
||||||
|
_closerect.Set( _tabrect.left + 4.0, _tabrect.top + 4.0,
|
||||||
|
_tabrect.left + 4.0 + 13.0, _tabrect.top + 4.0 + 13.0 );
|
||||||
|
|
||||||
|
// calulate zoom rect based on the tab rectangle
|
||||||
|
_zoomrect.Set( _tabrect.right - 4.0 - 13.0, _tabrect.top + 4.0,
|
||||||
|
_tabrect.right - 4.0, _tabrect.top + 4.0 + 13.0 );
|
||||||
|
|
||||||
|
// fromat close and zoom rects for a floating window - make rectangles smaller
|
||||||
|
if ( _look == B_FLOATING_WINDOW_LOOK ){
|
||||||
|
_closerect.InsetBy( 1, 1 );
|
||||||
|
_zoomrect.InsetBy( 1, 1 );
|
||||||
|
_closerect.OffsetBy( 0, -2 );
|
||||||
|
_zoomrect.OffsetBy( 0, -2 );
|
||||||
|
}
|
||||||
|
// Old version...
|
||||||
|
/*
|
||||||
|
_tabrect=_frame;
|
||||||
|
_resizerect=_frame;
|
||||||
|
_borderrect=_frame;
|
||||||
|
_closerect=_frame;
|
||||||
|
|
||||||
|
|
||||||
textoffset=(_look==B_FLOATING_WINDOW_LOOK)?5:7;
|
textoffset=(_look==B_FLOATING_WINDOW_LOOK)?5:7;
|
||||||
|
|
||||||
@@ -249,7 +329,7 @@ printf("DefaultDecorator: Do Layout\n");
|
|||||||
_zoomrect.bottom-=4;
|
_zoomrect.bottom-=4;
|
||||||
_zoomrect.left=_zoomrect.right-10;
|
_zoomrect.left=_zoomrect.right-10;
|
||||||
_zoomrect.bottom=_zoomrect.top+10;
|
_zoomrect.bottom=_zoomrect.top+10;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::MoveBy(float x, float y)
|
void DefaultDecorator::MoveBy(float x, float y)
|
||||||
@@ -269,6 +349,13 @@ printf("DefaultDecorator: Move By (%.1f, %.1f)\n",pt.x,pt.y);
|
|||||||
_resizerect.OffsetBy(pt);
|
_resizerect.OffsetBy(pt);
|
||||||
_borderrect.OffsetBy(pt);
|
_borderrect.OffsetBy(pt);
|
||||||
_zoomrect.OffsetBy(pt);
|
_zoomrect.OffsetBy(pt);
|
||||||
|
|
||||||
|
leftborder.OffsetBy(pt);
|
||||||
|
rightborder.OffsetBy(pt);
|
||||||
|
topborder.OffsetBy(pt);
|
||||||
|
bottomborder.OffsetBy(pt);
|
||||||
|
|
||||||
|
Draw( _borderrect );
|
||||||
}
|
}
|
||||||
|
|
||||||
BRegion * DefaultDecorator::GetFootprint(void)
|
BRegion * DefaultDecorator::GetFootprint(void)
|
||||||
@@ -287,13 +374,15 @@ printf("DefaultDecorator: Get Footprint\n");
|
|||||||
|
|
||||||
void DefaultDecorator::_DrawTitle(BRect r)
|
void DefaultDecorator::_DrawTitle(BRect r)
|
||||||
{
|
{
|
||||||
|
printf("_DrawTitle(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom);
|
||||||
// Designed simply to redraw the title when it has changed on
|
// Designed simply to redraw the title when it has changed on
|
||||||
// the client side.
|
// the client side.
|
||||||
_layerdata.highcolor=_colors->window_tab_text;
|
_layerdata.highcolor=_colors->window_tab_text;
|
||||||
_layerdata.lowcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
_layerdata.lowcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
||||||
|
|
||||||
int32 titlecount=_ClipTitle((_zoomrect.left-5)-(_closerect.right+textoffset));
|
int32 titlecount=_ClipTitle((_zoomrect.left-textoffset)-(_closerect.right+textoffset));
|
||||||
BString titlestr=GetTitle();
|
BString titlestr( GetTitle() );
|
||||||
|
|
||||||
if(titlecount<titlestr.CountChars())
|
if(titlecount<titlestr.CountChars())
|
||||||
{
|
{
|
||||||
titlestr.Truncate(titlecount-1);
|
titlestr.Truncate(titlecount-1);
|
||||||
@@ -301,7 +390,7 @@ void DefaultDecorator::_DrawTitle(BRect r)
|
|||||||
titlecount+=2;
|
titlecount+=2;
|
||||||
}
|
}
|
||||||
_driver->DrawString(titlestr.String(),titlecount,
|
_driver->DrawString(titlestr.String(),titlecount,
|
||||||
BPoint(_closerect.right+textoffset,_closerect.bottom+1),&_layerdata);
|
BPoint(_closerect.right+textoffset,_closerect.bottom-1),&_layerdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::_SetFocus(void)
|
void DefaultDecorator::_SetFocus(void)
|
||||||
@@ -311,14 +400,20 @@ void DefaultDecorator::_SetFocus(void)
|
|||||||
|
|
||||||
if(GetFocus())
|
if(GetFocus())
|
||||||
{
|
{
|
||||||
button_highcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
// ADI: a temporary hack - the colors were TOO dark
|
||||||
button_lowcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_DARKEN_2_TINT));
|
// button_highcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
||||||
|
// button_lowcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_DARKEN_2_TINT));
|
||||||
|
button_highcol.SetColor( RGBColor( 255, 255, 0 ) );
|
||||||
|
button_lowcol.SetColor( RGBColor( 234, 181, 0) );
|
||||||
textcol=_colors->window_tab_text;
|
textcol=_colors->window_tab_text;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button_highcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
// ADI: a temporary hack - the colors were TOO dark
|
||||||
button_lowcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_DARKEN_2_TINT));
|
// button_highcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
||||||
|
// button_lowcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_DARKEN_2_TINT));
|
||||||
|
button_highcol.SetColor( RGBColor(234, 181, 0) );
|
||||||
|
button_lowcol.SetColor( RGBColor( 255, 255, 0 ) );
|
||||||
textcol=_colors->inactive_window_tab_text;
|
textcol=_colors->inactive_window_tab_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,16 +426,14 @@ printf("DefaultDecorator: Draw(%.1f,%.1f,%.1f,%.1f)\n",update.left,update.top,up
|
|||||||
// We need to draw a few things: the tab, the resize thumb, the borders,
|
// We need to draw a few things: the tab, the resize thumb, the borders,
|
||||||
// and the buttons
|
// and the buttons
|
||||||
|
|
||||||
_DrawTab(update);
|
|
||||||
|
|
||||||
// Draw the top view's client area - just a hack :)
|
// Draw the top view's client area - just a hack :)
|
||||||
_layerdata.highcolor=_colors->document_background;
|
_layerdata.highcolor=_colors->document_background;
|
||||||
|
/*
|
||||||
if(_borderrect.Intersects(update))
|
if(_borderrect.Intersects(update))
|
||||||
_driver->FillRect(_borderrect & update,&_layerdata,pat_solidhigh);
|
_driver->FillRect(_borderrect & update,&_layerdata,pat_solidhigh);
|
||||||
|
*/
|
||||||
_DrawFrame(update);
|
_DrawFrame(update);
|
||||||
|
_DrawTab(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::Draw(void)
|
void DefaultDecorator::Draw(void)
|
||||||
@@ -360,24 +453,31 @@ void DefaultDecorator::Draw(void)
|
|||||||
|
|
||||||
void DefaultDecorator::_DrawZoom(BRect r)
|
void DefaultDecorator::_DrawZoom(BRect r)
|
||||||
{
|
{
|
||||||
|
printf("_DrawZoom(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom);
|
||||||
// If this has been implemented, then the decorator has a Zoom button
|
// If this has been implemented, then the decorator has a Zoom button
|
||||||
// which should be drawn based on the state of the member zoomstate
|
// which should be drawn based on the state of the member zoomstate
|
||||||
BRect zr=r;
|
BRect zr( r );
|
||||||
zr.left+=zr.Width()/3;
|
|
||||||
zr.top+=zr.Height()/3;
|
zr.left += 3.0;
|
||||||
|
zr.top += 3.0;
|
||||||
DrawBlendedRect(zr,GetZoom());
|
DrawBlendedRect( zr, GetZoom() );
|
||||||
DrawBlendedRect(zr.OffsetToCopy(r.LeftTop()),GetZoom());
|
|
||||||
|
zr = r;
|
||||||
|
zr.right -= 5.0;
|
||||||
|
zr.bottom -= 5.0;
|
||||||
|
DrawBlendedRect( zr, GetZoom() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::_DrawClose(BRect r)
|
void DefaultDecorator::_DrawClose(BRect r)
|
||||||
{
|
{
|
||||||
|
printf("_DrawClose(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom);
|
||||||
// Just like DrawZoom, but for a close button
|
// Just like DrawZoom, but for a close button
|
||||||
DrawBlendedRect(r,GetClose());
|
DrawBlendedRect( r, GetClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::_DrawTab(BRect r)
|
void DefaultDecorator::_DrawTab(BRect r)
|
||||||
{
|
{
|
||||||
|
printf("_DrawTab(%f,%f,%f,%f)\n", r.left, r.top, r.right, r.bottom);
|
||||||
// If a window has a tab, this will draw it and any buttons which are
|
// If a window has a tab, this will draw it and any buttons which are
|
||||||
// in it.
|
// in it.
|
||||||
if(_look==B_NO_BORDER_WINDOW_LOOK)
|
if(_look==B_NO_BORDER_WINDOW_LOOK)
|
||||||
@@ -385,8 +485,30 @@ void DefaultDecorator::_DrawTab(BRect r)
|
|||||||
|
|
||||||
_layerdata.highcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
_layerdata.highcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
||||||
_driver->FillRect(_tabrect,&_layerdata,pat_solidhigh);
|
_driver->FillRect(_tabrect,&_layerdata,pat_solidhigh);
|
||||||
_layerdata.highcolor=framecolors[3];
|
|
||||||
_driver->StrokeLine(_tabrect.LeftBottom(),_tabrect.RightBottom(),&_layerdata,pat_solidhigh);
|
_layerdata.highcolor=framecolors[2];
|
||||||
|
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.LeftBottom(),&_layerdata,pat_solidhigh);
|
||||||
|
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.RightTop(),&_layerdata,pat_solidhigh);
|
||||||
|
_layerdata.highcolor=framecolors[4];
|
||||||
|
_driver->StrokeLine(_tabrect.RightTop(),_tabrect.RightBottom(),&_layerdata,pat_solidhigh);
|
||||||
|
_layerdata.highcolor=framecolors[1];
|
||||||
|
_driver->StrokeLine( BPoint( _tabrect.left + 2, _tabrect.bottom ),
|
||||||
|
BPoint( _tabrect.right - 2, _tabrect.bottom ),
|
||||||
|
&_layerdata,pat_solidhigh);
|
||||||
|
|
||||||
|
_layerdata.highcolor = RGBColor( 255, 255, 0 );
|
||||||
|
_driver->StrokeLine( BPoint( _tabrect.left + 1, _tabrect.top + 1),
|
||||||
|
BPoint( _tabrect.left + 1, _tabrect.bottom),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
_driver->StrokeLine( BPoint( _tabrect.left + 1, _tabrect.top + 1),
|
||||||
|
BPoint( _tabrect.right - 1, _tabrect.top + 1),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
|
||||||
|
_layerdata.highcolor = RGBColor( 175, 123, 0 );
|
||||||
|
_driver->StrokeLine( BPoint( _tabrect.right - 1, _tabrect.top + 2),
|
||||||
|
BPoint( _tabrect.right - 1, _tabrect.bottom),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
|
||||||
|
|
||||||
_DrawTitle(_tabrect);
|
_DrawTitle(_tabrect);
|
||||||
|
|
||||||
@@ -408,7 +530,28 @@ void DefaultDecorator::DrawBlendedRect(BRect r, bool down)
|
|||||||
// Note that it is not part of the Decorator API - it's specific
|
// Note that it is not part of the Decorator API - it's specific
|
||||||
// to just the DefaultDecorator. Called by DrawZoom and DrawClose
|
// to just the DefaultDecorator. Called by DrawZoom and DrawClose
|
||||||
|
|
||||||
// Actually just draws a blended square
|
_layerdata.highcolor = RGBColor( 175, 123, 0 );
|
||||||
|
_driver->StrokeLine( r.LeftTop(),
|
||||||
|
BPoint( r.left, r.bottom - 1 ),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
_driver->StrokeLine( r.LeftTop(),
|
||||||
|
BPoint( r.right - 1, r.top ),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
_driver->StrokeLine( BPoint( r.right - 1, r.top + 2),
|
||||||
|
BPoint( r.right - 1, r.bottom - 1),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
_driver->StrokeLine( BPoint( r.left + 2, r.bottom -1),
|
||||||
|
BPoint( r.right - 2, r.bottom - 1),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
|
||||||
|
_layerdata.highcolor = RGBColor( 255, 255, 0 );
|
||||||
|
_driver->StrokeRect( BRect( r.left + 1, r.top + 1,
|
||||||
|
r.right, r.bottom),
|
||||||
|
&_layerdata, pat_solidhigh);
|
||||||
|
|
||||||
|
r.InsetBy( 2, 2 );
|
||||||
|
|
||||||
|
|
||||||
int32 w=r.IntegerWidth(), h=r.IntegerHeight();
|
int32 w=r.IntegerWidth(), h=r.IntegerHeight();
|
||||||
|
|
||||||
rgb_color tmpcol,halfcol, startcol, endcol;
|
rgb_color tmpcol,halfcol, startcol, endcol;
|
||||||
@@ -449,13 +592,7 @@ void DefaultDecorator::DrawBlendedRect(BRect r, bool down)
|
|||||||
_layerdata.highcolor=tmpcol;
|
_layerdata.highcolor=tmpcol;
|
||||||
_driver->StrokeLine(BPoint(r.left+steps,r.top+i),
|
_driver->StrokeLine(BPoint(r.left+steps,r.top+i),
|
||||||
BPoint(r.left+i,r.top+steps),&_layerdata,pat_solidhigh);
|
BPoint(r.left+i,r.top+steps),&_layerdata,pat_solidhigh);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// _layerdata.highcolor=startcol;
|
|
||||||
// _driver->FillRect(r,&_layerdata,pat_solidhigh);
|
|
||||||
_layerdata.highcolor=framecolors[3];
|
|
||||||
_driver->StrokeRect(r,&_layerdata,pat_solidhigh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultDecorator::_DrawFrame(BRect invalid)
|
void DefaultDecorator::_DrawFrame(BRect invalid)
|
||||||
@@ -465,11 +602,12 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// we must clip the lines drawn by this function to the invalid rectangle we are given
|
// we must clip the lines drawn by this function to the invalid rectangle we are given
|
||||||
|
|
||||||
#ifdef USE_VIEW_FILL_HACK
|
#ifdef USE_VIEW_FILL_HACK
|
||||||
_driver->FillRect(_borderrect,&_layerdata,pat_solidhigh);
|
_driver->FillRect(_frame,&_layerdata,pat_solidhigh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!borderwidth)
|
if(!borderwidth){
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Data specifically for the StrokeLineArray call.
|
// Data specifically for the StrokeLineArray call.
|
||||||
int32 numlines=0, maxlines=20;
|
int32 numlines=0, maxlines=20;
|
||||||
@@ -523,7 +661,6 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// Right side
|
// Right side
|
||||||
if(TestRectIntersection(rightborder,invalid))
|
if(TestRectIntersection(rightborder,invalid))
|
||||||
{
|
{
|
||||||
|
|
||||||
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
||||||
// it must be accounted for.
|
// it must be accounted for.
|
||||||
startx=(int32) MAX(invalid.left,rightborder.left);
|
startx=(int32) MAX(invalid.left,rightborder.left);
|
||||||
@@ -574,7 +711,6 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// Left side
|
// Left side
|
||||||
if(TestRectIntersection(leftborder,invalid))
|
if(TestRectIntersection(leftborder,invalid))
|
||||||
{
|
{
|
||||||
|
|
||||||
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
||||||
// it must be accounted for.
|
// it must be accounted for.
|
||||||
startx=(int32) MAX(invalid.left,leftborder.left);
|
startx=(int32) MAX(invalid.left,leftborder.left);
|
||||||
@@ -625,7 +761,6 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// Top side
|
// Top side
|
||||||
if(TestRectIntersection(topborder,invalid))
|
if(TestRectIntersection(topborder,invalid))
|
||||||
{
|
{
|
||||||
|
|
||||||
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
||||||
// it must be accounted for.
|
// it must be accounted for.
|
||||||
starty=(int32) MAX(invalid.top,topborder.top);
|
starty=(int32) MAX(invalid.top,topborder.top);
|
||||||
@@ -681,7 +816,6 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
// Bottom side
|
// Bottom side
|
||||||
if(TestRectIntersection(bottomborder,invalid))
|
if(TestRectIntersection(bottomborder,invalid))
|
||||||
{
|
{
|
||||||
|
|
||||||
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
// We may not have to redraw the entire width of the frame itself. Rare case, but
|
||||||
// it must be accounted for.
|
// it must be accounted for.
|
||||||
starty=(int32) MAX(invalid.top,bottomborder.top);
|
starty=(int32) MAX(invalid.top,bottomborder.top);
|
||||||
@@ -743,7 +877,6 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
if(!(_flags & B_NOT_RESIZABLE))
|
if(!(_flags & B_NOT_RESIZABLE))
|
||||||
{
|
{
|
||||||
r=_resizerect;
|
r=_resizerect;
|
||||||
|
|
||||||
// int32 w=r.IntegerWidth(), h=r.IntegerHeight();
|
// int32 w=r.IntegerWidth(), h=r.IntegerHeight();
|
||||||
|
|
||||||
// This code is strictly for B_DOCUMENT_WINDOW looks
|
// This code is strictly for B_DOCUMENT_WINDOW looks
|
||||||
@@ -813,10 +946,10 @@ void DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_layerdata.highcolor=framecolors[4];
|
_layerdata.highcolor=framecolors[2];
|
||||||
_driver->StrokeLine(BPoint(r.right,r.top),BPoint(r.right-3,r.top),
|
_driver->StrokeLine(BPoint(r.right-4,r.top),BPoint(r.right-2,r.top),
|
||||||
&_layerdata,pat_solidhigh);
|
&_layerdata,pat_solidhigh);
|
||||||
_driver->StrokeLine(BPoint(r.left,r.bottom),BPoint(r.left,r.bottom-3),
|
_driver->StrokeLine(BPoint(r.left,r.bottom-4),BPoint(r.left,r.bottom-2),
|
||||||
&_layerdata,pat_solidhigh);
|
&_layerdata,pat_solidhigh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,6 +462,23 @@ printf("Desktop: AddWindowToDesktop(%s,%ld,%ld)\n",win?win->GetTitle():"NULL",
|
|||||||
desktop_private::workspacelock.Unlock();
|
desktop_private::workspacelock.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WinBorder* WindowContainsPoint( BPoint pt ){
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: WindowContainsPoint(%s,%f,%f)\n",win?win->GetTitle():"NULL",
|
||||||
|
pt.x, pt.y);
|
||||||
|
#endif
|
||||||
|
WinBorder *wb;
|
||||||
|
|
||||||
|
desktop_private::workspacelock.Lock();
|
||||||
|
desktop_private::layerlock.Lock();
|
||||||
|
|
||||||
|
wb = desktop_private::activescreen->GetWindowAt( pt );
|
||||||
|
|
||||||
|
desktop_private::layerlock.Unlock();
|
||||||
|
desktop_private::workspacelock.Unlock();
|
||||||
|
|
||||||
|
return wb;
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
\brief Removes a window from the desktop
|
\brief Removes a window from the desktop
|
||||||
\param win Window to remove
|
\param win Window to remove
|
||||||
|
|||||||
@@ -32,11 +32,13 @@
|
|||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
//#include "WinBorder.h"
|
||||||
|
|
||||||
class ServerWindow;
|
class ServerWindow;
|
||||||
class Screen;
|
class Screen;
|
||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
class Layer;
|
class Layer;
|
||||||
|
class WinBorder;
|
||||||
|
|
||||||
void InitDesktop(void);
|
void InitDesktop(void);
|
||||||
void ShutdownDesktop(void);
|
void ShutdownDesktop(void);
|
||||||
@@ -57,6 +59,7 @@ status_t SetSpace(int32 index, int32 res, screen_id screen, bool stick=true);
|
|||||||
|
|
||||||
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen);
|
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen);
|
||||||
void RemoveWindowFromDesktop(ServerWindow *win);
|
void RemoveWindowFromDesktop(ServerWindow *win);
|
||||||
|
WinBorder* WindowContainsPoint( BPoint pt );
|
||||||
ServerWindow *GetActiveWindow(void);
|
ServerWindow *GetActiveWindow(void);
|
||||||
void SetActiveWindow(ServerWindow *win);
|
void SetActiveWindow(ServerWindow *win);
|
||||||
Layer *GetRootLayer(int32 workspace, screen_id screen);
|
Layer *GetRootLayer(int32 workspace, screen_id screen);
|
||||||
|
|||||||
@@ -33,7 +33,11 @@
|
|||||||
#include "TokenHandler.h"
|
#include "TokenHandler.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
|
#include "RootLayer.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
|
#include "DisplayDriver.h"
|
||||||
|
#include "Decorator.h"
|
||||||
|
|
||||||
|
|
||||||
//#define DEBUG_WORKSPACE
|
//#define DEBUG_WORKSPACE
|
||||||
//#define DEBUG_SCREEN
|
//#define DEBUG_SCREEN
|
||||||
@@ -443,6 +447,26 @@ printf("Screen::RemoveWindow(%s)\n",win?win->GetTitle():"NULL");
|
|||||||
|
|
||||||
win->_winborder->RemoveSelf();
|
win->_winborder->RemoveSelf();
|
||||||
}
|
}
|
||||||
|
/*!
|
||||||
|
\brief Returns the WinBorder taht contains the point
|
||||||
|
\param The point
|
||||||
|
\return The WinBorder that contains the point
|
||||||
|
*/
|
||||||
|
WinBorder* Screen::GetWindowAt( BPoint pt ){
|
||||||
|
WinBorder *wb;
|
||||||
|
Layer *rl = GetRootLayer();
|
||||||
|
Layer *child;
|
||||||
|
for(child = rl->_bottomchild; child!=NULL; child = child->_uppersibling)
|
||||||
|
{
|
||||||
|
if(child->_hidecount>0)
|
||||||
|
continue;
|
||||||
|
wb = dynamic_cast<WinBorder*>( child );
|
||||||
|
if (wb)
|
||||||
|
if(wb->GetDecorator()->GetFootprint()->Contains(pt))
|
||||||
|
return wb;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Returns the active window in the current workspace
|
\brief Returns the active window in the current workspace
|
||||||
|
|||||||
@@ -33,12 +33,14 @@
|
|||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <GraphicsCard.h>
|
#include <GraphicsCard.h>
|
||||||
#include <Window.h> // for workspace defs
|
#include <Window.h> // for workspace defs
|
||||||
#include "RootLayer.h"
|
|
||||||
|
|
||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
class ServerWindow;
|
class ServerWindow;
|
||||||
class RGBColor;
|
class RGBColor;
|
||||||
class Screen;
|
class Screen;
|
||||||
|
class WinBorder;
|
||||||
|
class RootLayer;
|
||||||
|
class Layer;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Workspace DesktopClasses.h
|
\class Workspace DesktopClasses.h
|
||||||
@@ -103,9 +105,10 @@ public:
|
|||||||
status_t SetSpace(int32 index, int32 res,bool stick=true);
|
status_t SetSpace(int32 index, int32 res,bool stick=true);
|
||||||
void AddWindow(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE);
|
void AddWindow(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE);
|
||||||
void RemoveWindow(ServerWindow *win);
|
void RemoveWindow(ServerWindow *win);
|
||||||
|
WinBorder* GetWindowAt( BPoint pt );
|
||||||
ServerWindow *ActiveWindow(void);
|
ServerWindow *ActiveWindow(void);
|
||||||
void SetActiveWindow(ServerWindow *win);
|
void SetActiveWindow(ServerWindow *win);
|
||||||
Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE);
|
Layer* GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE);
|
||||||
bool IsInitialized(void);
|
bool IsInitialized(void);
|
||||||
Workspace *GetWorkspace(int32 index);
|
Workspace *GetWorkspace(int32 index);
|
||||||
Workspace *GetActiveWorkspace(void);
|
Workspace *GetActiveWorkspace(void);
|
||||||
|
|||||||
@@ -470,10 +470,10 @@ bool Layer::IsDirty(void) const
|
|||||||
*/
|
*/
|
||||||
void Layer::UpdateIfNeeded(bool force_update)
|
void Layer::UpdateIfNeeded(bool force_update)
|
||||||
{
|
{
|
||||||
Layer *child;
|
|
||||||
|
|
||||||
if(IsHidden())
|
if(IsHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Layer *child;
|
||||||
|
|
||||||
if(force_update)
|
if(force_update)
|
||||||
{
|
{
|
||||||
@@ -535,27 +535,33 @@ void Layer::Show(void)
|
|||||||
if(_hidecount>0)
|
if(_hidecount>0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRegion *reg=new BRegion(ConvertToParent(_visible));
|
if( _parent ){
|
||||||
_parent->_visible->Exclude(reg);
|
BRegion *reg=new BRegion(ConvertToParent(_visible));
|
||||||
delete reg;
|
_parent->_visible->Exclude(reg);
|
||||||
|
delete reg;
|
||||||
|
_parent->_is_dirty=true;
|
||||||
|
}
|
||||||
_is_dirty=true;
|
_is_dirty=true;
|
||||||
_parent->_is_dirty=true;
|
|
||||||
|
if( _parent ){
|
||||||
Layer *sibling;
|
Layer *sibling;
|
||||||
for (sibling=_parent->_bottomchild; sibling!=NULL; sibling=sibling->_uppersibling)
|
for (sibling=_parent->_bottomchild; sibling!=NULL; sibling=sibling->_uppersibling)
|
||||||
{
|
{
|
||||||
if(TestRectIntersection(sibling->_frame,_frame))
|
if(TestRectIntersection(sibling->_frame,_frame))
|
||||||
sibling->MarkModified(_frame.OffsetByCopy(-sibling->_frame.left,-sibling->_frame.top));
|
sibling->MarkModified(_frame.OffsetByCopy(-sibling->_frame.left,-sibling->_frame.top));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer *child;
|
Layer *child;
|
||||||
for(child=_topchild; child!=NULL; child=child->_lowersibling)
|
for(child=_topchild; child!=NULL; child=child->_lowersibling)
|
||||||
child->Show();
|
child->Show();
|
||||||
|
|
||||||
if(_parent)
|
if(_parent){
|
||||||
_parent->RebuildRegions(true);
|
_parent->RebuildRegions(true);
|
||||||
|
_parent->UpdateIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
_parent->UpdateIfNeeded();
|
UpdateIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Hide the layer. Operates just like the BView call with the same name
|
//! Hide the layer. Operates just like the BView call with the same name
|
||||||
|
|||||||
@@ -35,11 +35,13 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include "LayerData.h"
|
#include "LayerData.h"
|
||||||
|
#include "DesktopClasses.h"
|
||||||
|
|
||||||
class ServerWindow;
|
class ServerWindow;
|
||||||
class PortLink;
|
class PortLink;
|
||||||
class RootLayer;
|
class RootLayer;
|
||||||
class WinBorder;
|
class WinBorder;
|
||||||
|
class Screen;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Layer Layer.h
|
\class Layer Layer.h
|
||||||
@@ -106,6 +108,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
friend class RootLayer;
|
friend class RootLayer;
|
||||||
friend class WinBorder;
|
friend class WinBorder;
|
||||||
|
friend class Screen;
|
||||||
|
|
||||||
|
|
||||||
BRect _frame;
|
BRect _frame;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include "DisplayDriver.h"
|
||||||
|
#include "Layer.h"
|
||||||
#include "RootLayer.h"
|
#include "RootLayer.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "PatternHandler.h" // for pattern_union
|
#include "PatternHandler.h" // for pattern_union
|
||||||
|
|||||||
@@ -28,8 +28,9 @@
|
|||||||
#ifndef _ROOTLAYER_H_
|
#ifndef _ROOTLAYER_H_
|
||||||
#define _ROOTLAYER_H_
|
#define _ROOTLAYER_H_
|
||||||
|
|
||||||
#include "DisplayDriver.h"
|
class DisplayDriver;
|
||||||
#include "Layer.h"
|
class RGBColor;
|
||||||
|
class Layer;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class RootLayer RootLayer.h
|
\class RootLayer RootLayer.h
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
|
|
||||||
|
#include <Session.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ScrollBar.h>
|
#include <ScrollBar.h>
|
||||||
@@ -136,6 +139,10 @@ ServerApp::~ServerApp(void)
|
|||||||
_piclist->MakeEmpty();
|
_piclist->MakeEmpty();
|
||||||
delete _piclist;
|
delete _piclist;
|
||||||
|
|
||||||
|
// ADI:
|
||||||
|
delete ses;
|
||||||
|
ses = NULL;
|
||||||
|
|
||||||
delete _applink;
|
delete _applink;
|
||||||
_applink=NULL;
|
_applink=NULL;
|
||||||
if(_appcursor)
|
if(_appcursor)
|
||||||
@@ -218,27 +225,14 @@ int32 ServerApp::MonitorApp(void *data)
|
|||||||
ServerApp *app=(ServerApp *)data;
|
ServerApp *app=(ServerApp *)data;
|
||||||
|
|
||||||
// Message-dispatching loop for the ServerApp
|
// Message-dispatching loop for the ServerApp
|
||||||
int32 msgcode;
|
int32 msgCode;
|
||||||
int8 *msgbuffer=NULL;
|
|
||||||
ssize_t buffersize,bytesread;
|
app->ses = new BSession( app->_receiver, 0L );
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
buffersize=port_buffer_size(app->_receiver);
|
if ( app->ses->ReadInt32( &msgCode ) != B_BAD_PORT_ID ){
|
||||||
|
switch (msgCode){
|
||||||
if(buffersize>0)
|
|
||||||
{
|
|
||||||
// buffers are PortLink messages. Allocate necessary buffer and
|
|
||||||
// we'll cast it as a BMessage.
|
|
||||||
msgbuffer=new int8[buffersize];
|
|
||||||
bytesread=read_port(app->_receiver,&msgcode,msgbuffer,buffersize);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bytesread=read_port(app->_receiver,&msgcode,NULL,0);
|
|
||||||
if (bytesread != B_BAD_PORT_ID && bytesread != B_TIMED_OUT && bytesread != B_WOULD_BLOCK)
|
|
||||||
{
|
|
||||||
switch(msgcode)
|
|
||||||
{
|
|
||||||
case AS_QUIT_APP:
|
case AS_QUIT_APP:
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SERVERAPP
|
#ifdef DEBUG_SERVERAPP
|
||||||
@@ -268,7 +262,7 @@ int32 ServerApp::MonitorApp(void *data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_QUIT_REQUESTED:
|
case B_QUIT_REQUESTED:
|
||||||
{
|
{
|
||||||
// Our BApplication sent us this message when it quit.
|
// Our BApplication sent us this message when it quit.
|
||||||
@@ -287,19 +281,15 @@ int32 ServerApp::MonitorApp(void *data)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
app->_DispatchMessage(msgcode, msgbuffer);
|
#ifdef DEBUG_SERVERAPP
|
||||||
|
printf("ServerApp %s: Got a Message to dispatch\n",app->_signature.String());
|
||||||
|
#endif
|
||||||
|
app->_DispatchMessage(msgCode, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} // switch
|
||||||
|
} // if
|
||||||
}
|
} // for
|
||||||
|
|
||||||
if(buffersize>0)
|
|
||||||
delete msgbuffer;
|
|
||||||
|
|
||||||
if(msgcode==B_QUIT_REQUESTED)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit_thread(0);
|
exit_thread(0);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -335,48 +325,51 @@ void ServerApp::_DispatchMessage(int32 code, int8 *buffer)
|
|||||||
// Create the ServerWindow to node monitor a new OBWindow
|
// Create the ServerWindow to node monitor a new OBWindow
|
||||||
|
|
||||||
// Attached data:
|
// Attached data:
|
||||||
// 1) port_id reply port
|
|
||||||
// 2) BRect window frame
|
// 2) BRect window frame
|
||||||
// 3) uint32 window look
|
// 3) uint32 window look
|
||||||
// 4) uint32 window feel
|
// 4) uint32 window feel
|
||||||
// 5) uint32 window flags
|
// 5) uint32 window flags
|
||||||
// 6) port_id window's message port
|
// 6) uint32 workspace index
|
||||||
// 7) uint32 workspace index
|
// 7) int32 BHandler token of the window
|
||||||
// 8) int32 BHandler token of the window
|
// 8) port_id window's message port
|
||||||
// 9) const char * title
|
// 9) const char * title
|
||||||
|
|
||||||
// Find the necessary data
|
BRect frame;
|
||||||
port_id reply_port=*((port_id*)index); index+=sizeof(port_id);
|
uint32 look;
|
||||||
BRect rect=*((BRect*)index); index+=sizeof(BRect);
|
uint32 feel;
|
||||||
|
uint32 flags;
|
||||||
|
uint32 wkspaces;
|
||||||
|
int32 token;
|
||||||
|
port_id sendPort;
|
||||||
|
char *title;
|
||||||
|
|
||||||
|
ses->ReadRect( &frame );
|
||||||
|
ses->ReadInt32( (int32*)&look );
|
||||||
|
ses->ReadInt32( (int32*)&feel );
|
||||||
|
ses->ReadInt32( (int32*)&flags );
|
||||||
|
ses->ReadInt32( (int32*)&wkspaces );
|
||||||
|
ses->ReadInt32( &token );
|
||||||
|
ses->ReadData( &sendPort, sizeof(port_id) );
|
||||||
|
title = ses->ReadString();
|
||||||
|
|
||||||
uint32 winlook=*((uint32*)index); index+=sizeof(uint32);
|
#ifdef DEBUG_SERVERAPP
|
||||||
uint32 winfeel=*((uint32*)index); index+=sizeof(uint32);
|
printf("ServerApp %s: Got 'New Window' message, trying to do smething...\n");
|
||||||
uint32 winflags=*((uint32*)index); index+=sizeof(uint32);
|
#endif
|
||||||
|
|
||||||
port_id win_port=*((port_id*)index); index+=sizeof(port_id);
|
// ServerWindow constructor will reply with port_id of a newly created port
|
||||||
int32 htoken=*((int32*)index); index+=sizeof(int32);
|
ServerWindow *newwin = new ServerWindow( frame, title,
|
||||||
uint32 workspace=*((uint32*)index); index+=sizeof(uint32);
|
look, feel, flags, this, sendPort, wkspaces, token);
|
||||||
|
_winlist->AddItem( newwin );
|
||||||
// Create the ServerWindow object for this window
|
//AddWindowToDesktop( newwin, workspace, ActiveScreen() );
|
||||||
ServerWindow *newwin=new ServerWindow(rect,(const char *)index,
|
|
||||||
winlook, winfeel, winflags,this,win_port,workspace,htoken);
|
|
||||||
_winlist->AddItem(newwin);
|
|
||||||
AddWindowToDesktop(newwin,workspace,ActiveScreen());
|
|
||||||
|
|
||||||
#ifdef DEBUG_SERVERAPP
|
#ifdef DEBUG_SERVERAPP
|
||||||
printf("ServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
printf("ServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
||||||
_signature.String(),(const char *)index,rect.left,rect.top,rect.right,rect.bottom);
|
_signature.String(),title,frame.left,frame.top,frame.right,frame.bottom);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
delete title;
|
||||||
|
|
||||||
// Window looper is waiting for our reply. Send back the
|
|
||||||
// ServerWindow's message port
|
|
||||||
PortLink *replylink=new PortLink(reply_port);
|
|
||||||
replylink->SetOpCode(AS_SET_SERVER_PORT);
|
|
||||||
replylink->Attach<int32>(newwin->_receiver);
|
|
||||||
replylink->Attach<int32>(newwin->_token);
|
|
||||||
replylink->Flush();
|
|
||||||
|
|
||||||
delete replylink;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_DELETE_WINDOW:
|
case AS_DELETE_WINDOW:
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <Session.h>
|
||||||
|
|
||||||
class AppServer;
|
class AppServer;
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class PortLink;
|
class PortLink;
|
||||||
@@ -86,6 +89,8 @@ protected:
|
|||||||
bool _cursorhidden;
|
bool _cursorhidden;
|
||||||
bool _isactive;
|
bool _isactive;
|
||||||
int32 _handlertoken;
|
int32 _handlertoken;
|
||||||
|
// ADI:
|
||||||
|
BSession *ses;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
|
#include "RootLayer.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
#include "DesktopClasses.h"
|
#include "DesktopClasses.h"
|
||||||
#include "TokenHandler.h"
|
#include "TokenHandler.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "DisplayDriver.h"
|
||||||
|
|
||||||
//#define DEBUG_SERVERWINDOW
|
//#define DEBUG_SERVERWINDOW
|
||||||
//#define DEBUG_SERVERWINDOW_MOUSE
|
//#define DEBUG_SERVERWINDOW_MOUSE
|
||||||
@@ -109,12 +111,18 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
|
|
||||||
// _sender is the monitored window's event port
|
// _sender is the monitored window's event port
|
||||||
_sender=winport;
|
_sender=winport;
|
||||||
_winlink=new PortLink(_sender);
|
|
||||||
|
|
||||||
|
_winlink=new PortLink(_sender);
|
||||||
_applink= (winapp)? new PortLink(winapp->_receiver) : NULL;
|
_applink= (winapp)? new PortLink(winapp->_receiver) : NULL;
|
||||||
|
|
||||||
// _receiver is the port to which the app sends messages for the server
|
// _receiver is the port to which the app sends messages for the server
|
||||||
_receiver=create_port(30,_title->String());
|
_receiver=create_port(30,_title->String());
|
||||||
|
|
||||||
|
|
||||||
|
ses = new BSession( _receiver, _sender );
|
||||||
|
// Send a reply to our window - it is expecting _receiver port.
|
||||||
|
ses->WriteData( &_receiver, sizeof(port_id) );
|
||||||
|
ses->Sync();
|
||||||
|
|
||||||
_active=false;
|
_active=false;
|
||||||
|
|
||||||
@@ -151,6 +159,10 @@ ServerWindow::~ServerWindow(void)
|
|||||||
delete _title;
|
delete _title;
|
||||||
delete _winlink;
|
delete _winlink;
|
||||||
delete _winborder;
|
delete _winborder;
|
||||||
|
|
||||||
|
|
||||||
|
delete ses;
|
||||||
|
ses = NULL;
|
||||||
}
|
}
|
||||||
kill_thread(_monitorthread);
|
kill_thread(_monitorthread);
|
||||||
}
|
}
|
||||||
@@ -390,9 +402,9 @@ bool ServerWindow::IsLocked(void)
|
|||||||
return _locker.IsLocked();
|
return _locker.IsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerWindow::DispatchMessage(PortMessage *msg)
|
void ServerWindow::DispatchMessage( int32 code )
|
||||||
{
|
{
|
||||||
switch(msg->Code())
|
switch( code )
|
||||||
{
|
{
|
||||||
case AS_LAYER_CREATE:
|
case AS_LAYER_CREATE:
|
||||||
{
|
{
|
||||||
@@ -459,6 +471,9 @@ void ServerWindow::DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
case AS_SHOW_WINDOW:
|
case AS_SHOW_WINDOW:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
|
printf("ServerWindow %s: Message AS_SHOW\n",_title->String());
|
||||||
|
#endif
|
||||||
Show();
|
Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -629,7 +644,7 @@ void ServerWindow::DispatchMessage(PortMessage *msg)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
printf("ServerWindow %s received unexpected code - message offset %lx\n",_title->String(),msg->Code()-SERVER_TRUE);
|
printf("ServerWindow %s received unexpected code - message offset %lx\n",_title->String(), code - SERVER_TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1181,23 +1196,17 @@ void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|||||||
*/
|
*/
|
||||||
int32 ServerWindow::MonitorWin(void *data)
|
int32 ServerWindow::MonitorWin(void *data)
|
||||||
{
|
{
|
||||||
ServerWindow *win=(ServerWindow *)data;
|
ServerWindow *win = (ServerWindow *)data;
|
||||||
PortMessage msg;
|
status_t rv;
|
||||||
int32 msgstat;
|
int32 code;
|
||||||
|
|
||||||
int8 *msgbuffer=NULL;
|
|
||||||
ssize_t buffersize;
|
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
msgstat=msg.ReadFromPort(win->_receiver);
|
rv = win->ses->ReadInt32( &code );
|
||||||
|
|
||||||
if(msgstat==B_OK)
|
if ( rv != B_BAD_PORT_ID ){
|
||||||
{
|
switch( code ){
|
||||||
switch(msg.Code())
|
case B_QUIT_REQUESTED:{
|
||||||
{
|
|
||||||
case B_QUIT_REQUESTED:
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s received Quit request\n",win->Title());
|
printf("ServerWindow %s received Quit request\n",win->Title());
|
||||||
#endif
|
#endif
|
||||||
@@ -1208,20 +1217,18 @@ int32 ServerWindow::MonitorWin(void *data)
|
|||||||
win->_applink->Flush();
|
win->_applink->Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_BEGIN_UPDATE:
|
default:{
|
||||||
{
|
win->DispatchMessage( code );
|
||||||
win->DispatchGraphicsMessage(buffersize,msgbuffer);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
// win->DispatchMessage(msgcode,msgbuffer);
|
|
||||||
win->DispatchMessage(&msg);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
exit_thread(1);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg.Code()==B_QUIT_REQUESTED)
|
if( code == B_QUIT_REQUESTED )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1279,11 +1286,10 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
|||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
// If we have clicked on a window,
|
// If we have clicked on a window,
|
||||||
active_winborder=_winborder=(WinBorder*)root->GetChildAt(pt);
|
active_winborder = _winborder = WindowContainsPoint(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
// _winborder->MouseDown(buffer);
|
|
||||||
_winborder->MouseDown((int8*)msg->Buffer());
|
_winborder->MouseDown((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1311,7 +1317,7 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
|||||||
set_is_sliding_tab(false);
|
set_is_sliding_tab(false);
|
||||||
set_is_moving_window(false);
|
set_is_moving_window(false);
|
||||||
set_is_resizing_window(false);
|
set_is_resizing_window(false);
|
||||||
_winborder=(WinBorder*)root->GetChildAt(pt);
|
_winborder = WindowContainsPoint(pt);
|
||||||
active_winborder=NULL;
|
active_winborder=NULL;
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
@@ -1319,7 +1325,6 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
|||||||
|
|
||||||
// Eventually, we will build in MouseUp messages with buttons specified
|
// Eventually, we will build in MouseUp messages with buttons specified
|
||||||
// For now, we just "assume" no mouse specification with a 0.
|
// For now, we just "assume" no mouse specification with a 0.
|
||||||
// _winborder->MouseUp(buffer);
|
|
||||||
_winborder->MouseUp((int8*)msg->Buffer());
|
_winborder->MouseUp((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1345,16 +1350,14 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
|||||||
|
|
||||||
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
||||||
{
|
{
|
||||||
// active_winborder->MouseMoved(buffer);
|
|
||||||
active_winborder->MouseMoved((int8*)msg->Buffer());
|
active_winborder->MouseMoved((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_winborder=(WinBorder*)root->GetChildAt(pt);
|
_winborder = WindowContainsPoint(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
// _winborder->MouseMoved(buffer);
|
|
||||||
_winborder->MouseMoved((int8*)msg->Buffer());
|
_winborder->MouseMoved((int8*)msg->Buffer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <PortMessage.h>
|
#include <PortMessage.h>
|
||||||
|
|
||||||
|
#include <Session.h>
|
||||||
|
|
||||||
class BString;
|
class BString;
|
||||||
class BMessenger;
|
class BMessenger;
|
||||||
class BPoint;
|
class BPoint;
|
||||||
@@ -85,7 +87,7 @@ public:
|
|||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool IsLocked(void);
|
bool IsLocked(void);
|
||||||
|
|
||||||
void DispatchMessage(PortMessage *msg);
|
void DispatchMessage( int32 code );
|
||||||
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
void DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer);
|
||||||
static int32 MonitorWin(void *data);
|
static int32 MonitorWin(void *data);
|
||||||
static void HandleMouseEvent(PortMessage *msg);
|
static void HandleMouseEvent(PortMessage *msg);
|
||||||
@@ -120,6 +122,9 @@ protected:
|
|||||||
BRect _frame;
|
BRect _frame;
|
||||||
uint32 _token;
|
uint32 _token;
|
||||||
int32 _handlertoken;
|
int32 _handlertoken;
|
||||||
|
|
||||||
|
// ADI:
|
||||||
|
BSession *ses;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
|
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
//#define DEBUG_WINBORDER
|
//#define DEBUG_WINBORDER
|
||||||
//#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>
|
||||||
@@ -84,8 +84,6 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
_mbuttons=0;
|
_mbuttons=0;
|
||||||
_kmodifiers=0;
|
_kmodifiers=0;
|
||||||
_win=win;
|
_win=win;
|
||||||
if(_win)
|
|
||||||
_frame=_win->_frame;
|
|
||||||
|
|
||||||
_mousepos.Set(0,0);
|
_mousepos.Set(0,0);
|
||||||
_update=false;
|
_update=false;
|
||||||
@@ -95,6 +93,13 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
_vresizewin=false;
|
_vresizewin=false;
|
||||||
_driver=GetGfxDriver(ActiveScreen());
|
_driver=GetGfxDriver(ActiveScreen());
|
||||||
_decorator=new_decorator(r,name,look,feel,flags,GetGfxDriver(ActiveScreen()));
|
_decorator=new_decorator(r,name,look,feel,flags,GetGfxDriver(ActiveScreen()));
|
||||||
|
// WinBorder must also include the right/left/top/bottom Decorator'
|
||||||
|
// rects - given by _decorator::GetBorderRect() - to be able to draw the borders
|
||||||
|
_frame = _decorator->GetBorderRect();
|
||||||
|
_visible->Set( _frame );
|
||||||
|
_full->Set( _frame );
|
||||||
|
_invalid->Set( _frame );
|
||||||
|
|
||||||
_decorator->SetDriver(_driver);
|
_decorator->SetDriver(_driver);
|
||||||
_decorator->SetTitle(name);
|
_decorator->SetTitle(name);
|
||||||
|
|
||||||
@@ -296,23 +301,28 @@ printf("ClickMove: Drag\n");
|
|||||||
{
|
{
|
||||||
BRect oldmoveframe=_win->_frame;
|
BRect oldmoveframe=_win->_frame;
|
||||||
_clientframe.OffsetBy(pt);
|
_clientframe.OffsetBy(pt);
|
||||||
|
|
||||||
_win->Lock();
|
_win->Lock();
|
||||||
_win->_frame.OffsetBy(dx,dy);
|
_win->_frame.OffsetBy(dx,dy);
|
||||||
_win->Unlock();
|
_win->Unlock();
|
||||||
|
|
||||||
lock_layers();
|
lock_layers();
|
||||||
BRegion *reg=_decorator->GetFootprint();
|
BRegion *reg=_decorator->GetFootprint();
|
||||||
_driver->CopyRegion(reg,_win->_frame.LeftTop());
|
// TODO: we get an error here!!! - this method is untested
|
||||||
|
//_driver->CopyRegion(reg,_win->_frame.LeftTop());
|
||||||
BRegion reg2(oldmoveframe);
|
|
||||||
MoveBy(dx,dy);
|
|
||||||
_decorator->MoveBy(BPoint(dx, dy));
|
_decorator->MoveBy(BPoint(dx, dy));
|
||||||
|
|
||||||
|
MoveBy(dx,dy);
|
||||||
|
|
||||||
|
// ADI: what do those do???
|
||||||
|
BRegion reg2(oldmoveframe);
|
||||||
reg->OffsetBy((int32)dx, (int32)dy);
|
reg->OffsetBy((int32)dx, (int32)dy);
|
||||||
reg2.Exclude(reg);
|
reg2.Exclude(reg);
|
||||||
|
|
||||||
_parent->RebuildRegions();
|
_parent->RebuildRegions();
|
||||||
_parent->RequestDraw();
|
_parent->RequestDraw();
|
||||||
|
|
||||||
delete reg;
|
delete reg;
|
||||||
unlock_layers();
|
unlock_layers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ protected:
|
|||||||
BString *_title;
|
BString *_title;
|
||||||
Decorator *_decorator;
|
Decorator *_decorator;
|
||||||
int32 _flags;
|
int32 _flags;
|
||||||
BRect _frame, _clientframe;
|
// !!! HERE we do have a problem... _frame is also defined in Layer.h
|
||||||
|
// BRect _frame, _clientframe;
|
||||||
|
BRect _clientframe;
|
||||||
int32 _mbuttons,_kmodifiers;
|
int32 _mbuttons,_kmodifiers;
|
||||||
BPoint _mousepos;
|
BPoint _mousepos;
|
||||||
bool _update;
|
bool _update;
|
||||||
|
|||||||
Reference in New Issue
Block a user