* Got rid of the "Layer" part of WindowLayer, ViewLayer, WorkspacesLayer
(now WorkspacesView), OffscreenWindowLayer. * Renamed ServerScreen.cpp/h to Screen.cpp/h (the class was already called Screen). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24303 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+80
-81
@@ -18,16 +18,16 @@
|
|||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
#include "InputManager.h"
|
#include "InputManager.h"
|
||||||
|
#include "Screen.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerScreen.h"
|
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "SystemPalette.h"
|
#include "SystemPalette.h"
|
||||||
#include "WindowPrivate.h"
|
#include "WindowPrivate.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
#include "WorkspacesLayer.h"
|
#include "WorkspacesView.h"
|
||||||
|
|
||||||
#include <ViewPrivate.h>
|
#include <ViewPrivate.h>
|
||||||
#include <WindowInfo.h>
|
#include <WindowInfo.h>
|
||||||
@@ -239,7 +239,7 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
|
|||||||
|
|
||||||
int32 viewToken = B_NULL_TOKEN;
|
int32 viewToken = B_NULL_TOKEN;
|
||||||
|
|
||||||
WindowLayer* window = fDesktop->MouseEventWindow();
|
Window* window = fDesktop->MouseEventWindow();
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
window = fDesktop->WindowAt(where);
|
window = fDesktop->WindowAt(where);
|
||||||
|
|
||||||
@@ -667,7 +667,7 @@ Desktop::_ActivateApp(team_id team)
|
|||||||
|
|
||||||
// search for an unhidden window to give focus to
|
// search for an unhidden window to give focus to
|
||||||
|
|
||||||
for (WindowLayer* window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
// if window is a normal window of the team, and not hidden,
|
// if window is a normal window of the team, and not hidden,
|
||||||
// we've found our target
|
// we've found our target
|
||||||
@@ -752,13 +752,13 @@ Desktop::RedrawBackground()
|
|||||||
|
|
||||||
BRegion redraw;
|
BRegion redraw;
|
||||||
|
|
||||||
WindowLayer* window = _CurrentWindows().FirstWindow();
|
Window* window = _CurrentWindows().FirstWindow();
|
||||||
if (window->Feel() == kDesktopWindowFeel) {
|
if (window->Feel() == kDesktopWindowFeel) {
|
||||||
redraw = window->VisibleContentRegion();
|
redraw = window->VisibleContentRegion();
|
||||||
|
|
||||||
// look for desktop background view, and update its background color
|
// look for desktop background view, and update its background color
|
||||||
// TODO: is there a better way to do this?
|
// TODO: is there a better way to do this?
|
||||||
ViewLayer* view = window->TopLayer();
|
View* view = window->TopLayer();
|
||||||
if (view != NULL)
|
if (view != NULL)
|
||||||
view = view->FirstChild();
|
view = view->FirstChild();
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
|
|
||||||
for (WindowLayer* window = _CurrentWindows().FirstWindow();
|
for (Window* window = _CurrentWindows().FirstWindow();
|
||||||
window != NULL; window = window->NextWindow(previousIndex)) {
|
window != NULL; window = window->NextWindow(previousIndex)) {
|
||||||
// store current position in Workspace anchor
|
// store current position in Workspace anchor
|
||||||
window->Anchor(previousIndex).position = window->Frame().LeftTop();
|
window->Anchor(previousIndex).position = window->Frame().LeftTop();
|
||||||
@@ -935,7 +935,7 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
WindowList windows(kWorkingList);
|
WindowList windows(kWorkingList);
|
||||||
BList previousRegions;
|
BList previousRegions;
|
||||||
|
|
||||||
for (WindowLayer* window = _Windows(index).FirstWindow();
|
for (Window* window = _Windows(index).FirstWindow();
|
||||||
window != NULL; window = window->NextWindow(index)) {
|
window != NULL; window = window->NextWindow(index)) {
|
||||||
BPoint position = window->Anchor(index).position;
|
BPoint position = window->Anchor(index).position;
|
||||||
|
|
||||||
@@ -989,7 +989,7 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
||||||
_SetBackground(stillAvailableOnScreen);
|
_SetBackground(stillAvailableOnScreen);
|
||||||
|
|
||||||
for (WindowLayer* window = _Windows(index).FirstWindow(); window != NULL;
|
for (Window* window = _Windows(index).FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(index)) {
|
window = window->NextWindow(index)) {
|
||||||
// send B_WORKSPACE_ACTIVATED message
|
// send B_WORKSPACE_ACTIVATED message
|
||||||
window->WorkspaceActivated(index, true);
|
window->WorkspaceActivated(index, true);
|
||||||
@@ -1006,7 +1006,7 @@ Desktop::_SetWorkspace(int32 index)
|
|||||||
|
|
||||||
// Catch order changes in the new workspaces window list
|
// Catch order changes in the new workspaces window list
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
for (WindowLayer* window = windows.FirstWindow(); window != NULL;
|
for (Window* window = windows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kWorkingList), i++) {
|
window = window->NextWindow(kWorkingList), i++) {
|
||||||
BRegion* region = (BRegion*)previousRegions.ItemAt(i);
|
BRegion* region = (BRegion*)previousRegions.ItemAt(i);
|
||||||
region->ExclusiveInclude(&window->VisibleRegion());
|
region->ExclusiveInclude(&window->VisibleRegion());
|
||||||
@@ -1066,7 +1066,7 @@ Desktop::ScreenChanged(Screen* screen, bool makeDefault)
|
|||||||
update.AddInt32("mode", screen->ColorSpace());
|
update.AddInt32("mode", screen->ColorSpace());
|
||||||
|
|
||||||
// TODO: currently ignores the screen argument!
|
// TODO: currently ignores the screen argument!
|
||||||
for (WindowLayer* window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
window->ServerWindow()->SendMessageToClient(&update);
|
window->ServerWindow()->SendMessageToClient(&update);
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1085,7 @@ Desktop::ScreenChanged(Screen* screen, bool makeDefault)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Methods for WindowLayer manipulation
|
// #pragma mark - Methods for Window manipulation
|
||||||
|
|
||||||
|
|
||||||
WindowList&
|
WindowList&
|
||||||
@@ -1104,14 +1104,14 @@ Desktop::_Windows(int32 index)
|
|||||||
|
|
||||||
void
|
void
|
||||||
Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
|
Desktop::_UpdateFloating(int32 previousWorkspace, int32 nextWorkspace,
|
||||||
WindowLayer* mouseEventWindow)
|
Window* mouseEventWindow)
|
||||||
{
|
{
|
||||||
if (previousWorkspace == -1)
|
if (previousWorkspace == -1)
|
||||||
previousWorkspace = fCurrentWorkspace;
|
previousWorkspace = fCurrentWorkspace;
|
||||||
if (nextWorkspace == -1)
|
if (nextWorkspace == -1)
|
||||||
nextWorkspace = previousWorkspace;
|
nextWorkspace = previousWorkspace;
|
||||||
|
|
||||||
for (WindowLayer* floating = fSubsetWindows.FirstWindow(); floating != NULL;
|
for (Window* floating = fSubsetWindows.FirstWindow(); floating != NULL;
|
||||||
floating = floating->NextWindow(kSubsetList)) {
|
floating = floating->NextWindow(kSubsetList)) {
|
||||||
// we only care about app/subset floating windows
|
// we only care about app/subset floating windows
|
||||||
if (floating->Feel() != B_FLOATING_SUBSET_WINDOW_FEEL
|
if (floating->Feel() != B_FLOATING_SUBSET_WINDOW_FEEL
|
||||||
@@ -1161,7 +1161,7 @@ Desktop::_UpdateBack()
|
|||||||
{
|
{
|
||||||
fBack = NULL;
|
fBack = NULL;
|
||||||
|
|
||||||
for (WindowLayer* window = _CurrentWindows().FirstWindow();
|
for (Window* window = _CurrentWindows().FirstWindow();
|
||||||
window != NULL; window = window->NextWindow(fCurrentWorkspace)) {
|
window != NULL; window = window->NextWindow(fCurrentWorkspace)) {
|
||||||
if (window->IsHidden() || window->Feel() == kDesktopWindowFeel)
|
if (window->IsHidden() || window->Feel() == kDesktopWindowFeel)
|
||||||
continue;
|
continue;
|
||||||
@@ -1185,7 +1185,7 @@ Desktop::_UpdateFront(bool updateFloating)
|
|||||||
{
|
{
|
||||||
fFront = NULL;
|
fFront = NULL;
|
||||||
|
|
||||||
for (WindowLayer* window = _CurrentWindows().LastWindow();
|
for (Window* window = _CurrentWindows().LastWindow();
|
||||||
window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) {
|
window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
if (window->IsHidden() || window->IsFloating() || !window->SupportsFront())
|
if (window->IsHidden() || window->IsFloating() || !window->SupportsFront())
|
||||||
continue;
|
continue;
|
||||||
@@ -1215,7 +1215,7 @@ Desktop::_UpdateFronts(bool updateFloating)
|
|||||||
EventTarget*
|
EventTarget*
|
||||||
Desktop::KeyboardEventTarget()
|
Desktop::KeyboardEventTarget()
|
||||||
{
|
{
|
||||||
WindowLayer* window = _CurrentWindows().LastWindow();
|
Window* window = _CurrentWindows().LastWindow();
|
||||||
while (window != NULL && window->IsHidden()) {
|
while (window != NULL && window->IsHidden()) {
|
||||||
window = window->PreviousWindow(fCurrentWorkspace);
|
window = window->PreviousWindow(fCurrentWorkspace);
|
||||||
}
|
}
|
||||||
@@ -1230,12 +1230,12 @@ Desktop::KeyboardEventTarget()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::_WindowHasModal(WindowLayer* window)
|
Desktop::_WindowHasModal(Window* window)
|
||||||
{
|
{
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (WindowLayer* modal = fSubsetWindows.FirstWindow(); modal != NULL;
|
for (Window* modal = fSubsetWindows.FirstWindow(); modal != NULL;
|
||||||
modal = modal->NextWindow(kSubsetList)) {
|
modal = modal->NextWindow(kSubsetList)) {
|
||||||
// only visible modal windows count
|
// only visible modal windows count
|
||||||
if (!modal->IsModal() || modal->IsHidden())
|
if (!modal->IsModal() || modal->IsHidden())
|
||||||
@@ -1253,10 +1253,10 @@ Desktop::_WindowHasModal(WindowLayer* window)
|
|||||||
You must at least hold a single window lock when calling this method.
|
You must at least hold a single window lock when calling this method.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_WindowChanged(WindowLayer* window)
|
Desktop::_WindowChanged(Window* window)
|
||||||
{
|
{
|
||||||
for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) {
|
for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) {
|
||||||
WorkspacesLayer* view = fWorkspacesViews.ItemAt(i);
|
WorkspacesView* view = fWorkspacesViews.ItemAt(i);
|
||||||
view->WindowChanged(window);
|
view->WindowChanged(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1266,17 +1266,17 @@ Desktop::_WindowChanged(WindowLayer* window)
|
|||||||
You must at least hold a single window lock when calling this method.
|
You must at least hold a single window lock when calling this method.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_WindowRemoved(WindowLayer* window)
|
Desktop::_WindowRemoved(Window* window)
|
||||||
{
|
{
|
||||||
for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) {
|
for (uint32 i = fWorkspacesViews.CountItems(); i-- > 0;) {
|
||||||
WorkspacesLayer* view = fWorkspacesViews.ItemAt(i);
|
WorkspacesView* view = fWorkspacesViews.ItemAt(i);
|
||||||
view->WindowRemoved(window);
|
view->WindowRemoved(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::AddWorkspacesView(WorkspacesLayer* view)
|
Desktop::AddWorkspacesView(WorkspacesView* view)
|
||||||
{
|
{
|
||||||
if (view->Window() == NULL || view->Window()->IsHidden())
|
if (view->Window() == NULL || view->Window()->IsHidden())
|
||||||
return;
|
return;
|
||||||
@@ -1291,7 +1291,7 @@ Desktop::AddWorkspacesView(WorkspacesLayer* view)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::RemoveWorkspacesView(WorkspacesLayer* view)
|
Desktop::RemoveWorkspacesView(WorkspacesView* view)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
@@ -1311,7 +1311,7 @@ Desktop::RemoveWorkspacesView(WorkspacesLayer* view)
|
|||||||
Windows must not be locked when calling this method.
|
Windows must not be locked when calling this method.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_SendFakeMouseMoved(WindowLayer* window)
|
Desktop::_SendFakeMouseMoved(Window* window)
|
||||||
{
|
{
|
||||||
int32 viewToken = B_NULL_TOKEN;
|
int32 viewToken = B_NULL_TOKEN;
|
||||||
EventTarget* target = NULL;
|
EventTarget* target = NULL;
|
||||||
@@ -1346,7 +1346,7 @@ Desktop::_SendFakeMouseMoved(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetFocusWindow(WindowLayer* focus)
|
Desktop::SetFocusWindow(Window* focus)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
@@ -1445,7 +1445,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list,
|
|||||||
// visible of the window
|
// visible of the window
|
||||||
BRegion clean;
|
BRegion clean;
|
||||||
|
|
||||||
for (WindowLayer* window = windows.FirstWindow(); window != NULL;
|
for (Window* window = windows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(list)) {
|
window = window->NextWindow(list)) {
|
||||||
if (wereVisible)
|
if (wereVisible)
|
||||||
clean.Include(&window->VisibleRegion());
|
clean.Include(&window->VisibleRegion());
|
||||||
@@ -1463,7 +1463,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list,
|
|||||||
// redraw what became visible of the window(s)
|
// redraw what became visible of the window(s)
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
for (WindowLayer* window = windows.FirstWindow(); window != NULL;
|
for (Window* window = windows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(list)) {
|
window = window->NextWindow(list)) {
|
||||||
dirty.Include(&window->VisibleRegion());
|
dirty.Include(&window->VisibleRegion());
|
||||||
}
|
}
|
||||||
@@ -1487,7 +1487,7 @@ Desktop::_BringWindowsToFront(WindowList& windows, int32 list,
|
|||||||
of their subset.
|
of their subset.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::ActivateWindow(WindowLayer* window)
|
Desktop::ActivateWindow(Window* window)
|
||||||
{
|
{
|
||||||
STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "<none>"));
|
STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "<none>"));
|
||||||
|
|
||||||
@@ -1533,7 +1533,7 @@ Desktop::ActivateWindow(WindowLayer* window)
|
|||||||
|
|
||||||
if (window == FrontWindow()) {
|
if (window == FrontWindow()) {
|
||||||
// see if there is a normal B_AVOID_FRONT window still in front of us
|
// see if there is a normal B_AVOID_FRONT window still in front of us
|
||||||
WindowLayer* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
Window* avoidsFront = window->NextWindow(fCurrentWorkspace);
|
||||||
while (avoidsFront && avoidsFront->IsNormal()
|
while (avoidsFront && avoidsFront->IsNormal()
|
||||||
&& (avoidsFront->Flags() & B_AVOID_FRONT) == 0) {
|
&& (avoidsFront->Flags() & B_AVOID_FRONT) == 0) {
|
||||||
avoidsFront = avoidsFront->NextWindow(fCurrentWorkspace);
|
avoidsFront = avoidsFront->NextWindow(fCurrentWorkspace);
|
||||||
@@ -1554,7 +1554,7 @@ Desktop::ActivateWindow(WindowLayer* window)
|
|||||||
BRegion clean(window->VisibleRegion());
|
BRegion clean(window->VisibleRegion());
|
||||||
WindowList windows(kWorkingList);
|
WindowList windows(kWorkingList);
|
||||||
|
|
||||||
WindowLayer* frontmost = window->Frontmost();
|
Window* frontmost = window->Frontmost();
|
||||||
|
|
||||||
_CurrentWindows().RemoveWindow(window);
|
_CurrentWindows().RemoveWindow(window);
|
||||||
windows.AddWindow(window);
|
windows.AddWindow(window);
|
||||||
@@ -1564,8 +1564,8 @@ Desktop::ActivateWindow(WindowLayer* window)
|
|||||||
// (ie. they are staying in front of them, but they are
|
// (ie. they are staying in front of them, but they are
|
||||||
// not supposed to change their order because of that)
|
// not supposed to change their order because of that)
|
||||||
|
|
||||||
WindowLayer* nextModal;
|
Window* nextModal;
|
||||||
for (WindowLayer* modal = frontmost; modal != NULL; modal = nextModal) {
|
for (Window* modal = frontmost; modal != NULL; modal = nextModal) {
|
||||||
// get the next modal window
|
// get the next modal window
|
||||||
nextModal = modal->NextWindow(fCurrentWorkspace);
|
nextModal = modal->NextWindow(fCurrentWorkspace);
|
||||||
while (nextModal != NULL && !nextModal->IsModal()) {
|
while (nextModal != NULL && !nextModal->IsModal()) {
|
||||||
@@ -1588,7 +1588,7 @@ Desktop::ActivateWindow(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf)
|
Desktop::SendWindowBehind(Window* window, Window* behindOf)
|
||||||
{
|
{
|
||||||
// TODO: should the "not in current workspace" be handled anyway?
|
// TODO: should the "not in current workspace" be handled anyway?
|
||||||
// (the code below would have to be changed then, though)
|
// (the code below would have to be changed then, though)
|
||||||
@@ -1607,7 +1607,7 @@ Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf)
|
|||||||
BRegion dirty(window->VisibleRegion());
|
BRegion dirty(window->VisibleRegion());
|
||||||
|
|
||||||
// detach window and re-attach at desired position
|
// detach window and re-attach at desired position
|
||||||
WindowLayer* backmost = window->Backmost(behindOf);
|
Window* backmost = window->Backmost(behindOf);
|
||||||
|
|
||||||
_CurrentWindows().RemoveWindow(window);
|
_CurrentWindows().RemoveWindow(window);
|
||||||
_CurrentWindows().AddWindow(window, backmost
|
_CurrentWindows().AddWindow(window, backmost
|
||||||
@@ -1639,7 +1639,7 @@ Desktop::SendWindowBehind(WindowLayer* window, WindowLayer* behindOf)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::ShowWindow(WindowLayer* window)
|
Desktop::ShowWindow(Window* window)
|
||||||
{
|
{
|
||||||
if (!window->IsHidden())
|
if (!window->IsHidden())
|
||||||
return;
|
return;
|
||||||
@@ -1676,7 +1676,7 @@ Desktop::ShowWindow(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::HideWindow(WindowLayer* window)
|
Desktop::HideWindow(Window* window)
|
||||||
{
|
{
|
||||||
if (window->IsHidden())
|
if (window->IsHidden())
|
||||||
return;
|
return;
|
||||||
@@ -1704,10 +1704,10 @@ Desktop::HideWindow(WindowLayer* window)
|
|||||||
|
|
||||||
if (window->HasWorkspacesViews()) {
|
if (window->HasWorkspacesViews()) {
|
||||||
// remove workspaces views from this window
|
// remove workspaces views from this window
|
||||||
BObjectList<WorkspacesLayer> list(false);
|
BObjectList<WorkspacesView> list(false);
|
||||||
window->FindWorkspacesViews(list);
|
window->FindWorkspacesViews(list);
|
||||||
|
|
||||||
while (WorkspacesLayer* view = list.RemoveItemAt(0)) {
|
while (WorkspacesView* view = list.RemoveItemAt(0)) {
|
||||||
fWorkspacesViews.RemoveItem(view);
|
fWorkspacesViews.RemoveItem(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1721,10 +1721,10 @@ Desktop::HideWindow(WindowLayer* window)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Shows the window on the screen - it does this independently of the
|
Shows the window on the screen - it does this independently of the
|
||||||
WindowLayer::IsHidden() state.
|
Window::IsHidden() state.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_ShowWindow(WindowLayer* window, bool affectsOtherWindows)
|
Desktop::_ShowWindow(Window* window, bool affectsOtherWindows)
|
||||||
{
|
{
|
||||||
BRegion background;
|
BRegion background;
|
||||||
_RebuildClippingForAllWindows(background);
|
_RebuildClippingForAllWindows(background);
|
||||||
@@ -1746,10 +1746,10 @@ Desktop::_ShowWindow(WindowLayer* window, bool affectsOtherWindows)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Hides the window from the screen - it does this independently of the
|
Hides the window from the screen - it does this independently of the
|
||||||
WindowLayer::IsHidden() state.
|
Window::IsHidden() state.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_HideWindow(WindowLayer* window)
|
Desktop::_HideWindow(Window* window)
|
||||||
{
|
{
|
||||||
// after rebuilding the clipping,
|
// after rebuilding the clipping,
|
||||||
// this window will not have a visible
|
// this window will not have a visible
|
||||||
@@ -1770,7 +1770,7 @@ Desktop::_HideWindow(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::MoveWindowBy(WindowLayer* window, float x, float y, int32 workspace)
|
Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
@@ -1836,7 +1836,7 @@ Desktop::MoveWindowBy(WindowLayer* window, float x, float y, int32 workspace)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::ResizeWindowBy(WindowLayer* window, float x, float y)
|
Desktop::ResizeWindowBy(Window* window, float x, float y)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
@@ -1877,7 +1877,7 @@ Desktop::ResizeWindowBy(WindowLayer* window, float x, float y)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::SetWindowTabLocation(WindowLayer* window, float location)
|
Desktop::SetWindowTabLocation(Window* window, float location)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return false;
|
return false;
|
||||||
@@ -1901,8 +1901,7 @@ Desktop::SetWindowTabLocation(WindowLayer* window, float location)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::SetWindowDecoratorSettings(WindowLayer* window,
|
Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
|
||||||
const BMessage& settings)
|
|
||||||
{
|
{
|
||||||
// TODO: almost exact code duplication to above function...
|
// TODO: almost exact code duplication to above function...
|
||||||
|
|
||||||
@@ -1934,7 +1933,7 @@ Desktop::SetWindowDecoratorSettings(WindowLayer* window,
|
|||||||
SetWorkspace().
|
SetWorkspace().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex,
|
Desktop::_UpdateSubsetWorkspaces(Window* window, int32 previousIndex,
|
||||||
int32 newIndex)
|
int32 newIndex)
|
||||||
{
|
{
|
||||||
STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window, window->Title()));
|
STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window, window->Title()));
|
||||||
@@ -1943,7 +1942,7 @@ Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex,
|
|||||||
if (!window->IsNormal() || window->IsHidden())
|
if (!window->IsNormal() || window->IsHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (WindowLayer* subset = fSubsetWindows.FirstWindow(); subset != NULL;
|
for (Window* subset = fSubsetWindows.FirstWindow(); subset != NULL;
|
||||||
subset = subset->NextWindow(kSubsetList)) {
|
subset = subset->NextWindow(kSubsetList)) {
|
||||||
if (subset->Feel() == B_MODAL_ALL_WINDOW_FEEL
|
if (subset->Feel() == B_MODAL_ALL_WINDOW_FEEL
|
||||||
|| subset->Feel() == B_FLOATING_ALL_WINDOW_FEEL) {
|
|| subset->Feel() == B_FLOATING_ALL_WINDOW_FEEL) {
|
||||||
@@ -1975,7 +1974,7 @@ Desktop::_UpdateSubsetWorkspaces(WindowLayer* window, int32 previousIndex,
|
|||||||
\brief Adds or removes the window to or from the workspaces it's on.
|
\brief Adds or removes the window to or from the workspaces it's on.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces,
|
Desktop::_ChangeWindowWorkspaces(Window* window, uint32 oldWorkspaces,
|
||||||
uint32 newWorkspaces)
|
uint32 newWorkspaces)
|
||||||
{
|
{
|
||||||
// apply changes to the workspaces' window lists
|
// apply changes to the workspaces' window lists
|
||||||
@@ -2025,7 +2024,7 @@ Desktop::_ChangeWindowWorkspaces(WindowLayer* window, uint32 oldWorkspaces,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces)
|
Desktop::SetWindowWorkspaces(Window* window, uint32 workspaces)
|
||||||
{
|
{
|
||||||
LockAllWindows();
|
LockAllWindows();
|
||||||
|
|
||||||
@@ -2046,7 +2045,7 @@ Desktop::SetWindowWorkspaces(WindowLayer* window, uint32 workspaces)
|
|||||||
via ShowWindow().
|
via ShowWindow().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::AddWindow(WindowLayer *window)
|
Desktop::AddWindow(Window *window)
|
||||||
{
|
{
|
||||||
LockAllWindows();
|
LockAllWindows();
|
||||||
|
|
||||||
@@ -2068,7 +2067,7 @@ Desktop::AddWindow(WindowLayer *window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::RemoveWindow(WindowLayer *window)
|
Desktop::RemoveWindow(Window *window)
|
||||||
{
|
{
|
||||||
LockAllWindows();
|
LockAllWindows();
|
||||||
|
|
||||||
@@ -2089,7 +2088,7 @@ Desktop::RemoveWindow(WindowLayer *window)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Desktop::AddWindowToSubset(WindowLayer* subset, WindowLayer* window)
|
Desktop::AddWindowToSubset(Window* subset, Window* window)
|
||||||
{
|
{
|
||||||
if (!subset->AddToSubset(window))
|
if (!subset->AddToSubset(window))
|
||||||
return false;
|
return false;
|
||||||
@@ -2100,7 +2099,7 @@ Desktop::AddWindowToSubset(WindowLayer* subset, WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::RemoveWindowFromSubset(WindowLayer* subset, WindowLayer* window)
|
Desktop::RemoveWindowFromSubset(Window* subset, Window* window)
|
||||||
{
|
{
|
||||||
subset->RemoveFromSubset(window);
|
subset->RemoveFromSubset(window);
|
||||||
_ChangeWindowWorkspaces(subset, subset->Workspaces(), subset->SubsetWorkspaces());
|
_ChangeWindowWorkspaces(subset, subset->Workspaces(), subset->SubsetWorkspaces());
|
||||||
@@ -2108,7 +2107,7 @@ Desktop::RemoveWindowFromSubset(WindowLayer* subset, WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowLook(WindowLayer *window, window_look newLook)
|
Desktop::SetWindowLook(Window *window, window_look newLook)
|
||||||
{
|
{
|
||||||
if (window->Look() == newLook)
|
if (window->Look() == newLook)
|
||||||
return;
|
return;
|
||||||
@@ -2133,7 +2132,7 @@ Desktop::SetWindowLook(WindowLayer *window, window_look newLook)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
|
Desktop::SetWindowFeel(Window *window, window_feel newFeel)
|
||||||
{
|
{
|
||||||
if (window->Feel() == newFeel)
|
if (window->Feel() == newFeel)
|
||||||
return;
|
return;
|
||||||
@@ -2168,10 +2167,10 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
|
|||||||
if (i == fCurrentWorkspace && window->IsVisible())
|
if (i == fCurrentWorkspace && window->IsVisible())
|
||||||
visibleBefore = window->VisibleRegion();
|
visibleBefore = window->VisibleRegion();
|
||||||
|
|
||||||
WindowLayer* backmost = window->Backmost(_Windows(i).LastWindow(), i);
|
Window* backmost = window->Backmost(_Windows(i).LastWindow(), i);
|
||||||
if (backmost != NULL) {
|
if (backmost != NULL) {
|
||||||
// check if the backmost window is really behind it
|
// check if the backmost window is really behind it
|
||||||
WindowLayer* previous = window->PreviousWindow(i);
|
Window* previous = window->PreviousWindow(i);
|
||||||
while (previous != NULL) {
|
while (previous != NULL) {
|
||||||
if (previous == backmost)
|
if (previous == backmost)
|
||||||
break;
|
break;
|
||||||
@@ -2187,10 +2186,10 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowLayer* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i);
|
Window* frontmost = window->Frontmost(_Windows(i).FirstWindow(), i);
|
||||||
if (frontmost != NULL) {
|
if (frontmost != NULL) {
|
||||||
// check if the frontmost window is really in front of it
|
// check if the frontmost window is really in front of it
|
||||||
WindowLayer* next = window->NextWindow(i);
|
Window* next = window->NextWindow(i);
|
||||||
while (next != NULL) {
|
while (next != NULL) {
|
||||||
if (next == frontmost)
|
if (next == frontmost)
|
||||||
break;
|
break;
|
||||||
@@ -2232,7 +2231,7 @@ Desktop::SetWindowFeel(WindowLayer *window, window_feel newFeel)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags)
|
Desktop::SetWindowFlags(Window *window, uint32 newFlags)
|
||||||
{
|
{
|
||||||
if (window->Flags() == newFlags)
|
if (window->Flags() == newFlags)
|
||||||
return;
|
return;
|
||||||
@@ -2257,7 +2256,7 @@ Desktop::SetWindowFlags(WindowLayer *window, uint32 newFlags)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowTitle(WindowLayer *window, const char* title)
|
Desktop::SetWindowTitle(Window *window, const char* title)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return;
|
return;
|
||||||
@@ -2281,10 +2280,10 @@ Desktop::SetWindowTitle(WindowLayer *window, const char* title)
|
|||||||
Returns the window under the mouse cursor.
|
Returns the window under the mouse cursor.
|
||||||
You need to have acquired the All Windows lock when calling this method.
|
You need to have acquired the All Windows lock when calling this method.
|
||||||
*/
|
*/
|
||||||
WindowLayer*
|
Window*
|
||||||
Desktop::WindowAt(BPoint where)
|
Desktop::WindowAt(BPoint where)
|
||||||
{
|
{
|
||||||
for (WindowLayer* window = _CurrentWindows().LastWindow(); window;
|
for (Window* window = _CurrentWindows().LastWindow(); window;
|
||||||
window = window->PreviousWindow(fCurrentWorkspace)) {
|
window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
if (window->IsVisible() && window->VisibleRegion().Contains(where))
|
if (window->IsVisible() && window->VisibleRegion().Contains(where))
|
||||||
return window;
|
return window;
|
||||||
@@ -2295,14 +2294,14 @@ Desktop::WindowAt(BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetMouseEventWindow(WindowLayer* window)
|
Desktop::SetMouseEventWindow(Window* window)
|
||||||
{
|
{
|
||||||
fMouseEventWindow = window;
|
fMouseEventWindow = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetViewUnderMouse(const WindowLayer* window, int32 viewToken)
|
Desktop::SetViewUnderMouse(const Window* window, int32 viewToken)
|
||||||
{
|
{
|
||||||
fWindowUnderMouse = window;
|
fWindowUnderMouse = window;
|
||||||
fViewUnderMouse = viewToken;
|
fViewUnderMouse = viewToken;
|
||||||
@@ -2310,7 +2309,7 @@ Desktop::SetViewUnderMouse(const WindowLayer* window, int32 viewToken)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
Desktop::ViewUnderMouse(const WindowLayer* window)
|
Desktop::ViewUnderMouse(const Window* window)
|
||||||
{
|
{
|
||||||
if (window != NULL && fWindowUnderMouse == window)
|
if (window != NULL && fWindowUnderMouse == window)
|
||||||
return fViewUnderMouse;
|
return fViewUnderMouse;
|
||||||
@@ -2319,10 +2318,10 @@ Desktop::ViewUnderMouse(const WindowLayer* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer *
|
Window *
|
||||||
Desktop::FindWindowLayerByClientToken(int32 token, team_id teamID)
|
Desktop::FindWindowByClientToken(int32 token, team_id teamID)
|
||||||
{
|
{
|
||||||
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window *window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
if (window->ServerWindow()->ClientToken() == token
|
if (window->ServerWindow()->ClientToken() == token
|
||||||
&& window->ServerWindow()->ClientTeam() == teamID) {
|
&& window->ServerWindow()->ClientTeam() == teamID) {
|
||||||
@@ -2341,7 +2340,7 @@ Desktop::MinimizeApplication(team_id team)
|
|||||||
|
|
||||||
// Just minimize all windows of that application
|
// Just minimize all windows of that application
|
||||||
|
|
||||||
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window *window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
if (window->ServerWindow()->ClientTeam() != team)
|
if (window->ServerWindow()->ClientTeam() != team)
|
||||||
continue;
|
continue;
|
||||||
@@ -2358,7 +2357,7 @@ Desktop::BringApplicationToFront(team_id team)
|
|||||||
|
|
||||||
// TODO: for now, just maximize all windows of that application
|
// TODO: for now, just maximize all windows of that application
|
||||||
|
|
||||||
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window *window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
if (window->ServerWindow()->ClientTeam() != team)
|
if (window->ServerWindow()->ClientTeam() != team)
|
||||||
continue;
|
continue;
|
||||||
@@ -2377,7 +2376,7 @@ Desktop::WindowAction(int32 windowToken, int32 action)
|
|||||||
LockAllWindows();
|
LockAllWindows();
|
||||||
|
|
||||||
::ServerWindow* serverWindow;
|
::ServerWindow* serverWindow;
|
||||||
WindowLayer* window;
|
Window* window;
|
||||||
if (BPrivate::gDefaultTokens.GetToken(windowToken,
|
if (BPrivate::gDefaultTokens.GetToken(windowToken,
|
||||||
B_SERVER_TOKEN, (void**)&serverWindow) != B_OK
|
B_SERVER_TOKEN, (void**)&serverWindow) != B_OK
|
||||||
|| (window = serverWindow->Window()) == NULL) {
|
|| (window = serverWindow->Window()) == NULL) {
|
||||||
@@ -2405,7 +2404,7 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
|
|||||||
|
|
||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
|
|
||||||
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window *window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
if (team < B_OK || window->ServerWindow()->ClientTeam() == team)
|
if (team < B_OK || window->ServerWindow()->ClientTeam() == team)
|
||||||
count++;
|
count++;
|
||||||
@@ -2416,7 +2415,7 @@ Desktop::WriteWindowList(team_id team, BPrivate::LinkSender& sender)
|
|||||||
sender.StartMessage(B_OK);
|
sender.StartMessage(B_OK);
|
||||||
sender.Attach<int32>(count);
|
sender.Attach<int32>(count);
|
||||||
|
|
||||||
for (WindowLayer *window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window *window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
if (team >= B_OK && window->ServerWindow()->ClientTeam() != team)
|
if (team >= B_OK && window->ServerWindow()->ClientTeam() != team)
|
||||||
continue;
|
continue;
|
||||||
@@ -2483,7 +2482,7 @@ Desktop::_RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen)
|
|||||||
stillAvailableOnScreen = fScreenRegion;
|
stillAvailableOnScreen = fScreenRegion;
|
||||||
|
|
||||||
// set clipping of each window
|
// set clipping of each window
|
||||||
for (WindowLayer* window = _CurrentWindows().LastWindow(); window != NULL;
|
for (Window* window = _CurrentWindows().LastWindow(); window != NULL;
|
||||||
window = window->PreviousWindow(fCurrentWorkspace)) {
|
window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
if (!window->IsHidden()) {
|
if (!window->IsHidden()) {
|
||||||
window->SetClipping(&stillAvailableOnScreen);
|
window->SetClipping(&stillAvailableOnScreen);
|
||||||
@@ -2498,7 +2497,7 @@ void
|
|||||||
Desktop::_TriggerWindowRedrawing(BRegion& newDirtyRegion)
|
Desktop::_TriggerWindowRedrawing(BRegion& newDirtyRegion)
|
||||||
{
|
{
|
||||||
// send redraw messages to all windows intersecting the dirty region
|
// send redraw messages to all windows intersecting the dirty region
|
||||||
for (WindowLayer* window = _CurrentWindows().LastWindow(); window != NULL;
|
for (Window* window = _CurrentWindows().LastWindow(); window != NULL;
|
||||||
window = window->PreviousWindow(fCurrentWorkspace)) {
|
window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
if (!window->IsHidden()
|
if (!window->IsHidden()
|
||||||
&& newDirtyRegion.Intersects(window->VisibleRegion().Frame()))
|
&& newDirtyRegion.Intersects(window->VisibleRegion().Frame()))
|
||||||
|
|||||||
+52
-51
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
#include "CursorManager.h"
|
#include "CursorManager.h"
|
||||||
#include "EventDispatcher.h"
|
#include "EventDispatcher.h"
|
||||||
|
#include "Screen.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ServerScreen.h"
|
|
||||||
#include "VirtualScreen.h"
|
#include "VirtualScreen.h"
|
||||||
#include "DesktopSettings.h"
|
#include "DesktopSettings.h"
|
||||||
#include "MessageLooper.h"
|
#include "MessageLooper.h"
|
||||||
@@ -44,7 +44,8 @@ class BMessage;
|
|||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class HWInterface;
|
class HWInterface;
|
||||||
class ServerApp;
|
class ServerApp;
|
||||||
class WorkspacesLayer;
|
class Window;
|
||||||
|
class WorkspacesView;
|
||||||
struct server_read_only_memory;
|
struct server_read_only_memory;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
@@ -109,55 +110,55 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
{ return fWorkspaces[index]; }
|
{ return fWorkspaces[index]; }
|
||||||
status_t SetWorkspacesCount(int32 newCount);
|
status_t SetWorkspacesCount(int32 newCount);
|
||||||
|
|
||||||
// WindowLayer methods
|
// Window methods
|
||||||
|
|
||||||
void ActivateWindow(WindowLayer* window);
|
void ActivateWindow(Window* window);
|
||||||
void SendWindowBehind(WindowLayer* window,
|
void SendWindowBehind(Window* window,
|
||||||
WindowLayer* behindOf = NULL);
|
Window* behindOf = NULL);
|
||||||
|
|
||||||
void ShowWindow(WindowLayer* window);
|
void ShowWindow(Window* window);
|
||||||
void HideWindow(WindowLayer* window);
|
void HideWindow(Window* window);
|
||||||
|
|
||||||
void MoveWindowBy(WindowLayer* window, float x, float y,
|
void MoveWindowBy(Window* window, float x, float y,
|
||||||
int32 workspace = -1);
|
int32 workspace = -1);
|
||||||
void ResizeWindowBy(WindowLayer* window, float x, float y);
|
void ResizeWindowBy(Window* window, float x, float y);
|
||||||
bool SetWindowTabLocation(WindowLayer* window, float location);
|
bool SetWindowTabLocation(Window* window, float location);
|
||||||
bool SetWindowDecoratorSettings(WindowLayer* window,
|
bool SetWindowDecoratorSettings(Window* window,
|
||||||
const BMessage& settings);
|
const BMessage& settings);
|
||||||
|
|
||||||
void SetWindowWorkspaces(WindowLayer* window,
|
void SetWindowWorkspaces(Window* window,
|
||||||
uint32 workspaces);
|
uint32 workspaces);
|
||||||
|
|
||||||
void AddWindow(WindowLayer* window);
|
void AddWindow(Window* window);
|
||||||
void RemoveWindow(WindowLayer* window);
|
void RemoveWindow(Window* window);
|
||||||
|
|
||||||
bool AddWindowToSubset(WindowLayer* subset,
|
bool AddWindowToSubset(Window* subset,
|
||||||
WindowLayer* window);
|
Window* window);
|
||||||
void RemoveWindowFromSubset(WindowLayer* subset,
|
void RemoveWindowFromSubset(Window* subset,
|
||||||
WindowLayer* window);
|
Window* window);
|
||||||
|
|
||||||
void SetWindowLook(WindowLayer* window, window_look look);
|
void SetWindowLook(Window* window, window_look look);
|
||||||
void SetWindowFeel(WindowLayer* window, window_feel feel);
|
void SetWindowFeel(Window* window, window_feel feel);
|
||||||
void SetWindowFlags(WindowLayer* window, uint32 flags);
|
void SetWindowFlags(Window* window, uint32 flags);
|
||||||
void SetWindowTitle(WindowLayer* window, const char* title);
|
void SetWindowTitle(Window* window, const char* title);
|
||||||
|
|
||||||
WindowLayer* FocusWindow() const { return fFocus; }
|
Window* FocusWindow() const { return fFocus; }
|
||||||
WindowLayer* FrontWindow() const { return fFront; }
|
Window* FrontWindow() const { return fFront; }
|
||||||
WindowLayer* BackWindow() const { return fBack; }
|
Window* BackWindow() const { return fBack; }
|
||||||
|
|
||||||
WindowLayer* WindowAt(BPoint where);
|
Window* WindowAt(BPoint where);
|
||||||
|
|
||||||
WindowLayer* MouseEventWindow() const { return fMouseEventWindow; }
|
Window* MouseEventWindow() const { return fMouseEventWindow; }
|
||||||
void SetMouseEventWindow(WindowLayer* window);
|
void SetMouseEventWindow(Window* window);
|
||||||
|
|
||||||
void SetViewUnderMouse(const WindowLayer* window, int32 viewToken);
|
void SetViewUnderMouse(const Window* window, int32 viewToken);
|
||||||
int32 ViewUnderMouse(const WindowLayer* window);
|
int32 ViewUnderMouse(const Window* window);
|
||||||
|
|
||||||
void SetFocusWindow(WindowLayer* window = NULL);
|
void SetFocusWindow(Window* window = NULL);
|
||||||
EventTarget* KeyboardEventTarget();
|
EventTarget* KeyboardEventTarget();
|
||||||
|
|
||||||
WindowLayer* FindWindowLayerByClientToken(int32 token, team_id teamID);
|
Window* FindWindowByClientToken(int32 token,
|
||||||
//WindowLayer* FindWindowLayerByServerToken(int32 token);
|
team_id teamID);
|
||||||
|
|
||||||
#if USE_MULTI_LOCKER
|
#if USE_MULTI_LOCKER
|
||||||
bool LockSingleWindow() { return fWindowLock.ReadLock(); }
|
bool LockSingleWindow() { return fWindowLock.ReadLock(); }
|
||||||
@@ -181,8 +182,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
void RedrawBackground();
|
void RedrawBackground();
|
||||||
void StoreWorkspaceConfiguration(int32 index);
|
void StoreWorkspaceConfiguration(int32 index);
|
||||||
|
|
||||||
void AddWorkspacesView(WorkspacesLayer* view);
|
void AddWorkspacesView(WorkspacesView* view);
|
||||||
void RemoveWorkspacesView(WorkspacesLayer* view);
|
void RemoveWorkspacesView(WorkspacesView* view);
|
||||||
|
|
||||||
void MinimizeApplication(team_id team);
|
void MinimizeApplication(team_id team);
|
||||||
void BringApplicationToFront(team_id team);
|
void BringApplicationToFront(team_id team);
|
||||||
@@ -196,19 +197,19 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
private:
|
private:
|
||||||
void _LaunchInputServer();
|
void _LaunchInputServer();
|
||||||
void _SetWorkspace(int32 index);
|
void _SetWorkspace(int32 index);
|
||||||
void _ShowWindow(WindowLayer* window,
|
void _ShowWindow(Window* window,
|
||||||
bool affectsOtherWindows = true);
|
bool affectsOtherWindows = true);
|
||||||
void _HideWindow(WindowLayer* window);
|
void _HideWindow(Window* window);
|
||||||
|
|
||||||
void _UpdateSubsetWorkspaces(WindowLayer* window,
|
void _UpdateSubsetWorkspaces(Window* window,
|
||||||
int32 previousIndex = -1,
|
int32 previousIndex = -1,
|
||||||
int32 newIndex = -1);
|
int32 newIndex = -1);
|
||||||
void _ChangeWindowWorkspaces(WindowLayer* window,
|
void _ChangeWindowWorkspaces(Window* window,
|
||||||
uint32 oldWorkspaces, uint32 newWorkspaces);
|
uint32 oldWorkspaces, uint32 newWorkspaces);
|
||||||
void _BringWindowsToFront(WindowList& windows,
|
void _BringWindowsToFront(WindowList& windows,
|
||||||
int32 list, bool wereVisible);
|
int32 list, bool wereVisible);
|
||||||
status_t _ActivateApp(team_id team);
|
status_t _ActivateApp(team_id team);
|
||||||
void _SendFakeMouseMoved(WindowLayer* window = NULL);
|
void _SendFakeMouseMoved(Window* window = NULL);
|
||||||
|
|
||||||
void _RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen);
|
void _RebuildClippingForAllWindows(BRegion& stillAvailableOnScreen);
|
||||||
void _TriggerWindowRedrawing(BRegion& newDirtyRegion);
|
void _TriggerWindowRedrawing(BRegion& newDirtyRegion);
|
||||||
@@ -216,14 +217,14 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
|
|
||||||
void _UpdateFloating(int32 previousWorkspace = -1,
|
void _UpdateFloating(int32 previousWorkspace = -1,
|
||||||
int32 nextWorkspace = -1,
|
int32 nextWorkspace = -1,
|
||||||
WindowLayer* mouseEventWindow = NULL);
|
Window* mouseEventWindow = NULL);
|
||||||
void _UpdateBack();
|
void _UpdateBack();
|
||||||
void _UpdateFront(bool updateFloating = true);
|
void _UpdateFront(bool updateFloating = true);
|
||||||
void _UpdateFronts(bool updateFloating = true);
|
void _UpdateFronts(bool updateFloating = true);
|
||||||
bool _WindowHasModal(WindowLayer* window);
|
bool _WindowHasModal(Window* window);
|
||||||
|
|
||||||
void _WindowChanged(WindowLayer* window);
|
void _WindowChanged(Window* window);
|
||||||
void _WindowRemoved(WindowLayer* window);
|
void _WindowRemoved(Window* window);
|
||||||
|
|
||||||
void _GetLooperName(char* name, size_t size);
|
void _GetLooperName(char* name, size_t size);
|
||||||
void _PrepareQuit();
|
void _PrepareQuit();
|
||||||
@@ -258,7 +259,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
WindowList fAllWindows;
|
WindowList fAllWindows;
|
||||||
WindowList fSubsetWindows;
|
WindowList fSubsetWindows;
|
||||||
WindowList fFocusList;
|
WindowList fFocusList;
|
||||||
BObjectList<WorkspacesLayer> fWorkspacesViews;
|
BObjectList<WorkspacesView> fWorkspacesViews;
|
||||||
|
|
||||||
Screen* fActiveScreen;
|
Screen* fActiveScreen;
|
||||||
|
|
||||||
@@ -273,15 +274,15 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
BRegion fBackgroundRegion;
|
BRegion fBackgroundRegion;
|
||||||
BRegion fScreenRegion;
|
BRegion fScreenRegion;
|
||||||
|
|
||||||
WindowLayer* fMouseEventWindow;
|
Window* fMouseEventWindow;
|
||||||
const WindowLayer* fWindowUnderMouse;
|
const Window* fWindowUnderMouse;
|
||||||
int32 fViewUnderMouse;
|
int32 fViewUnderMouse;
|
||||||
BPoint fLastMousePosition;
|
BPoint fLastMousePosition;
|
||||||
int32 fLastMouseButtons;
|
int32 fLastMouseButtons;
|
||||||
|
|
||||||
WindowLayer* fFocus;
|
Window* fFocus;
|
||||||
WindowLayer* fFront;
|
Window* fFront;
|
||||||
WindowLayer* fBack;
|
Window* fBack;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DESKTOP_H
|
#endif // DESKTOP_H
|
||||||
|
|||||||
@@ -39,27 +39,27 @@ Server app_server :
|
|||||||
MessageLooper.cpp
|
MessageLooper.cpp
|
||||||
MultiLocker.cpp
|
MultiLocker.cpp
|
||||||
OffscreenServerWindow.cpp
|
OffscreenServerWindow.cpp
|
||||||
OffscreenWindowLayer.cpp
|
OffscreenWindow.cpp
|
||||||
PNGDump.cpp
|
PNGDump.cpp
|
||||||
ProfileMessageSupport.cpp
|
ProfileMessageSupport.cpp
|
||||||
RAMLinkMsgReader.cpp
|
RAMLinkMsgReader.cpp
|
||||||
RGBColor.cpp
|
RGBColor.cpp
|
||||||
RegionPool.cpp
|
RegionPool.cpp
|
||||||
|
Screen.cpp
|
||||||
ScreenManager.cpp
|
ScreenManager.cpp
|
||||||
ServerApp.cpp
|
ServerApp.cpp
|
||||||
ServerBitmap.cpp
|
ServerBitmap.cpp
|
||||||
ServerCursor.cpp
|
ServerCursor.cpp
|
||||||
ServerFont.cpp
|
ServerFont.cpp
|
||||||
ServerPicture.cpp
|
ServerPicture.cpp
|
||||||
ServerScreen.cpp
|
|
||||||
ServerWindow.cpp
|
ServerWindow.cpp
|
||||||
SystemPalette.cpp
|
SystemPalette.cpp
|
||||||
ViewLayer.cpp
|
View.cpp
|
||||||
VirtualScreen.cpp
|
VirtualScreen.cpp
|
||||||
WindowLayer.cpp
|
Window.cpp
|
||||||
WindowList.cpp
|
WindowList.cpp
|
||||||
Workspace.cpp
|
Workspace.cpp
|
||||||
WorkspacesLayer.cpp
|
WorkspacesView.cpp
|
||||||
|
|
||||||
# libraries
|
# libraries
|
||||||
:
|
:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku, Inc. All rights reserved.
|
* Copyright 2005-2008, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,32 +7,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "OffscreenWindowLayer.h"
|
#include "OffscreenWindow.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
|
|
||||||
#include "OffscreenServerWindow.h"
|
#include "OffscreenServerWindow.h"
|
||||||
|
|
||||||
|
|
||||||
OffscreenServerWindow::OffscreenServerWindow(const char *title,
|
OffscreenServerWindow::OffscreenServerWindow(const char *title, ServerApp *app,
|
||||||
ServerApp *app,
|
port_id clientPort, port_id looperPort, int32 handlerID,
|
||||||
port_id clientPort,
|
ServerBitmap* bitmap)
|
||||||
port_id looperPort,
|
|
||||||
int32 handlerID,
|
|
||||||
ServerBitmap* bitmap)
|
|
||||||
: ServerWindow(title, app, clientPort, looperPort, handlerID),
|
: ServerWindow(title, app, clientPort, looperPort, handlerID),
|
||||||
fBitmap(bitmap)
|
fBitmap(bitmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
OffscreenServerWindow::~OffscreenServerWindow()
|
OffscreenServerWindow::~OffscreenServerWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessageToClient
|
|
||||||
void
|
void
|
||||||
OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
|
OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
|
||||||
bool usePreferred) const
|
bool usePreferred) const
|
||||||
{
|
{
|
||||||
// We're a special kind of window. The client BWindow thread is not running,
|
// We're a special kind of window. The client BWindow thread is not running,
|
||||||
// so we cannot post messages to the client. In order to not mess arround
|
// so we cannot post messages to the client. In order to not mess arround
|
||||||
@@ -41,9 +38,9 @@ OffscreenServerWindow::SendMessageToClient(const BMessage* msg, int32 target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer*
|
Window*
|
||||||
OffscreenServerWindow::MakeWindowLayer(BRect frame, const char* name,
|
OffscreenServerWindow::MakeWindow(BRect frame, const char* name,
|
||||||
window_look look, window_feel feel, uint32 flags, uint32 workspace)
|
window_look look, window_feel feel, uint32 flags, uint32 workspace)
|
||||||
{
|
{
|
||||||
return new OffscreenWindowLayer(fBitmap, name, this);
|
return new OffscreenWindow(fBitmap, name, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku, Inc. All rights reserved.
|
* Copyright 2005-2008, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -13,26 +13,23 @@
|
|||||||
|
|
||||||
|
|
||||||
class OffscreenServerWindow : public ServerWindow {
|
class OffscreenServerWindow : public ServerWindow {
|
||||||
public:
|
public:
|
||||||
OffscreenServerWindow(const char *title,
|
OffscreenServerWindow(const char *title, ServerApp *app,
|
||||||
ServerApp *app,
|
port_id clientPort, port_id looperPort,
|
||||||
port_id clientPort,
|
int32 handlerID, ServerBitmap* bitmap);
|
||||||
port_id looperPort,
|
virtual ~OffscreenServerWindow();
|
||||||
int32 handlerID,
|
|
||||||
ServerBitmap* bitmap);
|
|
||||||
virtual ~OffscreenServerWindow();
|
|
||||||
|
|
||||||
// util methods.
|
// util methods.
|
||||||
virtual void SendMessageToClient(const BMessage* msg,
|
virtual void SendMessageToClient(const BMessage* msg,
|
||||||
int32 target = B_NULL_TOKEN,
|
int32 target = B_NULL_TOKEN,
|
||||||
bool usePreferred = false) const;
|
bool usePreferred = false) const;
|
||||||
|
|
||||||
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
|
virtual ::Window* MakeWindow(BRect frame, const char* name,
|
||||||
window_look look, window_feel feel, uint32 flags,
|
window_look look, window_feel feel, uint32 flags,
|
||||||
uint32 workspace);
|
uint32 workspace);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ServerBitmap* fBitmap;
|
ServerBitmap* fBitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OFFSCREEN_SERVER_WINDOW_H
|
#endif // OFFSCREEN_SERVER_WINDOW_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku, Inc. All rights reserved.
|
* Copyright 2005-2008, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Author:
|
* Author:
|
||||||
@@ -7,24 +7,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "BitmapHWInterface.h"
|
#include "OffscreenWindow.h"
|
||||||
#include "DrawingEngine.h"
|
|
||||||
#include "OffscreenWindowLayer.h"
|
|
||||||
#include "ServerBitmap.h"
|
|
||||||
|
|
||||||
#include <Debug.h>
|
|
||||||
#include "DebugInfoManager.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <Debug.h>
|
||||||
|
|
||||||
OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap,
|
#include "BitmapHWInterface.h"
|
||||||
|
#include "DebugInfoManager.h"
|
||||||
|
#include "DrawingEngine.h"
|
||||||
|
#include "ServerBitmap.h"
|
||||||
|
|
||||||
|
|
||||||
|
OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
|
||||||
const char* name, ::ServerWindow* window)
|
const char* name, ::ServerWindow* window)
|
||||||
: WindowLayer(bitmap->Bounds(), name,
|
: Window(bitmap->Bounds(), name,
|
||||||
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
0, 0, window, new DrawingEngine()),
|
0, 0, window, new DrawingEngine()),
|
||||||
fBitmap(bitmap),
|
fBitmap(bitmap),
|
||||||
fHWInterface(new BitmapHWInterface(fBitmap))
|
fHWInterface(new BitmapHWInterface(fBitmap))
|
||||||
{
|
{
|
||||||
fHWInterface->Initialize();
|
fHWInterface->Initialize();
|
||||||
GetDrawingEngine()->SetHWInterface(fHWInterface);
|
GetDrawingEngine()->SetHWInterface(fHWInterface);
|
||||||
@@ -37,7 +38,7 @@ OffscreenWindowLayer::OffscreenWindowLayer(ServerBitmap* bitmap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OffscreenWindowLayer::~OffscreenWindowLayer()
|
OffscreenWindow::~OffscreenWindow()
|
||||||
{
|
{
|
||||||
fHWInterface->LockExclusiveAccess();
|
fHWInterface->LockExclusiveAccess();
|
||||||
// Unlike normal Layers, we own the DrawingEngine instance
|
// Unlike normal Layers, we own the DrawingEngine instance
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005-2008, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Author:
|
||||||
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
*/
|
||||||
|
#ifndef OFFSCREEN_WINDOW_H
|
||||||
|
#define OFFSCREEN_WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "Window.h"
|
||||||
|
|
||||||
|
|
||||||
|
class BitmapHWInterface;
|
||||||
|
class ServerBitmap;
|
||||||
|
|
||||||
|
class OffscreenWindow : public Window {
|
||||||
|
public:
|
||||||
|
OffscreenWindow(ServerBitmap* bitmap,
|
||||||
|
const char* name, ::ServerWindow* window);
|
||||||
|
virtual ~OffscreenWindow();
|
||||||
|
|
||||||
|
virtual bool IsOffscreenWindow() const
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
ServerBitmap* fBitmap;
|
||||||
|
BitmapHWInterface* fHWInterface;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OFFSCREEN_WINDOW_H
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2005, Haiku, Inc. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT license.
|
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
|
||||||
*/
|
|
||||||
#ifndef OFFSCREEN_WINBORDER_H
|
|
||||||
#define OFFSCREEN_WINBORDER_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "WindowLayer.h"
|
|
||||||
|
|
||||||
|
|
||||||
class BitmapHWInterface;
|
|
||||||
class ServerBitmap;
|
|
||||||
|
|
||||||
class OffscreenWindowLayer : public WindowLayer {
|
|
||||||
public:
|
|
||||||
OffscreenWindowLayer(ServerBitmap* bitmap,
|
|
||||||
const char* name,
|
|
||||||
::ServerWindow* window);
|
|
||||||
virtual ~OffscreenWindowLayer();
|
|
||||||
|
|
||||||
virtual bool IsOffscreenWindow() const
|
|
||||||
{ return true; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
ServerBitmap* fBitmap;
|
|
||||||
BitmapHWInterface* fHWInterface;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // OFFSCREEN_WINBORDER_H
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2007, Haiku, Inc.
|
* Copyright (c) 2001-2008, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ServerScreen.h"
|
#include "Screen.h"
|
||||||
|
|
||||||
#include "BitmapManager.h"
|
#include "BitmapManager.h"
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku.
|
* Copyright 2005-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
|
|
||||||
|
#include "Screen.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "ServerScreen.h"
|
|
||||||
|
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
|
|||||||
@@ -30,16 +30,16 @@
|
|||||||
#include "InputManager.h"
|
#include "InputManager.h"
|
||||||
#include "OffscreenServerWindow.h"
|
#include "OffscreenServerWindow.h"
|
||||||
#include "RAMLinkMsgReader.h"
|
#include "RAMLinkMsgReader.h"
|
||||||
|
#include "Screen.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
#include "ServerScreen.h"
|
|
||||||
#include "ServerTokenSpace.h"
|
#include "ServerTokenSpace.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "SystemPalette.h"
|
#include "SystemPalette.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
#include <FontPrivate.h>
|
#include <FontPrivate.h>
|
||||||
#include <MessengerPrivate.h>
|
#include <MessengerPrivate.h>
|
||||||
@@ -444,7 +444,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||||
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
WindowLayer* window = serverWindow->Window();
|
Window* window = serverWindow->Window();
|
||||||
if (window == NULL || window->IsOffscreenWindow())
|
if (window == NULL || window->IsOffscreenWindow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2666,7 +2666,7 @@ ServerApp::InWorkspace(int32 index) const
|
|||||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||||
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
const WindowLayer* window = serverWindow->Window();
|
const Window* window = serverWindow->Window();
|
||||||
if (window == NULL || window->IsOffscreenWindow())
|
if (window == NULL || window->IsOffscreenWindow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2693,7 +2693,7 @@ ServerApp::Workspaces() const
|
|||||||
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
|
||||||
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
ServerWindow* serverWindow = fWindowList.ItemAt(i);
|
||||||
|
|
||||||
const WindowLayer* window = serverWindow->Window();
|
const Window* window = serverWindow->Window();
|
||||||
if (window == NULL || window->IsOffscreenWindow())
|
if (window == NULL || window->IsOffscreenWindow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2007, Haiku.
|
* Copyright 2001-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
#include "ServerFont.h"
|
#include "ServerFont.h"
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
#include "ServerTokenSpace.h"
|
#include "ServerTokenSpace.h"
|
||||||
#include "ViewLayer.h"
|
#include "View.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
#include <LinkReceiver.h>
|
#include <LinkReceiver.h>
|
||||||
#include <OffsetFile.h>
|
#include <OffsetFile.h>
|
||||||
@@ -47,7 +47,7 @@ class ShapePainter : public BShapeIterator {
|
|||||||
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
|
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
|
||||||
virtual status_t IterateClose();
|
virtual status_t IterateClose();
|
||||||
|
|
||||||
void Draw(ViewLayer *view, BRect frame, bool filled);
|
void Draw(View *view, BRect frame, bool filled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stack<uint32> fOpStack;
|
stack<uint32> fOpStack;
|
||||||
@@ -109,7 +109,7 @@ ShapePainter::IterateClose(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShapePainter::Draw(ViewLayer *view, BRect frame, bool filled)
|
ShapePainter::Draw(View *view, BRect frame, bool filled)
|
||||||
{
|
{
|
||||||
// We're going to draw the currently iterated shape.
|
// We're going to draw the currently iterated shape.
|
||||||
int32 opCount, ptCount;
|
int32 opCount, ptCount;
|
||||||
@@ -177,14 +177,14 @@ nop()
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move_pen_by(ViewLayer *view, BPoint delta)
|
move_pen_by(View *view, BPoint delta)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta);
|
view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_line(ViewLayer *view, BPoint start, BPoint end)
|
stroke_line(View *view, BPoint start, BPoint end)
|
||||||
{
|
{
|
||||||
BPoint penPos = end;
|
BPoint penPos = end;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ stroke_line(ViewLayer *view, BPoint start, BPoint end)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_rect(ViewLayer *view, BRect rect)
|
stroke_rect(View *view, BRect rect)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->StrokeRect(rect);
|
view->Window()->GetDrawingEngine()->StrokeRect(rect);
|
||||||
@@ -208,7 +208,7 @@ stroke_rect(ViewLayer *view, BRect rect)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_rect(ViewLayer *view, BRect rect)
|
fill_rect(View *view, BRect rect)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->FillRect(rect);
|
view->Window()->GetDrawingEngine()->FillRect(rect);
|
||||||
@@ -216,7 +216,7 @@ fill_rect(ViewLayer *view, BRect rect)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_round_rect(ViewLayer *view, BRect rect, BPoint radii)
|
stroke_round_rect(View *view, BRect rect, BPoint radii)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
||||||
@@ -225,7 +225,7 @@ stroke_round_rect(ViewLayer *view, BRect rect, BPoint radii)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_round_rect(ViewLayer *view, BRect rect, BPoint radii)
|
fill_round_rect(View *view, BRect rect, BPoint radii)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
||||||
@@ -234,7 +234,7 @@ fill_round_rect(ViewLayer *view, BRect rect, BPoint radii)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_bezier(ViewLayer *view, const BPoint *viewPoints)
|
stroke_bezier(View *view, const BPoint *viewPoints)
|
||||||
{
|
{
|
||||||
BPoint points[4];
|
BPoint points[4];
|
||||||
view->ConvertToScreenForDrawing(points, viewPoints, 4);
|
view->ConvertToScreenForDrawing(points, viewPoints, 4);
|
||||||
@@ -244,7 +244,7 @@ stroke_bezier(ViewLayer *view, const BPoint *viewPoints)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_bezier(ViewLayer *view, const BPoint *viewPoints)
|
fill_bezier(View *view, const BPoint *viewPoints)
|
||||||
{
|
{
|
||||||
BPoint points[4];
|
BPoint points[4];
|
||||||
view->ConvertToScreenForDrawing(points, viewPoints, 4);
|
view->ConvertToScreenForDrawing(points, viewPoints, 4);
|
||||||
@@ -254,8 +254,8 @@ fill_bezier(ViewLayer *view, const BPoint *viewPoints)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
|
stroke_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
||||||
float arcTheta)
|
float arcTheta)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
||||||
center.y + radii.y - 1);
|
center.y + radii.y - 1);
|
||||||
@@ -265,8 +265,8 @@ stroke_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
|
fill_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
||||||
float arcTheta)
|
float arcTheta)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
||||||
center.y + radii.y - 1);
|
center.y + radii.y - 1);
|
||||||
@@ -276,7 +276,7 @@ fill_arc(ViewLayer *view, BPoint center, BPoint radii, float startTheta,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_ellipse(ViewLayer *view, BPoint center, BPoint radii)
|
stroke_ellipse(View *view, BPoint center, BPoint radii)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
||||||
center.y + radii.y - 1);
|
center.y + radii.y - 1);
|
||||||
@@ -286,7 +286,7 @@ stroke_ellipse(ViewLayer *view, BPoint center, BPoint radii)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_ellipse(ViewLayer *view, BPoint center, BPoint radii)
|
fill_ellipse(View *view, BPoint center, BPoint radii)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
||||||
center.y + radii.y - 1);
|
center.y + radii.y - 1);
|
||||||
@@ -296,11 +296,13 @@ fill_ellipse(ViewLayer *view, BPoint center, BPoint radii)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints, bool isClosed)
|
stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints,
|
||||||
|
bool isClosed)
|
||||||
{
|
{
|
||||||
if (numPoints <= 0) {
|
if (numPoints <= 0)
|
||||||
return;
|
return;
|
||||||
} else if (numPoints <= 200) {
|
|
||||||
|
if (numPoints <= 200) {
|
||||||
// fast path: no malloc/free, also avoid constructor/destructor calls
|
// fast path: no malloc/free, also avoid constructor/destructor calls
|
||||||
char data[200 * sizeof(BPoint)];
|
char data[200 * sizeof(BPoint)];
|
||||||
BPoint *points = (BPoint *)data;
|
BPoint *points = (BPoint *)data;
|
||||||
@@ -331,11 +333,12 @@ stroke_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints, bool
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints)
|
fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
||||||
{
|
{
|
||||||
if (numPoints <= 0) {
|
if (numPoints <= 0)
|
||||||
return;
|
return;
|
||||||
} else if (numPoints <= 200) {
|
|
||||||
|
if (numPoints <= 200) {
|
||||||
// fast path: no malloc/free, also avoid constructor/destructor calls
|
// fast path: no malloc/free, also avoid constructor/destructor calls
|
||||||
char data[200 * sizeof(BPoint)];
|
char data[200 * sizeof(BPoint)];
|
||||||
BPoint *points = (BPoint *)data;
|
BPoint *points = (BPoint *)data;
|
||||||
@@ -366,7 +369,7 @@ fill_polygon(ViewLayer *view, int32 numPoints, const BPoint *viewPoints)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_shape(ViewLayer *view, const BShape *shape)
|
stroke_shape(View *view, const BShape *shape)
|
||||||
{
|
{
|
||||||
ShapePainter drawShape;
|
ShapePainter drawShape;
|
||||||
|
|
||||||
@@ -376,7 +379,7 @@ stroke_shape(ViewLayer *view, const BShape *shape)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_shape(ViewLayer *view, const BShape *shape)
|
fill_shape(View *view, const BShape *shape)
|
||||||
{
|
{
|
||||||
ShapePainter drawShape;
|
ShapePainter drawShape;
|
||||||
|
|
||||||
@@ -386,7 +389,7 @@ fill_shape(ViewLayer *view, const BShape *shape)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_string(ViewLayer *view, const char *string, float deltaSpace,
|
draw_string(View *view, const char *string, float deltaSpace,
|
||||||
float deltaNonSpace)
|
float deltaNonSpace)
|
||||||
{
|
{
|
||||||
// NOTE: the picture data was recorded with a "set pen location" command
|
// NOTE: the picture data was recorded with a "set pen location" command
|
||||||
@@ -407,10 +410,11 @@ draw_string(ViewLayer *view, const char *string, float deltaSpace,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_pixels(ViewLayer *view, BRect src, BRect dest, int32 width, int32 height,
|
draw_pixels(View *view, BRect src, BRect dest, int32 width, int32 height,
|
||||||
int32 bytesPerRow, int32 pixelFormat, int32 flags, const void *data)
|
int32 bytesPerRow, int32 pixelFormat, int32 flags, const void *data)
|
||||||
{
|
{
|
||||||
UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1), (color_space)pixelFormat, flags, bytesPerRow);
|
UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1),
|
||||||
|
(color_space)pixelFormat, flags, bytesPerRow);
|
||||||
|
|
||||||
if (!bitmap.IsValid())
|
if (!bitmap.IsValid())
|
||||||
return;
|
return;
|
||||||
@@ -424,7 +428,7 @@ draw_pixels(ViewLayer *view, BRect src, BRect dest, int32 width, int32 height,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_picture(ViewLayer *view, BPoint where, int32 token)
|
draw_picture(View *view, BPoint where, int32 token)
|
||||||
{
|
{
|
||||||
ServerPicture *picture = view->Window()->ServerWindow()->App()->FindPicture(token);
|
ServerPicture *picture = view->Window()->ServerWindow()->App()->FindPicture(token);
|
||||||
if (picture != NULL) {
|
if (picture != NULL) {
|
||||||
@@ -435,7 +439,7 @@ draw_picture(ViewLayer *view, BPoint where, int32 token)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_clipping_rects(ViewLayer *view, const BRect *rects, uint32 numRects)
|
set_clipping_rects(View *view, const BRect *rects, uint32 numRects)
|
||||||
{
|
{
|
||||||
// TODO: This might be too slow, we should copy the rects
|
// TODO: This might be too slow, we should copy the rects
|
||||||
// directly to BRegion's internal data
|
// directly to BRegion's internal data
|
||||||
@@ -447,8 +451,8 @@ set_clipping_rects(ViewLayer *view, const BRect *rects, uint32 numRects)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clip_to_picture(ViewLayer *view, BPicture *picture, BPoint pt,
|
clip_to_picture(View *view, BPicture *picture, BPoint pt,
|
||||||
bool clip_to_inverse_picture)
|
bool clip_to_inverse_picture)
|
||||||
{
|
{
|
||||||
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n", pt.x, pt.y,
|
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n", pt.x, pt.y,
|
||||||
clip_to_inverse_picture ? "inverse" : "");
|
clip_to_inverse_picture ? "inverse" : "");
|
||||||
@@ -456,14 +460,14 @@ clip_to_picture(ViewLayer *view, BPicture *picture, BPoint pt,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_state(ViewLayer *view)
|
push_state(View *view)
|
||||||
{
|
{
|
||||||
view->PushState();
|
view->PushState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pop_state(ViewLayer *view)
|
pop_state(View *view)
|
||||||
{
|
{
|
||||||
view->PopState();
|
view->PopState();
|
||||||
|
|
||||||
@@ -477,40 +481,40 @@ pop_state(ViewLayer *view)
|
|||||||
// TODO: Be smart and actually take advantage of these methods:
|
// TODO: Be smart and actually take advantage of these methods:
|
||||||
// only apply state changes when they are called
|
// only apply state changes when they are called
|
||||||
static void
|
static void
|
||||||
enter_state_change(ViewLayer *view)
|
enter_state_change(View *view)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exit_state_change(ViewLayer *view)
|
exit_state_change(View *view)
|
||||||
{
|
{
|
||||||
view->Window()->ServerWindow()->ResyncDrawState();
|
view->Window()->ServerWindow()->ResyncDrawState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enter_font_state(ViewLayer *view)
|
enter_font_state(View *view)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exit_font_state(ViewLayer *view)
|
exit_font_state(View *view)
|
||||||
{
|
{
|
||||||
view->Window()->GetDrawingEngine()->SetFont(view->CurrentState()->Font());
|
view->Window()->GetDrawingEngine()->SetFont(view->CurrentState()->Font());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_origin(ViewLayer *view, BPoint pt)
|
set_origin(View *view, BPoint pt)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetOrigin(pt);
|
view->CurrentState()->SetOrigin(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pen_location(ViewLayer *view, BPoint pt)
|
set_pen_location(View *view, BPoint pt)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPenLocation(pt);
|
view->CurrentState()->SetPenLocation(pt);
|
||||||
// the DrawingEngine/Painter does not need to be updated, since this
|
// the DrawingEngine/Painter does not need to be updated, since this
|
||||||
@@ -520,7 +524,7 @@ set_pen_location(ViewLayer *view, BPoint pt)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_drawing_mode(ViewLayer *view, drawing_mode mode)
|
set_drawing_mode(View *view, drawing_mode mode)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetDrawingMode(mode);
|
view->CurrentState()->SetDrawingMode(mode);
|
||||||
view->Window()->GetDrawingEngine()->SetDrawingMode(mode);
|
view->Window()->GetDrawingEngine()->SetDrawingMode(mode);
|
||||||
@@ -528,7 +532,7 @@ set_drawing_mode(ViewLayer *view, drawing_mode mode)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miterLimit)
|
set_line_mode(View *view, cap_mode capMode, join_mode joinMode, float miterLimit)
|
||||||
{
|
{
|
||||||
DrawState *state = view->CurrentState();
|
DrawState *state = view->CurrentState();
|
||||||
state->SetLineCapMode(capMode);
|
state->SetLineCapMode(capMode);
|
||||||
@@ -539,7 +543,7 @@ set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miter
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pen_size(ViewLayer *view, float size)
|
set_pen_size(View *view, float size)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPenSize(size);
|
view->CurrentState()->SetPenSize(size);
|
||||||
view->Window()->GetDrawingEngine()->SetPenSize(view->CurrentState()->PenSize());
|
view->Window()->GetDrawingEngine()->SetPenSize(view->CurrentState()->PenSize());
|
||||||
@@ -549,7 +553,7 @@ set_pen_size(ViewLayer *view, float size)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_fore_color(ViewLayer *view, rgb_color color)
|
set_fore_color(View *view, rgb_color color)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetHighColor(color);
|
view->CurrentState()->SetHighColor(color);
|
||||||
view->Window()->GetDrawingEngine()->SetHighColor(color);
|
view->Window()->GetDrawingEngine()->SetHighColor(color);
|
||||||
@@ -557,7 +561,7 @@ set_fore_color(ViewLayer *view, rgb_color color)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_back_color(ViewLayer *view, rgb_color color)
|
set_back_color(View *view, rgb_color color)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetLowColor(color);
|
view->CurrentState()->SetLowColor(color);
|
||||||
view->Window()->GetDrawingEngine()->SetLowColor(color);
|
view->Window()->GetDrawingEngine()->SetLowColor(color);
|
||||||
@@ -565,7 +569,7 @@ set_back_color(ViewLayer *view, rgb_color color)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_stipple_pattern(ViewLayer *view, pattern p)
|
set_stipple_pattern(View *view, pattern p)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPattern(Pattern(p));
|
view->CurrentState()->SetPattern(Pattern(p));
|
||||||
view->Window()->GetDrawingEngine()->SetPattern(p);
|
view->Window()->GetDrawingEngine()->SetPattern(p);
|
||||||
@@ -573,7 +577,7 @@ set_stipple_pattern(ViewLayer *view, pattern p)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_scale(ViewLayer *view, float scale)
|
set_scale(View *view, float scale)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetScale(scale);
|
view->CurrentState()->SetScale(scale);
|
||||||
view->Window()->ServerWindow()->ResyncDrawState();
|
view->Window()->ServerWindow()->ResyncDrawState();
|
||||||
@@ -584,7 +588,7 @@ set_scale(ViewLayer *view, float scale)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_family(ViewLayer *view, const char *family)
|
set_font_family(View *view, const char *family)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
// Can we have a ServerFont::SetFamily() which accepts a string ?
|
// Can we have a ServerFont::SetFamily() which accepts a string ?
|
||||||
@@ -592,7 +596,7 @@ set_font_family(ViewLayer *view, const char *family)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_style(ViewLayer *view, const char *style)
|
set_font_style(View *view, const char *style)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
// Can we have a ServerFont::SetStyle() which accepts a string ?
|
// Can we have a ServerFont::SetStyle() which accepts a string ?
|
||||||
@@ -600,7 +604,7 @@ set_font_style(ViewLayer *view, const char *style)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_spacing(ViewLayer *view, int32 spacing)
|
set_font_spacing(View *view, int32 spacing)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetSpacing(spacing);
|
font.SetSpacing(spacing);
|
||||||
@@ -609,7 +613,7 @@ set_font_spacing(ViewLayer *view, int32 spacing)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_size(ViewLayer *view, float size)
|
set_font_size(View *view, float size)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetSize(size);
|
font.SetSize(size);
|
||||||
@@ -618,7 +622,7 @@ set_font_size(ViewLayer *view, float size)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_rotate(ViewLayer *view, float rotation)
|
set_font_rotate(View *view, float rotation)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetRotation(rotation);
|
font.SetRotation(rotation);
|
||||||
@@ -627,7 +631,7 @@ set_font_rotate(ViewLayer *view, float rotation)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_encoding(ViewLayer *view, int32 encoding)
|
set_font_encoding(View *view, int32 encoding)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetEncoding(encoding);
|
font.SetEncoding(encoding);
|
||||||
@@ -636,7 +640,7 @@ set_font_encoding(ViewLayer *view, int32 encoding)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_flags(ViewLayer *view, int32 flags)
|
set_font_flags(View *view, int32 flags)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetFlags(flags);
|
font.SetFlags(flags);
|
||||||
@@ -645,7 +649,7 @@ set_font_flags(ViewLayer *view, int32 flags)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_shear(ViewLayer *view, float shear)
|
set_font_shear(View *view, float shear)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetShear(shear);
|
font.SetShear(shear);
|
||||||
@@ -654,7 +658,7 @@ set_font_shear(ViewLayer *view, float shear)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_face(ViewLayer *view, int32 face)
|
set_font_face(View *view, int32 face)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetFace(face);
|
font.SetFace(face);
|
||||||
@@ -663,7 +667,7 @@ set_font_face(ViewLayer *view, int32 face)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_blending_mode(ViewLayer *view, int16 alphaSrcMode, int16 alphaFncMode)
|
set_blending_mode(View *view, int16 alphaSrcMode, int16 alphaFncMode)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode, (alpha_function)alphaFncMode);
|
view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode, (alpha_function)alphaFncMode);
|
||||||
}
|
}
|
||||||
@@ -813,7 +817,7 @@ ServerPicture::ExitStateChange()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerPicture::SyncState(ViewLayer *view)
|
ServerPicture::SyncState(View *view)
|
||||||
{
|
{
|
||||||
// TODO: Finish this
|
// TODO: Finish this
|
||||||
EnterStateChange();
|
EnterStateChange();
|
||||||
@@ -903,7 +907,7 @@ ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerPicture::Play(ViewLayer *view)
|
ServerPicture::Play(View *view)
|
||||||
{
|
{
|
||||||
// TODO: for now: then change PicturePlayer to accept a BPositionIO object
|
// TODO: for now: then change PicturePlayer to accept a BPositionIO object
|
||||||
BMallocIO *mallocIO = dynamic_cast<BMallocIO *>(fData);
|
BMallocIO *mallocIO = dynamic_cast<BMallocIO *>(fData);
|
||||||
|
|||||||
@@ -1,18 +1,27 @@
|
|||||||
#ifndef __SERVER_PICTURE_H
|
/*
|
||||||
#define __SERVER_PICTURE_H
|
* Copyright 2001-2008, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
|
||||||
|
*/
|
||||||
|
#ifndef SERVER_PICTURE_H
|
||||||
|
#define SERVER_PICTURE_H
|
||||||
|
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
|
||||||
#include <PictureDataWriter.h>
|
#include <PictureDataWriter.h>
|
||||||
|
|
||||||
#include <PortLink.h>
|
|
||||||
// TODO: For some reason, the forward declaration "class BPrivate::PortLink" causes compiling errors
|
|
||||||
|
|
||||||
|
|
||||||
class ServerApp;
|
class ServerApp;
|
||||||
class ViewLayer;
|
class View;
|
||||||
class BPrivate::LinkReceiver;
|
namespace BPrivate {
|
||||||
|
class LinkReceiver;
|
||||||
|
class PortLink;
|
||||||
|
}
|
||||||
class BList;
|
class BList;
|
||||||
|
|
||||||
class ServerPicture : public PictureDataWriter {
|
class ServerPicture : public PictureDataWriter {
|
||||||
public:
|
public:
|
||||||
int32 Token() { return fToken; }
|
int32 Token() { return fToken; }
|
||||||
@@ -20,10 +29,10 @@ public:
|
|||||||
void EnterStateChange();
|
void EnterStateChange();
|
||||||
void ExitStateChange();
|
void ExitStateChange();
|
||||||
|
|
||||||
void SyncState(ViewLayer *view);
|
void SyncState(View *view);
|
||||||
void SetFontFromLink(BPrivate::LinkReceiver& link);
|
void SetFontFromLink(BPrivate::LinkReceiver& link);
|
||||||
|
|
||||||
void Play(ViewLayer *view);
|
void Play(View *view);
|
||||||
|
|
||||||
void Usurp(ServerPicture *newPicture);
|
void Usurp(ServerPicture *newPicture);
|
||||||
ServerPicture* StepDown();
|
ServerPicture* StepDown();
|
||||||
@@ -50,4 +59,4 @@ friend class ServerApp;
|
|||||||
ServerPicture *fUsurped;
|
ServerPicture *fUsurped;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SERVER_PICTURE_H
|
#endif // SERVER_PICTURE_H
|
||||||
|
|||||||
+326
-326
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -36,9 +36,9 @@ class BMessage;
|
|||||||
class Desktop;
|
class Desktop;
|
||||||
class ServerApp;
|
class ServerApp;
|
||||||
class Decorator;
|
class Decorator;
|
||||||
class WindowLayer;
|
class Window;
|
||||||
class Workspace;
|
class Workspace;
|
||||||
class ViewLayer;
|
class View;
|
||||||
class ServerPicture;
|
class ServerPicture;
|
||||||
struct direct_window_data;
|
struct direct_window_data;
|
||||||
struct window_info;
|
struct window_info;
|
||||||
@@ -70,20 +70,22 @@ public:
|
|||||||
void NotifyZoom();
|
void NotifyZoom();
|
||||||
|
|
||||||
// util methods.
|
// util methods.
|
||||||
const BMessenger& FocusMessenger() const { return fFocusMessenger; }
|
const BMessenger& FocusMessenger() const
|
||||||
const BMessenger& HandlerMessenger() const { return fHandlerMessenger; }
|
{ return fFocusMessenger; }
|
||||||
|
const BMessenger& HandlerMessenger() const
|
||||||
|
{ return fHandlerMessenger; }
|
||||||
|
|
||||||
status_t SendMessageToClient(const BMessage* msg,
|
status_t SendMessageToClient(const BMessage* msg,
|
||||||
int32 target = B_NULL_TOKEN) const;
|
int32 target = B_NULL_TOKEN) const;
|
||||||
|
|
||||||
virtual WindowLayer* MakeWindowLayer(BRect frame, const char* name,
|
virtual ::Window* MakeWindow(BRect frame, const char* name,
|
||||||
window_look look, window_feel feel, uint32 flags,
|
window_look look, window_feel feel,
|
||||||
uint32 workspace);
|
uint32 flags, uint32 workspace);
|
||||||
|
|
||||||
// to who we belong. who do we own. our title.
|
// to who we belong. who do we own. our title.
|
||||||
inline ServerApp* App() const { return fServerApp; }
|
inline ServerApp* App() const { return fServerApp; }
|
||||||
::Desktop* Desktop() const { return fDesktop; }
|
::Desktop* Desktop() const { return fDesktop; }
|
||||||
::WindowLayer* Window() const;
|
::Window* Window() const;
|
||||||
|
|
||||||
void SetTitle(const char* newTitle);
|
void SetTitle(const char* newTitle);
|
||||||
inline const char* Title() const { return fTitle; }
|
inline const char* Title() const { return fTitle; }
|
||||||
@@ -104,8 +106,8 @@ public:
|
|||||||
void ResyncDrawState();
|
void ResyncDrawState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ViewLayer* _CreateLayerTree(BPrivate::LinkReceiver &link,
|
View* _CreateView(BPrivate::LinkReceiver &link,
|
||||||
ViewLayer **_parent);
|
View **_parent);
|
||||||
|
|
||||||
void _Show();
|
void _Show();
|
||||||
void _Hide();
|
void _Hide();
|
||||||
@@ -124,23 +126,22 @@ private:
|
|||||||
|
|
||||||
status_t _EnableDirectWindowMode();
|
status_t _EnableDirectWindowMode();
|
||||||
|
|
||||||
void _SetCurrentLayer(ViewLayer* view);
|
void _SetCurrentView(View* view);
|
||||||
void _UpdateDrawState(ViewLayer* view);
|
void _UpdateDrawState(View* view);
|
||||||
|
|
||||||
bool _MessageNeedsAllWindowsLocked(uint32 code) const;
|
bool _MessageNeedsAllWindowsLocked(uint32 code) const;
|
||||||
|
|
||||||
// TODO: Move me elsewhere
|
// TODO: Move me elsewhere
|
||||||
status_t PictureToRegion(ServerPicture *picture,
|
status_t PictureToRegion(ServerPicture *picture,
|
||||||
BRegion &,
|
BRegion& region, bool inverse,
|
||||||
bool inverse,
|
BPoint where);
|
||||||
BPoint where);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* fTitle;
|
char* fTitle;
|
||||||
|
|
||||||
::Desktop* fDesktop;
|
::Desktop* fDesktop;
|
||||||
ServerApp* fServerApp;
|
ServerApp* fServerApp;
|
||||||
WindowLayer* fWindowLayer;
|
::Window* fWindow;
|
||||||
bool fWindowAddedToDesktop;
|
bool fWindowAddedToDesktop;
|
||||||
|
|
||||||
team_id fClientTeam;
|
team_id fClientTeam;
|
||||||
@@ -157,7 +158,7 @@ private:
|
|||||||
int32 fServerToken;
|
int32 fServerToken;
|
||||||
int32 fClientToken;
|
int32 fClientToken;
|
||||||
|
|
||||||
ViewLayer* fCurrentLayer;
|
View* fCurrentView;
|
||||||
BRegion fCurrentDrawingRegion;
|
BRegion fCurrentDrawingRegion;
|
||||||
bool fCurrentDrawingRegionValid;
|
bool fCurrentDrawingRegionValid;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ViewLayer.h"
|
#include "View.h"
|
||||||
|
|
||||||
#include "BitmapManager.h"
|
#include "BitmapManager.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
#include "drawing_support.h"
|
#include "drawing_support.h"
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ resize_frame(IntRect& frame, uint32 resizingMode, int32 x, int32 y)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ViewLayer::ViewLayer(IntRect frame, IntPoint scrollingOffset, const char* name,
|
View::View(IntRect frame, IntPoint scrollingOffset, const char* name,
|
||||||
int32 token, uint32 resizeMode, uint32 flags)
|
int32 token, uint32 resizeMode, uint32 flags)
|
||||||
:
|
:
|
||||||
fName(name),
|
fName(name),
|
||||||
@@ -116,7 +116,7 @@ ViewLayer::ViewLayer(IntRect frame, IntPoint scrollingOffset, const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewLayer::~ViewLayer()
|
View::~View()
|
||||||
{
|
{
|
||||||
if (fViewBitmap != NULL)
|
if (fViewBitmap != NULL)
|
||||||
gBitmapManager->DeleteBitmap(fViewBitmap);
|
gBitmapManager->DeleteBitmap(fViewBitmap);
|
||||||
@@ -130,9 +130,9 @@ ViewLayer::~ViewLayer()
|
|||||||
fCursor->Release();
|
fCursor->Release();
|
||||||
|
|
||||||
// iterate over children and delete each one
|
// iterate over children and delete each one
|
||||||
ViewLayer* layer = fFirstChild;
|
View* layer = fFirstChild;
|
||||||
while (layer) {
|
while (layer) {
|
||||||
ViewLayer* toast = layer;
|
View* toast = layer;
|
||||||
layer = layer->fNextSibling;
|
layer = layer->fNextSibling;
|
||||||
delete toast;
|
delete toast;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ ViewLayer::~ViewLayer()
|
|||||||
|
|
||||||
|
|
||||||
IntRect
|
IntRect
|
||||||
ViewLayer::Bounds() const
|
View::Bounds() const
|
||||||
{
|
{
|
||||||
IntRect bounds(fScrollingOffset.x, fScrollingOffset.y,
|
IntRect bounds(fScrollingOffset.x, fScrollingOffset.y,
|
||||||
fScrollingOffset.x + fFrame.Width(),
|
fScrollingOffset.x + fFrame.Width(),
|
||||||
@@ -150,7 +150,7 @@ ViewLayer::Bounds() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToVisibleInTopView(IntRect* bounds) const
|
View::ConvertToVisibleInTopView(IntRect* bounds) const
|
||||||
{
|
{
|
||||||
*bounds = *bounds & Bounds();
|
*bounds = *bounds & Bounds();
|
||||||
// NOTE: this step is necessary even if we don't have a parent!
|
// NOTE: this step is necessary even if we don't have a parent!
|
||||||
@@ -162,7 +162,7 @@ ViewLayer::ConvertToVisibleInTopView(IntRect* bounds) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::AttachedToWindow(WindowLayer* window)
|
View::AttachedToWindow(::Window* window)
|
||||||
{
|
{
|
||||||
fWindow = window;
|
fWindow = window;
|
||||||
|
|
||||||
@@ -177,13 +177,13 @@ ViewLayer::AttachedToWindow(WindowLayer* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attach child views as well
|
// attach child views as well
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (View* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->AttachedToWindow(window);
|
child->AttachedToWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::DetachedFromWindow()
|
View::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
// remove view from local token space
|
// remove view from local token space
|
||||||
if (fWindow != NULL)
|
if (fWindow != NULL)
|
||||||
@@ -191,7 +191,7 @@ ViewLayer::DetachedFromWindow()
|
|||||||
|
|
||||||
fWindow = NULL;
|
fWindow = NULL;
|
||||||
// detach child views as well
|
// detach child views as well
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (View* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->DetachedFromWindow();
|
child->DetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,10 +200,10 @@ ViewLayer::DetachedFromWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddChild(ViewLayer* layer)
|
View::AddChild(View* layer)
|
||||||
{
|
{
|
||||||
if (layer->fParent) {
|
if (layer->fParent) {
|
||||||
printf("ViewLayer::AddChild() - ViewLayer already has a parent\n");
|
printf("View::AddChild() - View already has a parent\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,10 +243,10 @@ ViewLayer::AddChild(ViewLayer* layer)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ViewLayer::RemoveChild(ViewLayer* layer)
|
View::RemoveChild(View* layer)
|
||||||
{
|
{
|
||||||
if (layer->fParent != this) {
|
if (layer->fParent != this) {
|
||||||
printf("ViewLayer::RemoveChild(%p - %s) - ViewLayer is not child of "
|
printf("View::RemoveChild(%p - %s) - View is not child of "
|
||||||
"this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this);
|
"this (%p) layer!\n", layer, layer ? layer->Name() : NULL, this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -300,8 +300,8 @@ ViewLayer::RemoveChild(ViewLayer* layer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewLayer*
|
View*
|
||||||
ViewLayer::TopLayer()
|
View::TopLayer()
|
||||||
{
|
{
|
||||||
// returns the top level view of the hirarchy,
|
// returns the top level view of the hirarchy,
|
||||||
// it doesn't have to be the top level of a window
|
// it doesn't have to be the top level of a window
|
||||||
@@ -314,10 +314,10 @@ ViewLayer::TopLayer()
|
|||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
ViewLayer::CountChildren(bool deep) const
|
View::CountChildren(bool deep) const
|
||||||
{
|
{
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
count++;
|
count++;
|
||||||
if (deep) {
|
if (deep) {
|
||||||
count += child->CountChildren(deep);
|
count += child->CountChildren(deep);
|
||||||
@@ -328,9 +328,9 @@ ViewLayer::CountChildren(bool deep) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::CollectTokensForChildren(BList* tokenMap) const
|
View::CollectTokensForChildren(BList* tokenMap) const
|
||||||
{
|
{
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
tokenMap->AddItem((void*)child);
|
tokenMap->AddItem((void*)child);
|
||||||
child->CollectTokensForChildren(tokenMap);
|
child->CollectTokensForChildren(tokenMap);
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ ViewLayer::CollectTokensForChildren(BList* tokenMap) const
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
bool
|
bool
|
||||||
ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level)
|
View::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level)
|
||||||
{
|
{
|
||||||
BRect rect(fFrame.left, fFrame.top, fFrame.right, fFrame.bottom);
|
BRect rect(fFrame.left, fFrame.top, fFrame.right, fFrame.bottom);
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level)
|
|||||||
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
found |= child->MarkAt(engine, where, level + 1);
|
found |= child->MarkAt(engine, where, level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ ViewLayer::MarkAt(DrawingEngine* engine, const BPoint& where, int32 level)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::FindViews(uint32 flags, BObjectList<ViewLayer>& list, int32& left)
|
View::FindViews(uint32 flags, BObjectList<View>& list, int32& left)
|
||||||
{
|
{
|
||||||
if ((Flags() & flags) == flags) {
|
if ((Flags() & flags) == flags) {
|
||||||
list.AddItem(this);
|
list.AddItem(this);
|
||||||
@@ -385,7 +385,7 @@ ViewLayer::FindViews(uint32 flags, BObjectList<ViewLayer>& list, int32& left)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->FindViews(flags, list, left);
|
child->FindViews(flags, list, left);
|
||||||
if (left == 0)
|
if (left == 0)
|
||||||
break;
|
break;
|
||||||
@@ -393,8 +393,8 @@ ViewLayer::FindViews(uint32 flags, BObjectList<ViewLayer>& list, int32& left)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewLayer*
|
View*
|
||||||
ViewLayer::ViewAt(const BPoint& where)
|
View::ViewAt(const BPoint& where)
|
||||||
{
|
{
|
||||||
if (!fVisible)
|
if (!fVisible)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -406,8 +406,8 @@ ViewLayer::ViewAt(const BPoint& where)
|
|||||||
if (!frame.Contains(where))
|
if (!frame.Contains(where))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
ViewLayer* layer = child->ViewAt(where);
|
View* layer = child->ViewAt(where);
|
||||||
if (layer != NULL)
|
if (layer != NULL)
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
@@ -420,14 +420,14 @@ ViewLayer::ViewAt(const BPoint& where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetName(const char* string)
|
View::SetName(const char* string)
|
||||||
{
|
{
|
||||||
fName.SetTo(string);
|
fName.SetTo(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetFlags(uint32 flags)
|
View::SetFlags(uint32 flags)
|
||||||
{
|
{
|
||||||
fFlags = flags;
|
fFlags = flags;
|
||||||
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
||||||
@@ -435,7 +435,7 @@ ViewLayer::SetFlags(uint32 flags)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetDrawingOrigin(BPoint origin)
|
View::SetDrawingOrigin(BPoint origin)
|
||||||
{
|
{
|
||||||
fDrawState->SetOrigin(origin);
|
fDrawState->SetOrigin(origin);
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ ViewLayer::SetDrawingOrigin(BPoint origin)
|
|||||||
|
|
||||||
|
|
||||||
BPoint
|
BPoint
|
||||||
ViewLayer::DrawingOrigin() const
|
View::DrawingOrigin() const
|
||||||
{
|
{
|
||||||
BPoint origin(fDrawState->Origin());
|
BPoint origin(fDrawState->Origin());
|
||||||
float scale = Scale();
|
float scale = Scale();
|
||||||
@@ -459,7 +459,7 @@ ViewLayer::DrawingOrigin() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetScale(float scale)
|
View::SetScale(float scale)
|
||||||
{
|
{
|
||||||
fDrawState->SetScale(scale);
|
fDrawState->SetScale(scale);
|
||||||
|
|
||||||
@@ -470,14 +470,14 @@ ViewLayer::SetScale(float scale)
|
|||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
ViewLayer::Scale() const
|
View::Scale() const
|
||||||
{
|
{
|
||||||
return CurrentState()->Scale();
|
return CurrentState()->Scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetUserClipping(const BRegion* region)
|
View::SetUserClipping(const BRegion* region)
|
||||||
{
|
{
|
||||||
fDrawState->SetClippingRegion(region);
|
fDrawState->SetClippingRegion(region);
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ ViewLayer::SetUserClipping(const BRegion* region)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect,
|
View::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect,
|
||||||
IntRect destRect, int32 resizingMode, int32 options)
|
IntRect destRect, int32 resizingMode, int32 options)
|
||||||
{
|
{
|
||||||
if (fViewBitmap != NULL) {
|
if (fViewBitmap != NULL) {
|
||||||
@@ -520,7 +520,7 @@ ViewLayer::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect,
|
|||||||
|
|
||||||
|
|
||||||
::Overlay*
|
::Overlay*
|
||||||
ViewLayer::_Overlay() const
|
View::_Overlay() const
|
||||||
{
|
{
|
||||||
if (fViewBitmap == NULL)
|
if (fViewBitmap == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -530,7 +530,7 @@ ViewLayer::_Overlay() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::_UpdateOverlayView() const
|
View::_UpdateOverlayView() const
|
||||||
{
|
{
|
||||||
Overlay* overlay = _Overlay();
|
Overlay* overlay = _Overlay();
|
||||||
if (overlay == NULL)
|
if (overlay == NULL)
|
||||||
@@ -548,7 +548,7 @@ ViewLayer::_UpdateOverlayView() const
|
|||||||
be nice to have a better solution for this, though.
|
be nice to have a better solution for this, though.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ViewLayer::UpdateOverlay()
|
View::UpdateOverlay()
|
||||||
{
|
{
|
||||||
if (!IsVisible())
|
if (!IsVisible())
|
||||||
return;
|
return;
|
||||||
@@ -558,7 +558,7 @@ ViewLayer::UpdateOverlay()
|
|||||||
} else {
|
} else {
|
||||||
// recursively ask children of this view
|
// recursively ask children of this view
|
||||||
|
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->UpdateOverlay();
|
child->UpdateOverlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -569,7 +569,7 @@ ViewLayer::UpdateOverlay()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BPoint* point) const
|
View::ConvertToParent(BPoint* point) const
|
||||||
{
|
{
|
||||||
// remove scrolling offset and convert to parent coordinate space
|
// remove scrolling offset and convert to parent coordinate space
|
||||||
point->x += fFrame.left - fScrollingOffset.x;
|
point->x += fFrame.left - fScrollingOffset.x;
|
||||||
@@ -578,7 +578,7 @@ ViewLayer::ConvertToParent(BPoint* point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(IntPoint* point) const
|
View::ConvertToParent(IntPoint* point) const
|
||||||
{
|
{
|
||||||
// remove scrolling offset and convert to parent coordinate space
|
// remove scrolling offset and convert to parent coordinate space
|
||||||
point->x += fFrame.left - fScrollingOffset.x;
|
point->x += fFrame.left - fScrollingOffset.x;
|
||||||
@@ -587,7 +587,7 @@ ViewLayer::ConvertToParent(IntPoint* point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BRect* rect) const
|
View::ConvertToParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
// remove scrolling offset and convert to parent coordinate space
|
// remove scrolling offset and convert to parent coordinate space
|
||||||
rect->OffsetBy(fFrame.left - fScrollingOffset.x,
|
rect->OffsetBy(fFrame.left - fScrollingOffset.x,
|
||||||
@@ -596,7 +596,7 @@ ViewLayer::ConvertToParent(BRect* rect) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(IntRect* rect) const
|
View::ConvertToParent(IntRect* rect) const
|
||||||
{
|
{
|
||||||
// remove scrolling offset and convert to parent coordinate space
|
// remove scrolling offset and convert to parent coordinate space
|
||||||
rect->OffsetBy(fFrame.left - fScrollingOffset.x,
|
rect->OffsetBy(fFrame.left - fScrollingOffset.x,
|
||||||
@@ -605,7 +605,7 @@ ViewLayer::ConvertToParent(IntRect* rect) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToParent(BRegion* region) const
|
View::ConvertToParent(BRegion* region) const
|
||||||
{
|
{
|
||||||
// remove scrolling offset and convert to parent coordinate space
|
// remove scrolling offset and convert to parent coordinate space
|
||||||
region->OffsetBy(fFrame.left - fScrollingOffset.x,
|
region->OffsetBy(fFrame.left - fScrollingOffset.x,
|
||||||
@@ -614,7 +614,7 @@ ViewLayer::ConvertToParent(BRegion* region) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BPoint* point) const
|
View::ConvertFromParent(BPoint* point) const
|
||||||
{
|
{
|
||||||
// convert from parent coordinate space amd add scrolling offset
|
// convert from parent coordinate space amd add scrolling offset
|
||||||
point->x += fScrollingOffset.x - fFrame.left;
|
point->x += fScrollingOffset.x - fFrame.left;
|
||||||
@@ -623,7 +623,7 @@ ViewLayer::ConvertFromParent(BPoint* point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(IntPoint* point) const
|
View::ConvertFromParent(IntPoint* point) const
|
||||||
{
|
{
|
||||||
// convert from parent coordinate space amd add scrolling offset
|
// convert from parent coordinate space amd add scrolling offset
|
||||||
point->x += fScrollingOffset.x - fFrame.left;
|
point->x += fScrollingOffset.x - fFrame.left;
|
||||||
@@ -632,7 +632,7 @@ ViewLayer::ConvertFromParent(IntPoint* point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BRect* rect) const
|
View::ConvertFromParent(BRect* rect) const
|
||||||
{
|
{
|
||||||
// convert from parent coordinate space amd add scrolling offset
|
// convert from parent coordinate space amd add scrolling offset
|
||||||
rect->OffsetBy(fScrollingOffset.x - fFrame.left,
|
rect->OffsetBy(fScrollingOffset.x - fFrame.left,
|
||||||
@@ -641,7 +641,7 @@ ViewLayer::ConvertFromParent(BRect* rect) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(IntRect* rect) const
|
View::ConvertFromParent(IntRect* rect) const
|
||||||
{
|
{
|
||||||
// convert from parent coordinate space amd add scrolling offset
|
// convert from parent coordinate space amd add scrolling offset
|
||||||
rect->OffsetBy(fScrollingOffset.x - fFrame.left,
|
rect->OffsetBy(fScrollingOffset.x - fFrame.left,
|
||||||
@@ -650,7 +650,7 @@ ViewLayer::ConvertFromParent(IntRect* rect) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromParent(BRegion* region) const
|
View::ConvertFromParent(BRegion* region) const
|
||||||
{
|
{
|
||||||
// convert from parent coordinate space amd add scrolling offset
|
// convert from parent coordinate space amd add scrolling offset
|
||||||
region->OffsetBy(fScrollingOffset.x - fFrame.left,
|
region->OffsetBy(fScrollingOffset.x - fFrame.left,
|
||||||
@@ -659,7 +659,7 @@ ViewLayer::ConvertFromParent(BRegion* region) const
|
|||||||
|
|
||||||
//! converts a point from local to screen coordinate system
|
//! converts a point from local to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreen(BPoint* pt) const
|
View::ConvertToScreen(BPoint* pt) const
|
||||||
{
|
{
|
||||||
ConvertToParent(pt);
|
ConvertToParent(pt);
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ ViewLayer::ConvertToScreen(BPoint* pt) const
|
|||||||
|
|
||||||
//! converts a point from local to screen coordinate system
|
//! converts a point from local to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreen(IntPoint* pt) const
|
View::ConvertToScreen(IntPoint* pt) const
|
||||||
{
|
{
|
||||||
ConvertToParent(pt);
|
ConvertToParent(pt);
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ ViewLayer::ConvertToScreen(IntPoint* pt) const
|
|||||||
|
|
||||||
//! converts a rect from local to screen coordinate system
|
//! converts a rect from local to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreen(BRect* rect) const
|
View::ConvertToScreen(BRect* rect) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertToScreen(&offset);
|
ConvertToScreen(&offset);
|
||||||
@@ -692,7 +692,7 @@ ViewLayer::ConvertToScreen(BRect* rect) const
|
|||||||
|
|
||||||
//! converts a rect from local to screen coordinate system
|
//! converts a rect from local to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreen(IntRect* rect) const
|
View::ConvertToScreen(IntRect* rect) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertToScreen(&offset);
|
ConvertToScreen(&offset);
|
||||||
@@ -703,7 +703,7 @@ ViewLayer::ConvertToScreen(IntRect* rect) const
|
|||||||
|
|
||||||
//! converts a region from local to screen coordinate system
|
//! converts a region from local to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreen(BRegion* region) const
|
View::ConvertToScreen(BRegion* region) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertToScreen(&offset);
|
ConvertToScreen(&offset);
|
||||||
@@ -714,7 +714,7 @@ ViewLayer::ConvertToScreen(BRegion* region) const
|
|||||||
|
|
||||||
//! converts a point from screen to local coordinate system
|
//! converts a point from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreen(BPoint* pt) const
|
View::ConvertFromScreen(BPoint* pt) const
|
||||||
{
|
{
|
||||||
ConvertFromParent(pt);
|
ConvertFromParent(pt);
|
||||||
|
|
||||||
@@ -725,7 +725,7 @@ ViewLayer::ConvertFromScreen(BPoint* pt) const
|
|||||||
|
|
||||||
//! converts a point from screen to local coordinate system
|
//! converts a point from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreen(IntPoint* pt) const
|
View::ConvertFromScreen(IntPoint* pt) const
|
||||||
{
|
{
|
||||||
ConvertFromParent(pt);
|
ConvertFromParent(pt);
|
||||||
|
|
||||||
@@ -736,7 +736,7 @@ ViewLayer::ConvertFromScreen(IntPoint* pt) const
|
|||||||
|
|
||||||
//! converts a rect from screen to local coordinate system
|
//! converts a rect from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreen(BRect* rect) const
|
View::ConvertFromScreen(BRect* rect) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertFromScreen(&offset);
|
ConvertFromScreen(&offset);
|
||||||
@@ -747,7 +747,7 @@ ViewLayer::ConvertFromScreen(BRect* rect) const
|
|||||||
|
|
||||||
//! converts a rect from screen to local coordinate system
|
//! converts a rect from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreen(IntRect* rect) const
|
View::ConvertFromScreen(IntRect* rect) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertFromScreen(&offset);
|
ConvertFromScreen(&offset);
|
||||||
@@ -758,7 +758,7 @@ ViewLayer::ConvertFromScreen(IntRect* rect) const
|
|||||||
|
|
||||||
//! converts a region from screen to local coordinate system
|
//! converts a region from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreen(BRegion* region) const
|
View::ConvertFromScreen(BRegion* region) const
|
||||||
{
|
{
|
||||||
BPoint offset(0.0, 0.0);
|
BPoint offset(0.0, 0.0);
|
||||||
ConvertFromScreen(&offset);
|
ConvertFromScreen(&offset);
|
||||||
@@ -769,7 +769,7 @@ ViewLayer::ConvertFromScreen(BRegion* region) const
|
|||||||
|
|
||||||
//! converts a point from local *drawing* to screen coordinate system
|
//! converts a point from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BPoint* point) const
|
View::ConvertToScreenForDrawing(BPoint* point) const
|
||||||
{
|
{
|
||||||
fDrawState->Transform(point);
|
fDrawState->Transform(point);
|
||||||
// NOTE: from here on, don't use the
|
// NOTE: from here on, don't use the
|
||||||
@@ -780,7 +780,7 @@ ViewLayer::ConvertToScreenForDrawing(BPoint* point) const
|
|||||||
|
|
||||||
//! converts a rect from local *drawing* to screen coordinate system
|
//! converts a rect from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BRect* rect) const
|
View::ConvertToScreenForDrawing(BRect* rect) const
|
||||||
{
|
{
|
||||||
fDrawState->Transform(rect);
|
fDrawState->Transform(rect);
|
||||||
// NOTE: from here on, don't use the
|
// NOTE: from here on, don't use the
|
||||||
@@ -791,7 +791,7 @@ ViewLayer::ConvertToScreenForDrawing(BRect* rect) const
|
|||||||
|
|
||||||
//! converts a region from local *drawing* to screen coordinate system
|
//! converts a region from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BRegion* region) const
|
View::ConvertToScreenForDrawing(BRegion* region) const
|
||||||
{
|
{
|
||||||
fDrawState->Transform(region);
|
fDrawState->Transform(region);
|
||||||
// NOTE: from here on, don't use the
|
// NOTE: from here on, don't use the
|
||||||
@@ -802,7 +802,7 @@ ViewLayer::ConvertToScreenForDrawing(BRegion* region) const
|
|||||||
|
|
||||||
//! converts points from local *drawing* to screen coordinate system
|
//! converts points from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) const
|
View::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) const
|
||||||
{
|
{
|
||||||
// TODO: optimize this, it should be smarter
|
// TODO: optimize this, it should be smarter
|
||||||
while (num--) {
|
while (num--) {
|
||||||
@@ -819,7 +819,7 @@ ViewLayer::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num)
|
|||||||
|
|
||||||
//! converts rects from local *drawing* to screen coordinate system
|
//! converts rects from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) const
|
View::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) const
|
||||||
{
|
{
|
||||||
// TODO: optimize this, it should be smarter
|
// TODO: optimize this, it should be smarter
|
||||||
while (num--) {
|
while (num--) {
|
||||||
@@ -836,7 +836,7 @@ ViewLayer::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) co
|
|||||||
|
|
||||||
//! converts regions from local *drawing* to screen coordinate system
|
//! converts regions from local *drawing* to screen coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num) const
|
View::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num) const
|
||||||
{
|
{
|
||||||
// TODO: optimize this, it should be smarter
|
// TODO: optimize this, it should be smarter
|
||||||
while (num--) {
|
while (num--) {
|
||||||
@@ -853,7 +853,7 @@ ViewLayer::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num
|
|||||||
|
|
||||||
//! converts a point from screen to local coordinate system
|
//! converts a point from screen to local coordinate system
|
||||||
void
|
void
|
||||||
ViewLayer::ConvertFromScreenForDrawing(BPoint* point) const
|
View::ConvertFromScreenForDrawing(BPoint* point) const
|
||||||
{
|
{
|
||||||
ConvertFromScreen(point);
|
ConvertFromScreen(point);
|
||||||
fDrawState->InverseTransform(point);
|
fDrawState->InverseTransform(point);
|
||||||
@@ -864,7 +864,7 @@ ViewLayer::ConvertFromScreenForDrawing(BPoint* point) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion)
|
View::MoveBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
if (x == 0 && y == 0)
|
if (x == 0 && y == 0)
|
||||||
return;
|
return;
|
||||||
@@ -937,7 +937,7 @@ ViewLayer::MoveBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
View::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
if (x == 0 && y == 0)
|
if (x == 0 && y == 0)
|
||||||
return;
|
return;
|
||||||
@@ -969,7 +969,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
||||||
// exclude children, they are expected to
|
// exclude children, they are expected to
|
||||||
// include their own dirty regions in ParentResized()
|
// include their own dirty regions in ParentResized()
|
||||||
for (ViewLayer* child = FirstChild(); child;
|
for (View* child = FirstChild(); child;
|
||||||
child = child->NextSibling()) {
|
child = child->NextSibling()) {
|
||||||
if (!child->IsVisible())
|
if (!child->IsVisible())
|
||||||
continue;
|
continue;
|
||||||
@@ -988,7 +988,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// layout the children
|
// layout the children
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (View* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->ParentResized(x, y, dirtyRegion);
|
child->ParentResized(x, y, dirtyRegion);
|
||||||
|
|
||||||
// view bitmap
|
// view bitmap
|
||||||
@@ -1004,7 +1004,7 @@ ViewLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
View::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
IntRect newFrame = fFrame;
|
IntRect newFrame = fFrame;
|
||||||
resize_frame(newFrame, fResizeMode & 0x0000ffff, x, y);
|
resize_frame(newFrame, fResizeMode & 0x0000ffff, x, y);
|
||||||
@@ -1029,7 +1029,7 @@ ViewLayer::ParentResized(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
|
View::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
if (!fVisible || !fWindow) {
|
if (!fVisible || !fWindow) {
|
||||||
fScrollingOffset.x += x;
|
fScrollingOffset.x += x;
|
||||||
@@ -1087,7 +1087,7 @@ ViewLayer::ScrollBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping)
|
View::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping)
|
||||||
{
|
{
|
||||||
if (!fVisible || !fWindow)
|
if (!fVisible || !fWindow)
|
||||||
return;
|
return;
|
||||||
@@ -1167,7 +1167,7 @@ ViewLayer::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::PushState()
|
View::PushState()
|
||||||
{
|
{
|
||||||
fDrawState = fDrawState->PushState();
|
fDrawState = fDrawState->PushState();
|
||||||
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
fDrawState->SetSubPixelPrecise(fFlags & B_SUBPIXEL_PRECISE);
|
||||||
@@ -1175,7 +1175,7 @@ ViewLayer::PushState()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::PopState()
|
View::PopState()
|
||||||
{
|
{
|
||||||
if (fDrawState->PreviousState() == NULL) {
|
if (fDrawState->PreviousState() == NULL) {
|
||||||
fprintf(stderr, "WARNING: User called BView(%s)::PopState(), "
|
fprintf(stderr, "WARNING: User called BView(%s)::PopState(), "
|
||||||
@@ -1196,7 +1196,7 @@ ViewLayer::PopState()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetEventMask(uint32 eventMask, uint32 options)
|
View::SetEventMask(uint32 eventMask, uint32 options)
|
||||||
{
|
{
|
||||||
fEventMask = eventMask;
|
fEventMask = eventMask;
|
||||||
fEventOptions = options;
|
fEventOptions = options;
|
||||||
@@ -1204,7 +1204,7 @@ ViewLayer::SetEventMask(uint32 eventMask, uint32 options)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetCursor(ServerCursor *cursor)
|
View::SetCursor(ServerCursor *cursor)
|
||||||
{
|
{
|
||||||
if (cursor == fCursor)
|
if (cursor == fCursor)
|
||||||
return;
|
return;
|
||||||
@@ -1222,14 +1222,14 @@ ViewLayer::SetCursor(ServerCursor *cursor)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetPicture(ServerPicture *picture)
|
View::SetPicture(ServerPicture *picture)
|
||||||
{
|
{
|
||||||
fPicture = picture;
|
fPicture = picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
View::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
||||||
BRegion* windowContentClipping, bool deep)
|
BRegion* windowContentClipping, bool deep)
|
||||||
{
|
{
|
||||||
if (!fVisible) {
|
if (!fVisible) {
|
||||||
@@ -1266,7 +1266,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
rect.OffsetBy(-(rect.Width() + 1), 0.0);
|
rect.OffsetBy(-(rect.Width() + 1), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: locking removed because the WindowLayer keeps the engine locked
|
// XXX: locking removed because the Window keeps the engine locked
|
||||||
// because it keeps track of syncing right now
|
// because it keeps track of syncing right now
|
||||||
|
|
||||||
// lock the drawing engine for as long as we need the clipping
|
// lock the drawing engine for as long as we need the clipping
|
||||||
@@ -1357,7 +1357,7 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
|
|
||||||
// let children draw
|
// let children draw
|
||||||
if (deep) {
|
if (deep) {
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->Draw(drawingEngine, effectiveClipping,
|
child->Draw(drawingEngine, effectiveClipping,
|
||||||
windowContentClipping, deep);
|
windowContentClipping, deep);
|
||||||
}
|
}
|
||||||
@@ -1369,21 +1369,21 @@ ViewLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MouseDown(BMessage* message, BPoint where)
|
View::MouseDown(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook method
|
// empty hook method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MouseUp(BMessage* message, BPoint where)
|
View::MouseUp(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook method
|
// empty hook method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MouseMoved(BMessage* message, BPoint where)
|
View::MouseMoved(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// empty hook method
|
// empty hook method
|
||||||
}
|
}
|
||||||
@@ -1393,7 +1393,7 @@ ViewLayer::MouseMoved(BMessage* message, BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetHidden(bool hidden)
|
View::SetHidden(bool hidden)
|
||||||
{
|
{
|
||||||
if (fHidden != hidden) {
|
if (fHidden != hidden) {
|
||||||
fHidden = hidden;
|
fHidden = hidden;
|
||||||
@@ -1426,19 +1426,19 @@ ViewLayer::SetHidden(bool hidden)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ViewLayer::IsHidden() const
|
View::IsHidden() const
|
||||||
{
|
{
|
||||||
return fHidden;
|
return fHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
View::UpdateVisibleDeep(bool parentVisible)
|
||||||
{
|
{
|
||||||
bool wasVisible = fVisible;
|
bool wasVisible = fVisible;
|
||||||
|
|
||||||
fVisible = parentVisible && !fHidden;
|
fVisible = parentVisible && !fHidden;
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (View* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->UpdateVisibleDeep(fVisible);
|
child->UpdateVisibleDeep(fVisible);
|
||||||
|
|
||||||
// overlay handling
|
// overlay handling
|
||||||
@@ -1458,18 +1458,18 @@ ViewLayer::UpdateVisibleDeep(bool parentVisible)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::MarkBackgroundDirty()
|
View::MarkBackgroundDirty()
|
||||||
{
|
{
|
||||||
if (fBackgroundDirty)
|
if (fBackgroundDirty)
|
||||||
return;
|
return;
|
||||||
fBackgroundDirty = true;
|
fBackgroundDirty = true;
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling())
|
for (View* child = FirstChild(); child; child = child->NextSibling())
|
||||||
child->MarkBackgroundDirty();
|
child->MarkBackgroundDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
|
View::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
|
||||||
BRegion* windowContentClipping)
|
BRegion* windowContentClipping)
|
||||||
{
|
{
|
||||||
if (!fVisible)
|
if (!fVisible)
|
||||||
@@ -1478,7 +1478,7 @@ ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
|
|||||||
if (region.Intersects(ScreenClipping(windowContentClipping).Frame()))
|
if (region.Intersects(ScreenClipping(windowContentClipping).Frame()))
|
||||||
message->AddInt32("_token", fToken);
|
message->AddInt32("_token", fToken);
|
||||||
|
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->AddTokensForLayersInRegion(message, region,
|
child->AddTokensForLayersInRegion(message, region,
|
||||||
windowContentClipping);
|
windowContentClipping);
|
||||||
}
|
}
|
||||||
@@ -1486,7 +1486,7 @@ ViewLayer::AddTokensForLayersInRegion(BMessage* message, BRegion& region,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
|
View::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
|
||||||
BRegion* windowContentClipping)
|
BRegion* windowContentClipping)
|
||||||
{
|
{
|
||||||
if (!fVisible)
|
if (!fVisible)
|
||||||
@@ -1500,16 +1500,16 @@ ViewLayer::AddTokensForLayersInRegion(BPrivate::PortLink& link, BRegion& region,
|
|||||||
if (region.Intersects(ScreenClipping(windowContentClipping).Frame()))
|
if (region.Intersects(ScreenClipping(windowContentClipping).Frame()))
|
||||||
link.Attach<int32>(fToken);
|
link.Attach<int32>(fToken);
|
||||||
|
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->AddTokensForLayersInRegion(link, region, windowContentClipping);
|
child->AddTokensForLayersInRegion(link, region, windowContentClipping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::PrintToStream() const
|
View::PrintToStream() const
|
||||||
{
|
{
|
||||||
printf("ViewLayer: %s\n", Name());
|
printf("View: %s\n", Name());
|
||||||
printf(" fToken: %ld\n", fToken);
|
printf(" fToken: %ld\n", fToken);
|
||||||
printf(" fFrame: IntRect(%ld, %ld, %ld, %ld)\n", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom);
|
printf(" fFrame: IntRect(%ld, %ld, %ld, %ld)\n", fFrame.left, fFrame.top, fFrame.right, fFrame.bottom);
|
||||||
printf(" fScrollingOffset: IntPoint(%ld, %ld)\n", fScrollingOffset.x, fScrollingOffset.y);
|
printf(" fScrollingOffset: IntPoint(%ld, %ld)\n", fScrollingOffset.x, fScrollingOffset.y);
|
||||||
@@ -1531,12 +1531,12 @@ ViewLayer::PrintToStream() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::RebuildClipping(bool deep)
|
View::RebuildClipping(bool deep)
|
||||||
{
|
{
|
||||||
// the clipping spans over the bounds area
|
// the clipping spans over the bounds area
|
||||||
fLocalClipping.Set((clipping_rect)Bounds());
|
fLocalClipping.Set((clipping_rect)Bounds());
|
||||||
|
|
||||||
if (ViewLayer* child = FirstChild()) {
|
if (View* child = FirstChild()) {
|
||||||
// if this view does not draw over children,
|
// if this view does not draw over children,
|
||||||
// exclude all children from the clipping
|
// exclude all children from the clipping
|
||||||
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
|
||||||
@@ -1581,7 +1581,7 @@ ViewLayer::RebuildClipping(bool deep)
|
|||||||
|
|
||||||
|
|
||||||
BRegion&
|
BRegion&
|
||||||
ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
View::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
||||||
{
|
{
|
||||||
if (!fScreenClippingValid || force) {
|
if (!fScreenClippingValid || force) {
|
||||||
fScreenClipping = fLocalClipping;
|
fScreenClipping = fLocalClipping;
|
||||||
@@ -1604,14 +1604,14 @@ ViewLayer::ScreenClipping(BRegion* windowContentClipping, bool force) const
|
|||||||
fScreenClipping.IntersectWith(windowContentClipping);
|
fScreenClipping.IntersectWith(windowContentClipping);
|
||||||
fScreenClippingValid = true;
|
fScreenClippingValid = true;
|
||||||
}
|
}
|
||||||
//printf("###ViewLayer(%s)::ScreenClipping():\n", Name());
|
//printf("###View(%s)::ScreenClipping():\n", Name());
|
||||||
//fScreenClipping.PrintToStream();
|
//fScreenClipping.PrintToStream();
|
||||||
return fScreenClipping;
|
return fScreenClipping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::InvalidateScreenClipping()
|
View::InvalidateScreenClipping()
|
||||||
{
|
{
|
||||||
// TODO: appearantly, we are calling ScreenClipping() on
|
// TODO: appearantly, we are calling ScreenClipping() on
|
||||||
// views who's parents don't have a valid screen clipping yet,
|
// views who's parents don't have a valid screen clipping yet,
|
||||||
@@ -1631,21 +1631,21 @@ ViewLayer::InvalidateScreenClipping()
|
|||||||
|
|
||||||
fScreenClippingValid = false;
|
fScreenClippingValid = false;
|
||||||
// invalidate the childrens screen clipping as well
|
// invalidate the childrens screen clipping as well
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->InvalidateScreenClipping();
|
child->InvalidateScreenClipping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::_MoveScreenClipping(int32 x, int32 y, bool deep)
|
View::_MoveScreenClipping(int32 x, int32 y, bool deep)
|
||||||
{
|
{
|
||||||
if (fScreenClippingValid)
|
if (fScreenClippingValid)
|
||||||
fScreenClipping.OffsetBy(x, y);
|
fScreenClipping.OffsetBy(x, y);
|
||||||
|
|
||||||
if (deep) {
|
if (deep) {
|
||||||
// move the childrens screen clipping as well
|
// move the childrens screen clipping as well
|
||||||
for (ViewLayer* child = FirstChild(); child; child = child->NextSibling()) {
|
for (View* child = FirstChild(); child; child = child->NextSibling()) {
|
||||||
child->_MoveScreenClipping(x, y, deep);
|
child->_MoveScreenClipping(x, y, deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
* Marcus Overhagen <marcus@overhagen.de>
|
* Marcus Overhagen <marcus@overhagen.de>
|
||||||
*/
|
*/
|
||||||
#ifndef VIEW_LAYER_H
|
#ifndef VIEW_H
|
||||||
#define VIEW_LAYER_H
|
#define VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include "IntRect.h"
|
#include "IntRect.h"
|
||||||
@@ -30,18 +30,17 @@ namespace BPrivate {
|
|||||||
class DrawState;
|
class DrawState;
|
||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class Overlay;
|
class Overlay;
|
||||||
class WindowLayer;
|
class Window;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
class ServerPicture;
|
class ServerPicture;
|
||||||
|
|
||||||
class ViewLayer {
|
class View {
|
||||||
public:
|
public:
|
||||||
ViewLayer(IntRect frame, IntPoint scrollingOffset,
|
View(IntRect frame, IntPoint scrollingOffset,
|
||||||
const char* name, int32 token,
|
const char* name, int32 token,
|
||||||
uint32 resizeMode, uint32 flags);
|
uint32 resizeMode, uint32 flags);
|
||||||
|
virtual ~View();
|
||||||
virtual ~ViewLayer();
|
|
||||||
|
|
||||||
int32 Token() const
|
int32 Token() const
|
||||||
{ return fToken; }
|
{ return fToken; }
|
||||||
@@ -77,34 +76,34 @@ class ViewLayer {
|
|||||||
// clips to each views bounds
|
// clips to each views bounds
|
||||||
void ConvertToVisibleInTopView(IntRect* bounds) const;
|
void ConvertToVisibleInTopView(IntRect* bounds) const;
|
||||||
|
|
||||||
virtual void AttachedToWindow(WindowLayer* window);
|
virtual void AttachedToWindow(::Window* window);
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
WindowLayer* Window() const { return fWindow; }
|
::Window* Window() const { return fWindow; }
|
||||||
|
|
||||||
// tree stuff
|
// tree stuff
|
||||||
void AddChild(ViewLayer* layer);
|
void AddChild(View* layer);
|
||||||
bool RemoveChild(ViewLayer* layer);
|
bool RemoveChild(View* layer);
|
||||||
|
|
||||||
inline ViewLayer* Parent() const
|
inline View* Parent() const
|
||||||
{ return fParent; }
|
{ return fParent; }
|
||||||
|
|
||||||
inline ViewLayer* FirstChild() const
|
inline View* FirstChild() const
|
||||||
{ return fFirstChild; }
|
{ return fFirstChild; }
|
||||||
inline ViewLayer* LastChild() const
|
inline View* LastChild() const
|
||||||
{ return fLastChild; }
|
{ return fLastChild; }
|
||||||
inline ViewLayer* PreviousSibling() const
|
inline View* PreviousSibling() const
|
||||||
{ return fPreviousSibling; }
|
{ return fPreviousSibling; }
|
||||||
inline ViewLayer* NextSibling() const
|
inline View* NextSibling() const
|
||||||
{ return fNextSibling; }
|
{ return fNextSibling; }
|
||||||
|
|
||||||
ViewLayer* TopLayer();
|
View* TopLayer();
|
||||||
|
|
||||||
uint32 CountChildren(bool deep = false) const;
|
uint32 CountChildren(bool deep = false) const;
|
||||||
void CollectTokensForChildren(BList* tokenMap) const;
|
void CollectTokensForChildren(BList* tokenMap) const;
|
||||||
void FindViews(uint32 flags,
|
void FindViews(uint32 flags, BObjectList<View>& list,
|
||||||
BObjectList<ViewLayer>& list, int32& left);
|
int32& left);
|
||||||
|
|
||||||
ViewLayer* ViewAt(const BPoint& where);
|
View* ViewAt(const BPoint& where);
|
||||||
|
|
||||||
// coordinate conversion
|
// coordinate conversion
|
||||||
void ConvertToParent(BPoint* point) const;
|
void ConvertToParent(BPoint* point) const;
|
||||||
@@ -155,7 +154,7 @@ class ViewLayer {
|
|||||||
BRegion* dirtyRegion);
|
BRegion* dirtyRegion);
|
||||||
|
|
||||||
void CopyBits(IntRect src, IntRect dst,
|
void CopyBits(IntRect src, IntRect dst,
|
||||||
BRegion& windowContentClipping);
|
BRegion& windowContentClipping);
|
||||||
|
|
||||||
const BRegion& LocalClipping() const { return fLocalClipping; }
|
const BRegion& LocalClipping() const { return fLocalClipping; }
|
||||||
|
|
||||||
@@ -270,13 +269,13 @@ class ViewLayer {
|
|||||||
uint32 fEventMask;
|
uint32 fEventMask;
|
||||||
uint32 fEventOptions;
|
uint32 fEventOptions;
|
||||||
|
|
||||||
WindowLayer* fWindow;
|
::Window* fWindow;
|
||||||
ViewLayer* fParent;
|
View* fParent;
|
||||||
|
|
||||||
ViewLayer* fFirstChild;
|
View* fFirstChild;
|
||||||
ViewLayer* fPreviousSibling;
|
View* fPreviousSibling;
|
||||||
ViewLayer* fNextSibling;
|
View* fNextSibling;
|
||||||
ViewLayer* fLastChild;
|
View* fLastChild;
|
||||||
|
|
||||||
ServerCursor* fCursor;
|
ServerCursor* fCursor;
|
||||||
ServerPicture* fPicture;
|
ServerPicture* fPicture;
|
||||||
@@ -286,8 +285,6 @@ class ViewLayer {
|
|||||||
|
|
||||||
mutable BRegion fScreenClipping;
|
mutable BRegion fScreenClipping;
|
||||||
mutable bool fScreenClippingValid;
|
mutable bool fScreenClippingValid;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // VIEW_H
|
||||||
#endif // LAYER_H
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
#include "DebugInfoManager.h"
|
#include "DebugInfoManager.h"
|
||||||
#include "Decorator.h"
|
#include "Decorator.h"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
#include "WorkspacesLayer.h"
|
#include "WorkspacesView.h"
|
||||||
|
|
||||||
#include <ViewPrivate.h>
|
#include <ViewPrivate.h>
|
||||||
#include <WindowPrivate.h>
|
#include <WindowPrivate.h>
|
||||||
@@ -68,7 +68,7 @@ using std::nothrow;
|
|||||||
// the update session, which tells us the cause of the update
|
// the update session, which tells us the cause of the update
|
||||||
|
|
||||||
|
|
||||||
WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
Window::Window(const BRect& frame, const char *name,
|
||||||
window_look look, window_feel feel, uint32 flags, uint32 workspaces,
|
window_look look, window_feel feel, uint32 flags, uint32 workspaces,
|
||||||
::ServerWindow* window, DrawingEngine* drawingEngine)
|
::ServerWindow* window, DrawingEngine* drawingEngine)
|
||||||
:
|
:
|
||||||
@@ -167,14 +167,14 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STRACE(("WindowLayer %p, %s:\n", this, Name()));
|
STRACE(("Window %p, %s:\n", this, Name()));
|
||||||
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
|
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
|
||||||
fFrame.right, fFrame.bottom));
|
fFrame.right, fFrame.bottom));
|
||||||
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
|
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer::~WindowLayer()
|
Window::~Window()
|
||||||
{
|
{
|
||||||
if (fTopLayer)
|
if (fTopLayer)
|
||||||
fTopLayer->DetachedFromWindow();
|
fTopLayer->DetachedFromWindow();
|
||||||
@@ -185,7 +185,7 @@ WindowLayer::~WindowLayer()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetClipping(BRegion* stillAvailableOnScreen)
|
Window::SetClipping(BRegion* stillAvailableOnScreen)
|
||||||
{
|
{
|
||||||
// this function is only called from the Desktop thread
|
// this function is only called from the Desktop thread
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ WindowLayer::SetClipping(BRegion* stillAvailableOnScreen)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::GetFullRegion(BRegion* region)
|
Window::GetFullRegion(BRegion* region)
|
||||||
{
|
{
|
||||||
// TODO: if someone needs to call this from
|
// TODO: if someone needs to call this from
|
||||||
// the outside, the clipping needs to be readlocked!
|
// the outside, the clipping needs to be readlocked!
|
||||||
@@ -215,7 +215,7 @@ WindowLayer::GetFullRegion(BRegion* region)
|
|||||||
|
|
||||||
// GetBorderRegion
|
// GetBorderRegion
|
||||||
void
|
void
|
||||||
WindowLayer::GetBorderRegion(BRegion* region)
|
Window::GetBorderRegion(BRegion* region)
|
||||||
{
|
{
|
||||||
// TODO: if someone needs to call this from
|
// TODO: if someone needs to call this from
|
||||||
// the outside, the clipping needs to be readlocked!
|
// the outside, the clipping needs to be readlocked!
|
||||||
@@ -234,7 +234,7 @@ WindowLayer::GetBorderRegion(BRegion* region)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::GetContentRegion(BRegion* region)
|
Window::GetContentRegion(BRegion* region)
|
||||||
{
|
{
|
||||||
// TODO: if someone needs to call this from
|
// TODO: if someone needs to call this from
|
||||||
// the outside, the clipping needs to be readlocked!
|
// the outside, the clipping needs to be readlocked!
|
||||||
@@ -248,7 +248,7 @@ WindowLayer::GetContentRegion(BRegion* region)
|
|||||||
|
|
||||||
|
|
||||||
BRegion&
|
BRegion&
|
||||||
WindowLayer::VisibleContentRegion()
|
Window::VisibleContentRegion()
|
||||||
{
|
{
|
||||||
// TODO: if someone needs to call this from
|
// TODO: if someone needs to call this from
|
||||||
// the outside, the clipping needs to be readlocked!
|
// the outside, the clipping needs to be readlocked!
|
||||||
@@ -266,7 +266,7 @@ WindowLayer::VisibleContentRegion()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::_PropagatePosition()
|
Window::_PropagatePosition()
|
||||||
{
|
{
|
||||||
if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) == 0)
|
if ((fFlags & B_SAME_POSITION_IN_ALL_WORKSPACES) == 0)
|
||||||
return;
|
return;
|
||||||
@@ -278,7 +278,7 @@ WindowLayer::_PropagatePosition()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MoveBy(int32 x, int32 y)
|
Window::MoveBy(int32 x, int32 y)
|
||||||
{
|
{
|
||||||
// this function is only called from the desktop thread
|
// this function is only called from the desktop thread
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ WindowLayer::MoveBy(int32 x, int32 y)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
Window::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
||||||
{
|
{
|
||||||
// this function is only called from the desktop thread
|
// this function is only called from the desktop thread
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy)
|
Window::ScrollViewBy(View* view, int32 dx, int32 dy)
|
||||||
{
|
{
|
||||||
// this is executed in ServerWindow with the Readlock
|
// this is executed in ServerWindow with the Readlock
|
||||||
// held
|
// held
|
||||||
@@ -413,7 +413,7 @@ WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy)
|
|||||||
|
|
||||||
//! Takes care of invalidating parts that could not be copied
|
//! Takes care of invalidating parts that could not be copied
|
||||||
void
|
void
|
||||||
WindowLayer::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
||||||
{
|
{
|
||||||
// executed in ServerWindow thread with the read lock held
|
// executed in ServerWindow thread with the read lock held
|
||||||
if (!IsVisible())
|
if (!IsVisible())
|
||||||
@@ -485,7 +485,7 @@ WindowLayer::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetTopLayer(ViewLayer* topLayer)
|
Window::SetTopLayer(View* topLayer)
|
||||||
{
|
{
|
||||||
fTopLayer = topLayer;
|
fTopLayer = topLayer;
|
||||||
|
|
||||||
@@ -509,29 +509,29 @@ WindowLayer::SetTopLayer(ViewLayer* topLayer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewLayer*
|
View*
|
||||||
WindowLayer::ViewAt(const BPoint& where)
|
Window::ViewAt(const BPoint& where)
|
||||||
{
|
{
|
||||||
return fTopLayer->ViewAt(where);
|
return fTopLayer->ViewAt(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window_anchor&
|
window_anchor&
|
||||||
WindowLayer::Anchor(int32 index)
|
Window::Anchor(int32 index)
|
||||||
{
|
{
|
||||||
return fAnchor[index];
|
return fAnchor[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer*
|
Window*
|
||||||
WindowLayer::NextWindow(int32 index) const
|
Window::NextWindow(int32 index) const
|
||||||
{
|
{
|
||||||
return fAnchor[index].next;
|
return fAnchor[index].next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer*
|
Window*
|
||||||
WindowLayer::PreviousWindow(int32 index) const
|
Window::PreviousWindow(int32 index) const
|
||||||
{
|
{
|
||||||
return fAnchor[index].previous;
|
return fAnchor[index].previous;
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ WindowLayer::PreviousWindow(int32 index) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region)
|
Window::GetEffectiveDrawingRegion(View* layer, BRegion& region)
|
||||||
{
|
{
|
||||||
if (!fEffectiveDrawingRegionValid) {
|
if (!fEffectiveDrawingRegionValid) {
|
||||||
fEffectiveDrawingRegion = VisibleContentRegion();
|
fEffectiveDrawingRegion = VisibleContentRegion();
|
||||||
@@ -554,7 +554,7 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region)
|
|||||||
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion());
|
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession->DirtyRegion());
|
||||||
} else {
|
} else {
|
||||||
// not in update, the view can draw everywhere
|
// not in update, the view can draw everywhere
|
||||||
//printf("WindowLayer(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name());
|
//printf("Window(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name());
|
||||||
}
|
}
|
||||||
|
|
||||||
fEffectiveDrawingRegionValid = true;
|
fEffectiveDrawingRegionValid = true;
|
||||||
@@ -574,14 +574,14 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::DrawingRegionChanged(ViewLayer* layer) const
|
Window::DrawingRegionChanged(View* layer) const
|
||||||
{
|
{
|
||||||
return !fEffectiveDrawingRegionValid || !layer->IsScreenClippingValid();
|
return !fEffectiveDrawingRegionValid || !layer->IsScreenClippingValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::ProcessDirtyRegion(BRegion& region)
|
Window::ProcessDirtyRegion(BRegion& region)
|
||||||
{
|
{
|
||||||
// if this is exectuted in the desktop thread,
|
// if this is exectuted in the desktop thread,
|
||||||
// it means that the window thread currently
|
// it means that the window thread currently
|
||||||
@@ -610,7 +610,7 @@ WindowLayer::ProcessDirtyRegion(BRegion& region)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::RedrawDirtyRegion()
|
Window::RedrawDirtyRegion()
|
||||||
{
|
{
|
||||||
// executed from ServerWindow with the read lock held
|
// executed from ServerWindow with the read lock held
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ WindowLayer::RedrawDirtyRegion()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MarkDirty(BRegion& regionOnScreen)
|
Window::MarkDirty(BRegion& regionOnScreen)
|
||||||
{
|
{
|
||||||
// for marking any part of the desktop dirty
|
// for marking any part of the desktop dirty
|
||||||
// this will get write access to the global
|
// this will get write access to the global
|
||||||
@@ -651,7 +651,7 @@ WindowLayer::MarkDirty(BRegion& regionOnScreen)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MarkContentDirty(BRegion& regionOnScreen)
|
Window::MarkContentDirty(BRegion& regionOnScreen)
|
||||||
{
|
{
|
||||||
// for triggering AS_REDRAW
|
// for triggering AS_REDRAW
|
||||||
// since this won't affect other windows, read locking
|
// since this won't affect other windows, read locking
|
||||||
@@ -667,7 +667,7 @@ WindowLayer::MarkContentDirty(BRegion& regionOnScreen)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MarkContentDirtyAsync(BRegion& regionOnScreen)
|
Window::MarkContentDirtyAsync(BRegion& regionOnScreen)
|
||||||
{
|
{
|
||||||
// NOTE: see comments in ProcessDirtyRegion()
|
// NOTE: see comments in ProcessDirtyRegion()
|
||||||
if (fHidden)
|
if (fHidden)
|
||||||
@@ -685,7 +685,7 @@ WindowLayer::MarkContentDirtyAsync(BRegion& regionOnScreen)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion)
|
Window::InvalidateView(View* layer, BRegion& layerRegion)
|
||||||
{
|
{
|
||||||
if (layer && IsVisible() && layer->IsVisible()) {
|
if (layer && IsVisible() && layer->IsVisible()) {
|
||||||
|
|
||||||
@@ -707,7 +707,7 @@ WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion)
|
|||||||
|
|
||||||
// DisableUpdateRequests
|
// DisableUpdateRequests
|
||||||
void
|
void
|
||||||
WindowLayer::DisableUpdateRequests()
|
Window::DisableUpdateRequests()
|
||||||
{
|
{
|
||||||
fUpdatesEnabled = false;
|
fUpdatesEnabled = false;
|
||||||
}
|
}
|
||||||
@@ -715,7 +715,7 @@ WindowLayer::DisableUpdateRequests()
|
|||||||
|
|
||||||
// EnableUpdateRequests
|
// EnableUpdateRequests
|
||||||
void
|
void
|
||||||
WindowLayer::EnableUpdateRequests()
|
Window::EnableUpdateRequests()
|
||||||
{
|
{
|
||||||
fUpdatesEnabled = true;
|
fUpdatesEnabled = true;
|
||||||
if (!fUpdateRequested && fPendingUpdateSession->IsUsed())
|
if (!fUpdateRequested && fPendingUpdateSession->IsUsed())
|
||||||
@@ -726,15 +726,15 @@ WindowLayer::EnableUpdateRequests()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
||||||
{
|
{
|
||||||
// TODO: move into Decorator
|
// TODO: move into Decorator
|
||||||
if (!fBorderRegionValid)
|
if (!fBorderRegionValid)
|
||||||
GetBorderRegion(&fBorderRegion);
|
GetBorderRegion(&fBorderRegion);
|
||||||
|
|
||||||
// default action is to drag the WindowLayer
|
// default action is to drag the Window
|
||||||
if (fBorderRegion.Contains(where)) {
|
if (fBorderRegion.Contains(where)) {
|
||||||
// clicking WindowLayer visible area
|
// clicking Window visible area
|
||||||
|
|
||||||
click_type action = DEC_DRAG;
|
click_type action = DEC_DRAG;
|
||||||
|
|
||||||
@@ -830,11 +830,11 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// click was inside the window contents
|
// click was inside the window contents
|
||||||
if (ViewLayer* view = ViewAt(where)) {
|
if (View* view = ViewAt(where)) {
|
||||||
if (HasModal())
|
if (HasModal())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// clicking a simple ViewLayer
|
// clicking a simple View
|
||||||
if (!IsFocus()) {
|
if (!IsFocus()) {
|
||||||
DesktopSettings desktopSettings(fDesktop);
|
DesktopSettings desktopSettings(fDesktop);
|
||||||
|
|
||||||
@@ -864,7 +864,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
||||||
{
|
{
|
||||||
bool invalidate = false;
|
bool invalidate = false;
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
@@ -924,7 +924,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
fIsResizing = false;
|
fIsResizing = false;
|
||||||
fIsSlidingTab = false;
|
fIsSlidingTab = false;
|
||||||
|
|
||||||
if (ViewLayer* view = ViewAt(where)) {
|
if (View* view = ViewAt(where)) {
|
||||||
if (HasModal())
|
if (HasModal())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -935,7 +935,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
Window::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
||||||
bool isLatestMouseMoved)
|
bool isLatestMouseMoved)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
@@ -949,7 +949,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ViewLayer* view = ViewAt(where);
|
View* view = ViewAt(where);
|
||||||
if (view != NULL)
|
if (view != NULL)
|
||||||
*_viewToken = view->Token();
|
*_viewToken = view->Token();
|
||||||
|
|
||||||
@@ -1070,7 +1070,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::WorkspaceActivated(int32 index, bool active)
|
Window::WorkspaceActivated(int32 index, bool active)
|
||||||
{
|
{
|
||||||
if (!active)
|
if (!active)
|
||||||
fWindow->HandleDirectConnection(B_DIRECT_STOP);
|
fWindow->HandleDirectConnection(B_DIRECT_STOP);
|
||||||
@@ -1088,7 +1088,7 @@ WindowLayer::WorkspaceActivated(int32 index, bool active)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
|
Window::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
|
||||||
{
|
{
|
||||||
fWorkspaces = newWorkspaces;
|
fWorkspaces = newWorkspaces;
|
||||||
|
|
||||||
@@ -1102,7 +1102,7 @@ WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::Activated(bool active)
|
Window::Activated(bool active)
|
||||||
{
|
{
|
||||||
BMessage msg(B_WINDOW_ACTIVATED);
|
BMessage msg(B_WINDOW_ACTIVATED);
|
||||||
msg.AddBool("active", active);
|
msg.AddBool("active", active);
|
||||||
@@ -1114,7 +1114,7 @@ WindowLayer::Activated(bool active)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetTitle(const char* name, BRegion& dirty)
|
Window::SetTitle(const char* name, BRegion& dirty)
|
||||||
{
|
{
|
||||||
// rebuild the clipping for the title area
|
// rebuild the clipping for the title area
|
||||||
// and redraw it.
|
// and redraw it.
|
||||||
@@ -1131,7 +1131,7 @@ WindowLayer::SetTitle(const char* name, BRegion& dirty)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetFocus(bool focus)
|
Window::SetFocus(bool focus)
|
||||||
{
|
{
|
||||||
// executed from Desktop thread
|
// executed from Desktop thread
|
||||||
// it holds the clipping write lock,
|
// it holds the clipping write lock,
|
||||||
@@ -1154,7 +1154,7 @@ WindowLayer::SetFocus(bool focus)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetHidden(bool hidden)
|
Window::SetHidden(bool hidden)
|
||||||
{
|
{
|
||||||
// the desktop takes care of dirty regions
|
// the desktop takes care of dirty regions
|
||||||
if (fHidden != hidden) {
|
if (fHidden != hidden) {
|
||||||
@@ -1168,7 +1168,7 @@ WindowLayer::SetHidden(bool hidden)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetMinimized(bool minimized)
|
Window::SetMinimized(bool minimized)
|
||||||
{
|
{
|
||||||
if (minimized == fMinimized)
|
if (minimized == fMinimized)
|
||||||
return;
|
return;
|
||||||
@@ -1178,7 +1178,7 @@ WindowLayer::SetMinimized(bool minimized)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsVisible() const
|
Window::IsVisible() const
|
||||||
{
|
{
|
||||||
if (IsOffscreenWindow())
|
if (IsOffscreenWindow())
|
||||||
return true;
|
return true;
|
||||||
@@ -1195,7 +1195,7 @@ WindowLayer::IsVisible() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetSizeLimits(int32 minWidth, int32 maxWidth,
|
Window::SetSizeLimits(int32 minWidth, int32 maxWidth,
|
||||||
int32 minHeight, int32 maxHeight)
|
int32 minHeight, int32 maxHeight)
|
||||||
{
|
{
|
||||||
if (minWidth < 0)
|
if (minWidth < 0)
|
||||||
@@ -1220,7 +1220,7 @@ WindowLayer::SetSizeLimits(int32 minWidth, int32 maxWidth,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::GetSizeLimits(int32* minWidth, int32* maxWidth,
|
Window::GetSizeLimits(int32* minWidth, int32* maxWidth,
|
||||||
int32* minHeight, int32* maxHeight) const
|
int32* minHeight, int32* maxHeight) const
|
||||||
{
|
{
|
||||||
*minWidth = fMinWidth;
|
*minWidth = fMinWidth;
|
||||||
@@ -1231,7 +1231,7 @@ WindowLayer::GetSizeLimits(int32* minWidth, int32* maxWidth,
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::SetTabLocation(float location, BRegion& dirty)
|
Window::SetTabLocation(float location, BRegion& dirty)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
@@ -1244,7 +1244,7 @@ WindowLayer::SetTabLocation(float location, BRegion& dirty)
|
|||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
WindowLayer::TabLocation() const
|
Window::TabLocation() const
|
||||||
{
|
{
|
||||||
if (fDecorator)
|
if (fDecorator)
|
||||||
return fDecorator->TabLocation();
|
return fDecorator->TabLocation();
|
||||||
@@ -1253,7 +1253,7 @@ WindowLayer::TabLocation() const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::SetDecoratorSettings(const BMessage& settings, BRegion& dirty)
|
Window::SetDecoratorSettings(const BMessage& settings, BRegion& dirty)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
@@ -1266,7 +1266,7 @@ WindowLayer::SetDecoratorSettings(const BMessage& settings, BRegion& dirty)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::GetDecoratorSettings(BMessage* settings)
|
Window::GetDecoratorSettings(BMessage* settings)
|
||||||
{
|
{
|
||||||
if (fDecorator)
|
if (fDecorator)
|
||||||
return fDecorator->GetSettings(settings);
|
return fDecorator->GetSettings(settings);
|
||||||
@@ -1276,7 +1276,7 @@ WindowLayer::GetDecoratorSettings(BMessage* settings)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetLook(window_look look, BRegion* updateRegion)
|
Window::SetLook(window_look look, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
|
if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
|
||||||
// we need a new decorator
|
// we need a new decorator
|
||||||
@@ -1314,7 +1314,7 @@ WindowLayer::SetLook(window_look look, BRegion* updateRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetFeel(window_feel feel)
|
Window::SetFeel(window_feel feel)
|
||||||
{
|
{
|
||||||
// if the subset list is no longer needed, clear it
|
// if the subset list is no longer needed, clear it
|
||||||
if ((fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_FLOATING_SUBSET_WINDOW_FEEL)
|
if ((fFeel == B_MODAL_SUBSET_WINDOW_FEEL || fFeel == B_FLOATING_SUBSET_WINDOW_FEEL)
|
||||||
@@ -1336,7 +1336,7 @@ WindowLayer::SetFeel(window_feel feel)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion)
|
Window::SetFlags(uint32 flags, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
fOriginalFlags = flags;
|
fOriginalFlags = flags;
|
||||||
fFlags = flags & ValidWindowFlags(fFeel);
|
fFlags = flags & ValidWindowFlags(fFeel);
|
||||||
@@ -1366,14 +1366,14 @@ WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
specified \a index.
|
specified \a index.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::InWorkspace(int32 index) const
|
Window::InWorkspace(int32 index) const
|
||||||
{
|
{
|
||||||
return (fWorkspaces & (1UL << index)) != 0;
|
return (fWorkspaces & (1UL << index)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::SupportsFront()
|
Window::SupportsFront()
|
||||||
{
|
{
|
||||||
if (fFeel == kDesktopWindowFeel
|
if (fFeel == kDesktopWindowFeel
|
||||||
|| fFeel == kMenuWindowFeel
|
|| fFeel == kMenuWindowFeel
|
||||||
@@ -1385,30 +1385,30 @@ WindowLayer::SupportsFront()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsModal() const
|
Window::IsModal() const
|
||||||
{
|
{
|
||||||
return IsModalFeel(fFeel);
|
return IsModalFeel(fFeel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsFloating() const
|
Window::IsFloating() const
|
||||||
{
|
{
|
||||||
return IsFloatingFeel(fFeel);
|
return IsFloatingFeel(fFeel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsNormal() const
|
Window::IsNormal() const
|
||||||
{
|
{
|
||||||
return !IsFloatingFeel(fFeel) && !IsModalFeel(fFeel);
|
return !IsFloatingFeel(fFeel) && !IsModalFeel(fFeel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::HasModal() const
|
Window::HasModal() const
|
||||||
{
|
{
|
||||||
for (WindowLayer* window = NextWindow(fCurrentWorkspace); window != NULL;
|
for (Window* window = NextWindow(fCurrentWorkspace); window != NULL;
|
||||||
window = window->NextWindow(fCurrentWorkspace)) {
|
window = window->NextWindow(fCurrentWorkspace)) {
|
||||||
if (window->IsHidden() || !window->IsModal())
|
if (window->IsHidden() || !window->IsModal())
|
||||||
continue;
|
continue;
|
||||||
@@ -1425,8 +1425,8 @@ WindowLayer::HasModal() const
|
|||||||
this window can get.
|
this window can get.
|
||||||
Returns NULL is this window can be the backmost window.
|
Returns NULL is this window can be the backmost window.
|
||||||
*/
|
*/
|
||||||
WindowLayer*
|
Window*
|
||||||
WindowLayer::Backmost(WindowLayer* window, int32 workspace)
|
Window::Backmost(Window* window, int32 workspace)
|
||||||
{
|
{
|
||||||
if (workspace == -1)
|
if (workspace == -1)
|
||||||
workspace = fCurrentWorkspace;
|
workspace = fCurrentWorkspace;
|
||||||
@@ -1454,8 +1454,8 @@ WindowLayer::Backmost(WindowLayer* window, int32 workspace)
|
|||||||
this window can get.
|
this window can get.
|
||||||
Returns NULL if this window can be the frontmost window.
|
Returns NULL if this window can be the frontmost window.
|
||||||
*/
|
*/
|
||||||
WindowLayer*
|
Window*
|
||||||
WindowLayer::Frontmost(WindowLayer* first, int32 workspace)
|
Window::Frontmost(Window* first, int32 workspace)
|
||||||
{
|
{
|
||||||
if (workspace == -1)
|
if (workspace == -1)
|
||||||
workspace = fCurrentWorkspace;
|
workspace = fCurrentWorkspace;
|
||||||
@@ -1466,7 +1466,7 @@ WindowLayer::Frontmost(WindowLayer* first, int32 workspace)
|
|||||||
if (first == NULL)
|
if (first == NULL)
|
||||||
first = NextWindow(workspace);
|
first = NextWindow(workspace);
|
||||||
|
|
||||||
for (WindowLayer* window = first; window != NULL;
|
for (Window* window = first; window != NULL;
|
||||||
window = window->NextWindow(workspace)) {
|
window = window->NextWindow(workspace)) {
|
||||||
if (window->IsHidden() || window == this)
|
if (window->IsHidden() || window == this)
|
||||||
continue;
|
continue;
|
||||||
@@ -1480,21 +1480,21 @@ WindowLayer::Frontmost(WindowLayer* first, int32 workspace)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::AddToSubset(WindowLayer* window)
|
Window::AddToSubset(Window* window)
|
||||||
{
|
{
|
||||||
return fSubsets.AddItem(window);
|
return fSubsets.AddItem(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::RemoveFromSubset(WindowLayer* window)
|
Window::RemoveFromSubset(Window* window)
|
||||||
{
|
{
|
||||||
fSubsets.RemoveItem(window);
|
fSubsets.RemoveItem(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::HasInSubset(const WindowLayer* window) const
|
Window::HasInSubset(const Window* window) const
|
||||||
{
|
{
|
||||||
if (window == NULL || fFeel == window->Feel()
|
if (window == NULL || fFeel == window->Feel()
|
||||||
|| fFeel == B_NORMAL_WINDOW_FEEL)
|
|| fFeel == B_NORMAL_WINDOW_FEEL)
|
||||||
@@ -1531,11 +1531,10 @@ WindowLayer::HasInSubset(const WindowLayer* window) const
|
|||||||
/*! \brief Collects all workspaces views in this window and puts it into \a list
|
/*! \brief Collects all workspaces views in this window and puts it into \a list
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WindowLayer::FindWorkspacesViews(BObjectList<WorkspacesLayer>& list) const
|
Window::FindWorkspacesViews(BObjectList<WorkspacesView>& list) const
|
||||||
{
|
{
|
||||||
int32 count = fWorkspacesViewCount;
|
int32 count = fWorkspacesViewCount;
|
||||||
TopLayer()->FindViews(kWorkspacesViewFlag, (BObjectList<ViewLayer>&)list,
|
fTopLayer->FindViews(kWorkspacesViewFlag, (BObjectList<View>&)list, count);
|
||||||
count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1546,14 +1545,14 @@ WindowLayer::FindWorkspacesViews(BObjectList<WorkspacesLayer>& list) const
|
|||||||
to have a subset as front window to be visible.
|
to have a subset as front window to be visible.
|
||||||
*/
|
*/
|
||||||
uint32
|
uint32
|
||||||
WindowLayer::SubsetWorkspaces() const
|
Window::SubsetWorkspaces() const
|
||||||
{
|
{
|
||||||
if (fFeel == B_MODAL_ALL_WINDOW_FEEL
|
if (fFeel == B_MODAL_ALL_WINDOW_FEEL
|
||||||
|| fFeel == B_FLOATING_ALL_WINDOW_FEEL)
|
|| fFeel == B_FLOATING_ALL_WINDOW_FEEL)
|
||||||
return B_ALL_WORKSPACES;
|
return B_ALL_WORKSPACES;
|
||||||
|
|
||||||
if (fFeel == B_FLOATING_APP_WINDOW_FEEL) {
|
if (fFeel == B_FLOATING_APP_WINDOW_FEEL) {
|
||||||
WindowLayer* front = fDesktop->FrontWindow();
|
Window* front = fDesktop->FrontWindow();
|
||||||
if (front != NULL && front->IsNormal()
|
if (front != NULL && front->IsNormal()
|
||||||
&& front->ServerWindow()->App() == ServerWindow()->App())
|
&& front->ServerWindow()->App() == ServerWindow()->App())
|
||||||
return ServerWindow()->App()->Workspaces();
|
return ServerWindow()->App()->Workspaces();
|
||||||
@@ -1577,7 +1576,7 @@ WindowLayer::SubsetWorkspaces() const
|
|||||||
uint32 workspaces = 0;
|
uint32 workspaces = 0;
|
||||||
bool hasNormalFront = false;
|
bool hasNormalFront = false;
|
||||||
for (int32 i = 0; i < fSubsets.CountItems(); i++) {
|
for (int32 i = 0; i < fSubsets.CountItems(); i++) {
|
||||||
WindowLayer* window = fSubsets.ItemAt(i);
|
Window* window = fSubsets.ItemAt(i);
|
||||||
|
|
||||||
if (!window->IsHidden())
|
if (!window->IsHidden())
|
||||||
workspaces |= window->Workspaces();
|
workspaces |= window->Workspaces();
|
||||||
@@ -1600,7 +1599,7 @@ WindowLayer::SubsetWorkspaces() const
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsValidLook(window_look look)
|
Window::IsValidLook(window_look look)
|
||||||
{
|
{
|
||||||
return look == B_TITLED_WINDOW_LOOK
|
return look == B_TITLED_WINDOW_LOOK
|
||||||
|| look == B_DOCUMENT_WINDOW_LOOK
|
|| look == B_DOCUMENT_WINDOW_LOOK
|
||||||
@@ -1615,7 +1614,7 @@ WindowLayer::IsValidLook(window_look look)
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsValidFeel(window_feel feel)
|
Window::IsValidFeel(window_feel feel)
|
||||||
{
|
{
|
||||||
return feel == B_NORMAL_WINDOW_FEEL
|
return feel == B_NORMAL_WINDOW_FEEL
|
||||||
|| feel == B_MODAL_SUBSET_WINDOW_FEEL
|
|| feel == B_MODAL_SUBSET_WINDOW_FEEL
|
||||||
@@ -1632,7 +1631,7 @@ WindowLayer::IsValidFeel(window_feel feel)
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsModalFeel(window_feel feel)
|
Window::IsModalFeel(window_feel feel)
|
||||||
{
|
{
|
||||||
return feel == B_MODAL_SUBSET_WINDOW_FEEL
|
return feel == B_MODAL_SUBSET_WINDOW_FEEL
|
||||||
|| feel == B_MODAL_APP_WINDOW_FEEL
|
|| feel == B_MODAL_APP_WINDOW_FEEL
|
||||||
@@ -1642,7 +1641,7 @@ WindowLayer::IsModalFeel(window_feel feel)
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
bool
|
bool
|
||||||
WindowLayer::IsFloatingFeel(window_feel feel)
|
Window::IsFloatingFeel(window_feel feel)
|
||||||
{
|
{
|
||||||
return feel == B_FLOATING_SUBSET_WINDOW_FEEL
|
return feel == B_FLOATING_SUBSET_WINDOW_FEEL
|
||||||
|| feel == B_FLOATING_APP_WINDOW_FEEL
|
|| feel == B_FLOATING_APP_WINDOW_FEEL
|
||||||
@@ -1652,7 +1651,7 @@ WindowLayer::IsFloatingFeel(window_feel feel)
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
uint32
|
uint32
|
||||||
WindowLayer::ValidWindowFlags()
|
Window::ValidWindowFlags()
|
||||||
{
|
{
|
||||||
return B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
|
return B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
|
||||||
| B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
| B_NOT_MINIMIZABLE | B_NOT_RESIZABLE
|
||||||
@@ -1671,7 +1670,7 @@ WindowLayer::ValidWindowFlags()
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
uint32
|
uint32
|
||||||
WindowLayer::ValidWindowFlags(window_feel feel)
|
Window::ValidWindowFlags(window_feel feel)
|
||||||
{
|
{
|
||||||
uint32 flags = ValidWindowFlags();
|
uint32 flags = ValidWindowFlags();
|
||||||
if (IsModalFeel(feel))
|
if (IsModalFeel(feel))
|
||||||
@@ -1686,7 +1685,7 @@ WindowLayer::ValidWindowFlags(window_feel feel)
|
|||||||
|
|
||||||
// _ShiftPartOfRegion
|
// _ShiftPartOfRegion
|
||||||
void
|
void
|
||||||
WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
Window::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
||||||
int32 xOffset, int32 yOffset)
|
int32 xOffset, int32 yOffset)
|
||||||
{
|
{
|
||||||
BRegion* common = fRegionPool.GetRegion(*regionToShift);
|
BRegion* common = fRegionPool.GetRegion(*regionToShift);
|
||||||
@@ -1706,7 +1705,7 @@ WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion)
|
Window::_TriggerContentRedraw(BRegion& dirtyContentRegion)
|
||||||
{
|
{
|
||||||
if (IsVisible() && dirtyContentRegion.CountRects() > 0) {
|
if (IsVisible() && dirtyContentRegion.CountRects() > 0) {
|
||||||
// put this into the pending dirty region
|
// put this into the pending dirty region
|
||||||
@@ -1742,7 +1741,7 @@ WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::_DrawBorder()
|
Window::_DrawBorder()
|
||||||
{
|
{
|
||||||
// this is executed in the window thread, but only
|
// this is executed in the window thread, but only
|
||||||
// in respond to a REDRAW message having been received, the
|
// in respond to a REDRAW message having been received, the
|
||||||
@@ -1790,7 +1789,7 @@ fWindow->ResyncDrawState();
|
|||||||
the clipping lock held
|
the clipping lock held
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WindowLayer::_TransferToUpdateSession(BRegion* contentDirtyRegion)
|
Window::_TransferToUpdateSession(BRegion* contentDirtyRegion)
|
||||||
{
|
{
|
||||||
if (contentDirtyRegion->CountRects() <= 0)
|
if (contentDirtyRegion->CountRects() <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -1832,7 +1831,7 @@ WindowLayer::_TransferToUpdateSession(BRegion* contentDirtyRegion)
|
|||||||
|
|
||||||
// _SendUpdateMessage
|
// _SendUpdateMessage
|
||||||
void
|
void
|
||||||
WindowLayer::_SendUpdateMessage()
|
Window::_SendUpdateMessage()
|
||||||
{
|
{
|
||||||
if (!fUpdatesEnabled)
|
if (!fUpdatesEnabled)
|
||||||
return;
|
return;
|
||||||
@@ -1846,11 +1845,11 @@ WindowLayer::_SendUpdateMessage()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::BeginUpdate(BPrivate::PortLink& link)
|
Window::BeginUpdate(BPrivate::PortLink& link)
|
||||||
{
|
{
|
||||||
// NOTE: since we might "shift" parts of the
|
// NOTE: since we might "shift" parts of the
|
||||||
// internal dirty regions from the desktop thread
|
// internal dirty regions from the desktop thread
|
||||||
// in response to WindowLayer::ResizeBy(), which
|
// in response to Window::ResizeBy(), which
|
||||||
// might move arround views, the user of this function
|
// might move arround views, the user of this function
|
||||||
// needs to hold the global clipping lock so that the internal
|
// needs to hold the global clipping lock so that the internal
|
||||||
// dirty regions are not messed with from the Desktop thread
|
// dirty regions are not messed with from the Desktop thread
|
||||||
@@ -1872,7 +1871,7 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link)
|
|||||||
// TODO: each view could be drawn individually
|
// TODO: each view could be drawn individually
|
||||||
// right before carrying out the first drawing
|
// right before carrying out the first drawing
|
||||||
// command from the client during an update
|
// command from the client during an update
|
||||||
// (ViewLayer::IsBackgroundDirty() can be used
|
// (View::IsBackgroundDirty() can be used
|
||||||
// for this)
|
// for this)
|
||||||
if (!fContentRegionValid)
|
if (!fContentRegionValid)
|
||||||
_UpdateContentRegion();
|
_UpdateContentRegion();
|
||||||
@@ -1928,13 +1927,13 @@ WindowLayer::BeginUpdate(BPrivate::PortLink& link)
|
|||||||
printf("BeginUpdate() but no update requested!!\n");
|
printf("BeginUpdate() but no update requested!!\n");
|
||||||
link.StartMessage(B_ERROR);
|
link.StartMessage(B_ERROR);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
fprintf(stderr, "WindowLayer::BeginUpdate() - no update requested!\n");
|
fprintf(stderr, "Window::BeginUpdate() - no update requested!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::EndUpdate()
|
Window::EndUpdate()
|
||||||
{
|
{
|
||||||
// NOTE: see comment in _BeginUpdate()
|
// NOTE: see comment in _BeginUpdate()
|
||||||
|
|
||||||
@@ -1954,7 +1953,7 @@ WindowLayer::EndUpdate()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::_UpdateContentRegion()
|
Window::_UpdateContentRegion()
|
||||||
{
|
{
|
||||||
fContentRegion.Set(fFrame);
|
fContentRegion.Set(fFrame);
|
||||||
|
|
||||||
@@ -1971,7 +1970,7 @@ WindowLayer::_UpdateContentRegion()
|
|||||||
|
|
||||||
|
|
||||||
click_type
|
click_type
|
||||||
WindowLayer::_ActionFor(const BMessage* msg) const
|
Window::_ActionFor(const BMessage* msg) const
|
||||||
{
|
{
|
||||||
if (fDecorator == NULL)
|
if (fDecorator == NULL)
|
||||||
return DEC_NONE;
|
return DEC_NONE;
|
||||||
@@ -1993,7 +1992,7 @@ WindowLayer::_ActionFor(const BMessage* msg) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::_ObeySizeLimits()
|
Window::_ObeySizeLimits()
|
||||||
{
|
{
|
||||||
// make sure we even have valid size limits
|
// make sure we even have valid size limits
|
||||||
if (fMaxWidth < fMinWidth)
|
if (fMaxWidth < fMinWidth)
|
||||||
@@ -2038,7 +2037,7 @@ WindowLayer::_ObeySizeLimits()
|
|||||||
// #pragma mark - UpdateSession
|
// #pragma mark - UpdateSession
|
||||||
|
|
||||||
|
|
||||||
WindowLayer::UpdateSession::UpdateSession()
|
Window::UpdateSession::UpdateSession()
|
||||||
: fDirtyRegion(),
|
: fDirtyRegion(),
|
||||||
fInUse(false),
|
fInUse(false),
|
||||||
fCause(0)
|
fCause(0)
|
||||||
@@ -2046,34 +2045,34 @@ WindowLayer::UpdateSession::UpdateSession()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowLayer::UpdateSession::~UpdateSession()
|
Window::UpdateSession::~UpdateSession()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::Include(BRegion* additionalDirty)
|
Window::UpdateSession::Include(BRegion* additionalDirty)
|
||||||
{
|
{
|
||||||
fDirtyRegion.Include(additionalDirty);
|
fDirtyRegion.Include(additionalDirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::Exclude(BRegion* dirtyInNextSession)
|
Window::UpdateSession::Exclude(BRegion* dirtyInNextSession)
|
||||||
{
|
{
|
||||||
fDirtyRegion.Exclude(dirtyInNextSession);
|
fDirtyRegion.Exclude(dirtyInNextSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::MoveBy(int32 x, int32 y)
|
Window::UpdateSession::MoveBy(int32 x, int32 y)
|
||||||
{
|
{
|
||||||
fDirtyRegion.OffsetBy(x, y);
|
fDirtyRegion.OffsetBy(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::SetUsed(bool used)
|
Window::UpdateSession::SetUsed(bool used)
|
||||||
{
|
{
|
||||||
fInUse = used;
|
fInUse = used;
|
||||||
if (!fInUse) {
|
if (!fInUse) {
|
||||||
@@ -2084,7 +2083,7 @@ WindowLayer::UpdateSession::SetUsed(bool used)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowLayer::UpdateSession::AddCause(uint8 cause)
|
Window::UpdateSession::AddCause(uint8 cause)
|
||||||
{
|
{
|
||||||
fCause |= cause;
|
fCause |= cause;
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
*/
|
*/
|
||||||
#ifndef WINDOW_LAYER_H
|
#ifndef WINDOW_H
|
||||||
#define WINDOW_LAYER_H
|
#define WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
#include "Decorator.h"
|
#include "Decorator.h"
|
||||||
#include "ViewLayer.h"
|
|
||||||
#include "RegionPool.h"
|
#include "RegionPool.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
|
#include "View.h"
|
||||||
#include "WindowList.h"
|
#include "WindowList.h"
|
||||||
|
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
@@ -31,7 +31,7 @@ class Decorator;
|
|||||||
class Desktop;
|
class Desktop;
|
||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class EventDispatcher;
|
class EventDispatcher;
|
||||||
class WorkspacesLayer;
|
class WorkspacesView;
|
||||||
|
|
||||||
// TODO: move this into a proper place
|
// TODO: move this into a proper place
|
||||||
#define AS_REDRAW 'rdrw'
|
#define AS_REDRAW 'rdrw'
|
||||||
@@ -41,22 +41,21 @@ enum {
|
|||||||
UPDATE_EXPOSE = 0x02,
|
UPDATE_EXPOSE = 0x02,
|
||||||
};
|
};
|
||||||
|
|
||||||
class WindowLayer {
|
class Window {
|
||||||
public:
|
public:
|
||||||
WindowLayer(const BRect& frame,
|
Window(const BRect& frame, const char *name,
|
||||||
const char *name, window_look look,
|
window_look look, window_feel feel,
|
||||||
window_feel feel, uint32 flags,
|
uint32 flags, uint32 workspaces,
|
||||||
uint32 workspaces,
|
::ServerWindow* window,
|
||||||
::ServerWindow* window,
|
DrawingEngine* drawingEngine);
|
||||||
DrawingEngine* drawingEngine);
|
virtual ~Window();
|
||||||
virtual ~WindowLayer();
|
|
||||||
|
|
||||||
BRect Frame() const { return fFrame; }
|
BRect Frame() const { return fFrame; }
|
||||||
const char* Title() const { return fTitle.String(); }
|
const char* Title() const { return fTitle.String(); }
|
||||||
|
|
||||||
window_anchor& Anchor(int32 index);
|
window_anchor& Anchor(int32 index);
|
||||||
WindowLayer* NextWindow(int32 index) const;
|
Window* NextWindow(int32 index) const;
|
||||||
WindowLayer* PreviousWindow(int32 index) const;
|
Window* PreviousWindow(int32 index) const;
|
||||||
|
|
||||||
::Desktop* Desktop() const { return fDesktop; }
|
::Desktop* Desktop() const { return fDesktop; }
|
||||||
::Decorator* Decorator() const { return fDecorator; }
|
::Decorator* Decorator() const { return fDecorator; }
|
||||||
@@ -71,7 +70,7 @@ public:
|
|||||||
BRegion& VisibleContentRegion();
|
BRegion& VisibleContentRegion();
|
||||||
|
|
||||||
// TODO: not protected by a lock, but noone should need this anyways
|
// TODO: not protected by a lock, but noone should need this anyways
|
||||||
// make private? when used inside WindowLayer, it has the ReadLock()
|
// make private? when used inside Window, it has the ReadLock()
|
||||||
void GetFullRegion(BRegion* region);
|
void GetFullRegion(BRegion* region);
|
||||||
void GetBorderRegion(BRegion* region);
|
void GetBorderRegion(BRegion* region);
|
||||||
void GetContentRegion(BRegion* region);
|
void GetContentRegion(BRegion* region);
|
||||||
@@ -79,18 +78,16 @@ public:
|
|||||||
void MoveBy(int32 x, int32 y);
|
void MoveBy(int32 x, int32 y);
|
||||||
void ResizeBy(int32 x, int32 y, BRegion* dirtyRegion);
|
void ResizeBy(int32 x, int32 y, BRegion* dirtyRegion);
|
||||||
|
|
||||||
void ScrollViewBy(ViewLayer* view, int32 dx, int32 dy);
|
void ScrollViewBy(View* view, int32 dx, int32 dy);
|
||||||
|
|
||||||
void SetTopLayer(ViewLayer* topLayer);
|
void SetTopLayer(View* topLayer);
|
||||||
ViewLayer* TopLayer() const { return fTopLayer; }
|
View* TopLayer() const { return fTopLayer; }
|
||||||
// TODO: only used for WorkspacesLayer, can go away if we do
|
View* ViewAt(const BPoint& where);
|
||||||
// this differently one day
|
|
||||||
ViewLayer* ViewAt(const BPoint& where);
|
|
||||||
|
|
||||||
virtual bool IsOffscreenWindow() const { return false; }
|
virtual bool IsOffscreenWindow() const { return false; }
|
||||||
|
|
||||||
void GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region);
|
void GetEffectiveDrawingRegion(View* layer, BRegion& region);
|
||||||
bool DrawingRegionChanged(ViewLayer* layer) const;
|
bool DrawingRegionChanged(View* layer) const;
|
||||||
|
|
||||||
// generic version, used by the Desktop
|
// generic version, used by the Desktop
|
||||||
void ProcessDirtyRegion(BRegion& regionOnScreen);
|
void ProcessDirtyRegion(BRegion& regionOnScreen);
|
||||||
@@ -103,7 +100,7 @@ public:
|
|||||||
void MarkContentDirty(BRegion& regionOnScreen);
|
void MarkContentDirty(BRegion& regionOnScreen);
|
||||||
void MarkContentDirtyAsync(BRegion& regionOnScreen);
|
void MarkContentDirtyAsync(BRegion& regionOnScreen);
|
||||||
// shortcut for invalidating just one view
|
// shortcut for invalidating just one view
|
||||||
void InvalidateView(ViewLayer* view, BRegion& layerRegion);
|
void InvalidateView(View* view, BRegion& layerRegion);
|
||||||
|
|
||||||
void DisableUpdateRequests();
|
void DisableUpdateRequests();
|
||||||
void EnableUpdateRequests();
|
void EnableUpdateRequests();
|
||||||
@@ -130,7 +127,7 @@ public:
|
|||||||
{ fRegionPool.Recycle(region); }
|
{ fRegionPool.Recycle(region); }
|
||||||
|
|
||||||
void CopyContents(BRegion* region,
|
void CopyContents(BRegion* region,
|
||||||
int32 xOffset, int32 yOffset);
|
int32 xOffset, int32 yOffset);
|
||||||
|
|
||||||
void MouseDown(BMessage* message, BPoint where, int32* _viewToken);
|
void MouseDown(BMessage* message, BPoint where, int32* _viewToken);
|
||||||
void MouseUp(BMessage* message, BPoint where, int32* _viewToken);
|
void MouseUp(BMessage* message, BPoint where, int32* _viewToken);
|
||||||
@@ -200,13 +197,15 @@ public:
|
|||||||
|
|
||||||
bool HasModal() const;
|
bool HasModal() const;
|
||||||
|
|
||||||
WindowLayer* Frontmost(WindowLayer* first = NULL, int32 workspace = -1);
|
Window* Frontmost(Window* first = NULL,
|
||||||
WindowLayer* Backmost(WindowLayer* first = NULL, int32 workspace = -1);
|
int32 workspace = -1);
|
||||||
|
Window* Backmost(Window* first = NULL,
|
||||||
|
int32 workspace = -1);
|
||||||
|
|
||||||
bool AddToSubset(WindowLayer* window);
|
bool AddToSubset(Window* window);
|
||||||
void RemoveFromSubset(WindowLayer* window);
|
void RemoveFromSubset(Window* window);
|
||||||
bool HasInSubset(const WindowLayer* window) const;
|
bool HasInSubset(const Window* window) const;
|
||||||
bool SameSubset(WindowLayer* window);
|
bool SameSubset(Window* window);
|
||||||
uint32 SubsetWorkspaces() const;
|
uint32 SubsetWorkspaces() const;
|
||||||
|
|
||||||
bool HasWorkspacesViews() const
|
bool HasWorkspacesViews() const
|
||||||
@@ -216,7 +215,7 @@ public:
|
|||||||
void RemoveWorkspacesView()
|
void RemoveWorkspacesView()
|
||||||
{ fWorkspacesViewCount--; }
|
{ fWorkspacesViewCount--; }
|
||||||
void FindWorkspacesViews(
|
void FindWorkspacesViews(
|
||||||
BObjectList<WorkspacesLayer>& list) const;
|
BObjectList<WorkspacesView>& list) const;
|
||||||
|
|
||||||
static bool IsValidLook(window_look look);
|
static bool IsValidLook(window_look look);
|
||||||
static bool IsValidFeel(window_feel feel);
|
static bool IsValidFeel(window_feel feel);
|
||||||
@@ -230,8 +229,9 @@ protected:
|
|||||||
friend class Desktop;
|
friend class Desktop;
|
||||||
// TODO: for now (list management)
|
// TODO: for now (list management)
|
||||||
|
|
||||||
void _ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
|
void _ShiftPartOfRegion(BRegion* region,
|
||||||
int32 xOffset, int32 yOffset);
|
BRegion* regionToShift, int32 xOffset,
|
||||||
|
int32 yOffset);
|
||||||
|
|
||||||
// different types of drawing
|
// different types of drawing
|
||||||
void _TriggerContentRedraw(BRegion& dirty);
|
void _TriggerContentRedraw(BRegion& dirty);
|
||||||
@@ -280,7 +280,7 @@ protected:
|
|||||||
|
|
||||||
::RegionPool fRegionPool;
|
::RegionPool fRegionPool;
|
||||||
|
|
||||||
BObjectList<WindowLayer> fSubsets;
|
BObjectList<Window> fSubsets;
|
||||||
|
|
||||||
// TODO: remove those some day (let the decorator handle that stuff)
|
// TODO: remove those some day (let the decorator handle that stuff)
|
||||||
bool fIsClosing : 1;
|
bool fIsClosing : 1;
|
||||||
@@ -292,7 +292,7 @@ protected:
|
|||||||
bool fActivateOnMouseUp : 1;
|
bool fActivateOnMouseUp : 1;
|
||||||
|
|
||||||
::Decorator* fDecorator;
|
::Decorator* fDecorator;
|
||||||
ViewLayer* fTopLayer;
|
View* fTopLayer;
|
||||||
::ServerWindow* fWindow;
|
::ServerWindow* fWindow;
|
||||||
DrawingEngine* fDrawingEngine;
|
DrawingEngine* fDrawingEngine;
|
||||||
::Desktop* fDesktop;
|
::Desktop* fDesktop;
|
||||||
@@ -366,4 +366,4 @@ protected:
|
|||||||
int32 fWorkspacesViewCount;
|
int32 fWorkspacesViewCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WINDOW_LAYER_H
|
#endif // WINDOW_H
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005-2006, Haiku, Inc.
|
* Copyright (c) 2005-2008, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "DesktopSettings.h"
|
#include "DesktopSettings.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
|
|
||||||
const BPoint kInvalidWindowPosition = BPoint(INFINITY, INFINITY);
|
const BPoint kInvalidWindowPosition = BPoint(INFINITY, INFINITY);
|
||||||
@@ -52,7 +52,7 @@ WindowList::SetIndex(int32 index)
|
|||||||
given, it will be inserted right before that window.
|
given, it will be inserted right before that window.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WindowList::AddWindow(WindowLayer* window, WindowLayer* before)
|
WindowList::AddWindow(Window* window, Window* before)
|
||||||
{
|
{
|
||||||
window_anchor& windowAnchor = window->Anchor(fIndex);
|
window_anchor& windowAnchor = window->Anchor(fIndex);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ WindowList::AddWindow(WindowLayer* window, WindowLayer* before)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WindowList::RemoveWindow(WindowLayer* window)
|
WindowList::RemoveWindow(Window* window)
|
||||||
{
|
{
|
||||||
window_anchor& windowAnchor = window->Anchor(fIndex);
|
window_anchor& windowAnchor = window->Anchor(fIndex);
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ WindowList::RemoveWindow(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowList::HasWindow(WindowLayer* window) const
|
WindowList::HasWindow(Window* window) const
|
||||||
{
|
{
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -13,29 +13,29 @@
|
|||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
|
|
||||||
|
|
||||||
class WindowLayer;
|
class Window;
|
||||||
|
|
||||||
|
|
||||||
class WindowList {
|
class WindowList {
|
||||||
public:
|
public:
|
||||||
WindowList(int32 index = 0);
|
WindowList(int32 index = 0);
|
||||||
~WindowList();
|
~WindowList();
|
||||||
|
|
||||||
void SetIndex(int32 index);
|
void SetIndex(int32 index);
|
||||||
int32 Index() const { return fIndex; }
|
int32 Index() const { return fIndex; }
|
||||||
|
|
||||||
WindowLayer* FirstWindow() { return fFirstWindow; }
|
Window* FirstWindow() { return fFirstWindow; }
|
||||||
WindowLayer* LastWindow() { return fLastWindow; }
|
Window* LastWindow() { return fLastWindow; }
|
||||||
|
|
||||||
void AddWindow(WindowLayer* window, WindowLayer* before = NULL);
|
void AddWindow(Window* window, Window* before = NULL);
|
||||||
void RemoveWindow(WindowLayer* window);
|
void RemoveWindow(Window* window);
|
||||||
|
|
||||||
bool HasWindow(WindowLayer* window) const;
|
bool HasWindow(Window* window) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fIndex;
|
int32 fIndex;
|
||||||
WindowLayer* fFirstWindow;
|
Window* fFirstWindow;
|
||||||
WindowLayer* fLastWindow;
|
Window* fLastWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum window_lists {
|
enum window_lists {
|
||||||
@@ -50,9 +50,9 @@ enum window_lists {
|
|||||||
struct window_anchor {
|
struct window_anchor {
|
||||||
window_anchor();
|
window_anchor();
|
||||||
|
|
||||||
WindowLayer* next;
|
Window* next;
|
||||||
WindowLayer* previous;
|
Window* previous;
|
||||||
BPoint position;
|
BPoint position;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const BPoint kInvalidWindowPosition;
|
extern const BPoint kInvalidWindowPosition;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2007, Haiku.
|
* Copyright 2005-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
#include "WorkspacePrivate.h"
|
#include "WorkspacePrivate.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -116,7 +116,7 @@ Workspace::SetColor(const rgb_color& color, bool makeDefault)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Workspace::GetNextWindow(WindowLayer*& _window, BPoint& _leftTop)
|
Workspace::GetNextWindow(Window*& _window, BPoint& _leftTop)
|
||||||
{
|
{
|
||||||
if (fCurrent == NULL)
|
if (fCurrent == NULL)
|
||||||
fCurrent = fWorkspace.Windows().FirstWindow();
|
fCurrent = fWorkspace.Windows().FirstWindow();
|
||||||
@@ -138,7 +138,7 @@ Workspace::GetNextWindow(WindowLayer*& _window, BPoint& _leftTop)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Workspace::GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop)
|
Workspace::GetPreviousWindow(Window*& _window, BPoint& _leftTop)
|
||||||
{
|
{
|
||||||
if (fCurrent == NULL)
|
if (fCurrent == NULL)
|
||||||
fCurrent = fWorkspace.Windows().LastWindow();
|
fCurrent = fWorkspace.Windows().LastWindow();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2007, Haiku.
|
* Copyright 2005-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class Desktop;
|
class Desktop;
|
||||||
class WindowLayer;
|
class Window;
|
||||||
|
|
||||||
|
|
||||||
class Workspace {
|
class Workspace {
|
||||||
@@ -26,8 +26,8 @@ class Workspace {
|
|||||||
bool IsCurrent() const
|
bool IsCurrent() const
|
||||||
{ return fCurrentWorkspace; }
|
{ return fCurrentWorkspace; }
|
||||||
|
|
||||||
status_t GetNextWindow(WindowLayer*& _window, BPoint& _leftTop);
|
status_t GetNextWindow(Window*& _window, BPoint& _leftTop);
|
||||||
status_t GetPreviousWindow(WindowLayer*& _window, BPoint& _leftTop);
|
status_t GetPreviousWindow(Window*& _window, BPoint& _leftTop);
|
||||||
void RewindWindows();
|
void RewindWindows();
|
||||||
|
|
||||||
class Private;
|
class Private;
|
||||||
@@ -35,7 +35,7 @@ class Workspace {
|
|||||||
private:
|
private:
|
||||||
Workspace::Private& fWorkspace;
|
Workspace::Private& fWorkspace;
|
||||||
Desktop& fDesktop;
|
Desktop& fDesktop;
|
||||||
WindowLayer* fCurrent;
|
Window* fCurrent;
|
||||||
bool fCurrentWorkspace;
|
bool fCurrentWorkspace;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Haiku.
|
* Copyright 2005-2008, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -51,8 +51,8 @@ class Workspace::Private {
|
|||||||
void _SetDefaults();
|
void _SetDefaults();
|
||||||
|
|
||||||
WindowList fWindows;
|
WindowList fWindows;
|
||||||
WindowLayer* fFront;
|
Window* fFront;
|
||||||
WindowLayer* fFocus;
|
Window* fFocus;
|
||||||
|
|
||||||
BObjectList<display_info> fDisplays;
|
BObjectList<display_info> fDisplays;
|
||||||
|
|
||||||
|
|||||||
@@ -8,20 +8,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "WorkspacesLayer.h"
|
#include "WorkspacesView.h"
|
||||||
|
|
||||||
#include "AppServer.h"
|
#include "AppServer.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
#include "WindowLayer.h"
|
#include "Window.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
|
|
||||||
#include <WindowPrivate.h>
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
|
|
||||||
WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset,
|
WorkspacesView::WorkspacesView(BRect frame, BPoint scrollingOffset,
|
||||||
const char* name, int32 token, uint32 resizeMode, uint32 flags)
|
const char* name, int32 token, uint32 resizeMode, uint32 flags)
|
||||||
: ViewLayer(frame, scrollingOffset, name, token, resizeMode, flags),
|
: View(frame, scrollingOffset, name, token, resizeMode, flags),
|
||||||
fSelectedWindow(NULL),
|
fSelectedWindow(NULL),
|
||||||
fSelectedWorkspace(-1),
|
fSelectedWorkspace(-1),
|
||||||
fHasMoved(false)
|
fHasMoved(false)
|
||||||
@@ -31,15 +31,15 @@ WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkspacesLayer::~WorkspacesLayer()
|
WorkspacesView::~WorkspacesView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::AttachedToWindow(WindowLayer* window)
|
WorkspacesView::AttachedToWindow(::Window* window)
|
||||||
{
|
{
|
||||||
ViewLayer::AttachedToWindow(window);
|
View::AttachedToWindow(window);
|
||||||
|
|
||||||
window->AddWorkspacesView();
|
window->AddWorkspacesView();
|
||||||
window->Desktop()->AddWorkspacesView(this);
|
window->Desktop()->AddWorkspacesView(this);
|
||||||
@@ -47,17 +47,17 @@ WorkspacesLayer::AttachedToWindow(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::DetachedFromWindow()
|
WorkspacesView::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
fWindow->Desktop()->RemoveWorkspacesView(this);
|
fWindow->Desktop()->RemoveWorkspacesView(this);
|
||||||
fWindow->RemoveWorkspacesView();
|
fWindow->RemoveWorkspacesView();
|
||||||
|
|
||||||
ViewLayer::DetachedFromWindow();
|
View::DetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_GetGrid(int32& columns, int32& rows)
|
WorkspacesView::_GetGrid(int32& columns, int32& rows)
|
||||||
{
|
{
|
||||||
DesktopSettings settings(Window()->Desktop());
|
DesktopSettings settings(Window()->Desktop());
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ WorkspacesLayer::_GetGrid(int32& columns, int32& rows)
|
|||||||
\brief Returns the frame of the screen for the specified workspace.
|
\brief Returns the frame of the screen for the specified workspace.
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
WorkspacesLayer::_ScreenFrame(int32 i)
|
WorkspacesView::_ScreenFrame(int32 i)
|
||||||
{
|
{
|
||||||
return Window()->Desktop()->VirtualScreen().Frame();
|
return Window()->Desktop()->VirtualScreen().Frame();
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ WorkspacesLayer::_ScreenFrame(int32 i)
|
|||||||
workspaces layer.
|
workspaces layer.
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
WorkspacesLayer::_WorkspaceAt(int32 i)
|
WorkspacesView::_WorkspaceAt(int32 i)
|
||||||
{
|
{
|
||||||
int32 columns, rows;
|
int32 columns, rows;
|
||||||
_GetGrid(columns, rows);
|
_GetGrid(columns, rows);
|
||||||
@@ -126,7 +126,7 @@ WorkspacesLayer::_WorkspaceAt(int32 i)
|
|||||||
an empty rectangle is returned, and \a index is set to -1.
|
an empty rectangle is returned, and \a index is set to -1.
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
WorkspacesLayer::_WorkspaceAt(BPoint where, int32& index)
|
WorkspacesView::_WorkspaceAt(BPoint where, int32& index)
|
||||||
{
|
{
|
||||||
int32 columns, rows;
|
int32 columns, rows;
|
||||||
_GetGrid(columns, rows);
|
_GetGrid(columns, rows);
|
||||||
@@ -143,7 +143,7 @@ WorkspacesLayer::_WorkspaceAt(BPoint where, int32& index)
|
|||||||
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
|
WorkspacesView::_WindowFrame(const BRect& workspaceFrame,
|
||||||
const BRect& screenFrame, const BRect& windowFrame,
|
const BRect& screenFrame, const BRect& windowFrame,
|
||||||
BPoint windowPosition)
|
BPoint windowPosition)
|
||||||
{
|
{
|
||||||
@@ -164,9 +164,9 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspaceFrame,
|
WorkspacesView::_DrawWindow(DrawingEngine* drawingEngine,
|
||||||
const BRect& screenFrame, WindowLayer* window, BPoint windowPosition,
|
const BRect& workspaceFrame, const BRect& screenFrame, ::Window* window,
|
||||||
BRegion& backgroundRegion, bool active)
|
BPoint windowPosition, BRegion& backgroundRegion, bool active)
|
||||||
{
|
{
|
||||||
if (window->Feel() == kDesktopWindowFeel || window->IsHidden())
|
if (window->Feel() == kDesktopWindowFeel || window->IsHidden())
|
||||||
return;
|
return;
|
||||||
@@ -226,7 +226,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
|
|||||||
// draw title
|
// draw title
|
||||||
|
|
||||||
// TODO: disabled because it's much too slow this way - the mini-window
|
// TODO: disabled because it's much too slow this way - the mini-window
|
||||||
// functionality should probably be moved into the WindowLayer class,
|
// functionality should probably be moved into the Window class,
|
||||||
// so that it has only to be recalculated on demand. With double buffered
|
// so that it has only to be recalculated on demand. With double buffered
|
||||||
// windows, this would also open up the door to have a more detailed
|
// windows, this would also open up the door to have a more detailed
|
||||||
// preview.
|
// preview.
|
||||||
@@ -252,7 +252,7 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
|
WorkspacesView::_DrawWorkspace(DrawingEngine* drawingEngine,
|
||||||
BRegion& redraw, int32 index)
|
BRegion& redraw, int32 index)
|
||||||
{
|
{
|
||||||
BRect rect = _WorkspaceAt(index);
|
BRect rect = _WorkspaceAt(index);
|
||||||
@@ -288,7 +288,7 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
|
|||||||
|
|
||||||
// We draw from top down and cut the window out of the clipping region
|
// We draw from top down and cut the window out of the clipping region
|
||||||
// which reduces the flickering
|
// which reduces the flickering
|
||||||
WindowLayer* window;
|
::Window* window;
|
||||||
BPoint leftTop;
|
BPoint leftTop;
|
||||||
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
||||||
_DrawWindow(drawingEngine, rect, screenFrame, window,
|
_DrawWindow(drawingEngine, rect, screenFrame, window,
|
||||||
@@ -303,14 +303,14 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_DarkenColor(rgb_color& color) const
|
WorkspacesView::_DarkenColor(rgb_color& color) const
|
||||||
{
|
{
|
||||||
color = tint_color(color, B_DARKEN_2_TINT);
|
color = tint_color(color, B_DARKEN_2_TINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::_Invalidate() const
|
WorkspacesView::_Invalidate() const
|
||||||
{
|
{
|
||||||
BRect frame = Bounds();
|
BRect frame = Bounds();
|
||||||
ConvertToScreen(&frame);
|
ConvertToScreen(&frame);
|
||||||
@@ -321,7 +321,7 @@ WorkspacesLayer::_Invalidate() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
WorkspacesView::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
||||||
BRegion* windowContentClipping, bool deep)
|
BRegion* windowContentClipping, bool deep)
|
||||||
{
|
{
|
||||||
// we can only draw within our own area
|
// we can only draw within our own area
|
||||||
@@ -377,7 +377,7 @@ WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::MouseDown(BMessage* message, BPoint where)
|
WorkspacesView::MouseDown(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
// reset tracking variables
|
// reset tracking variables
|
||||||
fSelectedWorkspace = -1;
|
fSelectedWorkspace = -1;
|
||||||
@@ -400,7 +400,7 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where)
|
|||||||
|
|
||||||
BRect screenFrame = _ScreenFrame(index);
|
BRect screenFrame = _ScreenFrame(index);
|
||||||
|
|
||||||
WindowLayer* window;
|
::Window* window;
|
||||||
BRect windowFrame;
|
BRect windowFrame;
|
||||||
BPoint leftTop;
|
BPoint leftTop;
|
||||||
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
|
||||||
@@ -453,7 +453,7 @@ WorkspacesLayer::MouseDown(BMessage* message, BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::MouseUp(BMessage* message, BPoint where)
|
WorkspacesView::MouseUp(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
if (!fHasMoved && fSelectedWorkspace >= 0) {
|
if (!fHasMoved && fSelectedWorkspace >= 0) {
|
||||||
int32 index;
|
int32 index;
|
||||||
@@ -473,7 +473,7 @@ WorkspacesLayer::MouseUp(BMessage* message, BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::MouseMoved(BMessage* message, BPoint where)
|
WorkspacesView::MouseMoved(BMessage* message, BPoint where)
|
||||||
{
|
{
|
||||||
if (fSelectedWindow == NULL && fSelectedWorkspace < 0)
|
if (fSelectedWindow == NULL && fSelectedWorkspace < 0)
|
||||||
return;
|
return;
|
||||||
@@ -537,7 +537,7 @@ WorkspacesLayer::MouseMoved(BMessage* message, BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::WindowChanged(WindowLayer* window)
|
WorkspacesView::WindowChanged(::Window* window)
|
||||||
{
|
{
|
||||||
// TODO: be smarter about this!
|
// TODO: be smarter about this!
|
||||||
_Invalidate();
|
_Invalidate();
|
||||||
@@ -545,7 +545,7 @@ WorkspacesLayer::WindowChanged(WindowLayer* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspacesLayer::WindowRemoved(WindowLayer* window)
|
WorkspacesView::WindowRemoved(::Window* window)
|
||||||
{
|
{
|
||||||
if (fSelectedWindow == window)
|
if (fSelectedWindow == window)
|
||||||
fSelectedWindow = NULL;
|
fSelectedWindow = NULL;
|
||||||
@@ -5,23 +5,21 @@
|
|||||||
* Authors:
|
* Authors:
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
*/
|
*/
|
||||||
#ifndef WORKSPACES_LAYER_H
|
#ifndef WORKSPACES_VIEW_H
|
||||||
#define WORKSPACES_LAYER_H
|
#define WORKSPACES_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include "ViewLayer.h"
|
#include "View.h"
|
||||||
|
|
||||||
class WindowLayer;
|
|
||||||
|
|
||||||
|
|
||||||
class WorkspacesLayer : public ViewLayer {
|
class WorkspacesView : public View {
|
||||||
public:
|
public:
|
||||||
WorkspacesLayer(BRect frame, BPoint scrollingOffset,
|
WorkspacesView(BRect frame, BPoint scrollingOffset,
|
||||||
const char* name, int32 token, uint32 resize,
|
const char* name, int32 token, uint32 resize,
|
||||||
uint32 flags);
|
uint32 flags);
|
||||||
virtual ~WorkspacesLayer();
|
virtual ~WorkspacesView();
|
||||||
|
|
||||||
virtual void AttachedToWindow(WindowLayer* window);
|
virtual void AttachedToWindow(::Window* window);
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
|
|
||||||
virtual void Draw(DrawingEngine* drawingEngine,
|
virtual void Draw(DrawingEngine* drawingEngine,
|
||||||
@@ -32,8 +30,8 @@ public:
|
|||||||
virtual void MouseUp(BMessage* message, BPoint where);
|
virtual void MouseUp(BMessage* message, BPoint where);
|
||||||
virtual void MouseMoved(BMessage* message, BPoint where);
|
virtual void MouseMoved(BMessage* message, BPoint where);
|
||||||
|
|
||||||
void WindowChanged(WindowLayer* window);
|
void WindowChanged(::Window* window);
|
||||||
void WindowRemoved(WindowLayer* window);
|
void WindowRemoved(::Window* window);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _GetGrid(int32& columns, int32& rows);
|
void _GetGrid(int32& columns, int32& rows);
|
||||||
@@ -46,7 +44,7 @@ private:
|
|||||||
|
|
||||||
void _DrawWindow(DrawingEngine* drawingEngine,
|
void _DrawWindow(DrawingEngine* drawingEngine,
|
||||||
const BRect& workspaceFrame, const BRect& screenFrame,
|
const BRect& workspaceFrame, const BRect& screenFrame,
|
||||||
WindowLayer* window, BPoint windowPosition,
|
::Window* window, BPoint windowPosition,
|
||||||
BRegion& backgroundRegion, bool active);
|
BRegion& backgroundRegion, bool active);
|
||||||
void _DrawWorkspace(DrawingEngine* drawingEngine,
|
void _DrawWorkspace(DrawingEngine* drawingEngine,
|
||||||
BRegion& redraw, int32 index);
|
BRegion& redraw, int32 index);
|
||||||
@@ -55,10 +53,10 @@ private:
|
|||||||
void _Invalidate() const;
|
void _Invalidate() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowLayer* fSelectedWindow;
|
::Window* fSelectedWindow;
|
||||||
int32 fSelectedWorkspace;
|
int32 fSelectedWorkspace;
|
||||||
bool fHasMoved;
|
bool fHasMoved;
|
||||||
BPoint fLeftTopOffset;
|
BPoint fLeftTopOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WORKSPACES_LAYER_H
|
#endif // WORKSPACES_VIEW_H
|
||||||
Reference in New Issue
Block a user