Modified to use the new BSession class
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4431 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+232
-349
@@ -20,44 +20,44 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
// File Name: Window.cpp
|
// File Name: Window.cpp
|
||||||
// Author: Adrian Oanca (oancaadrian@yahoo.com)
|
// Author: Adrian Oanca (e2joseph@hotpop.com)
|
||||||
// Description: A BWindow object represents a window that can be displayed
|
// Description: A BWindow object represents a window that can be displayed
|
||||||
// on the screen, and that can be the target of user events
|
// on the screen, and that can be the target of user events
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Standard Includes -----------------------------------------------------------
|
|
||||||
|
|
||||||
// System Includes -------------------------------------------------------------
|
// System Includes -------------------------------------------------------------
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
|
||||||
#include <AppMisc.h>
|
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Application.h>
|
#include <PropertyInfo.h>
|
||||||
#include <Looper.h>
|
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
|
#include <Looper.h>
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Window.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <PropertyInfo.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <PortLink.h>
|
|
||||||
#include <ServerProtocol.h>
|
|
||||||
#include <AppServerLink.h>
|
|
||||||
#include <MessageQueue.h>
|
#include <MessageQueue.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
// Local Includes --------------------------------------------------------------
|
// Project Includes ------------------------------------------------------------
|
||||||
#include <WindowAux.h>
|
#include <AppMisc.h>
|
||||||
|
#include <Session.h>
|
||||||
|
#include <ServerProtocol.h>
|
||||||
#include <TokenSpace.h>
|
#include <TokenSpace.h>
|
||||||
#include "MessageUtils.h"
|
#include <MessageUtils.h>
|
||||||
|
#include <WindowAux.h>
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
#define DEBUG_WIN
|
||||||
|
|
||||||
// Globals ---------------------------------------------------------------------
|
// Globals ---------------------------------------------------------------------
|
||||||
static property_info windowPropInfo[] =
|
static property_info windowPropInfo[] =
|
||||||
@@ -126,6 +126,9 @@ BWindow::BWindow(BRect frame,
|
|||||||
uint32 workspace)
|
uint32 workspace)
|
||||||
: BLooper( title )
|
: BLooper( title )
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WIN
|
||||||
|
printf("BWindow::BWindow()\n");
|
||||||
|
#endif
|
||||||
window_look look;
|
window_look look;
|
||||||
window_feel feel;
|
window_feel feel;
|
||||||
|
|
||||||
@@ -173,7 +176,7 @@ BWindow::BWindow(BMessage* data)
|
|||||||
data->FindInt32("_wspace", (int32*)&workspaces);
|
data->FindInt32("_wspace", (int32*)&workspaces);
|
||||||
|
|
||||||
if ( data->FindInt32("_type", (int32*)&type) == B_OK ){
|
if ( data->FindInt32("_type", (int32*)&type) == B_OK ){
|
||||||
decomposeType( (window_type)type, &fLook, &fFeel );
|
( (window_type)type, &fLook, &fFeel );
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect to app_server and initialize data
|
// connect to app_server and initialize data
|
||||||
@@ -228,8 +231,7 @@ BWindow::~BWindow(){
|
|||||||
// disable pulsing
|
// disable pulsing
|
||||||
SetPulseRate( 0 );
|
SetPulseRate( 0 );
|
||||||
|
|
||||||
delete srvGfxLink;
|
delete session;
|
||||||
delete serverLink;
|
|
||||||
delete_port( receive_port );
|
delete_port( receive_port );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,11 +365,10 @@ void BWindow::Minimize(bool minimize){
|
|||||||
if (IsFloating())
|
if (IsFloating())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_WINDOW_MINIMIZE );
|
|
||||||
serverLink->Attach<bool>( minimize );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_WINDOW_MINIMIZE );
|
||||||
|
session->WriteBool( minimize );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -376,60 +377,57 @@ status_t BWindow::SendBehind(const BWindow* window){
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SEND_BEHIND );
|
int32 rCode;
|
||||||
serverLink->Attach<int32>( _get_object_token_(window) );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SEND_BEHIND );
|
||||||
|
session->WriteInt32( _get_object_token_(window) );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
return rCode == SERVER_TRUE? B_OK : B_ERROR;
|
||||||
|
|
||||||
return replyData.code == SERVER_TRUE? B_OK : B_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::Flush() const{
|
void BWindow::Flush() const{
|
||||||
const_cast<BWindow*>(this)->Lock();
|
const_cast<BWindow*>(this)->Lock();
|
||||||
srvGfxLink->Flush();
|
session->Sync();
|
||||||
const_cast<BWindow*>(this)->Unlock();
|
const_cast<BWindow*>(this)->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::Sync() const{
|
void BWindow::Sync() const{
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
int32 rCode;
|
||||||
|
|
||||||
const_cast<BWindow*>(this)->Lock();
|
const_cast<BWindow*>(this)->Lock();
|
||||||
srvGfxLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SYNC );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
const_cast<BWindow*>(this)->Unlock();
|
const_cast<BWindow*>(this)->Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::DisableUpdates(){
|
void BWindow::DisableUpdates(){
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_DISABLE_UPDATES );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_DISABLE_UPDATES );
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::EnableUpdates(){
|
void BWindow::EnableUpdates(){
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_ENABLE_UPDATES );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_ENABLE_UPDATES );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +435,10 @@ void BWindow::EnableUpdates(){
|
|||||||
|
|
||||||
void BWindow::BeginViewTransaction(){
|
void BWindow::BeginViewTransaction(){
|
||||||
if ( !fInTransaction ){
|
if ( !fInTransaction ){
|
||||||
srvGfxLink->SetOpCode( AS_BEGIN_TRANSACTION );
|
Lock();
|
||||||
|
session->WriteInt32( AS_BEGIN_TRANSACTION );
|
||||||
|
Unlock();
|
||||||
|
|
||||||
fInTransaction = true;
|
fInTransaction = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,10 +447,12 @@ void BWindow::BeginViewTransaction(){
|
|||||||
|
|
||||||
void BWindow::EndViewTransaction(){
|
void BWindow::EndViewTransaction(){
|
||||||
if ( fInTransaction ){
|
if ( fInTransaction ){
|
||||||
// !!!!!!!!! if not '(int32)AS_END_TRANSACTION' we receive an error ?????
|
Lock();
|
||||||
srvGfxLink->Attach<int32>( (int32)AS_END_TRANSACTION );
|
session->WriteInt32( AS_END_TRANSACTION );
|
||||||
fInTransaction = false;
|
session->Sync();
|
||||||
Flush();
|
Unlock();
|
||||||
|
|
||||||
|
fInTransaction = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,7 +869,7 @@ void BWindow::DispatchMessage(BMessage *msg, BHandler *target)
|
|||||||
BLooper::DispatchMessage(msg, target);
|
BLooper::DispatchMessage(msg, target);
|
||||||
break;}
|
break;}
|
||||||
}
|
}
|
||||||
Flush();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -915,33 +918,29 @@ void BWindow::MenusEnded(){
|
|||||||
|
|
||||||
void BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
void BWindow::SetSizeLimits(float minWidth, float maxWidth,
|
||||||
float minHeight, float maxHeight){
|
float minHeight, float maxHeight){
|
||||||
|
int32 rCode;
|
||||||
|
|
||||||
if (minWidth > maxWidth)
|
if (minWidth > maxWidth)
|
||||||
return;
|
return;
|
||||||
if (minHeight > maxHeight)
|
if (minHeight > maxHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SET_SIZE_LIMITS );
|
|
||||||
serverLink->Attach<float>( fMinWindWidth );
|
|
||||||
serverLink->Attach<float>( fMaxWindWidth );
|
|
||||||
serverLink->Attach<float>( fMinWindHeight );
|
|
||||||
serverLink->Attach<float>( fMaxWindHeight );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SET_SIZE_LIMITS );
|
||||||
|
session->WriteFloat( fMinWindWidth );
|
||||||
|
session->WriteFloat( fMaxWindWidth );
|
||||||
|
session->WriteFloat( fMinWindHeight );
|
||||||
|
session->WriteFloat( fMaxWindHeight );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
if (rCode == SERVER_TRUE){
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
|
||||||
fMinWindHeight = minHeight;
|
fMinWindHeight = minHeight;
|
||||||
fMinWindWidth = minWidth;
|
fMinWindWidth = minWidth;
|
||||||
fMaxWindHeight = maxHeight;
|
fMaxWindHeight = maxHeight;
|
||||||
fMaxWindWidth = maxWidth;
|
fMaxWindWidth = maxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1157,17 +1156,16 @@ Note: for developers!
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool BWindow::NeedsUpdate() const{
|
bool BWindow::NeedsUpdate() const{
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_NEEDS_UPDATE );
|
int32 rCode;
|
||||||
|
|
||||||
const_cast<BWindow*>(this)->Lock();
|
const_cast<BWindow*>(this)->Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_NEEDS_UPDATE );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
const_cast<BWindow*>(this)->Unlock();
|
const_cast<BWindow*>(this)->Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
return rCode == SERVER_TRUE;
|
||||||
|
|
||||||
return replyData.code == SERVER_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1175,7 +1173,7 @@ bool BWindow::NeedsUpdate() const{
|
|||||||
void BWindow::UpdateIfNeeded(){
|
void BWindow::UpdateIfNeeded(){
|
||||||
// works only from this thread
|
// works only from this thread
|
||||||
if (find_thread(NULL) == Thread()){
|
if (find_thread(NULL) == Thread()){
|
||||||
Flush();
|
Sync();
|
||||||
drawAllViews( top_view );
|
drawAllViews( top_view );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1206,11 +1204,10 @@ void BWindow::Activate(bool active){
|
|||||||
if (IsHidden())
|
if (IsHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_ACTIVATE_WINDOW );
|
|
||||||
serverLink->Attach<bool>( active );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_ACTIVATE_WINDOW );
|
||||||
|
session->WriteBool( active );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1350,16 +1347,14 @@ void BWindow::SetTitle(const char* title){
|
|||||||
rename_thread( Thread(), threadName );
|
rename_thread( Thread(), threadName );
|
||||||
|
|
||||||
// we notify the app_server so we can actually see the change
|
// we notify the app_server so we can actually see the change
|
||||||
serverLink->SetOpCode( AS_WINDOW_TITLE);
|
|
||||||
serverLink->Attach( fTitle, strlen(fTitle)+1 );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_WINDOW_TITLE);
|
||||||
|
session->WriteString( fTitle );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SetName( threadName );
|
SetName( threadName );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1412,22 +1407,20 @@ bool BWindow::IsFloating() const{
|
|||||||
status_t BWindow::AddToSubset(BWindow* window){
|
status_t BWindow::AddToSubset(BWindow* window){
|
||||||
if ( !window )
|
if ( !window )
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
int32 rCode;
|
||||||
|
|
||||||
if (window->Feel() == B_MODAL_SUBSET_WINDOW_FEEL ||
|
if (window->Feel() == B_MODAL_SUBSET_WINDOW_FEEL ||
|
||||||
window->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL){
|
window->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL){
|
||||||
|
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_ADD_TO_SUBSET );
|
|
||||||
serverLink->Attach<int32>( _get_object_token_(window) );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_ADD_TO_SUBSET );
|
||||||
|
session->WriteInt32( _get_object_token_(window) );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
|
||||||
|
|
||||||
return replyData.code == SERVER_TRUE? B_OK : B_ERROR;
|
return rCode == SERVER_TRUE? B_OK : B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -1438,19 +1431,17 @@ status_t BWindow::AddToSubset(BWindow* window){
|
|||||||
status_t BWindow::RemoveFromSubset(BWindow* window){
|
status_t BWindow::RemoveFromSubset(BWindow* window){
|
||||||
if ( !window )
|
if ( !window )
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
int32 rCode;
|
||||||
|
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_REM_FROM_SUBSET );
|
|
||||||
serverLink->Attach<int32>( _get_object_token_(window) );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_REM_FROM_SUBSET );
|
||||||
|
session->WriteInt32( _get_object_token_(window) );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
return rCode == SERVER_TRUE? B_OK : B_ERROR;
|
||||||
|
|
||||||
return replyData.code == SERVER_TRUE? B_OK : B_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1477,26 +1468,21 @@ window_type BWindow::Type() const{
|
|||||||
|
|
||||||
status_t BWindow::SetLook(window_look look){
|
status_t BWindow::SetLook(window_look look){
|
||||||
|
|
||||||
uint32 uintLook;
|
int32 rCode;
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
uintLook = WindowLookToInteger( look );
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SET_LOOK );
|
|
||||||
serverLink->Attach( &uintLook, sizeof( uint32 ) );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SET_LOOK );
|
||||||
|
session->WriteInt32( (int32)look );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
if (rCode == SERVER_TRUE){
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
|
||||||
fLook = look;
|
fLook = look;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1508,30 +1494,24 @@ window_look BWindow::Look() const{
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t BWindow::SetFeel(window_feel feel){
|
status_t BWindow::SetFeel(window_feel feel){
|
||||||
|
|
||||||
/* TODO: See what happens when a window that is part of a subset, changes its
|
/* TODO: See what happens when a window that is part of a subset, changes its
|
||||||
feel!? should it be removed from the subset???
|
feel!? should it be removed from the subset???
|
||||||
*/
|
*/
|
||||||
uint32 uintFeel;
|
int32 rCode;
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
uintFeel = WindowFeelToInteger( feel );
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SET_FEEL );
|
|
||||||
serverLink->Attach( &uintFeel, sizeof( uint32 ) );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SET_FEEL );
|
||||||
|
session->WriteInt32( (int32)feel );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
if (rCode == SERVER_TRUE){
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
|
||||||
fFeel = feel;
|
fFeel = feel;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1543,23 +1523,22 @@ window_feel BWindow::Feel() const{
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
status_t BWindow::SetFlags(uint32 flags){
|
status_t BWindow::SetFlags(uint32 flags){
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
int32 rCode;
|
||||||
serverLink->SetOpCode( AS_SET_FLAGS );
|
|
||||||
serverLink->Attach( &flags, sizeof( uint32 ) );
|
Lock();
|
||||||
|
session->WriteInt32( AS_SET_FLAGS );
|
||||||
Lock();
|
session->WriteUInt32( flags );
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
if (rCode == SERVER_TRUE){
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
|
||||||
fFlags = flags;
|
fFlags = flags;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1595,27 +1574,24 @@ status_t BWindow::SetWindowAlignment(window_alignment mode,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// TODO: test if hOffset = 0 and set it to 1 if true.
|
// TODO: test if hOffset = 0 and set it to 1 if true.
|
||||||
|
int32 rCode;
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SET_ALIGNMENT );
|
|
||||||
serverLink->Attach<int32>( (int32)mode );
|
|
||||||
serverLink->Attach<int32>( h );
|
|
||||||
serverLink->Attach<int32>( hOffset );
|
|
||||||
serverLink->Attach<int32>( width );
|
|
||||||
serverLink->Attach<int32>( widthOffset );
|
|
||||||
serverLink->Attach<int32>( v );
|
|
||||||
serverLink->Attach<int32>( vOffset );
|
|
||||||
serverLink->Attach<int32>( height );
|
|
||||||
serverLink->Attach<int32>( heightOffset );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_SET_ALIGNMENT );
|
||||||
|
session->WriteInt32( (int32)mode );
|
||||||
|
session->WriteInt32( h );
|
||||||
|
session->WriteInt32( hOffset );
|
||||||
|
session->WriteInt32( width );
|
||||||
|
session->WriteInt32( widthOffset );
|
||||||
|
session->WriteInt32( v );
|
||||||
|
session->WriteInt32( vOffset );
|
||||||
|
session->WriteInt32( height );
|
||||||
|
session->WriteInt32( heightOffset );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
if ( rCode == SERVER_TRUE){
|
||||||
|
|
||||||
if ( replyData.code == SERVER_TRUE){
|
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1630,40 +1606,27 @@ status_t BWindow::GetWindowAlignment(window_alignment* mode,
|
|||||||
int32* v, int32* vOffset,
|
int32* v, int32* vOffset,
|
||||||
int32* height, int32* heightOffset) const
|
int32* height, int32* heightOffset) const
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replyData;
|
int32 rCode;
|
||||||
int8 *rb; // short for: replybuffer
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_GET_ALIGNMENT );
|
|
||||||
|
|
||||||
const_cast<BWindow*>(this)->Lock();
|
const_cast<BWindow*>(this)->Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_GET_ALIGNMENT );
|
||||||
const_cast<BWindow*>(this)->Unlock();
|
session->Sync();
|
||||||
|
session->ReadInt32( &rCode );
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
if (rCode == SERVER_TRUE){
|
||||||
rb = replyData.buffer;
|
session->ReadInt32( (int32*)mode );
|
||||||
if (mode)
|
session->ReadInt32( h );
|
||||||
*mode = *((window_alignment*)*((int32*)rb)); rb += sizeof(int32);
|
session->ReadInt32( hOffset );
|
||||||
if (h)
|
session->ReadInt32( width );
|
||||||
*h = *((int32*)rb); rb += sizeof(int32);
|
session->ReadInt32( widthOffset );
|
||||||
if (hOffset)
|
session->ReadInt32( v );
|
||||||
*hOffset = *((int32*)rb); rb += sizeof(int32);
|
session->ReadInt32( hOffset );
|
||||||
if (width)
|
session->ReadInt32( height );
|
||||||
*width = *((int32*)rb); rb += sizeof(int32);
|
session->ReadInt32( heightOffset );
|
||||||
if (widthOffset)
|
|
||||||
*widthOffset = *((int32*)rb); rb += sizeof(int32);
|
|
||||||
if (v)
|
|
||||||
*v = *((int32*)rb); rb += sizeof(int32);
|
|
||||||
if (vOffset)
|
|
||||||
*vOffset = *((int32*)rb); rb += sizeof(int32);
|
|
||||||
if (height)
|
|
||||||
*height = *((int32*)rb); rb += sizeof(int32);
|
|
||||||
if (heightOffset)
|
|
||||||
*heightOffset = *((int32*)rb);
|
|
||||||
|
|
||||||
delete replyData.buffer;
|
|
||||||
|
|
||||||
return B_NO_ERROR;
|
return B_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
const_cast<BWindow*>(this)->Unlock();
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1671,49 +1634,26 @@ status_t BWindow::GetWindowAlignment(window_alignment* mode,
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
uint32 BWindow::Workspaces() const{
|
uint32 BWindow::Workspaces() const{
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
uint32 workspaces;
|
uint32 workspaces;
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_GET_WORKSPACES );
|
|
||||||
|
|
||||||
const_cast<BWindow*>(this)->Lock();
|
const_cast<BWindow*>(this)->Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_GET_WORKSPACES );
|
||||||
|
session->Sync();
|
||||||
|
session->ReadInt32( (int32*)&workspaces );
|
||||||
const_cast<BWindow*>(this)->Unlock();
|
const_cast<BWindow*>(this)->Unlock();
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE){
|
return workspaces;
|
||||||
workspaces = *((uint32*)replyData.buffer);
|
|
||||||
|
|
||||||
delete replyData.buffer;
|
|
||||||
|
|
||||||
return workspaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_CURRENT_WORKSPACE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::SetWorkspaces(uint32 workspaces){
|
void BWindow::SetWorkspaces(uint32 workspaces){
|
||||||
// PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_SET_WORKSPACES );
|
|
||||||
serverLink->Attach<int32>( (int32)workspaces );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_SET_WORKSPACES );
|
||||||
// serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( (int32)workspaces );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
// delete replyData.buffer;
|
|
||||||
/*
|
|
||||||
Note: In future versions of OBOS we should make SetWorkspaces(uint32) return
|
|
||||||
a status value! The following code should be added
|
|
||||||
|
|
||||||
if (replyData.code == SERVER_TRUE)
|
|
||||||
return B_OK;
|
|
||||||
|
|
||||||
return B_ERROR;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -1741,12 +1681,11 @@ void BWindow::MoveTo( BPoint point ){
|
|||||||
|
|
||||||
void BWindow::MoveTo(float x, float y){
|
void BWindow::MoveTo(float x, float y){
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_WINDOW_MOVE );
|
|
||||||
serverLink->Attach<float>( x );
|
|
||||||
serverLink->Attach<float>( y );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush();
|
session->WriteInt32( AS_WINDOW_MOVE );
|
||||||
|
session->WriteFloat( x );
|
||||||
|
session->WriteFloat( y );
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1775,43 +1714,52 @@ void BWindow::ResizeTo(float width, float height){
|
|||||||
height = (height < fMinWindHeight) ? fMinWindHeight : height;
|
height = (height < fMinWindHeight) ? fMinWindHeight : height;
|
||||||
height = (height > fMaxWindHeight) ? fMaxWindHeight : height;
|
height = (height > fMaxWindHeight) ? fMaxWindHeight : height;
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_WINDOW_RESIZE );
|
|
||||||
serverLink->Attach<float>( width );
|
|
||||||
serverLink->Attach<float>( height );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush( );
|
session->WriteInt32( AS_WINDOW_RESIZE );
|
||||||
|
session->WriteFloat( width );
|
||||||
|
session->WriteFloat( height );
|
||||||
|
session->Sync( );
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::Show(){
|
void BWindow::Show(){
|
||||||
if ( Thread() == B_ERROR )
|
bool isLocked = IsLocked();
|
||||||
{
|
|
||||||
Lock();
|
|
||||||
Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
fShowLevel--;
|
fShowLevel--;
|
||||||
|
|
||||||
if (fShowLevel == 0){
|
if (fShowLevel == 0){
|
||||||
serverLink->SetOpCode( AS_SHOW_WINDOW );
|
#ifdef DEBUG_WIN
|
||||||
|
printf(">BWindow: sending AS_SHOW_WINDOW message...\n");
|
||||||
Lock();
|
#endif
|
||||||
serverLink->Flush( );
|
if ( !isLocked ) Lock();
|
||||||
Unlock();
|
session->WriteInt32( AS_SHOW_WINDOW );
|
||||||
|
session->Sync( );
|
||||||
|
if ( !isLocked) Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( Thread() == B_ERROR )
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_WIN
|
||||||
|
printf(">BWindow: calling Run()...\n");
|
||||||
|
#endif
|
||||||
|
Lock();
|
||||||
|
Run();
|
||||||
|
#ifdef DEBUG_WIN
|
||||||
|
printf(">BWindow: Run() called.\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::Hide(){
|
void BWindow::Hide(){
|
||||||
if (fShowLevel == 0){
|
if (fShowLevel == 0){
|
||||||
serverLink->SetOpCode( AS_HIDE_WINDOW );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush();
|
session->WriteInt32( AS_HIDE_WINDOW );
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
fShowLevel++;
|
fShowLevel++;
|
||||||
@@ -1920,6 +1868,10 @@ void BWindow::InitData( BRect frame,
|
|||||||
uint32 flags,
|
uint32 flags,
|
||||||
uint32 workspace){
|
uint32 workspace){
|
||||||
|
|
||||||
|
#ifdef DEBUG_WIN
|
||||||
|
printf("BWindow::InitData(...)\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
fTitle=NULL;
|
fTitle=NULL;
|
||||||
if ( be_app == NULL ){
|
if ( be_app == NULL ){
|
||||||
//debugger("You need a valid BApplication object before interacting with the app_server");
|
//debugger("You need a valid BApplication object before interacting with the app_server");
|
||||||
@@ -1995,58 +1947,45 @@ void BWindow::InitData( BRect frame,
|
|||||||
receive_port = create_port( B_LOOPER_PORT_DEFAULT_CAPACITY ,
|
receive_port = create_port( B_LOOPER_PORT_DEFAULT_CAPACITY ,
|
||||||
"w_rcv_port");
|
"w_rcv_port");
|
||||||
if (receive_port==B_BAD_VALUE || receive_port==B_NO_MORE_PORTS){
|
if (receive_port==B_BAD_VALUE || receive_port==B_NO_MORE_PORTS){
|
||||||
//debugger("Could not create BWindow's receive port, used for interacting with the app_server!");
|
debugger("Could not create BWindow's receive port, used for interacting with the app_server!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_WIN
|
||||||
|
printf("BWindow::InitData(): contacting app_server\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
// let app_server to know that a window has been created.
|
// let app_server to know that a window has been created.
|
||||||
serverLink = new PortLink(be_app->fServerFrom);
|
session = new BSession( receive_port, be_app->fServerFrom );
|
||||||
status_t replyStat;
|
int32 rCode;
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode(AS_CREATE_WINDOW);
|
|
||||||
serverLink->Attach<BRect>(fFrame);
|
|
||||||
serverLink->Attach<int32>((int32)WindowLookToInteger(fLook));
|
|
||||||
serverLink->Attach<int32>((int32)WindowFeelToInteger(fFeel));
|
|
||||||
serverLink->Attach<int32>((int32)fFlags);
|
|
||||||
serverLink->Attach<int32>((int32)workspace);
|
|
||||||
serverLink->Attach<int32>((int32)_get_object_token_(this));
|
|
||||||
serverLink->Attach(&receive_port,sizeof(port_id));
|
|
||||||
// We add one so that the string will end up NULL-terminated.
|
|
||||||
serverLink->Attach( (char*)title, strlen(title)+1 );
|
|
||||||
|
|
||||||
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
||||||
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
||||||
be_app->Lock();
|
// be_app->Lock();
|
||||||
|
session->WriteInt32( AS_CREATE_WINDOW );
|
||||||
// Send and wait for ServerWindow port. Necessary here so we can respond to
|
session->WriteRect( fFrame );
|
||||||
// messages as soon as Show() is called.
|
session->WriteInt32( (int32)fLook );
|
||||||
|
session->WriteInt32( (int32)fFeel );
|
||||||
replyStat = serverLink->FlushWithReply( &replyData );
|
session->WriteUInt32( fFlags );
|
||||||
if ( replyStat != B_OK ){
|
session->WriteUInt32( workspace );
|
||||||
//debugger("First reply from app_server was not received.");
|
session->WriteInt32( _get_object_token_(this) );
|
||||||
return;
|
session->WriteData( &receive_port, sizeof(port_id) );
|
||||||
}
|
session->WriteString( title );
|
||||||
|
session->Sync();
|
||||||
|
// The port on witch app_server will listen for us
|
||||||
|
session->ReadData( &send_port, sizeof(port_id) );
|
||||||
// unlock, so other threads can do their job.
|
// unlock, so other threads can do their job.
|
||||||
be_app->Unlock();
|
// be_app->Unlock();
|
||||||
|
|
||||||
send_port = *((port_id*)replyData.buffer);
|
|
||||||
|
|
||||||
// Set the port on witch app_server will listen for us
|
session->SetSendPort(send_port);
|
||||||
serverLink->SetPort(send_port);
|
#ifdef DEBUG_WIN
|
||||||
// Initialize a PortLink object for use with graphic calls.
|
printf("BWindow::InitData(): app_server link established - port_id received\n");
|
||||||
// They need to be sent separately because of the speed reasons.
|
#endif
|
||||||
srvGfxLink = new PortLink( send_port );
|
|
||||||
|
|
||||||
// delete replyData.buffer;
|
|
||||||
|
|
||||||
// Create and attach the top view
|
// Create and attach the top view
|
||||||
top_view = buildTopView();
|
// top_view = buildTopView();
|
||||||
// Here we will register the top view with app_server
|
// Here we will register the top view with app_server
|
||||||
// TODO: implement the following function
|
// attachTopView( );
|
||||||
attachTopView( );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -2278,61 +2217,12 @@ void BWindow::decomposeType(window_type type,
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
uint32 BWindow::WindowLookToInteger(window_look wl)
|
|
||||||
{
|
|
||||||
switch(wl)
|
|
||||||
{
|
|
||||||
case B_BORDERED_WINDOW_LOOK:
|
|
||||||
return 20;
|
|
||||||
case B_TITLED_WINDOW_LOOK:
|
|
||||||
return 1;
|
|
||||||
case B_DOCUMENT_WINDOW_LOOK:
|
|
||||||
return 11;
|
|
||||||
case B_MODAL_WINDOW_LOOK:
|
|
||||||
return 3;
|
|
||||||
case B_FLOATING_WINDOW_LOOK:
|
|
||||||
return 7;
|
|
||||||
case B_NO_BORDER_WINDOW_LOOK:
|
|
||||||
return 19;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
uint32 BWindow::WindowFeelToInteger(window_feel wf)
|
|
||||||
{
|
|
||||||
switch(wf)
|
|
||||||
{
|
|
||||||
case B_MODAL_SUBSET_WINDOW_FEEL:
|
|
||||||
return 2;
|
|
||||||
case B_MODAL_APP_WINDOW_FEEL:
|
|
||||||
return 1;
|
|
||||||
case B_MODAL_ALL_WINDOW_FEEL:
|
|
||||||
return 3;
|
|
||||||
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
|
||||||
return 5;
|
|
||||||
case B_FLOATING_APP_WINDOW_FEEL:
|
|
||||||
return 4;
|
|
||||||
case B_FLOATING_ALL_WINDOW_FEEL:
|
|
||||||
return 6;
|
|
||||||
|
|
||||||
case B_NORMAL_WINDOW_FEEL:
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
BView* BWindow::buildTopView(){
|
BView* BWindow::buildTopView(){
|
||||||
BView *topView;
|
BView *topView;
|
||||||
|
|
||||||
topView = new BView( fFrame.OffsetToCopy(0,0), "top_view",
|
topView = new BView( fFrame.OffsetToCopy(0,0), "top_view",
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
topView->owner = this;
|
topView->owner = this;
|
||||||
topView->attached = true;
|
|
||||||
topView->top_level_view = true;
|
topView->top_level_view = true;
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
@@ -2349,16 +2239,16 @@ void BWindow::attachTopView(){
|
|||||||
|
|
||||||
// TODO: implement after you have a messaging protocol with app_server
|
// TODO: implement after you have a messaging protocol with app_server
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_LAYER_CREATE_ROOT );
|
|
||||||
serverLink->Attach<int32>( _get_object_token_( top_view ) ); // no need for that!
|
|
||||||
/* serverLink->Attach( top_view->Name() );
|
|
||||||
serverLink->Attach( fCachedBounds.OffsetToCopy( origin_h, origin_v ) );
|
|
||||||
serverLink->Attach( ...ResizeMode... );
|
|
||||||
serverLink->Attach( top_view->fFlags );
|
|
||||||
serverLink->Attach( top_view->fShowLevel );
|
|
||||||
*/
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush();
|
session->WriteInt32( AS_LAYER_CREATE_ROOT );
|
||||||
|
session->WriteInt32( _get_object_token_( top_view ) ); // no need for that!
|
||||||
|
/* session->Attach( top_view->Name() );
|
||||||
|
session->Attach( fCachedBounds.OffsetToCopy( origin_h, origin_v ) );
|
||||||
|
session->Attach( ...ResizeMode... );
|
||||||
|
session->Attach( top_view->fFlags );
|
||||||
|
session->Attach( top_view->fShowLevel );
|
||||||
|
*/
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2369,11 +2259,10 @@ void BWindow::detachTopView(){
|
|||||||
|
|
||||||
// TODO: detach all views
|
// TODO: detach all views
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_LAYER_DELETE_ROOT );
|
|
||||||
serverLink->Attach<int32>( _get_object_token_( top_view ) ); // no need for that!
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush();
|
session->WriteInt32( AS_LAYER_DELETE_ROOT );
|
||||||
|
session->WriteInt32( _get_object_token_( top_view ) ); // no need for that!
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete top_view;
|
delete top_view;
|
||||||
@@ -2382,15 +2271,10 @@ void BWindow::detachTopView(){
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void BWindow::stopConnection(){
|
void BWindow::stopConnection(){
|
||||||
PortLink::ReplyData replyData;
|
|
||||||
|
|
||||||
serverLink->SetOpCode( AS_QUIT_WINDOW );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->FlushWithReply( &replyData );
|
session->WriteInt32( AS_QUIT_WINDOW );
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
delete replyData.buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -2583,7 +2467,7 @@ BView* BWindow::sendMessageUsingEventMask2( BView* aView, int32 message, BPoint
|
|||||||
BView *destView;
|
BView *destView;
|
||||||
destView = NULL;
|
destView = NULL;
|
||||||
|
|
||||||
if ( aView->fCachedBounds.Contains( aView->ConvertFromScreen(where) ) &&
|
if ( aView->fBounds.Contains( aView->ConvertFromScreen(where) ) &&
|
||||||
!aView->first_child ){
|
!aView->first_child ){
|
||||||
return aView;
|
return aView;
|
||||||
}
|
}
|
||||||
@@ -3332,10 +3216,9 @@ void BWindow::drawAllViews(BView* aView){
|
|||||||
queue->Unlock();
|
queue->Unlock();
|
||||||
|
|
||||||
// we'll send a message to app_server, tell him that we want all our views updated
|
// we'll send a message to app_server, tell him that we want all our views updated
|
||||||
serverLink->SetOpCode( AS_UPDATE_IF_NEEDED );
|
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
serverLink->Flush();
|
session->WriteInt32( AS_UPDATE_IF_NEEDED );
|
||||||
|
session->Sync();
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
// process all update messages from receive port queue
|
// process all update messages from receive port queue
|
||||||
|
|||||||
Reference in New Issue
Block a user