2005-06-23 21:40:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
2005-11-07 22:01:12 +03:00
|
|
|
* Adrian Oanca <adioanca@gmail.com>
|
2005-06-23 21:40:35 +04:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
|
2005-07-24 21:13:02 +04:00
|
|
|
/*!
|
|
|
|
\class ServerWindow
|
|
|
|
\brief Shadow BWindow class
|
|
|
|
|
|
|
|
A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are
|
|
|
|
too many tasks to list as being done by them, but they include handling View transactions,
|
|
|
|
coordinating and linking a window's WinBorder half with its messaging half, dispatching
|
|
|
|
mouse and key events from the server to its window, and other such things.
|
|
|
|
*/
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
#include <new>
|
2005-07-01 10:44:39 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <AppDefs.h>
|
2005-10-11 09:25:52 +04:00
|
|
|
#include <DirectWindow.h>
|
2003-09-09 01:18:39 +04:00
|
|
|
#include <GraphicsDefs.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Message.h>
|
2003-07-11 00:22:07 +04:00
|
|
|
#include <PortLink.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Rect.h>
|
|
|
|
#include <View.h>
|
2004-10-16 06:02:27 +04:00
|
|
|
#include <ViewAux.h>
|
2005-06-28 05:14:39 +04:00
|
|
|
#include <Autolock.h>
|
2005-07-05 22:14:24 +04:00
|
|
|
#include <TokenSpace.h>
|
|
|
|
#include <WindowInfo.h>
|
2005-07-06 00:28:40 +04:00
|
|
|
#include <WindowPrivate.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "AppServer.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "BGet++.h"
|
2005-05-26 03:59:23 +04:00
|
|
|
#include "DebugInfoManager.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "Desktop.h"
|
2005-11-04 18:54:16 +03:00
|
|
|
#include "DrawingEngine.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "HWInterface.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "Layer.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "MessagePrivate.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "RAMLinkMsgReader.h"
|
2005-10-12 01:37:47 +04:00
|
|
|
#include "RenderingBuffer.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "RootLayer.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "ServerApp.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "ServerBitmap.h"
|
2005-06-03 18:20:10 +04:00
|
|
|
#include "ServerPicture.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "ServerProtocol.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
#include "TokenHandler.h"
|
2003-06-24 17:55:18 +04:00
|
|
|
#include "Utils.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "WinBorder.h"
|
2004-01-13 03:56:36 +03:00
|
|
|
#include "Workspace.h"
|
2005-07-01 10:53:07 +04:00
|
|
|
#include "WorkspacesLayer.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
|
|
|
|
#include "ServerWindow.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2005-10-12 01:37:47 +04:00
|
|
|
#include "clipping.h"
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW
|
|
|
|
//#define DEBUG_SERVERWINDOW_GRAPHICS
|
2003-03-23 23:52:37 +03:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-09 01:18:39 +04:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
2005-01-19 18:12:35 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW_GRAPHICS
|
|
|
|
# include <stdio.h>
|
|
|
|
# define DTRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define DTRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
struct dw_data {
|
|
|
|
sem_id direct_sem;
|
|
|
|
sem_id direct_sem_ack;
|
|
|
|
area_id direct_area;
|
|
|
|
direct_buffer_info *direct_info;
|
|
|
|
|
|
|
|
dw_data() :
|
|
|
|
direct_sem(-1),
|
|
|
|
direct_sem_ack(-1),
|
2005-10-12 01:37:47 +04:00
|
|
|
direct_area(-1),
|
|
|
|
direct_info(NULL)
|
2005-10-11 09:25:52 +04:00
|
|
|
{
|
|
|
|
direct_area = create_area("direct area", (void **)&direct_info,
|
|
|
|
B_ANY_ADDRESS, B_PAGE_SIZE, B_NO_LOCK, B_READ_WRITE);
|
|
|
|
|
|
|
|
direct_sem = create_sem(1, "direct sem");
|
|
|
|
direct_sem_ack = create_sem(1, "direct sem ack");
|
|
|
|
}
|
|
|
|
|
|
|
|
~dw_data()
|
|
|
|
{
|
|
|
|
if (direct_area >= 0)
|
|
|
|
delete_area(direct_area);
|
|
|
|
if (direct_sem >= 0)
|
|
|
|
delete_sem(direct_sem);
|
|
|
|
if (direct_sem_ack >= 0)
|
|
|
|
delete_sem(direct_sem_ack);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const
|
|
|
|
{
|
2005-10-12 01:37:47 +04:00
|
|
|
return (direct_area >= 0) && (direct_sem >= 0)
|
|
|
|
&& (direct_sem_ack >= 0) && (direct_info != NULL);
|
2005-10-11 09:25:52 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Copied from DirectWindow.cpp: Move to a common header
|
|
|
|
struct dw_sync_data {
|
|
|
|
area_id area;
|
|
|
|
sem_id disableSem;
|
|
|
|
sem_id disableSemAck;
|
|
|
|
};
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-02-12 04:11:55 +03:00
|
|
|
/*!
|
2005-05-26 19:04:45 +04:00
|
|
|
\brief Constructor
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
Does a lot of stuff to set up for the window - new decorator, new winborder, spawn a
|
|
|
|
monitor thread.
|
2003-02-12 04:11:55 +03:00
|
|
|
*/
|
2005-06-23 22:48:10 +04:00
|
|
|
ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
port_id clientPort, port_id looperPort, int32 handlerID)
|
2005-07-23 22:30:48 +04:00
|
|
|
: MessageLooper(title && *title ? title : "Unnamed Window"),
|
2005-11-01 04:32:49 +03:00
|
|
|
fTitle(title),
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop(app->GetDesktop()),
|
2005-06-23 21:40:35 +04:00
|
|
|
fServerApp(app),
|
2005-06-24 02:43:11 +04:00
|
|
|
fWinBorder(NULL),
|
|
|
|
fClientTeam(app->ClientTeam()),
|
|
|
|
fMessagePort(-1),
|
2005-06-23 21:40:35 +04:00
|
|
|
fClientReplyPort(clientPort),
|
2005-04-16 17:30:49 +04:00
|
|
|
fClientLooperPort(looperPort),
|
2005-05-18 16:16:15 +04:00
|
|
|
fClientViewsWithInvalidCoords(B_VIEW_RESIZED),
|
2005-06-24 02:43:11 +04:00
|
|
|
fHandlerToken(handlerID),
|
2005-10-11 09:25:52 +04:00
|
|
|
fCurrentLayer(NULL),
|
|
|
|
fDirectWindowData(NULL)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow(%s)::ServerWindow()\n", title));
|
2005-07-05 22:14:24 +04:00
|
|
|
|
|
|
|
fServerToken = BPrivate::gDefaultTokens.NewToken(B_SERVER_TOKEN, this);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2004-06-19 17:04:50 +04:00
|
|
|
//!Tears down all connections the main app_server objects, and deletes some internals.
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::~ServerWindow()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-07-18 13:24:08 +04:00
|
|
|
STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (!fWinBorder->IsOffscreenWindow())
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->RemoveWinBorder(fWinBorder);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
delete fWinBorder;
|
2005-07-07 02:39:15 +04:00
|
|
|
|
2005-11-01 04:32:49 +03:00
|
|
|
free(const_cast<char *>(fTitle));
|
2005-07-07 02:39:15 +04:00
|
|
|
delete_port(fMessagePort);
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
BPrivate::gDefaultTokens.RemoveToken(fServerToken);
|
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
delete fDirectWindowData;
|
2005-07-18 13:24:08 +04:00
|
|
|
STRACE(("#ServerWindow(%p) will exit NOW\n", this));
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
status_t
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 workspace)
|
2005-06-24 02:43:11 +04:00
|
|
|
{
|
2005-11-01 04:32:49 +03:00
|
|
|
if (fTitle == NULL)
|
|
|
|
fTitle = strdup("Unnamed Window");
|
|
|
|
if (fTitle == NULL)
|
|
|
|
return B_NO_MEMORY;
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// fMessagePort is the port to which the app sends messages for the server
|
|
|
|
fMessagePort = create_port(100, fTitle);
|
2005-06-24 02:43:11 +04:00
|
|
|
if (fMessagePort < B_OK)
|
|
|
|
return fMessagePort;
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fLink.SetSenderPort(fClientReplyPort);
|
|
|
|
fLink.SetReceiverPort(fMessagePort);
|
|
|
|
|
|
|
|
// We cannot call MakeWinBorder in the constructor, since it
|
|
|
|
fWinBorder = MakeWinBorder(frame, fTitle, look, feel, flags, workspace);
|
|
|
|
if (!fWinBorder)
|
|
|
|
return B_NO_MEMORY;
|
|
|
|
|
|
|
|
if (!fWinBorder->IsOffscreenWindow())
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->AddWinBorder(fWinBorder);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
ServerWindow::Run()
|
|
|
|
{
|
2005-07-23 22:30:48 +04:00
|
|
|
if (!MessageLooper::Run())
|
2005-06-24 02:43:11 +04:00
|
|
|
return false;
|
|
|
|
|
2005-06-28 05:14:39 +04:00
|
|
|
// Send a reply to our window - it is expecting fMessagePort
|
|
|
|
// port and some other info
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<port_id>(fMessagePort);
|
2005-06-28 05:14:39 +04:00
|
|
|
|
|
|
|
float minWidth, maxWidth, minHeight, maxHeight;
|
|
|
|
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
|
|
|
|
|
|
|
fLink.Attach<BRect>(fWinBorder->Frame());
|
|
|
|
fLink.Attach<float>(minWidth);
|
|
|
|
fLink.Attach<float>(maxWidth);
|
|
|
|
fLink.Attach<float>(minHeight);
|
|
|
|
fLink.Attach<float>(maxHeight);
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-07-24 21:13:02 +04:00
|
|
|
ServerWindow::_PrepareQuit()
|
2003-02-12 04:11:55 +03:00
|
|
|
{
|
2005-06-24 02:43:11 +04:00
|
|
|
if (fThread == find_thread(NULL)) {
|
2005-07-07 02:39:15 +04:00
|
|
|
// make sure we're hidden
|
|
|
|
Hide();
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
App()->RemoveWindow(this);
|
2005-07-24 21:13:02 +04:00
|
|
|
} else if (fThread >= B_OK)
|
2005-06-24 03:21:10 +04:00
|
|
|
PostMessage(AS_HIDE_WINDOW);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-07-23 22:30:48 +04:00
|
|
|
ServerWindow::_GetLooperName(char* name, size_t length)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-07-23 22:30:48 +04:00
|
|
|
snprintf(name, length, "w:%ld:%s", ClientTeam(), Title());
|
2005-06-24 02:43:11 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
//! Forces the window border to update its decorator
|
|
|
|
void
|
|
|
|
ServerWindow::ReplaceDecorator()
|
|
|
|
{
|
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n");
|
|
|
|
|
|
|
|
STRACE(("ServerWindow %s: Replace Decorator\n", fTitle));
|
|
|
|
fWinBorder->UpdateDecorator();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-10-12 18:41:02 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Shows the window's WinBorder
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::Show()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Show\n", Title()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-24 03:21:10 +04:00
|
|
|
if (fQuitting || !fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
RootLayer* rootLayer = fWinBorder->GetRootLayer();
|
2005-07-07 03:24:03 +04:00
|
|
|
if (rootLayer && rootLayer->Lock()) {
|
|
|
|
rootLayer->ShowWinBorder(fWinBorder);
|
|
|
|
rootLayer->Unlock();
|
|
|
|
}
|
2005-10-11 09:25:52 +04:00
|
|
|
|
|
|
|
if (fDirectWindowData != NULL)
|
2005-11-08 11:32:32 +03:00
|
|
|
HandleDirectConnection(B_DIRECT_START|B_BUFFER_RESET);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-10-12 18:41:02 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Hides the window's WinBorder
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::Hide()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Hide\n", Title()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
if (fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-10-12 01:37:47 +04:00
|
|
|
if (fDirectWindowData != NULL)
|
2005-11-08 11:32:32 +03:00
|
|
|
HandleDirectConnection(B_DIRECT_STOP);
|
2005-10-12 01:37:47 +04:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
RootLayer* rootLayer = fWinBorder->GetRootLayer();
|
2005-07-07 03:24:03 +04:00
|
|
|
if (rootLayer && rootLayer->Lock()) {
|
|
|
|
rootLayer->HideWinBorder(fWinBorder);
|
|
|
|
rootLayer->Unlock();
|
|
|
|
}
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-07-05 23:20:19 +04:00
|
|
|
void
|
|
|
|
ServerWindow::SetTitle(const char* newTitle)
|
|
|
|
{
|
2005-11-01 04:32:49 +03:00
|
|
|
const char* oldTitle = fTitle;
|
|
|
|
|
|
|
|
if (newTitle == NULL || !newTitle[0])
|
|
|
|
fTitle = strdup("Unnamed Window");
|
|
|
|
else
|
|
|
|
fTitle = strdup(newTitle);
|
|
|
|
|
|
|
|
if (fTitle == NULL) {
|
|
|
|
fTitle = oldTitle;
|
2005-07-05 23:20:19 +04:00
|
|
|
return;
|
2005-11-01 04:32:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
free(const_cast<char*>(oldTitle));
|
2005-07-05 23:20:19 +04:00
|
|
|
|
|
|
|
if (Thread() >= B_OK) {
|
|
|
|
char name[B_OS_NAME_LENGTH];
|
|
|
|
snprintf(name, sizeof(name), "w:%ld:%s", ClientTeam(), fTitle);
|
|
|
|
rename_thread(Thread(), name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fWinBorder != NULL)
|
|
|
|
fWinBorder->SetName(newTitle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
//! Requests that the ServerWindow's BWindow quit
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyQuitRequested()
|
|
|
|
{
|
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
|
|
|
STRACE(("ServerWindow %s: Quit\n", fTitle));
|
|
|
|
|
|
|
|
BMessage msg(B_QUIT_REQUESTED);
|
|
|
|
SendMessageToClient(&msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ServerWindow::NotifyMinimize(bool minimize)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2004-06-15 00:32:21 +04:00
|
|
|
// This function doesn't need much -- check to make sure that we should and
|
|
|
|
// send the message to the client. According to the BeBook, the BWindow hook function
|
|
|
|
// does all the heavy lifting for us. :)
|
2004-06-11 18:47:36 +04:00
|
|
|
bool sendMessages = false;
|
2003-11-15 03:28:40 +03:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
if (minimize) {
|
2005-05-26 19:04:45 +04:00
|
|
|
if (!fWinBorder->IsHidden()) {
|
2003-11-15 03:28:40 +03:00
|
|
|
Hide();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
} else {
|
|
|
|
if (fWinBorder->IsHidden()) {
|
2003-11-15 03:28:40 +03:00
|
|
|
Show();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
if (sendMessages) {
|
2005-06-24 02:43:11 +04:00
|
|
|
BMessage msg(B_MINIMIZE);
|
2003-11-15 03:28:40 +03:00
|
|
|
msg.AddInt64("when", real_time_clock_usecs());
|
2005-06-24 02:43:11 +04:00
|
|
|
msg.AddBool("minimize", minimize);
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
//! Sends a message to the client to perform a Zoom
|
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyZoom()
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-05-26 19:04:45 +04:00
|
|
|
BMessage msg(B_ZOOM);
|
2004-06-11 06:46:48 +04:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of a change in screen resolution
|
|
|
|
\param frame Size of the new resolution
|
|
|
|
\param color_space Color space of the new screen mode
|
|
|
|
*/
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyScreenModeChanged(const BRect frame, const color_space colorSpace)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: ScreenModeChanged\n", fTitle));
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
BMessage msg(B_SCREEN_CHANGED);
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.AddRect("frame", frame);
|
2005-05-26 19:04:45 +04:00
|
|
|
msg.AddInt32("mode", (int32)colorSpace);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ServerWindow::GetInfo(window_info& info)
|
|
|
|
{
|
|
|
|
info.team = ClientTeam();
|
|
|
|
info.server_token = ServerToken();
|
|
|
|
|
|
|
|
info.thread = Thread();
|
|
|
|
info.client_token = ClientToken();
|
|
|
|
info.client_port = fClientLooperPort;
|
|
|
|
info.workspaces = fWinBorder->Workspaces();
|
|
|
|
|
|
|
|
info.layer = 0; // ToDo: what is this???
|
2005-07-06 00:28:40 +04:00
|
|
|
info.feel = fWinBorder->Feel();
|
2005-07-05 22:14:24 +04:00
|
|
|
info.flags = fWinBorder->WindowFlags();
|
|
|
|
info.window_left = (int)floor(fWinBorder->Frame().left);
|
|
|
|
info.window_top = (int)floor(fWinBorder->Frame().top);
|
|
|
|
info.window_right = (int)floor(fWinBorder->Frame().right);
|
|
|
|
info.window_bottom = (int)floor(fWinBorder->Frame().bottom);
|
|
|
|
|
|
|
|
info.show_hide_level = fWinBorder->IsHidden() ? 1 : -1; // ???
|
|
|
|
info.is_mini = fWinBorder->IsHidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
/*!
|
|
|
|
\brief Sets the font state for a layer
|
|
|
|
\param layer The layer to set the font
|
|
|
|
*/
|
2005-06-03 23:50:30 +04:00
|
|
|
inline void
|
2005-06-15 01:28:56 +04:00
|
|
|
ServerWindow::SetLayerFontState(Layer *layer, BPrivate::LinkReceiver &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
|
2005-06-23 22:48:10 +04:00
|
|
|
fTitle, layer->Name()));
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
layer->CurrentState()->ReadFontFromLink(link);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline void
|
2005-06-15 01:28:56 +04:00
|
|
|
ServerWindow::SetLayerState(Layer *layer, BPrivate::LinkReceiver &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: SetLayerState for layer %s\n", Title(),
|
|
|
|
layer->Name()));
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
layer->CurrentState()->ReadFromLink(link);
|
2005-11-07 22:01:12 +03:00
|
|
|
// TODO: Rebuild clipping here!
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-11-04 12:52:56 +03:00
|
|
|
Layer*
|
2005-06-16 04:46:02 +04:00
|
|
|
ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
int32 token;
|
|
|
|
BRect frame;
|
|
|
|
uint32 resizeMask;
|
2005-03-21 23:29:24 +03:00
|
|
|
uint32 eventMask;
|
|
|
|
uint32 eventOptions;
|
2004-06-11 18:47:36 +04:00
|
|
|
uint32 flags;
|
|
|
|
bool hidden;
|
2005-06-16 04:46:02 +04:00
|
|
|
int32 parentToken;
|
2004-07-30 19:16:59 +04:00
|
|
|
char *name = NULL;
|
2005-06-10 20:20:38 +04:00
|
|
|
rgb_color viewColor;
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
|
|
|
link.ReadString(&name);
|
|
|
|
link.Read<BRect>(&frame);
|
|
|
|
link.Read<uint32>(&resizeMask);
|
2005-03-21 23:29:24 +03:00
|
|
|
link.Read<uint32>(&eventMask);
|
|
|
|
link.Read<uint32>(&eventOptions);
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<uint32>(&flags);
|
|
|
|
link.Read<bool>(&hidden);
|
2005-06-16 04:46:02 +04:00
|
|
|
link.Read<rgb_color>(&viewColor);
|
|
|
|
link.Read<int32>(&parentToken);
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n",
|
2005-06-23 22:48:10 +04:00
|
|
|
fTitle, name, token));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-01 10:53:07 +04:00
|
|
|
Layer *newLayer;
|
|
|
|
|
|
|
|
if (link.Code() == AS_LAYER_CREATE_ROOT
|
2005-07-06 00:28:40 +04:00
|
|
|
&& (fWinBorder->WindowFlags() & kWorkspacesWindowFlag) != 0) {
|
2005-07-01 10:53:07 +04:00
|
|
|
// this is a workspaces window!
|
2005-11-04 12:52:56 +03:00
|
|
|
newLayer = new (nothrow) WorkspacesLayer(frame, name, token, resizeMask,
|
2005-11-04 18:23:54 +03:00
|
|
|
flags, fWinBorder->GetDrawingEngine());
|
2005-07-01 10:53:07 +04:00
|
|
|
} else {
|
2005-11-04 12:52:56 +03:00
|
|
|
newLayer = new (nothrow) Layer(frame, name, token, resizeMask, flags,
|
2005-11-04 18:23:54 +03:00
|
|
|
fWinBorder->GetDrawingEngine());
|
2005-07-01 10:53:07 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-11-04 12:52:56 +03:00
|
|
|
if (newLayer == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
free(name);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// there is no way of setting this, other than manually :-)
|
2005-11-04 15:15:36 +03:00
|
|
|
newLayer->SetViewColor(viewColor);
|
2005-05-26 19:04:45 +04:00
|
|
|
newLayer->fHidden = hidden;
|
|
|
|
newLayer->fEventMask = eventMask;
|
|
|
|
newLayer->fEventOptions = eventOptions;
|
|
|
|
newLayer->fOwner = fWinBorder;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-11-04 12:52:56 +03:00
|
|
|
DesktopSettings settings(fDesktop);
|
|
|
|
ServerFont font;
|
|
|
|
settings.GetDefaultPlainFont(font);
|
2005-11-04 15:15:36 +03:00
|
|
|
newLayer->CurrentState()->SetFont(font);
|
2005-11-04 12:52:56 +03:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// TODO: rework the clipping stuff to remove RootLayer dependency and then
|
|
|
|
// remove this hack:
|
|
|
|
if (fWinBorder->IsOffscreenWindow()) {
|
|
|
|
newLayer->fVisible2.Set(newLayer->fFrame);
|
|
|
|
}
|
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
if (_parent) {
|
|
|
|
Layer *parent = fWinBorder->FindLayer(parentToken);
|
|
|
|
if (parent == NULL)
|
|
|
|
CRITICAL("View token not found!\n");
|
|
|
|
|
|
|
|
*_parent = parent;
|
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-04-03 19:05:49 +04:00
|
|
|
return newLayer;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
// TODO: when creating a Layer, check for yet non-existing Layer::InitCheck()
|
|
|
|
// and take appropriate actions, then checking for fCurrentLayer->fLayerData
|
|
|
|
// is unnecessary
|
|
|
|
if ((fCurrentLayer == NULL || fCurrentLayer->CurrentState() == NULL) &&
|
|
|
|
code != AS_LAYER_CREATE_ROOT && code != AS_LAYER_CREATE) {
|
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld before top_view attached.\n", Title(), code - SERVER_TRUE);
|
2004-07-30 19:16:59 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
RootLayer *myRootLayer = fWinBorder->GetRootLayer();
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// NOTE: is NULL when fWinBorder is offscreen!
|
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Lock();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
switch (code) {
|
2003-12-07 08:40:51 +03:00
|
|
|
//--------- BView Messages -----------------
|
2005-04-27 21:26:57 +04:00
|
|
|
case AS_LAYER_SCROLL:
|
2005-03-27 09:25:59 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SCROLL: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-04-27 21:26:57 +04:00
|
|
|
float dh;
|
|
|
|
float dv;
|
2005-04-19 22:55:46 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
link.Read<float>(&dh);
|
|
|
|
link.Read<float>(&dv);
|
2005-06-28 16:25:32 +04:00
|
|
|
fCurrentLayer->ScrollBy(dh, dv);
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_COPY_BITS:
|
|
|
|
{
|
|
|
|
BRect src;
|
|
|
|
BRect dst;
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
link.Read<BRect>(&src);
|
|
|
|
link.Read<BRect>(&dst);
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
// TODO: Are origin and scale handled in this conversion?
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&src);
|
|
|
|
fCurrentLayer->ConvertToScreen(&dst);
|
2005-04-27 21:26:57 +04:00
|
|
|
|
|
|
|
int32 xOffset = (int32)(dst.left - src.left);
|
|
|
|
int32 yOffset = (int32)(dst.top - src.top);
|
|
|
|
|
2005-06-28 19:34:54 +04:00
|
|
|
fCurrentLayer->CopyBits(src, dst, xOffset, yOffset);
|
2005-04-19 22:55:46 +04:00
|
|
|
|
2005-03-27 09:25:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_SET_CURRENT_LAYER:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
int32 token;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
2005-06-16 04:46:02 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
Layer *current = fWinBorder->FindLayer(token);
|
2005-06-16 04:46:02 +04:00
|
|
|
if (current) {
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle, current->Name(), token));
|
2005-06-16 04:46:02 +04:00
|
|
|
} else {
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: layer not found, token %ld\n", fTitle, token));
|
2005-02-23 04:45:48 +03:00
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
if (current)
|
2005-06-16 04:46:02 +04:00
|
|
|
fCurrentLayer = current;
|
2003-09-09 01:18:39 +04:00
|
|
|
else // hope this NEVER happens! :-)
|
2005-05-26 03:59:23 +04:00
|
|
|
CRITICAL("Server PANIC: window cannot find Layer with ID\n");
|
2005-06-16 04:46:02 +04:00
|
|
|
// ToDo: if this happens, we probably want to kill the app and clean up
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
case AS_LAYER_CREATE_ROOT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE_ROOT\n", fTitle));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
// Start receiving top_view data -- pass NULL as the parent view.
|
|
|
|
// This should be the *only* place where this happens.
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer != NULL)
|
2004-07-30 19:16:59 +04:00
|
|
|
break;
|
2005-06-16 04:46:02 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fWinBorder->SetTopLayer(CreateLayerTree(link, NULL));
|
|
|
|
fCurrentLayer = fWinBorder->TopLayer();
|
2004-07-30 19:16:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_CREATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
Layer* parent = NULL;
|
|
|
|
Layer* newLayer = CreateLayerTree(link, &parent);
|
|
|
|
if (parent != NULL)
|
|
|
|
parent->AddChild(newLayer, this);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-11-07 22:01:12 +03:00
|
|
|
if (myRootLayer && !newLayer->IsHidden() && parent) {
|
2005-06-28 18:57:16 +04:00
|
|
|
BRegion invalidRegion;
|
|
|
|
newLayer->GetWantedRegion(invalidRegion);
|
2005-11-06 20:47:06 +03:00
|
|
|
parent->MarkForRebuild(invalidRegion);
|
|
|
|
parent->TriggerRebuild();
|
|
|
|
if (newLayer->VisibleRegion().Frame().IsValid()) {
|
|
|
|
myRootLayer->MarkForRedraw(newLayer->VisibleRegion());
|
|
|
|
myRootLayer->TriggerRedraw();
|
|
|
|
}
|
2005-06-28 18:57:16 +04:00
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_DELETE:
|
|
|
|
{
|
|
|
|
// Received when a view is detached from a window. This is definitely
|
|
|
|
// the less taxing operation - we call PruneTree() on the removed
|
|
|
|
// layer, detach the layer itself, delete it, and invalidate the
|
|
|
|
// area assuming that the view was visible when removed
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: AS_LAYER_DELETE(self)...\n", fTitle));
|
2005-07-05 22:46:59 +04:00
|
|
|
|
2005-06-28 18:57:16 +04:00
|
|
|
Layer *parent = fCurrentLayer->fParent;
|
2005-11-06 20:47:06 +03:00
|
|
|
// BRegion *invalidRegion = NULL;
|
2005-06-28 18:57:16 +04:00
|
|
|
|
2005-11-06 20:47:06 +03:00
|
|
|
if (!fCurrentLayer->IsHidden() && parent && myRootLayer) {
|
|
|
|
if (fCurrentLayer->FullVisible().Frame().IsValid()) {
|
|
|
|
parent->MarkForRebuild(fCurrentLayer->FullVisible());
|
|
|
|
myRootLayer->MarkForRedraw(fCurrentLayer->FullVisible());
|
|
|
|
}
|
2005-06-28 18:57:16 +04:00
|
|
|
}
|
2005-06-22 22:14:13 +04:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// here we remove current layer from list.
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RemoveSelf();
|
|
|
|
fCurrentLayer->PruneTree();
|
2005-06-22 22:14:13 +04:00
|
|
|
|
2005-11-06 20:47:06 +03:00
|
|
|
if (parent)
|
|
|
|
parent->TriggerRebuild();
|
2005-07-07 18:04:29 +04:00
|
|
|
|
2005-11-06 20:47:06 +03:00
|
|
|
if (myRootLayer) {
|
2005-07-07 18:04:29 +04:00
|
|
|
myRootLayer->LayerRemoved(fCurrentLayer);
|
2005-11-06 20:47:06 +03:00
|
|
|
myRootLayer->TriggerRedraw();
|
2005-06-28 18:57:16 +04:00
|
|
|
}
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2004-08-08 00:30:58 +04:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-15 23:14:45 +04:00
|
|
|
parent->PrintTree();
|
2004-08-08 00:30:58 +04:00
|
|
|
#endif
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", fTitle, parent->Name(), fCurrentLayer->Name()));
|
2003-06-24 17:55:18 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
delete fCurrentLayer;
|
2005-07-07 18:04:29 +04:00
|
|
|
// TODO: It is necessary to do this, but I find it very obscure.
|
2005-06-16 04:46:02 +04:00
|
|
|
fCurrentLayer = parent;
|
2003-06-24 17:55:18 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_LAYER_SET_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
SetLayerState(fCurrentLayer, link);
|
2005-04-19 04:42:42 +04:00
|
|
|
// TODO: should this be moved into SetLayerState?
|
|
|
|
// If it _always_ needs to be done afterwards, then yes!
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_FONT_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
SetLayerFontState(fCurrentLayer, link);
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-04-19 04:42:42 +04:00
|
|
|
|
|
|
|
// attach state data
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->WriteToLink(fLink.Sender());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-09-03 21:55:16 +04:00
|
|
|
case AS_LAYER_SET_EVENT_MASK:
|
2005-05-23 21:23:20 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-23 21:23:20 +04:00
|
|
|
|
|
|
|
uint32 mask;
|
|
|
|
uint32 options;
|
|
|
|
|
|
|
|
link.Read<uint32>(&mask);
|
|
|
|
link.Read<uint32>(&options);
|
|
|
|
|
2005-09-08 20:53:42 +04:00
|
|
|
fCurrentLayer->QuietlySetEventMask(mask);
|
|
|
|
fCurrentLayer->QuietlySetEventOptions(options);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer)
|
2005-09-05 22:55:32 +04:00
|
|
|
myRootLayer->AddToInputNotificationLists(fCurrentLayer, mask, options);
|
2005-09-03 21:55:16 +04:00
|
|
|
}
|
|
|
|
case AS_LAYER_SET_MOUSE_EVENT_MASK:
|
|
|
|
{
|
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
uint32 mask;
|
|
|
|
uint32 options;
|
|
|
|
|
|
|
|
link.Read<uint32>(&mask);
|
|
|
|
link.Read<uint32>(&options);
|
|
|
|
|
|
|
|
if (myRootLayer)
|
2005-09-05 22:55:32 +04:00
|
|
|
myRootLayer->SetNotifyLayer(fCurrentLayer, mask, options);
|
2005-05-23 21:23:20 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_MOVE_TO:
|
2003-09-25 16:31:11 +04:00
|
|
|
{
|
2005-06-28 22:56:55 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_MOVE_TO: Layer name: %s\n",
|
|
|
|
fTitle, fCurrentLayer->Name()));
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
float offsetX = x - fCurrentLayer->fFrame.left;
|
|
|
|
float offsetY = y - fCurrentLayer->fFrame.top;
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->MoveBy(offsetX, offsetY);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_RESIZE_TO:
|
2003-09-25 16:31:11 +04:00
|
|
|
{
|
2005-06-28 22:56:55 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_TO: Layer name: %s\n",
|
|
|
|
fTitle, fCurrentLayer->Name()));
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
float newWidth, newHeight;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&newWidth);
|
|
|
|
link.Read<float>(&newHeight);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
// TODO: If fCurrentLayer is a window, check for minimum size allowed.
|
2005-04-28 13:44:29 +04:00
|
|
|
// Need WinBorder::GetSizeLimits
|
2005-05-26 17:56:42 +04:00
|
|
|
float deltaWidth = newWidth - fCurrentLayer->fFrame.Width();
|
|
|
|
float deltaHeight = newHeight - fCurrentLayer->fFrame.Height();
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->ResizeBy(deltaWidth, deltaHeight);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COORD:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-04-28 03:20:29 +04:00
|
|
|
// our offset in the parent -> will be originX and originY in BView
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Attach<float>(fCurrentLayer->fFrame.left);
|
|
|
|
fLink.Attach<float>(fCurrentLayer->fFrame.top);
|
2005-11-08 04:16:15 +03:00
|
|
|
fLink.Attach<BRect>(fCurrentLayer->Bounds());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_SET_ORIGIN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetOrigin(BPoint(x, y));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_ORIGIN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<BPoint>(fCurrentLayer->CurrentState()->Origin());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
link.Read<uint32>(&(fCurrentLayer->fResizeMode));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CURSOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 token;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-01-19 21:00:05 +03:00
|
|
|
// TODO: implement; I think each Layer should have a member pointing
|
|
|
|
// to this requested cursor.
|
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_FLAGS:
|
|
|
|
{
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
uint32 flags;
|
|
|
|
link.Read<uint32>(&flags);
|
|
|
|
fCurrentLayer->SetFlags(flags);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_HIDE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->Hide();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SHOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->Show();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LINE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 lineCap, lineJoin;
|
2005-04-19 04:42:42 +04:00
|
|
|
float miterLimit;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Look into locking scheme relating to Layers and modifying redraw-related members
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&lineCap);
|
|
|
|
link.Read<int8>(&lineJoin);
|
2005-04-19 04:42:42 +04:00
|
|
|
link.Read<float>(&miterLimit);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetLineCapMode((cap_mode)lineCap);
|
|
|
|
fCurrentLayer->CurrentState()->SetLineJoinMode((join_mode)lineJoin);
|
|
|
|
fCurrentLayer->CurrentState()->SetMiterLimit(miterLimit);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_LINE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->CurrentState()->LineCapMode()));
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->CurrentState()->LineJoinMode()));
|
|
|
|
fLink.Attach<float>(fCurrentLayer->CurrentState()->MiterLimit());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PUSH_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-10 19:28:34 +04:00
|
|
|
fCurrentLayer->PushState();
|
2005-11-07 22:01:12 +03:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_POP_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-10 19:28:34 +04:00
|
|
|
fCurrentLayer->PopState();
|
2005-11-07 22:01:12 +03:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_SCALE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
float scale;
|
|
|
|
link.Read<float>(&scale);
|
2005-11-04 15:01:44 +03:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetScale(scale);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_SCALE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-11-04 12:52:56 +03:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<float>(fCurrentLayer->CurrentState()->Scale());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_LOC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-11-04 12:52:56 +03:00
|
|
|
float x, y;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetPenLocation(BPoint(x, y));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_LOC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<BPoint>(fCurrentLayer->CurrentState()->PenLocation());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
float penSize;
|
|
|
|
link.Read<float>(&penSize);
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetPenSize(penSize);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<float>(fCurrentLayer->CurrentState()->PenSize());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_VIEW_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color c;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2005-11-05 01:48:51 +03:00
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Lock();
|
2005-06-10 20:20:38 +04:00
|
|
|
fCurrentLayer->SetViewColor(RGBColor(c));
|
2005-04-19 04:42:42 +04:00
|
|
|
|
2005-11-06 20:47:06 +03:00
|
|
|
if (myRootLayer) {
|
|
|
|
myRootLayer->MarkForRedraw(fCurrentLayer->VisibleRegion());
|
|
|
|
myRootLayer->TriggerRedraw();
|
|
|
|
}
|
2005-11-05 01:48:51 +03:00
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Unlock();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
|
|
|
|
case AS_LAYER_GET_HIGH_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_HIGH_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->HighColor().GetColor32());
|
2005-06-28 22:56:55 +04:00
|
|
|
fLink.Flush();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AS_LAYER_GET_LOW_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LOW_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->CurrentState()->LowColor().GetColor32());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2005-06-28 22:56:55 +04:00
|
|
|
break;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_GET_VIEW_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_VIEW_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->ViewColor().GetColor32());
|
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
2005-06-28 22:56:55 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_BLEND_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 srcAlpha, alphaFunc;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&srcAlpha);
|
|
|
|
link.Read<int8>(&alphaFunc);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetBlendingMode((source_alpha)srcAlpha,
|
2005-04-19 04:42:42 +04:00
|
|
|
(alpha_function)alphaFunc);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_BLEND_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->CurrentState()->AlphaSrcMode()));
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->CurrentState()->AlphaFncMode()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_DRAW_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 drawingMode;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&drawingMode);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetDrawingMode((drawing_mode)drawingMode);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_DRAW_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-11-04 15:15:36 +03:00
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->CurrentState()->GetDrawingMode()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PRINT_ALIASING:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
bool fontAliasing;
|
|
|
|
link.Read<bool>(&fontAliasing);
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetForceFontAliasing(fontAliasing);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_PICTURE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-03-19 21:58:47 +03:00
|
|
|
// TODO: you are not allowed to use Layer regions here!!!
|
|
|
|
// If there is no other way, then first lock RootLayer object first.
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
2005-06-03 18:20:10 +04:00
|
|
|
bool inverse = false;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&pictureToken);
|
|
|
|
link.Read<BPoint>(&where);
|
2005-06-03 18:20:10 +04:00
|
|
|
link.Read<bool>(&inverse);
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// search for a picture with the specified token.
|
2005-06-03 18:20:10 +04:00
|
|
|
ServerPicture *picture = fServerApp->FindPicture(pictureToken);
|
2005-05-14 17:22:26 +04:00
|
|
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
2005-06-03 18:20:10 +04:00
|
|
|
if (picture == NULL)
|
2005-05-14 17:22:26 +04:00
|
|
|
break;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
BRegion region;
|
|
|
|
// TODO: I think we also need the BView's token
|
|
|
|
// I think PictureToRegion would fit better into the Layer class (?)
|
|
|
|
if (PictureToRegion(picture, region, inverse, where) < B_OK)
|
2005-05-14 17:22:26 +04:00
|
|
|
break;
|
2005-06-25 19:45:58 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetClippingRegion(region);
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2005-11-07 22:01:12 +03:00
|
|
|
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) {
|
2005-06-28 18:57:16 +04:00
|
|
|
BRegion invalidRegion;
|
|
|
|
fCurrentLayer->GetWantedRegion(invalidRegion);
|
2005-11-06 20:47:06 +03:00
|
|
|
|
|
|
|
// TODO: this is broken! a smaller area may be invalidated!
|
|
|
|
|
|
|
|
fCurrentLayer->fParent->MarkForRebuild(invalidRegion);
|
|
|
|
fCurrentLayer->fParent->TriggerRebuild();
|
|
|
|
myRootLayer->MarkForRedraw(invalidRegion);
|
|
|
|
myRootLayer->TriggerRedraw();
|
2005-06-28 18:57:16 +04:00
|
|
|
}
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_GET_CLIP_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
// if this Layer is hidden, it is clear that its visible region is void.
|
2005-07-05 05:19:01 +04:00
|
|
|
if (fCurrentLayer->IsHidden()) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<int32>(0L);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fLink.Flush();
|
2005-07-05 05:19:01 +04:00
|
|
|
} else {
|
2005-11-11 03:19:32 +03:00
|
|
|
BRegion drawingRegion = fCurrentLayer->DrawingRegion();
|
|
|
|
int32 rectCount = drawingRegion.CountRects();
|
2005-07-05 05:19:01 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-07-05 05:19:01 +04:00
|
|
|
fLink.Attach<int32>(rectCount);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
for (int32 i = 0; i < rectCount; i++) {
|
2005-11-11 03:19:32 +03:00
|
|
|
BRect converted(drawingRegion.RectAt(i));
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertFromScreen(&converted);
|
|
|
|
fLink.Attach<BRect>(converted);
|
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
|
|
|
fLink.Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
}
|
2005-07-05 05:19:01 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_CLIP_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-11-11 03:19:32 +03:00
|
|
|
int32 rectCount;
|
|
|
|
link.Read<int32>(&rectCount);
|
2005-04-19 04:42:42 +04:00
|
|
|
|
|
|
|
BRegion region;
|
2005-11-11 03:19:32 +03:00
|
|
|
for (int32 i = 0; i < rectCount; i++) {
|
2005-11-08 20:38:07 +03:00
|
|
|
BRect r;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
2005-11-08 20:38:07 +03:00
|
|
|
region.Include(r);
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2005-11-11 03:19:32 +03:00
|
|
|
fCurrentLayer->SetUserClipping(region);
|
2005-11-07 22:01:12 +03:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_INVAL_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-04-15 04:31:39 +04:00
|
|
|
// TODO: handle transformation (origin and scale) prior to converting to top
|
2003-09-25 21:25:38 +04:00
|
|
|
BRect invalRect;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&invalRect);
|
2005-01-22 23:51:12 +03:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer) {
|
2005-11-08 20:38:07 +03:00
|
|
|
BRect converted(invalRect.LeftTop(), invalRect.RightBottom());
|
|
|
|
|
|
|
|
fCurrentLayer->ConvertToScreen(&converted);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
BRegion invalidRegion(converted);
|
2005-11-07 22:01:12 +03:00
|
|
|
invalidRegion.IntersectWith(&fCurrentLayer->VisibleRegion());
|
2005-11-06 20:47:06 +03:00
|
|
|
myRootLayer->MarkForRedraw(invalidRegion);
|
|
|
|
myRootLayer->TriggerRedraw();
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_INVAL_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
// TODO: handle transformation (origin and scale) prior to converting to top
|
|
|
|
// TODO: Handle conversion to top
|
2005-11-06 20:47:06 +03:00
|
|
|
BRegion invalidReg;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 noOfRects;
|
|
|
|
BRect rect;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&noOfRects);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
for (int i = 0; i < noOfRects; i++) {
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-11-06 20:47:06 +03:00
|
|
|
invalidReg.Include(rect);
|
2003-09-25 21:25:38 +04:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-11-06 20:47:06 +03:00
|
|
|
if (myRootLayer) {
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&invalidReg);
|
2005-11-06 20:47:06 +03:00
|
|
|
|
|
|
|
myRootLayer->MarkForRedraw(invalidReg);
|
|
|
|
myRootLayer->TriggerRedraw();
|
|
|
|
}
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-06 00:37:13 +04:00
|
|
|
case AS_BEGIN_UPDATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title()));
|
2005-03-31 20:48:51 +04:00
|
|
|
fWinBorder->UpdateStart();
|
2004-07-06 00:37:13 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_END_UPDATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title()));
|
2005-03-31 20:48:51 +04:00
|
|
|
fWinBorder->UpdateEnd();
|
2004-07-06 00:37:13 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********** END: BView Messages ***********
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********* BWindow Messages ***********
|
2003-06-24 17:55:18 +04:00
|
|
|
case AS_LAYER_DELETE_ROOT:
|
|
|
|
{
|
|
|
|
// Received when a window deletes its internal top view
|
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_LAYER_DELETE_ROOT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SHOW_WINDOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_HIDE_WINDOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Hide();
|
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SEND_BEHIND:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
int32 token;
|
|
|
|
team_id teamID;
|
|
|
|
status_t status = B_NAME_NOT_FOUND;
|
|
|
|
|
|
|
|
link.Read<int32>(&token);
|
|
|
|
link.Read<team_id>(&teamID);
|
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
WinBorder *behindOf;
|
|
|
|
if ((behindOf = fDesktop->FindWinBorderByClientToken(token, teamID)) != NULL) {
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
|
|
|
// TODO: move to back ATM. Fix this later!
|
|
|
|
fWinBorder->GetRootLayer()->SetActive(fWinBorder, false);
|
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
|
|
|
status = B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
fLink.StartMessage(status);
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ENABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->EnableUpdateRequests();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_DISABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->DisableUpdateRequests();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_NEEDS_UPDATE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid())
|
|
|
|
fLink.StartMessage(B_OK);
|
|
|
|
else
|
|
|
|
fLink.StartMessage(B_ERROR);
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-05 23:20:19 +04:00
|
|
|
case AS_SET_WINDOW_TITLE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-07-01 22:29:20 +04:00
|
|
|
char* newTitle;
|
|
|
|
if (link.ReadString(&newTitle) == B_OK) {
|
2005-07-05 23:20:19 +04:00
|
|
|
SetTitle(newTitle);
|
2005-07-01 22:29:20 +04:00
|
|
|
free(newTitle);
|
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 22:29:20 +04:00
|
|
|
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ADD_TO_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title()));
|
2005-07-05 22:14:24 +04:00
|
|
|
WinBorder *windowBorder;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.Read(&teamID, sizeof(team_id));
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
2005-07-05 22:14:24 +04:00
|
|
|
if (windowBorder) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-03-14 01:54:01 +03:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->AddWinBorderToSubset(fWinBorder, windowBorder);
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2005-06-15 01:28:56 +04:00
|
|
|
} else {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_REM_FROM_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title()));
|
2005-07-05 22:14:24 +04:00
|
|
|
WinBorder *windowBorder;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.Read(&teamID, sizeof(team_id));
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
2005-07-05 22:14:24 +04:00
|
|
|
if (windowBorder) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder);
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2005-06-15 01:28:56 +04:00
|
|
|
} else {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
#if 0
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_LOOK:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_LOOK
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Look unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FLAGS:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FLAGS
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Flags unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FEEL:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SET_FEEL\n", Title()));
|
2005-06-15 01:28:56 +04:00
|
|
|
int32 newFeel;
|
2005-04-21 22:57:34 +04:00
|
|
|
link.Read<int32>(&newFeel);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->GoChangeWinBorderFeel(winBorder, newFeel);
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_ALIGNMENT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_GET_ALIGNMENT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
#endif
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<uint32>(fWinBorder->Workspaces());
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n", Title()));
|
2005-06-15 01:28:56 +04:00
|
|
|
uint32 newWorkspaces;
|
2005-04-16 17:30:49 +04:00
|
|
|
link.Read<uint32>(&newWorkspaces);
|
2005-04-10 23:04:06 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
|
|
|
fWinBorder->GetRootLayer()->SetWinBorderWorskpaces( fWinBorder,
|
|
|
|
fWinBorder->Workspaces(),
|
|
|
|
newWorkspaces);
|
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-04-18 23:58:43 +04:00
|
|
|
case AS_WINDOW_RESIZE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
float xResizeBy;
|
|
|
|
float yResizeBy;
|
2004-05-16 23:24:18 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xResizeBy);
|
|
|
|
link.Read<float>(&yResizeBy);
|
2005-04-28 16:31:25 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
|
2004-05-16 23:24:18 +04:00
|
|
|
|
|
|
|
fWinBorder->ResizeBy(xResizeBy, yResizeBy);
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-06-18 23:13:06 +04:00
|
|
|
case AS_WINDOW_MOVE:
|
|
|
|
{
|
|
|
|
float xMoveBy;
|
|
|
|
float yMoveBy;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xMoveBy);
|
|
|
|
link.Read<float>(&yMoveBy);
|
2004-06-18 23:13:06 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
|
2005-04-28 16:31:25 +04:00
|
|
|
|
2004-06-18 23:13:06 +04:00
|
|
|
fWinBorder->MoveBy(xMoveBy, yMoveBy);
|
|
|
|
break;
|
|
|
|
}
|
2004-08-08 00:30:58 +04:00
|
|
|
case AS_SET_SIZE_LIMITS:
|
|
|
|
{
|
|
|
|
// Attached Data:
|
|
|
|
// 1) float minimum width
|
|
|
|
// 2) float maximum width
|
|
|
|
// 3) float minimum height
|
|
|
|
// 4) float maximum height
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
float minWidth;
|
|
|
|
float maxWidth;
|
|
|
|
float minHeight;
|
|
|
|
float maxHeight;
|
2004-08-08 00:30:58 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
link.Read<float>(&minWidth);
|
|
|
|
link.Read<float>(&maxWidth);
|
|
|
|
link.Read<float>(&minHeight);
|
|
|
|
link.Read<float>(&maxHeight);
|
2004-08-08 00:30:58 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
fWinBorder->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
|
|
|
|
|
|
|
|
// and now, sync the client to the limits that we were able to enforce
|
|
|
|
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-07-18 13:53:37 +04:00
|
|
|
fLink.Attach<BRect>(fWinBorder->Frame());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Attach<float>(minWidth);
|
|
|
|
fLink.Attach<float>(maxWidth);
|
|
|
|
fLink.Attach<float>(minHeight);
|
|
|
|
fLink.Attach<float>(maxHeight);
|
2005-06-03 23:50:30 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-08-08 00:30:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-10-06 14:45:46 +04:00
|
|
|
case AS_ACTIVATE_WINDOW:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-10-06 14:45:46 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-10-29 14:19:23 +04:00
|
|
|
bool activate = true;
|
|
|
|
|
|
|
|
link.Read<bool>(&activate);
|
|
|
|
|
2005-10-06 14:45:46 +04:00
|
|
|
if (myRootLayer && myRootLayer->Lock()) {
|
2005-10-29 14:19:23 +04:00
|
|
|
myRootLayer->SetActive(fWinBorder, activate);
|
2005-10-06 14:45:46 +04:00
|
|
|
myRootLayer->Unlock();
|
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
// Some BView drawing messages, but which don't need clipping
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_LAYER_SET_HIGH_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetHighColor(RGBColor(c));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LOW_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetLowColor(RGBColor(c));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2005-03-27 08:08:33 +04:00
|
|
|
case AS_LAYER_SET_PATTERN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PATTERN: Layer: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-03-27 08:08:33 +04:00
|
|
|
pattern pat;
|
|
|
|
|
|
|
|
link.Read(&pat, sizeof(pattern));
|
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetPattern(Pattern(pat));
|
2005-03-27 08:08:33 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
case AS_MOVEPENTO:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_MOVEPENTO\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
float x,y;
|
|
|
|
|
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2005-11-04 15:15:36 +03:00
|
|
|
if (fCurrentLayer && fCurrentLayer->CurrentState())
|
|
|
|
fCurrentLayer->CurrentState()->SetPenLocation(BPoint(x, y));
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SETPENSIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SETPENSIZE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
float size;
|
|
|
|
|
|
|
|
link.Read<float>(&size);
|
2005-11-04 15:15:36 +03:00
|
|
|
if (fCurrentLayer && fCurrentLayer->CurrentState())
|
|
|
|
fCurrentLayer->CurrentState()->SetPenSize(size);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// TODO: Implement AS_SET_FONT?
|
|
|
|
// Confusing!! But it works already!
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT_SIZE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// TODO: Implement AS_SET_FONT_SIZE?
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_AREA_MESSAGE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_AREA_MESSAGE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// This occurs in only one kind of case: a message is too big to send over a port. This
|
|
|
|
// is really an edge case, so this shouldn't happen *too* often
|
|
|
|
|
|
|
|
// Attached Data:
|
|
|
|
// 1) area_id id of an area already owned by the server containing the message
|
|
|
|
// 2) size_t offset of the pointer in the area
|
|
|
|
// 3) size_t size of the message
|
|
|
|
|
|
|
|
area_id area;
|
|
|
|
size_t offset;
|
|
|
|
size_t msgsize;
|
|
|
|
area_info ai;
|
|
|
|
int8 *msgpointer;
|
|
|
|
|
|
|
|
link.Read<area_id>(&area);
|
|
|
|
link.Read<size_t>(&offset);
|
|
|
|
link.Read<size_t>(&msgsize);
|
|
|
|
|
|
|
|
// Part sanity check, part get base pointer :)
|
|
|
|
if(get_area_info(area,&ai)!=B_OK)
|
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
msgpointer = (int8*)ai.address + offset;
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
RAMLinkMsgReader mlink(msgpointer);
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchMessage(mlink.Code(), mlink);
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
// This is a very special case in the sense that when ServerMemIO is used for this
|
|
|
|
// purpose, it will be set to NOT automatically free the memory which it had
|
|
|
|
// requested. This is the server's job once the message has been dispatched.
|
|
|
|
fServerApp->AppAreaPool()->ReleaseBuffer(msgpointer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SYNC:
|
|
|
|
{
|
|
|
|
// TODO: AS_SYNC is a no-op for now, just to get things working
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAG_IMAGE:
|
|
|
|
{
|
|
|
|
// TODO: Implement AS_LAYER_DRAG_IMAGE
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n", Title()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAG_RECT:
|
|
|
|
{
|
|
|
|
// TODO: Implement AS_LAYER_DRAG_RECT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n", Title()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_MOUSE_COORDS:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n", fTitle));
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
// Returns
|
|
|
|
// 1) BPoint mouse location
|
|
|
|
// 2) int32 button state
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
fLink.Attach<BPoint>(fDesktop->GetHWInterface()->GetCursorPosition());
|
|
|
|
fLink.Attach<int32>(fDesktop->ActiveRootLayer()->Buttons());
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-10-11 09:25:52 +04:00
|
|
|
|
|
|
|
case AS_DW_GET_SYNC_DATA:
|
|
|
|
{
|
|
|
|
// TODO: Use token or get rid of it.
|
|
|
|
int32 serverToken;
|
|
|
|
link.Read<int32>(&serverToken);
|
|
|
|
|
|
|
|
if (_EnableDirectWindowMode() == B_OK) {
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
struct dw_sync_data syncData = {
|
|
|
|
fDirectWindowData->direct_area,
|
|
|
|
fDirectWindowData->direct_sem,
|
|
|
|
fDirectWindowData->direct_sem_ack
|
|
|
|
};
|
|
|
|
|
|
|
|
fLink.Attach(&syncData, sizeof(syncData));
|
|
|
|
|
|
|
|
} else
|
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
|
|
|
|
fLink.Flush();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
default:
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchGraphicsMessage(code, link);
|
2005-05-20 06:42:52 +04:00
|
|
|
break;
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
2005-06-28 07:23:16 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Unlock();
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
2005-06-15 01:28:56 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// -------------------- Graphics messages ----------------------------------
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
2005-05-20 04:09:59 +04:00
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
// NOTE: fCurrentLayer and fCurrentLayer->fLayerData cannot be NULL,
|
|
|
|
// _DispatchGraphicsMessage() is called from _DispatchMessage() which
|
|
|
|
// checks both these conditions
|
2005-11-11 03:19:32 +03:00
|
|
|
BRegion rreg(fCurrentLayer->DrawingRegion());
|
2005-06-25 19:45:58 +04:00
|
|
|
|
2005-06-25 17:09:19 +04:00
|
|
|
if (fWinBorder->InUpdate())
|
|
|
|
rreg.IntersectWith(&fWinBorder->RegionToBeUpdated());
|
2005-05-20 04:09:59 +04:00
|
|
|
|
2005-11-04 18:23:54 +03:00
|
|
|
DrawingEngine* driver = fWinBorder->GetDrawingEngine();
|
2005-11-04 16:45:16 +03:00
|
|
|
if (!driver) {
|
|
|
|
// ?!?
|
|
|
|
DTRACE(("ServerWindow %s: no display driver!!\n", Title()));
|
|
|
|
return;
|
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
|
|
|
driver->ConstrainClippingRegion(&rreg);
|
2005-11-04 15:15:36 +03:00
|
|
|
// rgb_color rrr = fCurrentLayer->CurrentState()->viewcolor.GetColor32();
|
2005-05-20 04:09:59 +04:00
|
|
|
// RGBColor c(rand()%255,rand()%255,rand()%255);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// driver->FillRect(BRect(0,0,639,479), c);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
switch (code) {
|
2004-09-14 04:51:51 +04:00
|
|
|
case AS_STROKE_LINE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINE\n", Title()));
|
2005-05-26 17:56:42 +04:00
|
|
|
|
2004-09-14 04:51:51 +04:00
|
|
|
float x1, y1, x2, y2;
|
2005-05-26 17:56:42 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x1);
|
|
|
|
link.Read<float>(&y1);
|
|
|
|
link.Read<float>(&x2);
|
|
|
|
link.Read<float>(&y2);
|
2005-05-26 17:56:42 +04:00
|
|
|
|
2005-11-09 16:28:15 +03:00
|
|
|
BPoint p1(x1, y1);
|
|
|
|
BPoint p2(x2, y2);
|
|
|
|
BPoint penPos = p2;
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&p1);
|
|
|
|
fCurrentLayer->ConvertToScreen(&p2);
|
|
|
|
driver->StrokeLine(p1, p2, fCurrentLayer->CurrentState());
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2005-11-04 18:23:54 +03:00
|
|
|
// We update the pen here because many DrawingEngine calls which do not update the
|
2005-11-04 16:45:16 +03:00
|
|
|
// pen position actually call StrokeLine
|
2005-04-19 04:42:42 +04:00
|
|
|
|
2005-11-04 16:45:16 +03:00
|
|
|
// TODO: Decide where to put this, for example, it cannot be done
|
|
|
|
// for DrawString(), also there needs to be a decision, if penlocation
|
|
|
|
// is in View coordinates (I think it should be) or in screen coordinates.
|
2005-11-09 16:28:15 +03:00
|
|
|
fCurrentLayer->CurrentState()->SetPenLocation(penPos);
|
2004-09-14 04:51:51 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-01-21 05:01:28 +03:00
|
|
|
case AS_LAYER_INVERT_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_INVERT_RECT\n", Title()));
|
2005-01-21 05:01:28 +03:00
|
|
|
|
|
|
|
BRect rect;
|
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->InvertRect(rect);
|
2005-01-21 05:01:28 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_STROKE_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_RECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
float left, top, right, bottom;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&left);
|
|
|
|
link.Read<float>(&top);
|
|
|
|
link.Read<float>(&right);
|
|
|
|
link.Read<float>(&bottom);
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect(left,top,right,bottom);
|
2005-01-19 18:12:35 +03:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->StrokeRect(rect, fCurrentLayer->CurrentState());
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
case AS_FILL_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_RECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-11-08 20:38:07 +03:00
|
|
|
|
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->FillRect(rect, fCurrentLayer->CurrentState());
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_(A)SYNC_AT_POINT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BPoint>(&point);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
|
|
|
BRect src = sbmp->Bounds();
|
2005-06-06 02:02:25 +04:00
|
|
|
BRect dst = src.OffsetToCopy(point);
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&dst);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
driver->DrawBitmap(sbmp, src, dst, fCurrentLayer->CurrentState());
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
|
|
|
|
2005-11-04 16:45:16 +03:00
|
|
|
// TODO: how should AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT sync with the client?
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
|
2005-05-20 04:09:59 +04:00
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_(A)SYNC_IN_RECT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BRect>(&dstRect);
|
|
|
|
link.Read<BRect>(&srcRect);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&dstRect);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
2005-11-04 15:15:36 +03:00
|
|
|
driver->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->CurrentState());
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-11-04 16:45:16 +03:00
|
|
|
// TODO: how should AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client?
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_STROKE_ARC:
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_FILL_ARC:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_ARC\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
float angle, span;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
|
|
|
link.Read<float>(&angle);
|
|
|
|
link.Read<float>(&span);
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&r);
|
|
|
|
driver->DrawArc(r, angle, span, fCurrentLayer->CurrentState(), code == AS_FILL_ARC);
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_BEZIER:
|
|
|
|
case AS_FILL_BEZIER:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_BEZIER\n", Title()));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-11-04 16:45:16 +03:00
|
|
|
BPoint pts[4];
|
|
|
|
for (int32 i = 0; i < 4; i++) {
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&pts[i]);
|
2005-11-04 16:45:16 +03:00
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-11-04 21:22:22 +03:00
|
|
|
driver->DrawBezier(pts, fCurrentLayer->CurrentState(), code == AS_FILL_BEZIER);
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ELLIPSE:
|
|
|
|
case AS_FILL_ELLIPSE:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_ELLIPSE\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->DrawEllipse(rect, fCurrentLayer->CurrentState(), code == AS_FILL_ELLIPSE);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_STROKE_ROUNDRECT:
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_FILL_ROUNDRECT:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_ROUNDRECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
|
|
|
float xrad,yrad;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
link.Read<float>(&xrad);
|
|
|
|
link.Read<float>(&yrad);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->DrawRoundRect(rect, xrad, yrad, fCurrentLayer->CurrentState(), code == AS_FILL_ROUNDRECT);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_STROKE_TRIANGLE:
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_FILL_TRIANGLE:
|
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_TRIANGLE\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BPoint pts[3];
|
|
|
|
BRect rect;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-04 16:45:16 +03:00
|
|
|
for (int32 i = 0; i < 3; i++) {
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&pts[i]);
|
2005-11-04 16:45:16 +03:00
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&rect);
|
|
|
|
driver->DrawTriangle(pts, rect, fCurrentLayer->CurrentState(), code == AS_FILL_TRIANGLE);
|
2005-11-04 16:45:16 +03:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_POLYGON:
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_FILL_POLYGON:
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_POLYGON\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
BRect polyFrame;
|
|
|
|
bool isClosed = true;
|
|
|
|
int32 pointCount;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
link.Read<BRect>(&polyFrame);
|
2005-11-04 16:45:16 +03:00
|
|
|
if (code == AS_STROKE_POLYGON)
|
2005-11-10 16:37:08 +03:00
|
|
|
link.Read<bool>(&isClosed);
|
|
|
|
link.Read<int32>(&pointCount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
BPoint* pointList = new(nothrow) BPoint[pointCount];
|
|
|
|
if (link.Read(pointList, pointCount * sizeof(BPoint)) >= B_OK) {
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
for (int32 i = 0; i < pointCount; i++)
|
|
|
|
fCurrentLayer->ConvertToScreen(&pointList[i]);
|
|
|
|
|
|
|
|
driver->DrawPolygon(pointList, pointCount, polyFrame,
|
|
|
|
fCurrentLayer->CurrentState(), code == AS_FILL_POLYGON,
|
|
|
|
isClosed && pointCount > 2);
|
|
|
|
|
|
|
|
delete[] pointList;
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_SHAPE:
|
2005-11-04 16:45:16 +03:00
|
|
|
case AS_FILL_SHAPE:
|
2004-09-17 14:27:58 +04:00
|
|
|
{
|
2005-11-04 16:45:16 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE/FILL_SHAPE\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
BRect shapeFrame;
|
|
|
|
int32 opCount;
|
|
|
|
int32 ptCount;
|
2004-09-17 14:27:58 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
link.Read<BRect>(&shapeFrame);
|
|
|
|
link.Read<int32>(&opCount);
|
|
|
|
link.Read<int32>(&ptCount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
uint32* opList = new(nothrow) uint32[opCount];
|
|
|
|
BPoint* ptList = new(nothrow) BPoint[ptCount];
|
|
|
|
if (link.Read(opList, opCount * sizeof(uint32)) >= B_OK &&
|
|
|
|
link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) {
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
for (int32 i = 0; i < ptCount; i++)
|
|
|
|
fCurrentLayer->ConvertToScreen(&ptList[i]);
|
|
|
|
|
|
|
|
driver->DrawShape(shapeFrame, opCount, opList, ptCount, ptList,
|
|
|
|
fCurrentLayer->CurrentState(), code == AS_FILL_SHAPE);
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
delete[] opList;
|
|
|
|
delete[] ptList;
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_REGION:
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_REGION\n", Title()));
|
2004-09-17 14:27:58 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
int32 count;
|
|
|
|
link.Read<int32>(&count);
|
|
|
|
|
2005-11-10 16:37:08 +03:00
|
|
|
BRect* rects = new(nothrow) BRect[count];
|
|
|
|
if (link.Read(rects, sizeof(BRect) * count) < B_OK) {
|
2005-06-23 22:48:10 +04:00
|
|
|
delete[] rects;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
// Between the client-side conversion to BRects from clipping_rects to the overhead
|
|
|
|
// in repeatedly calling FillRect(), this is definitely in need of optimization. At
|
|
|
|
// least it works for now. :)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
BRegion region;
|
2005-06-23 22:48:10 +04:00
|
|
|
for (int32 i = 0; i < count; i++) {
|
2005-11-08 20:38:07 +03:00
|
|
|
region.Include(rects[i]);
|
2005-06-23 22:48:10 +04:00
|
|
|
}
|
2005-11-08 20:38:07 +03:00
|
|
|
|
|
|
|
fCurrentLayer->ConvertToScreen(®ion);
|
2005-11-04 15:15:36 +03:00
|
|
|
driver->FillRegion(region, fCurrentLayer->CurrentState());
|
2005-06-23 22:48:10 +04:00
|
|
|
|
|
|
|
delete[] rects;
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
// TODO: create support for clipping_rect usage for faster BRegion display.
|
2005-11-04 18:23:54 +03:00
|
|
|
// Tweaks to DrawingEngine are necessary along with conversion routines in Layer
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_LINEARRAY:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINEARRAY\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
// Attached Data:
|
|
|
|
// 1) int32 Number of lines in the array
|
|
|
|
// 2) array of struct _array_data_ objects, as defined in ViewAux.h
|
|
|
|
|
|
|
|
int32 linecount;
|
|
|
|
|
|
|
|
link.Read<int32>(&linecount);
|
2005-07-01 12:50:45 +04:00
|
|
|
if (linecount > 0) {
|
2005-11-09 16:28:15 +03:00
|
|
|
LineArrayData linedata[linecount];
|
|
|
|
LineArrayData* index;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
for (int32 i = 0; i < linecount; i++) {
|
|
|
|
index = &linedata[i];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&(index->pt1.x));
|
|
|
|
link.Read<float>(&(index->pt1.y));
|
|
|
|
link.Read<float>(&(index->pt2.x));
|
|
|
|
link.Read<float>(&(index->pt2.y));
|
|
|
|
link.Read<rgb_color>(&(index->color));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&index->pt1);
|
|
|
|
fCurrentLayer->ConvertToScreen(&index->pt2);
|
2005-07-01 12:50:45 +04:00
|
|
|
}
|
2005-11-09 16:28:15 +03:00
|
|
|
driver->StrokeLineArray(linecount, linedata, fCurrentLayer->CurrentState());
|
2004-10-16 06:02:27 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-09-21 02:50:02 +04:00
|
|
|
case AS_DRAW_STRING:
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAW_STRING\n", Title()));
|
2004-09-21 02:50:02 +04:00
|
|
|
char *string;
|
|
|
|
int32 length;
|
|
|
|
BPoint location;
|
|
|
|
escapement_delta delta;
|
|
|
|
|
2004-10-17 02:42:08 +04:00
|
|
|
link.Read<int32>(&length);
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&location);
|
|
|
|
link.Read<escapement_delta>(&delta);
|
|
|
|
link.ReadString(&string);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
2005-11-08 20:38:07 +03:00
|
|
|
fCurrentLayer->ConvertToScreen(&location);
|
2005-11-09 19:55:08 +03:00
|
|
|
BPoint penLocation = driver->DrawString(string, length, location,
|
|
|
|
fCurrentLayer->CurrentState(), &delta);
|
|
|
|
fCurrentLayer->ConvertFromScreen(&penLocation);
|
|
|
|
fCurrentLayer->CurrentState()->SetPenLocation(penLocation);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
|
|
|
free(string);
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-07-05 01:13:48 +04:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
case AS_LAYER_BEGIN_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_BEGIN_PICTURE not implemented\n");
|
|
|
|
break;
|
|
|
|
case AS_LAYER_APPEND_TO_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_APPEND_TO_PICTURE not implemented\n");
|
|
|
|
break;
|
|
|
|
case AS_LAYER_END_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_END_PICTURE not implemented\n");
|
|
|
|
break;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
default:
|
2005-07-01 12:50:45 +04:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld\n",
|
|
|
|
Title(), code - SERVER_TRUE);
|
|
|
|
|
|
|
|
if (link.NeedsReply()) {
|
|
|
|
// the client is now blocking and waiting for a reply!
|
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2005-03-31 00:06:50 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->ConstrainClippingRegion(NULL);
|
2003-03-19 04:12:53 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Message-dispatching loop for the ServerWindow
|
|
|
|
|
|
|
|
Watches the ServerWindow's message port and dispatches as necessary
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ServerWindow::_MessageLooper()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-24 02:43:11 +04:00
|
|
|
BPrivate::LinkReceiver& receiver = fLink.Receiver();
|
2005-07-07 02:39:15 +04:00
|
|
|
bool quitLoop = false;
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
while (!quitLoop) {
|
2005-07-18 13:24:08 +04:00
|
|
|
//STRACE(("info: ServerWindow::MonitorWin listening on port %ld.\n",
|
|
|
|
// fMessagePort));
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
int32 code;
|
|
|
|
status_t status = receiver.GetNextMessage(code);
|
|
|
|
if (status < B_OK) {
|
2005-06-24 02:43:11 +04:00
|
|
|
// that shouldn't happen, it's our port
|
2005-07-07 02:39:15 +04:00
|
|
|
printf("Someone deleted our message port!\n");
|
|
|
|
|
|
|
|
// try to let our client die happily
|
|
|
|
NotifyQuitRequested();
|
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
}
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
Lock();
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
switch (code) {
|
2004-06-19 17:04:50 +04:00
|
|
|
case AS_DELETE_WINDOW:
|
2005-07-24 21:13:02 +04:00
|
|
|
case kMsgQuitLooper:
|
2004-01-13 03:56:36 +03:00
|
|
|
// this means the client has been killed
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s received 'AS_DELETE_WINDOW' message code\n",
|
2005-06-24 02:43:11 +04:00
|
|
|
Title()));
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
quitLoop = true;
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
// ToDo: what's this?
|
2005-05-26 19:04:45 +04:00
|
|
|
//RootLayer *rootLayer = fWinBorder->GetRootLayer();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
// we are preparing to delete a ServerWindow, RootLayer should be aware
|
|
|
|
// of that and stop for a moment.
|
|
|
|
// also we must wait a bit for the associated WinBorder to become hidden
|
2005-05-26 19:04:45 +04:00
|
|
|
//while(1) {
|
|
|
|
// myRootLayer->Lock();
|
|
|
|
// if (IsHidden())
|
|
|
|
// break;
|
|
|
|
// else
|
|
|
|
// rootLayer->Unlock();
|
|
|
|
//}
|
|
|
|
|
2004-06-19 17:04:50 +04:00
|
|
|
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
2005-06-24 02:43:11 +04:00
|
|
|
if (!fWinBorder->IsHidden())
|
2005-05-26 03:59:23 +04:00
|
|
|
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2005-07-07 02:39:15 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
case B_QUIT_REQUESTED:
|
2005-06-24 02:43:11 +04:00
|
|
|
STRACE(("ServerWindow %s received quit request\n", Title()));
|
|
|
|
NotifyQuitRequested();
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
default:
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchMessage(code, receiver);
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2003-08-31 21:38:34 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
Unlock();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-07-07 02:39:15 +04:00
|
|
|
|
|
|
|
// we were asked to quit the message loop - either on request or because of an error
|
|
|
|
Quit();
|
|
|
|
// does not return
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-04-27 21:26:57 +04:00
|
|
|
|
2005-10-24 20:21:49 +04:00
|
|
|
status_t
|
2005-05-26 19:04:45 +04:00
|
|
|
ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2005-05-04 01:42:37 +04:00
|
|
|
ssize_t size = msg->FlattenedSize();
|
2005-11-10 16:37:08 +03:00
|
|
|
char* buffer = new(nothrow) char[size];
|
2005-10-24 20:21:49 +04:00
|
|
|
status_t ret;
|
2005-05-04 01:42:37 +04:00
|
|
|
|
2005-10-24 20:21:49 +04:00
|
|
|
if ((ret = msg->Flatten(buffer, size)) == B_OK) {
|
|
|
|
ret = BMessage::Private::SendFlattenedMessage(buffer, size,
|
|
|
|
fClientLooperPort, target, usePreferred, 100000);
|
2005-05-04 01:42:37 +04:00
|
|
|
if (ret < B_OK)
|
|
|
|
fprintf(stderr, "ServerWindow::SendMessageToClient(): %s\n", strerror(ret));
|
|
|
|
} else
|
2005-06-23 22:48:10 +04:00
|
|
|
printf("PANIC: ServerWindow %s: can't flatten message in 'SendMessageToClient()'\n", fTitle);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-05-04 01:42:37 +04:00
|
|
|
delete[] buffer;
|
2005-10-24 20:21:49 +04:00
|
|
|
|
|
|
|
return ret;
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// MakeWinBorder
|
|
|
|
WinBorder*
|
|
|
|
ServerWindow::MakeWinBorder(BRect frame, const char* name,
|
|
|
|
uint32 look, uint32 feel, uint32 flags,
|
|
|
|
uint32 workspace)
|
|
|
|
{
|
2005-11-04 18:23:54 +03:00
|
|
|
// The non-offscreen ServerWindow uses the DrawingEngine instance from the desktop.
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
return new(nothrow) WinBorder(frame, name, look, feel, flags,
|
2005-11-04 18:23:54 +03:00
|
|
|
workspace, this, fDesktop->GetDrawingEngine());
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
}
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
|
|
|
|
status_t
|
|
|
|
ServerWindow::_EnableDirectWindowMode()
|
|
|
|
{
|
|
|
|
if (fDirectWindowData != NULL)
|
|
|
|
return B_ERROR; // already in direct window mode
|
|
|
|
|
|
|
|
fDirectWindowData = new (nothrow) dw_data;
|
|
|
|
if (fDirectWindowData == NULL)
|
|
|
|
return B_NO_MEMORY;
|
|
|
|
|
|
|
|
if (!fDirectWindowData->IsValid()) {
|
|
|
|
delete fDirectWindowData;
|
|
|
|
fDirectWindowData = NULL;
|
|
|
|
return B_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-08 11:32:32 +03:00
|
|
|
ServerWindow::HandleDirectConnection(int bufferState, int driverState)
|
2005-10-11 09:25:52 +04:00
|
|
|
{
|
|
|
|
if (fDirectWindowData == NULL)
|
|
|
|
return;
|
|
|
|
|
2005-11-01 12:53:47 +03:00
|
|
|
if (bufferState != -1)
|
|
|
|
fDirectWindowData->direct_info->buffer_state = (direct_buffer_state)bufferState;
|
2005-10-11 09:25:52 +04:00
|
|
|
|
2005-11-01 12:53:47 +03:00
|
|
|
if (driverState != -1)
|
|
|
|
fDirectWindowData->direct_info->driver_state = (direct_driver_state)driverState;
|
|
|
|
|
|
|
|
if ((bufferState & B_DIRECT_MODE_MASK) != B_DIRECT_STOP) {
|
2005-10-12 01:37:47 +04:00
|
|
|
// TODO: Locking ?
|
2005-10-31 14:05:52 +03:00
|
|
|
RenderingBuffer *buffer = fDesktop->GetHWInterface()->FrontBuffer();
|
2005-10-12 01:37:47 +04:00
|
|
|
fDirectWindowData->direct_info->bits = buffer->Bits();
|
|
|
|
fDirectWindowData->direct_info->pci_bits = NULL; // TODO
|
|
|
|
fDirectWindowData->direct_info->bytes_per_row = buffer->BytesPerRow();
|
|
|
|
fDirectWindowData->direct_info->bits_per_pixel = buffer->BytesPerRow() / buffer->Width() * 8;
|
|
|
|
fDirectWindowData->direct_info->pixel_format = buffer->ColorSpace();
|
|
|
|
fDirectWindowData->direct_info->layout = B_BUFFER_NONINTERLEAVED;
|
|
|
|
fDirectWindowData->direct_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO
|
|
|
|
|
2005-10-12 02:32:27 +04:00
|
|
|
WinBorder *border = const_cast<WinBorder *>(GetWinBorder());
|
|
|
|
fDirectWindowData->direct_info->window_bounds = to_clipping_rect(border->Frame());
|
2005-10-12 01:37:47 +04:00
|
|
|
|
|
|
|
// TODO: Review this
|
|
|
|
const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info)) / sizeof(clipping_rect);
|
|
|
|
|
2005-11-01 21:13:10 +03:00
|
|
|
// TODO: Is there a simpler way to obtain this result ?
|
|
|
|
// We just want the region INSIDE the window, border excluded.
|
|
|
|
BRegion clipRegion = const_cast<BRegion &>(border->FullVisible());
|
|
|
|
BRegion exclude = const_cast<BRegion &>(border->VisibleRegion());
|
|
|
|
clipRegion.Exclude(&exclude);
|
|
|
|
|
2005-10-12 01:37:47 +04:00
|
|
|
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount);
|
|
|
|
fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
|
|
|
|
|
|
|
|
for (uint32 i = 0; i < fDirectWindowData->direct_info->clip_list_count; i++)
|
|
|
|
fDirectWindowData->direct_info->clip_list[i] = clipRegion.RectAtInt(i);
|
2005-10-11 09:25:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Releasing this sem causes the client to call BDirectWindow::DirectConnected()
|
|
|
|
release_sem(fDirectWindowData->direct_sem);
|
|
|
|
|
2005-11-09 02:26:47 +03:00
|
|
|
// TODO: Waiting 3 seconds in this thread is not a problem,
|
|
|
|
// but since we are called from the RootLayer's thread too, very bad things could happen.
|
|
|
|
// Find some way to call this method only within ServerWindow's thread (messaging ?)
|
2005-10-11 09:25:52 +04:00
|
|
|
status_t status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 3000000);
|
|
|
|
if (status == B_TIMED_OUT) {
|
|
|
|
// The client application didn't release the semaphore
|
|
|
|
// within the given timeout. Deleting this member should make it crash.
|
2005-10-12 01:37:47 +04:00
|
|
|
// TODO: Actually, it will not. At least, not always. Find a better way to
|
|
|
|
// crash the client application.
|
2005-10-11 09:25:52 +04:00
|
|
|
delete fDirectWindowData;
|
|
|
|
fDirectWindowData = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
status_t
|
|
|
|
ServerWindow::PictureToRegion(ServerPicture *picture, BRegion ®ion,
|
|
|
|
bool inverse, BPoint where)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "ServerWindow::PictureToRegion() not implemented\n");
|
|
|
|
region.MakeEmpty();
|
|
|
|
return B_ERROR;
|
|
|
|
}
|