2005-06-17 19:10:15 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2001-2005, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Author: DarkWyrm <bpmagic@columbus.rr.com>
|
2005-11-07 19:01:12 +00:00
|
|
|
* Adi Oanca <adioanca@gmail.com>
|
2005-06-17 19:10:15 +00:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
*/
|
2005-06-23 22:43:11 +00:00
|
|
|
|
|
|
|
|
2005-11-08 23:26:47 +00:00
|
|
|
#include <DirectWindow.h>
|
2005-06-03 19:50:30 +00:00
|
|
|
#include <Locker.h>
|
2003-02-14 01:53:53 +00:00
|
|
|
#include <Region.h>
|
|
|
|
#include <String.h>
|
2005-06-03 19:50:30 +00:00
|
|
|
#include <View.h> // for mouse button defines
|
|
|
|
|
2003-02-14 01:53:53 +00:00
|
|
|
#include <Debug.h>
|
2005-07-05 20:28:40 +00:00
|
|
|
#include <WindowPrivate.h>
|
2005-06-03 19:50:30 +00:00
|
|
|
#include "DebugInfoManager.h"
|
|
|
|
|
2003-02-14 01:53:53 +00:00
|
|
|
#include "Decorator.h"
|
2005-06-17 19:10:15 +00:00
|
|
|
#include "DecorManager.h"
|
2003-02-14 01:53:53 +00:00
|
|
|
#include "Desktop.h"
|
2005-06-03 19:50:30 +00:00
|
|
|
#include "MessagePrivate.h"
|
|
|
|
#include "PortLink.h"
|
2004-01-13 00:38:42 +00:00
|
|
|
#include "RootLayer.h"
|
2005-11-03 17:03:36 +00:00
|
|
|
#include "ServerApp.h"
|
2005-06-03 19:50:30 +00:00
|
|
|
#include "ServerWindow.h"
|
2005-11-24 17:45:26 +00:00
|
|
|
#include "WindowLayer.h"
|
2004-01-13 00:38:42 +00:00
|
|
|
#include "Workspace.h"
|
2003-02-14 01:53:53 +00:00
|
|
|
|
2005-11-08 23:26:47 +00:00
|
|
|
|
2005-11-24 17:45:26 +00:00
|
|
|
// Toggle debug output
|
2004-06-18 11:50:17 +00:00
|
|
|
//#define DEBUG_WINBORDER
|
2004-06-02 20:44:46 +00:00
|
|
|
//#define DEBUG_WINBORDER_CLICK
|
2003-03-23 20:52:37 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_WINBORDER
|
2003-09-08 22:09:10 +00:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE(x) ;
|
2003-03-23 20:52:37 +00:00
|
|
|
#endif
|
|
|
|
|
2003-04-05 01:51:35 +00:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
2003-09-08 22:09:10 +00:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE_CLICK(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE_CLICK(x) ;
|
2003-04-05 01:51:35 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-24 17:45:26 +00:00
|
|
|
|
|
|
|
WindowLayer::WindowLayer(const BRect &frame,
|
2005-12-01 12:07:28 +00:00
|
|
|
const char *name, window_look look, window_feel feel,
|
|
|
|
uint32 flags, uint32 workspaces,
|
|
|
|
ServerWindow *window, DrawingEngine *driver)
|
2005-06-27 02:06:15 +00:00
|
|
|
: Layer(frame, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
|
2005-06-03 19:50:30 +00:00
|
|
|
fDecorator(NULL),
|
|
|
|
fTopLayer(NULL),
|
|
|
|
|
2005-06-25 13:09:19 +00:00
|
|
|
fCumulativeRegion(),
|
|
|
|
fInUpdateRegion(),
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-11-07 19:01:12 +00:00
|
|
|
fDecRegion(),
|
|
|
|
fRebuildDecRegion(true),
|
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
fMouseButtons(0),
|
|
|
|
fLastMousePosition(-1.0, -1.0),
|
2003-02-14 01:53:53 +00:00
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
fIsFocus(false),
|
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
fIsClosing(false),
|
|
|
|
fIsMinimizing(false),
|
|
|
|
fIsZooming(false),
|
|
|
|
fIsResizing(false),
|
2005-06-16 12:32:42 +00:00
|
|
|
fIsSlidingTab(false),
|
2005-10-30 11:33:31 +00:00
|
|
|
fIsDragging(false),
|
2005-06-16 12:32:42 +00:00
|
|
|
|
2005-10-30 11:33:31 +00:00
|
|
|
fUpdateRequestsEnabled(true),
|
2005-06-03 19:50:30 +00:00
|
|
|
fInUpdate(false),
|
|
|
|
fRequestSent(false),
|
|
|
|
|
2005-06-28 02:00:48 +00:00
|
|
|
fLook(look),
|
2005-12-01 12:07:28 +00:00
|
|
|
fFeel(feel),
|
2005-06-28 02:00:48 +00:00
|
|
|
fWindowFlags(flags),
|
|
|
|
fWorkspaces(workspaces),
|
2005-06-03 19:50:30 +00:00
|
|
|
|
|
|
|
fMinWidth(1.0),
|
2005-06-28 02:00:48 +00:00
|
|
|
fMaxWidth(32768.0),
|
2005-06-03 19:50:30 +00:00
|
|
|
fMinHeight(1.0),
|
2005-11-24 12:22:55 +00:00
|
|
|
fMaxHeight(32768.0)
|
2003-02-14 01:53:53 +00:00
|
|
|
{
|
2004-02-24 11:56:03 +00:00
|
|
|
// unlike BViews, windows start off as hidden
|
2005-11-24 12:19:11 +00:00
|
|
|
fHidden = true;
|
|
|
|
fWindow = window;
|
|
|
|
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
|
2005-11-07 19:01:12 +00:00
|
|
|
|
2005-12-01 12:07:28 +00:00
|
|
|
if (fLook != B_NO_BORDER_WINDOW_LOOK) {
|
2005-12-01 14:56:01 +00:00
|
|
|
fDecorator = gDecorManager.AllocateDecorator(window->Desktop(), frame,
|
|
|
|
name, fLook, fWindowFlags);
|
2005-06-28 02:00:48 +00:00
|
|
|
if (fDecorator)
|
2005-06-03 19:50:30 +00:00
|
|
|
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
|
|
|
}
|
2004-03-28 14:58:39 +00:00
|
|
|
|
2005-06-28 02:00:48 +00:00
|
|
|
// do we need to change our size to let the decorator fit?
|
|
|
|
// _ResizeBy() will adapt the frame for validity before resizing
|
2005-07-05 20:28:40 +00:00
|
|
|
if (feel == kDesktopWindowFeel) {
|
|
|
|
// the desktop window spans over the whole screen
|
|
|
|
// ToDo: this functionality should be moved somewhere else (so that it
|
|
|
|
// is always used when the workspace is changed)
|
|
|
|
uint16 width, height;
|
|
|
|
uint32 colorSpace;
|
|
|
|
float frequency;
|
2005-12-01 14:56:01 +00:00
|
|
|
if (window->Desktop()->ScreenAt(0)) {
|
|
|
|
window->Desktop()->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
|
2005-11-09 20:14:52 +00:00
|
|
|
// TODO: MOVE THIS AWAY!!! RemoveBy contains calls to virtual methods! Also, there is not TopLayer()!
|
2005-11-28 23:36:59 +00:00
|
|
|
fFrame.OffsetTo(B_ORIGIN);
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::ResizeBy(width - frame.Width(), height - frame.Height());
|
2005-11-04 15:23:54 +00:00
|
|
|
}
|
2005-11-07 01:16:12 +00:00
|
|
|
}
|
2005-06-28 02:00:48 +00:00
|
|
|
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer %p, %s:\n", this, Name()));
|
2005-07-18 10:34:25 +00:00
|
|
|
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
|
|
|
|
fFrame.right, fFrame.bottom));
|
2005-06-28 02:00:48 +00:00
|
|
|
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
|
2003-02-14 01:53:53 +00:00
|
|
|
}
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-06-28 02:00:48 +00:00
|
|
|
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::~WindowLayer()
|
2003-02-14 01:53:53 +00:00
|
|
|
{
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer(%s)::~WindowLayer()\n", Name()));
|
2005-02-28 20:23:51 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
delete fDecorator;
|
2003-02-14 01:53:53 +00:00
|
|
|
}
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-11-14 17:39:33 +00:00
|
|
|
|
2004-09-09 00:54:21 +00:00
|
|
|
//! redraws a certain section of the window border
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::Draw(const BRect& updateRect)
|
2003-02-14 01:53:53 +00:00
|
|
|
{
|
2004-06-26 02:15:48 +00:00
|
|
|
#ifdef DEBUG_WINBORDER
|
2005-11-24 17:45:26 +00:00
|
|
|
printf("WindowLayer(%s)::Draw() : ", Name());
|
2004-06-26 02:15:48 +00:00
|
|
|
r.PrintToStream();
|
|
|
|
#endif
|
|
|
|
|
2004-06-16 06:40:26 +00:00
|
|
|
// if we have a visible region, it is decorator's one.
|
2005-06-03 19:50:30 +00:00
|
|
|
if (fDecorator) {
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
fDecorator->SetFocus(IsFocus());
|
2005-11-24 17:12:32 +00:00
|
|
|
fDecorator->Draw(updateRect);
|
2005-02-28 20:23:51 +00:00
|
|
|
}
|
2003-02-14 01:53:53 +00:00
|
|
|
}
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-11-14 17:39:33 +00:00
|
|
|
|
2004-09-09 00:54:21 +00:00
|
|
|
//! Moves the winborder with redraw
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::MoveBy(float x, float y)
|
2003-02-14 01:53:53 +00:00
|
|
|
{
|
2005-11-09 20:14:52 +00:00
|
|
|
if (x == 0.0f && y == 0.0f)
|
2005-11-08 23:26:47 +00:00
|
|
|
return;
|
2005-11-09 20:14:52 +00:00
|
|
|
|
|
|
|
// lock here because we play with some regions
|
2005-11-11 00:10:03 +00:00
|
|
|
if (GetRootLayer()) {
|
|
|
|
// TODO: MoveBy and ResizeBy() are usually called
|
|
|
|
// from the rootlayer's thread. HandleDirectConnection() could
|
|
|
|
// block the calling thread for ~3 seconds in the worst case,
|
|
|
|
// and while it would be acceptable if called from the
|
|
|
|
// ServerWindow's thread (only the window would be blocked), in this case
|
|
|
|
// it's not, as also the mouse movement is driven by rootlayer.
|
|
|
|
// Find some way to call DirectConnected() from the ServerWindow's thread,
|
|
|
|
// by sending a message from here or whatever.
|
2005-11-11 00:45:45 +00:00
|
|
|
// (Tested with BeSnes9x and works fine, though)
|
2005-11-11 00:10:03 +00:00
|
|
|
Window()->HandleDirectConnection(B_DIRECT_STOP);
|
|
|
|
|
|
|
|
if (GetRootLayer()->Lock()) {
|
|
|
|
fDecRegion.OffsetBy(x, y);
|
|
|
|
|
|
|
|
fCumulativeRegion.OffsetBy(x, y);
|
|
|
|
fInUpdateRegion.OffsetBy(x, y);
|
|
|
|
|
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->MoveBy(x, y);
|
|
|
|
|
|
|
|
Layer::MoveBy(x, y);
|
|
|
|
|
|
|
|
GetRootLayer()->Unlock();
|
|
|
|
}
|
2005-11-24 17:12:32 +00:00
|
|
|
|
|
|
|
Window()->HandleDirectConnection(B_DIRECT_START | B_BUFFER_MOVED);
|
2005-11-10 22:30:43 +00:00
|
|
|
} else {
|
|
|
|
// just offset to the new position
|
2005-11-09 20:14:52 +00:00
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->MoveBy(x, y);
|
|
|
|
|
|
|
|
Layer::MoveBy(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// dispatch a message to the client informing about the changed size
|
|
|
|
BMessage msg(B_WINDOW_MOVED);
|
|
|
|
msg.AddInt64("when", system_time());
|
|
|
|
msg.AddPoint("where", Frame().LeftTop());
|
2005-11-24 17:12:32 +00:00
|
|
|
Window()->SendMessageToClient(&msg);
|
2003-02-14 01:53:53 +00:00
|
|
|
}
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-06-28 02:00:48 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::ResizeBy(float x, float y)
|
2005-06-28 02:00:48 +00:00
|
|
|
{
|
2005-06-03 19:50:30 +00:00
|
|
|
float wantWidth = fFrame.Width() + x;
|
|
|
|
float wantHeight = fFrame.Height() + y;
|
|
|
|
|
|
|
|
// enforce size limits
|
|
|
|
if (wantWidth < fMinWidth)
|
|
|
|
wantWidth = fMinWidth;
|
|
|
|
if (wantWidth > fMaxWidth)
|
|
|
|
wantWidth = fMaxWidth;
|
|
|
|
|
|
|
|
if (wantHeight < fMinHeight)
|
|
|
|
wantHeight = fMinHeight;
|
|
|
|
if (wantHeight > fMaxHeight)
|
|
|
|
wantHeight = fMaxHeight;
|
|
|
|
|
|
|
|
x = wantWidth - fFrame.Width();
|
|
|
|
y = wantHeight - fFrame.Height();
|
|
|
|
|
2005-06-21 20:11:44 +00:00
|
|
|
if (x == 0.0 && y == 0.0)
|
2005-11-09 20:14:52 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// this method can be called from a ServerWindow thread or from a RootLayer one,
|
|
|
|
// so lock
|
2005-11-11 00:45:45 +00:00
|
|
|
if (GetRootLayer()) {
|
|
|
|
Window()->HandleDirectConnection(B_DIRECT_STOP);
|
|
|
|
|
|
|
|
if (GetRootLayer()->Lock()) {
|
|
|
|
fRebuildDecRegion = true;
|
2005-11-09 20:14:52 +00:00
|
|
|
|
2005-11-11 00:45:45 +00:00
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->ResizeBy(x, y);
|
2005-11-09 20:14:52 +00:00
|
|
|
|
2005-11-11 00:45:45 +00:00
|
|
|
Layer::ResizeBy(x, y);
|
2005-11-09 20:14:52 +00:00
|
|
|
|
2005-11-11 00:45:45 +00:00
|
|
|
GetRootLayer()->Unlock();
|
|
|
|
}
|
2005-11-24 17:12:32 +00:00
|
|
|
|
|
|
|
Window()->HandleDirectConnection(B_DIRECT_START | B_BUFFER_RESIZED);
|
2005-11-10 22:30:43 +00:00
|
|
|
} else {
|
2005-11-09 20:14:52 +00:00
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->ResizeBy(x, y);
|
2005-06-03 19:50:30 +00:00
|
|
|
|
2005-11-09 20:14:52 +00:00
|
|
|
Layer::ResizeBy(x, y);
|
|
|
|
}
|
2005-06-21 20:11:44 +00:00
|
|
|
|
2005-11-09 20:14:52 +00:00
|
|
|
// send a message to the client informing about the changed size
|
|
|
|
BRect frame(Frame());
|
|
|
|
BMessage msg(B_WINDOW_RESIZED);
|
|
|
|
msg.AddInt64("when", system_time());
|
|
|
|
msg.AddInt32("width", frame.IntegerWidth());
|
|
|
|
msg.AddInt32("height", frame.IntegerHeight());
|
2005-11-24 17:12:32 +00:00
|
|
|
Window()->SendMessageToClient(&msg);
|
2003-02-14 01:53:53 +00:00
|
|
|
}
|
2004-06-11 02:46:48 +00:00
|
|
|
|
2005-11-14 17:39:33 +00:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::SetName(const char* name)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
{
|
|
|
|
Layer::SetName(name);
|
|
|
|
|
|
|
|
// rebuild the clipping for the title area
|
|
|
|
// and redraw it.
|
|
|
|
|
|
|
|
if (fDecorator) {
|
2005-11-14 18:16:01 +00:00
|
|
|
BRegion updateRegion;
|
|
|
|
fDecorator->SetTitle(name, &updateRegion);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
|
2005-11-11 11:03:33 +00:00
|
|
|
fRebuildDecRegion = true;
|
2005-11-14 18:16:01 +00:00
|
|
|
GetRootLayer()->MarkForRebuild(updateRegion);
|
2005-11-11 11:03:33 +00:00
|
|
|
GetRootLayer()->TriggerRebuild();
|
|
|
|
|
2005-11-14 18:16:01 +00:00
|
|
|
GetRootLayer()->MarkForRedraw(updateRegion);
|
2005-11-07 19:01:12 +00:00
|
|
|
GetRootLayer()->TriggerRedraw();
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
2005-06-28 02:00:48 +00:00
|
|
|
|
2005-11-14 17:39:33 +00:00
|
|
|
|
2005-06-25 13:09:19 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateStart()
|
2005-06-25 13:09:19 +00:00
|
|
|
{
|
|
|
|
// During updates we only want to draw what's in the update region
|
|
|
|
fInUpdate = true;
|
|
|
|
fRequestSent = false;
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-25 13:09:19 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateEnd()
|
2005-06-25 13:09:19 +00:00
|
|
|
{
|
|
|
|
// The usual case. Drawing is permitted in the whole visible area.
|
|
|
|
|
|
|
|
fInUpdate = false;
|
|
|
|
|
|
|
|
fInUpdateRegion.MakeEmpty();
|
|
|
|
|
|
|
|
if (fCumulativeRegion.CountRects() > 0) {
|
2005-11-07 21:24:53 +00:00
|
|
|
GetRootLayer()->MarkForRedraw(fCumulativeRegion);
|
|
|
|
GetRootLayer()->TriggerRedraw();
|
|
|
|
}
|
|
|
|
}
|
2005-11-10 22:30:43 +00:00
|
|
|
|
|
|
|
|
2005-11-07 21:24:53 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::EnableUpdateRequests()
|
2005-11-10 22:30:43 +00:00
|
|
|
{
|
2005-11-07 21:24:53 +00:00
|
|
|
fUpdateRequestsEnabled = true;
|
|
|
|
if (fCumulativeRegion.CountRects() > 0) {
|
|
|
|
GetRootLayer()->MarkForRedraw(fCumulativeRegion);
|
|
|
|
GetRootLayer()->TriggerRedraw();
|
2005-06-25 13:09:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2004-09-09 00:54:21 +00:00
|
|
|
//! Sets the minimum and maximum sizes of the window
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::SetSizeLimits(float minWidth, float maxWidth,
|
2005-06-03 19:50:30 +00:00
|
|
|
float minHeight, float maxHeight)
|
2004-08-07 20:30:58 +00:00
|
|
|
{
|
2005-06-03 19:50:30 +00:00
|
|
|
if (minWidth < 0)
|
|
|
|
minWidth = 0;
|
2004-08-07 20:30:58 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
if (minHeight < 0)
|
|
|
|
minHeight = 0;
|
|
|
|
|
|
|
|
fMinWidth = minWidth;
|
|
|
|
fMaxWidth = maxWidth;
|
|
|
|
fMinHeight = minHeight;
|
|
|
|
fMaxHeight = maxHeight;
|
|
|
|
|
|
|
|
// give the Decorator a say in this too
|
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight,
|
|
|
|
&fMaxWidth, &fMaxHeight);
|
|
|
|
|
|
|
|
if (fMaxWidth < fMinWidth)
|
|
|
|
fMaxWidth = fMinWidth;
|
|
|
|
|
|
|
|
if (fMaxHeight < fMinHeight)
|
|
|
|
fMaxHeight = fMinHeight;
|
|
|
|
|
|
|
|
// Automatically resize the window to fit these new limits
|
|
|
|
// if it does not already.
|
2005-06-28 02:00:48 +00:00
|
|
|
|
|
|
|
// On R5, Windows don't automatically resize, but since
|
|
|
|
// BWindow::ResizeTo() even honors the limits, I would guess
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
// this is a bug that we don't have to adopt.
|
|
|
|
// Note that most current apps will do unnecessary resizing
|
|
|
|
// after having set the limits, but the overhead is neglible.
|
2005-06-28 02:00:48 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
float minWidthDiff = fMinWidth - fFrame.Width();
|
|
|
|
float minHeightDiff = fMinHeight - fFrame.Height();
|
|
|
|
float maxWidthDiff = fMaxWidth - fFrame.Width();
|
|
|
|
float maxHeightDiff = fMaxHeight - fFrame.Height();
|
|
|
|
|
|
|
|
float xDiff = 0.0;
|
|
|
|
if (minWidthDiff > 0.0) // we're currently smaller than minWidth
|
|
|
|
xDiff = minWidthDiff;
|
|
|
|
else if (maxWidthDiff < 0.0) // we're currently larger than maxWidth
|
|
|
|
xDiff = maxWidthDiff;
|
|
|
|
|
|
|
|
float yDiff = 0.0;
|
|
|
|
if (minHeightDiff > 0.0) // we're currently smaller than minHeight
|
|
|
|
yDiff = minHeightDiff;
|
|
|
|
else if (maxHeightDiff < 0.0) // we're currently larger than maxHeight
|
|
|
|
yDiff = maxHeightDiff;
|
|
|
|
|
|
|
|
ResizeBy(xDiff, yDiff);
|
|
|
|
}
|
|
|
|
|
2005-10-31 11:05:52 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::GetSizeLimits(float* minWidth, float* maxWidth,
|
2005-10-31 11:05:52 +00:00
|
|
|
float* minHeight, float* maxHeight) const
|
2005-06-03 19:50:30 +00:00
|
|
|
{
|
|
|
|
*minWidth = fMinWidth;
|
|
|
|
*maxWidth = fMaxWidth;
|
|
|
|
*minHeight = fMinHeight;
|
|
|
|
*maxHeight = fMaxHeight;
|
2004-08-07 20:30:58 +00:00
|
|
|
}
|
|
|
|
|
2005-10-31 11:05:52 +00:00
|
|
|
|
2005-09-08 16:53:42 +00:00
|
|
|
void
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
WindowLayer::MouseDown(BMessage *msg, BPoint where, int32* _viewToken)
|
2005-09-08 16:53:42 +00:00
|
|
|
{
|
2005-11-28 23:36:59 +00:00
|
|
|
Desktop* desktop = Window()->App()->GetDesktop();
|
|
|
|
|
2005-11-24 17:45:26 +00:00
|
|
|
// default action is to drag the WindowLayer
|
2005-11-23 21:52:36 +00:00
|
|
|
Layer *target = LayerAt(where);
|
|
|
|
if (target == this) {
|
2005-11-24 17:45:26 +00:00
|
|
|
// clicking WindowLayer visible area
|
2005-09-18 22:43:31 +00:00
|
|
|
|
2005-11-23 21:52:36 +00:00
|
|
|
click_type action = DEC_DRAG;
|
2005-09-18 22:43:31 +00:00
|
|
|
|
2005-11-23 21:52:36 +00:00
|
|
|
if (fDecorator)
|
|
|
|
action = _ActionFor(msg);
|
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
// deactivate border buttons on first click (select)
|
|
|
|
if (!IsFocus() && action != DEC_MOVETOBACK
|
2005-11-23 21:52:36 +00:00
|
|
|
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
|
|
|
|
action = DEC_DRAG;
|
|
|
|
|
|
|
|
// set decorator internals
|
|
|
|
switch (action) {
|
|
|
|
case DEC_CLOSE:
|
|
|
|
fIsClosing = true;
|
|
|
|
fDecorator->SetClose(true);
|
|
|
|
STRACE_CLICK(("===> DEC_CLOSE\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEC_ZOOM:
|
|
|
|
fIsZooming = true;
|
|
|
|
fDecorator->SetZoom(true);
|
|
|
|
STRACE_CLICK(("===> DEC_ZOOM\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEC_MINIMIZE:
|
|
|
|
fIsMinimizing = true;
|
|
|
|
fDecorator->SetMinimize(true);
|
|
|
|
STRACE_CLICK(("===> DEC_MINIMIZE\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEC_DRAG:
|
|
|
|
fIsDragging = true;
|
|
|
|
fLastMousePosition = where;
|
|
|
|
STRACE_CLICK(("===> DEC_DRAG\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEC_RESIZE:
|
|
|
|
fIsResizing = true;
|
|
|
|
fLastMousePosition = where;
|
|
|
|
STRACE_CLICK(("===> DEC_RESIZE\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEC_SLIDETAB:
|
|
|
|
fIsSlidingTab = true;
|
|
|
|
fLastMousePosition = where;
|
|
|
|
STRACE_CLICK(("===> DEC_SLIDETAB\n"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2005-11-12 17:49:05 +00:00
|
|
|
|
2005-11-23 21:52:36 +00:00
|
|
|
// based on what the Decorator returned, properly place this window.
|
|
|
|
if (action == DEC_MOVETOBACK) {
|
2005-11-28 23:36:59 +00:00
|
|
|
desktop->SendBehindWindow(this, NULL);
|
2005-11-23 21:52:36 +00:00
|
|
|
} else {
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
GetRootLayer()->SetMouseEventWindow(this);
|
2005-11-28 23:36:59 +00:00
|
|
|
desktop->ActivateWindow(this);
|
2005-11-23 21:52:36 +00:00
|
|
|
}
|
|
|
|
} else if (target != NULL) {
|
|
|
|
// clicking a simple Layer.
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
if (!IsFocus()) {
|
2005-11-28 23:36:59 +00:00
|
|
|
DesktopSettings desktopSettings(desktop);
|
2005-09-18 22:43:31 +00:00
|
|
|
|
2005-11-23 21:52:36 +00:00
|
|
|
// not in FFM mode?
|
|
|
|
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
|
2005-11-28 23:36:59 +00:00
|
|
|
desktop->ActivateWindow(this);
|
2005-11-23 21:52:36 +00:00
|
|
|
|
2005-12-01 12:31:05 +00:00
|
|
|
if ((WindowFlags() & (B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS)) == 0)
|
2005-11-23 21:52:36 +00:00
|
|
|
return;
|
2005-11-10 22:30:43 +00:00
|
|
|
}
|
2005-11-23 21:52:36 +00:00
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
target->MouseDown(msg, where, _viewToken);
|
2005-09-18 22:43:31 +00:00
|
|
|
}
|
2005-09-08 16:53:42 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-09-08 16:53:42 +00:00
|
|
|
void
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
WindowLayer::MouseUp(BMessage *msg, BPoint where, int32* _viewToken)
|
2005-09-08 16:53:42 +00:00
|
|
|
{
|
2005-10-02 21:55:45 +00:00
|
|
|
bool invalidate = false;
|
2005-09-16 05:10:21 +00:00
|
|
|
if (fDecorator) {
|
2005-10-25 18:42:10 +00:00
|
|
|
click_type action = _ActionFor(msg);
|
2005-10-02 21:55:45 +00:00
|
|
|
// TODO: present behavior is not fine!
|
|
|
|
// Decorator's Set*() methods _actualy draw_! on screen, not
|
|
|
|
// taking into account if that region is visible or not!
|
|
|
|
// Decorator redraw code should follow the same path as Layer's
|
|
|
|
// one!
|
2005-09-16 05:10:21 +00:00
|
|
|
if (fIsZooming) {
|
|
|
|
fIsZooming = false;
|
|
|
|
fDecorator->SetZoom(false);
|
2005-10-02 21:55:45 +00:00
|
|
|
if (action == DEC_ZOOM) {
|
|
|
|
invalidate = true;
|
2005-09-16 05:10:21 +00:00
|
|
|
Window()->NotifyZoom();
|
2005-10-02 21:55:45 +00:00
|
|
|
}
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
if (fIsClosing) {
|
|
|
|
fIsClosing = false;
|
|
|
|
fDecorator->SetClose(false);
|
2005-10-02 21:55:45 +00:00
|
|
|
if (action == DEC_CLOSE) {
|
|
|
|
invalidate = true;
|
2005-09-16 05:10:21 +00:00
|
|
|
Window()->NotifyQuitRequested();
|
2005-10-02 21:55:45 +00:00
|
|
|
}
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
if (fIsMinimizing) {
|
|
|
|
fIsMinimizing = false;
|
|
|
|
fDecorator->SetMinimize(false);
|
2005-10-02 21:55:45 +00:00
|
|
|
if (action == DEC_MINIMIZE) {
|
|
|
|
invalidate = true;
|
2005-09-16 05:10:21 +00:00
|
|
|
Window()->NotifyMinimize(true);
|
2005-10-02 21:55:45 +00:00
|
|
|
}
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fIsDragging = false;
|
|
|
|
fIsResizing = false;
|
|
|
|
fIsSlidingTab = false;
|
2005-11-24 16:04:29 +00:00
|
|
|
|
|
|
|
Layer* target = LayerAt(where);
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
if (target != NULL && target != this)
|
|
|
|
target->MouseUp(msg, where, _viewToken);
|
2005-09-08 16:53:42 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-09-08 16:53:42 +00:00
|
|
|
void
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
|
2005-09-08 16:53:42 +00:00
|
|
|
{
|
2005-09-16 05:10:21 +00:00
|
|
|
if (fDecorator) {
|
2005-10-02 21:55:45 +00:00
|
|
|
// TODO: present behavior is not fine!
|
|
|
|
// Decorator's Set*() methods _actualy draw_! on screen, not
|
|
|
|
// taking into account if that region is visible or not!
|
|
|
|
// Decorator redraw code should follow the same path as Layer's
|
|
|
|
// one!
|
2005-09-16 05:10:21 +00:00
|
|
|
if (fIsZooming) {
|
2005-10-25 18:42:10 +00:00
|
|
|
fDecorator->SetZoom(_ActionFor(msg) == DEC_ZOOM);
|
2005-09-16 05:10:21 +00:00
|
|
|
} else if (fIsClosing) {
|
2005-10-25 18:42:10 +00:00
|
|
|
fDecorator->SetClose(_ActionFor(msg) == DEC_CLOSE);
|
2005-09-16 05:10:21 +00:00
|
|
|
} else if (fIsMinimizing) {
|
2005-10-25 18:42:10 +00:00
|
|
|
fDecorator->SetMinimize(_ActionFor(msg) == DEC_MINIMIZE);
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
}
|
2005-10-02 21:55:45 +00:00
|
|
|
|
2005-09-16 05:10:21 +00:00
|
|
|
if (fIsDragging) {
|
2005-10-25 18:42:10 +00:00
|
|
|
BPoint delta = where - fLastMousePosition;
|
2005-12-01 10:31:30 +00:00
|
|
|
Window()->Desktop()->MoveWindowBy(this, delta.x, delta.y);
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
if (fIsResizing) {
|
2005-10-25 18:42:10 +00:00
|
|
|
BPoint delta = where - fLastMousePosition;
|
2005-12-01 10:31:30 +00:00
|
|
|
Window()->Desktop()->ResizeWindowBy(this, delta.x, delta.y);
|
2005-09-16 05:10:21 +00:00
|
|
|
}
|
|
|
|
if (fIsSlidingTab) {
|
|
|
|
// TODO: implement
|
|
|
|
}
|
2005-10-02 21:55:45 +00:00
|
|
|
|
2005-10-25 18:42:10 +00:00
|
|
|
fLastMousePosition = where;
|
2005-11-23 21:52:36 +00:00
|
|
|
|
|
|
|
// change focus in FFM mode
|
2005-12-01 10:31:30 +00:00
|
|
|
Desktop* desktop = Window()->Desktop();
|
2005-11-28 23:36:59 +00:00
|
|
|
DesktopSettings desktopSettings(desktop);
|
|
|
|
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus())
|
2005-11-28 23:36:59 +00:00
|
|
|
GetRootLayer()->SetFocus(this);
|
2005-11-24 16:04:29 +00:00
|
|
|
|
|
|
|
Layer* target = LayerAt(where);
|
Have I said input event handling is done?
* didn't realize that mouse events always go to the view under the mouse, not
only if its the focus window (FFM can really do harm, after all :-)).
* removed a TODO from the list: EventDispatcher::Target is now a public
class EventTarget, and every ServerWindow has one.
* as a result, EventDispatcher no longer manages targets itself, it
just maintains a list of them. You no longer set messengers, you
only set targets.
* customization of the message filters, they no longer inherit from
BMessageFilter (but EventFilter).
* a message target is no longer set explicetly anywhere, it's only
changed in the message filters if needed.
* therefore, no more locking mess in the EventDispatcher needed.
* this also made the EventDispatcher::fLastFocus stuff superfluous.
* moved the RootLayer::MouseEventHandler() into the message filter.
* Replaced RootLayer::_ChildAt() with WindowAt().
* WindowLayer now has an idea if it has focus or not, it no longer needs
to query the RootLayer for this - maybe we should rename "focus" to
"active", though (as far as layers are concerned).
* the "_view_token" data is now added from the EventDispatcher, not
the (Window)Layer class anymore.
* removed Layer::MouseWheelChanged() as we currently don't need it
(if the need arises, we can add it back later again)
* there is still no mouse moved message sent when opening a window
under the cursor, though...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-29 16:01:41 +00:00
|
|
|
if (target != NULL && target != this)
|
|
|
|
target->MouseMoved(msg, where, _viewToken);
|
2005-09-08 16:53:42 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-09-28 21:12:38 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::WorkspaceActivated(int32 index, bool active)
|
2005-09-28 21:12:38 +00:00
|
|
|
{
|
|
|
|
BMessage activatedMsg(B_WORKSPACE_ACTIVATED);
|
|
|
|
activatedMsg.AddInt64("when", real_time_clock_usecs());
|
|
|
|
activatedMsg.AddInt32("workspace", index);
|
|
|
|
activatedMsg.AddBool("active", active);
|
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
Window()->SendMessageToClient(&activatedMsg);
|
2005-09-28 21:12:38 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-10-01 10:03:43 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
|
2005-10-01 10:03:43 +00:00
|
|
|
{
|
|
|
|
fWorkspaces = newWorkspaces;
|
|
|
|
|
|
|
|
BMessage changedMsg(B_WORKSPACES_CHANGED);
|
|
|
|
changedMsg.AddInt64("when", real_time_clock_usecs());
|
|
|
|
changedMsg.AddInt32("old", oldWorkspaces);
|
|
|
|
changedMsg.AddInt32("new", newWorkspaces);
|
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
Window()->SendMessageToClient(&changedMsg);
|
2005-10-01 10:03:43 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-10-29 11:15:47 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::Activated(bool active)
|
2005-10-29 11:15:47 +00:00
|
|
|
{
|
|
|
|
BMessage msg(B_WINDOW_ACTIVATED);
|
2005-11-15 01:42:58 +00:00
|
|
|
msg.AddBool("active", active);
|
2005-11-24 17:12:32 +00:00
|
|
|
Window()->SendMessageToClient(&msg);
|
2005-10-29 11:15:47 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-16 12:32:42 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::SetTabLocation(float location)
|
2005-06-16 12:32:42 +00:00
|
|
|
{
|
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->SetTabLocation(location);
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-16 12:32:42 +00:00
|
|
|
float
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::TabLocation() const
|
2005-06-16 12:32:42 +00:00
|
|
|
{
|
|
|
|
if (fDecorator)
|
|
|
|
return fDecorator->TabLocation();
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-16 12:32:42 +00:00
|
|
|
//! Sets the decorator focus to active or inactive colors
|
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::HighlightDecorator(bool active)
|
2005-06-16 12:32:42 +00:00
|
|
|
{
|
|
|
|
STRACE(("Decorator->Highlight\n"));
|
|
|
|
if (fDecorator)
|
|
|
|
fDecorator->SetFocus(active);
|
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateColors()
|
2003-02-24 15:47:06 +00:00
|
|
|
{
|
2005-11-10 22:30:43 +00:00
|
|
|
// Unimplemented. Hook function for handling when system GUI colors change
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer %s: UpdateColors unimplemented\n", Name()));
|
2003-02-24 15:47:06 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateDecorator()
|
2003-02-24 15:47:06 +00:00
|
|
|
{
|
2005-11-10 22:30:43 +00:00
|
|
|
// Unimplemented. Hook function for handling when the system decorator changes
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer %s: UpdateDecorator unimplemented\n", Name()));
|
2003-02-24 15:47:06 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateFont()
|
2003-02-24 15:47:06 +00:00
|
|
|
{
|
2005-11-10 22:30:43 +00:00
|
|
|
// Unimplemented. Hook function for handling when a system font changes
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer %s: UpdateFont unimplemented\n", Name()));
|
2003-02-24 15:47:06 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::UpdateScreen()
|
2003-02-24 15:47:06 +00:00
|
|
|
{
|
2005-11-10 22:30:43 +00:00
|
|
|
// Unimplemented. Hook function for handling when the screen resolution changes
|
2005-11-24 17:45:26 +00:00
|
|
|
STRACE(("WindowLayer %s: UpdateScreen unimplemented\n", Name()));
|
2003-02-24 15:47:06 +00:00
|
|
|
}
|
2005-02-28 20:23:51 +00:00
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-11-28 23:36:59 +00:00
|
|
|
bool
|
|
|
|
WindowLayer::SupportsFront()
|
|
|
|
{
|
|
|
|
if (fFeel == kDesktopWindowFeel)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-01 13:59:04 +00:00
|
|
|
void
|
|
|
|
WindowLayer::SetLook(window_look look, BRegion* updateRegion)
|
|
|
|
{
|
2005-12-01 14:56:01 +00:00
|
|
|
if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
|
|
|
|
// we need a new decorator
|
|
|
|
fDecorator = gDecorManager.AllocateDecorator(Window()->Desktop(), Frame(),
|
|
|
|
Name(), fLook, fWindowFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
fLook = look;
|
|
|
|
fRebuildDecRegion = true;
|
|
|
|
|
|
|
|
if (fDecorator != NULL) {
|
|
|
|
DesktopSettings settings(Window()->Desktop());
|
|
|
|
fDecorator->SetLook(settings, look, updateRegion);
|
|
|
|
|
|
|
|
// TODO: we might need to resize the window!
|
|
|
|
//fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (look == B_NO_BORDER_WINDOW_LOOK) {
|
|
|
|
// we don't need a decorator for this window
|
|
|
|
delete fDecorator;
|
|
|
|
fDecorator = NULL;
|
|
|
|
}
|
2005-12-01 13:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
void
|
2005-12-01 12:07:28 +00:00
|
|
|
WindowLayer::SetFeel(window_feel feel)
|
2005-02-28 20:23:51 +00:00
|
|
|
{
|
2005-04-21 18:57:34 +00:00
|
|
|
fFeel = feel;
|
|
|
|
|
2005-12-01 12:07:28 +00:00
|
|
|
// TODO: this shouldn't be necessary, but we'll see :)
|
2005-04-21 18:57:34 +00:00
|
|
|
|
|
|
|
// floating and modal windows must appear in every workspace where
|
2005-07-05 20:28:40 +00:00
|
|
|
// their main window is present. Thus their fWorkspaces will be set to
|
2005-04-21 18:57:34 +00:00
|
|
|
// '0x0' and they will be made visible when needed.
|
2005-06-03 19:50:30 +00:00
|
|
|
switch (fFeel) {
|
2005-04-21 18:57:34 +00:00
|
|
|
case B_MODAL_APP_WINDOW_FEEL:
|
2005-04-23 10:05:33 +00:00
|
|
|
break;
|
2005-04-21 18:57:34 +00:00
|
|
|
case B_MODAL_SUBSET_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_APP_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
|
|
|
fWorkspaces = 0x0UL;
|
|
|
|
break;
|
|
|
|
case B_MODAL_ALL_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_ALL_WINDOW_FEEL:
|
|
|
|
fWorkspaces = 0xffffffffUL;
|
|
|
|
break;
|
|
|
|
case B_NORMAL_WINDOW_FEEL:
|
2005-04-23 10:05:33 +00:00
|
|
|
break;
|
2005-04-21 18:57:34 +00:00
|
|
|
}
|
2005-06-03 19:50:30 +00:00
|
|
|
}
|
|
|
|
|
2005-11-14 17:39:33 +00:00
|
|
|
|
2005-12-01 13:59:04 +00:00
|
|
|
void
|
|
|
|
WindowLayer::SetWindowFlags(uint32 flags, BRegion* updateRegion)
|
|
|
|
{
|
2005-12-01 15:02:11 +00:00
|
|
|
fWindowFlags = flags;
|
|
|
|
|
|
|
|
if (fDecorator == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fDecorator->SetFlags(flags, updateRegion);
|
|
|
|
fRebuildDecRegion = true;
|
|
|
|
|
|
|
|
// TODO: we might need to resize the window!
|
|
|
|
//fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
|
2005-12-01 13:59:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-03 19:50:30 +00:00
|
|
|
click_type
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::_ActionFor(const BMessage *msg) const
|
2005-06-03 19:50:30 +00:00
|
|
|
{
|
2005-10-25 18:42:10 +00:00
|
|
|
BPoint where(0,0);
|
|
|
|
int32 buttons = 0;
|
|
|
|
int32 modifiers = 0;
|
|
|
|
|
|
|
|
msg->FindPoint("where", &where);
|
|
|
|
msg->FindInt32("buttons", &buttons);
|
|
|
|
msg->FindInt32("modifiers", &modifiers);
|
|
|
|
|
2005-06-16 20:43:53 +00:00
|
|
|
if (fDecorator)
|
2005-10-25 18:42:10 +00:00
|
|
|
return fDecorator->Clicked(where, buttons, modifiers);
|
2005-11-14 17:39:33 +00:00
|
|
|
|
|
|
|
return DEC_NONE;
|
2005-06-03 19:50:30 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::set_decorator_region(BRect bounds)
|
2005-06-15 20:36:43 +00:00
|
|
|
{
|
|
|
|
fRebuildDecRegion = false;
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
if (fDecorator) {
|
2005-06-21 20:11:44 +00:00
|
|
|
fDecRegion.MakeEmpty();
|
|
|
|
fDecorator->GetFootprint(&fDecRegion);
|
|
|
|
}
|
2005-06-15 20:36:43 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-10-07 16:05:22 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::_ReserveRegions(BRegion ®)
|
2005-06-15 20:36:43 +00:00
|
|
|
{
|
2005-10-07 16:05:22 +00:00
|
|
|
BRegion reserve(reg);
|
|
|
|
reserve.IntersectWith(&fDecRegion);
|
2005-11-14 17:56:51 +00:00
|
|
|
fVisible.Include(&reserve);
|
2005-10-07 16:05:22 +00:00
|
|
|
reg.Exclude(&reserve);
|
2005-06-15 20:36:43 +00:00
|
|
|
}
|
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-10-07 16:05:22 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::GetOnScreenRegion(BRegion& region)
|
2005-06-15 20:36:43 +00:00
|
|
|
{
|
|
|
|
if (fRebuildDecRegion)
|
|
|
|
set_decorator_region(Bounds());
|
|
|
|
|
2005-11-14 17:50:39 +00:00
|
|
|
BRect frame(Bounds());
|
|
|
|
ConvertToScreen(&frame);
|
|
|
|
region.Set(frame);
|
2005-06-15 20:36:43 +00:00
|
|
|
|
2005-11-14 17:50:39 +00:00
|
|
|
region.Include(&fDecRegion);
|
2005-11-06 17:47:06 +00:00
|
|
|
|
2005-11-14 17:50:39 +00:00
|
|
|
BRegion screenRegion(GetRootLayer()->Bounds());
|
|
|
|
region.IntersectWith(&screenRegion);
|
2005-11-06 17:47:06 +00:00
|
|
|
}
|
2005-06-15 20:36:43 +00:00
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-11-06 17:47:06 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::RequestClientRedraw(const BRegion &invalid)
|
2005-11-06 17:47:06 +00:00
|
|
|
{
|
|
|
|
BRegion updateReg(fTopLayer->FullVisible());
|
|
|
|
updateReg.IntersectWith(&invalid);
|
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
if (updateReg.CountRects() == 0)
|
|
|
|
return;
|
2005-11-06 17:47:06 +00:00
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
fCumulativeRegion.Include(&updateReg);
|
2005-11-07 19:01:12 +00:00
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
if (fUpdateRequestsEnabled && !InUpdate() && !fRequestSent) {
|
|
|
|
fInUpdateRegion = fCumulativeRegion;
|
|
|
|
fRequestSent = true; // this is here to avoid a possible de-synchronization
|
2005-11-06 17:47:06 +00:00
|
|
|
|
2005-11-24 17:12:32 +00:00
|
|
|
BRect rect(fInUpdateRegion.Frame());
|
|
|
|
ConvertFromScreen(&rect);
|
|
|
|
|
|
|
|
BMessage msg(_UPDATE_);
|
|
|
|
msg.AddRect("_rect", rect);
|
|
|
|
msg.AddRect("debug_rect", fInUpdateRegion.Frame());
|
|
|
|
|
|
|
|
if (Window()->SendMessageToClient(&msg) == B_OK) {
|
|
|
|
fCumulativeRegion.MakeEmpty();
|
|
|
|
} else {
|
|
|
|
fRequestSent = false;
|
|
|
|
fInUpdateRegion.MakeEmpty();
|
2005-11-06 17:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2005-06-15 20:36:43 +00:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-11-24 17:54:14 +00:00
|
|
|
void
|
|
|
|
WindowLayer::_AllRedraw(const BRegion &invalid)
|
|
|
|
{
|
|
|
|
// send _UPDATE_ message to client
|
|
|
|
RequestClientRedraw(invalid);
|
|
|
|
|
|
|
|
Layer::_AllRedraw(invalid);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
void
|
2005-11-24 17:45:26 +00:00
|
|
|
WindowLayer::SetTopLayer(Layer* layer)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
{
|
2005-11-24 13:14:49 +00:00
|
|
|
if (fTopLayer != NULL) {
|
|
|
|
RemoveChild(fTopLayer);
|
|
|
|
fTopLayer->SetAsTopLayer(false);
|
|
|
|
}
|
2005-11-10 22:30:43 +00:00
|
|
|
|
2005-11-24 13:14:49 +00:00
|
|
|
fTopLayer = layer;
|
|
|
|
|
|
|
|
if (layer != NULL) {
|
|
|
|
AddChild(fTopLayer, Window());
|
|
|
|
fTopLayer->SetAsTopLayer(true);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 16:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|