* No longer activates a window on first click if B_WILL_ACCEPT_FIRST_CLICK is set.
* minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15449 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <DirectWindow.h>
|
#include <DirectWindow.h>
|
||||||
#include <View.h> // for mouse button defines
|
#include <View.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
// constructor
|
|
||||||
WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
||||||
window_look look, window_feel feel,
|
window_look look, window_feel feel,
|
||||||
uint32 flags, uint32 workspaces,
|
uint32 flags, uint32 workspaces,
|
||||||
@@ -156,102 +156,14 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
|
|||||||
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
|
STRACE(("\tWindow %s\n", window ? window->Title() : "NULL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
WindowLayer::~WindowLayer()
|
WindowLayer::~WindowLayer()
|
||||||
{
|
{
|
||||||
delete fTopLayer;
|
delete fTopLayer;
|
||||||
delete fDecorator;
|
delete fDecorator;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// MessageReceived
|
|
||||||
void
|
|
||||||
WindowLayer::MessageReceived(BMessage* message)
|
|
||||||
{
|
|
||||||
switch (message->what) {
|
|
||||||
case MSG_REDRAW: {
|
|
||||||
// there is only one MSG_REDRAW in the queue at anytime
|
|
||||||
if (fDesktop->ReadLockWindows()) {
|
|
||||||
|
|
||||||
_DrawBorder();
|
|
||||||
_TriggerContentRedraw();
|
|
||||||
|
|
||||||
// reset the dirty region, since
|
|
||||||
// we're fully clean. If the desktop
|
|
||||||
// thread wanted to mark something
|
|
||||||
// dirty in the mean time, it was
|
|
||||||
// blocking on the global region lock to
|
|
||||||
// get write access, since we held the
|
|
||||||
// read lock for the whole time.
|
|
||||||
fDirtyRegion.MakeEmpty();
|
|
||||||
|
|
||||||
fDesktop->ReadUnlockWindows();
|
|
||||||
} else {
|
|
||||||
//printf("%s MSG_REDRAW -> pending redraws\n", Name());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MSG_BEGIN_UPDATE:
|
|
||||||
_BeginUpdate();
|
|
||||||
break;
|
|
||||||
case MSG_END_UPDATE:
|
|
||||||
_EndUpdate();
|
|
||||||
break;
|
|
||||||
case MSG_DRAWING_COMMAND: {
|
|
||||||
int32 token;
|
|
||||||
if (message->FindInt32("token", &token) >= B_OK)
|
|
||||||
_DrawClient(token);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MSG_DRAW_POLYGON: {
|
|
||||||
int32 token;
|
|
||||||
BPoint polygon[4];
|
|
||||||
if (message->FindInt32("token", &token) >= B_OK &&
|
|
||||||
message->FindPoint("point", 0, &polygon[0]) >= B_OK &&
|
|
||||||
message->FindPoint("point", 1, &polygon[1]) >= B_OK &&
|
|
||||||
message->FindPoint("point", 2, &polygon[2]) >= B_OK &&
|
|
||||||
message->FindPoint("point", 3, &polygon[3]) >= B_OK) {
|
|
||||||
|
|
||||||
_DrawClientPolygon(token, polygon);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case MSG_INVALIDATE_VIEW: {
|
|
||||||
int32 token;
|
|
||||||
if (message->FindInt32("token", &token) >= B_OK)
|
|
||||||
InvalidateView(token);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MSG_SHOW:
|
|
||||||
if (IsHidden()) {
|
|
||||||
fDesktop->ShowWindow(this);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BLooper::MessageReceived(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QuitRequested
|
|
||||||
bool
|
|
||||||
WindowLayer::QuitRequested()
|
|
||||||
{
|
|
||||||
if (fDesktop && fDesktop->WriteLockWindows()) {
|
|
||||||
fDesktop->WindowDied(this);
|
|
||||||
|
|
||||||
fClient->Lock();
|
|
||||||
fClient->Quit();
|
|
||||||
|
|
||||||
fDesktop->WriteUnlockWindows();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ReadLockWindows
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::ReadLockWindows()
|
WindowLayer::ReadLockWindows()
|
||||||
{
|
{
|
||||||
@@ -263,7 +175,7 @@ WindowLayer::ReadLockWindows()
|
|||||||
return fReadLocked;
|
return fReadLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadUnlockWindows
|
|
||||||
void
|
void
|
||||||
WindowLayer::ReadUnlockWindows()
|
WindowLayer::ReadUnlockWindows()
|
||||||
{
|
{
|
||||||
@@ -667,6 +579,7 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region)
|
|||||||
region.IntersectWith(&layer->ScreenClipping(&fContentRegion));
|
region.IntersectWith(&layer->ScreenClipping(&fContentRegion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowLayer::DrawingRegionChanged(ViewLayer* layer) const
|
WindowLayer::DrawingRegionChanged(ViewLayer* layer) const
|
||||||
{
|
{
|
||||||
@@ -882,14 +795,14 @@ WindowLayer::MouseDown(BMessage* msg, BPoint where, int32* _viewToken)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ViewLayer* view = ViewAt(where)) {
|
if (ViewLayer* view = ViewAt(where)) {
|
||||||
//printf("clicked: %s\n", view->Name());
|
|
||||||
//view->PrintToStream();
|
|
||||||
// clicking a simple ViewLayer
|
// clicking a simple ViewLayer
|
||||||
if (!IsFocus()) {
|
if (!IsFocus()) {
|
||||||
DesktopSettings desktopSettings(fDesktop);
|
DesktopSettings desktopSettings(fDesktop);
|
||||||
|
|
||||||
// not in FFM mode?
|
// Activate window in case it doesn't accept first click, and
|
||||||
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
|
// we're not in FFM mode
|
||||||
|
if ((Flags() & B_WILL_ACCEPT_FIRST_CLICK) == 0
|
||||||
|
&& desktopSettings.MouseMode() == B_NORMAL_MOUSE)
|
||||||
fDesktop->ActivateWindow(this);
|
fDesktop->ActivateWindow(this);
|
||||||
|
|
||||||
// eat the click if we don't accept first click
|
// eat the click if we don't accept first click
|
||||||
@@ -899,8 +812,6 @@ WindowLayer::MouseDown(BMessage* msg, BPoint where, int32* _viewToken)
|
|||||||
// always fill out view token if we already have focus
|
// always fill out view token if we already have focus
|
||||||
*_viewToken = view->Token();
|
*_viewToken = view->Token();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//printf("clicked: nowhere\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1264,6 +1175,7 @@ WindowLayer::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Returns wether or not the window is visible on the specified
|
\brief Returns wether or not the window is visible on the specified
|
||||||
workspace.
|
workspace.
|
||||||
|
|||||||
@@ -245,8 +245,6 @@ class WindowLayer {
|
|||||||
bool fIsSlidingTab;
|
bool fIsSlidingTab;
|
||||||
bool fIsDragging;
|
bool fIsDragging;
|
||||||
|
|
||||||
// bool fBringToFrontOnRelease;
|
|
||||||
|
|
||||||
::Decorator* fDecorator;
|
::Decorator* fDecorator;
|
||||||
ViewLayer* fTopLayer;
|
ViewLayer* fTopLayer;
|
||||||
::ServerWindow* fWindow;
|
::ServerWindow* fWindow;
|
||||||
@@ -254,7 +252,6 @@ class WindowLayer {
|
|||||||
::Desktop* fDesktop;
|
::Desktop* fDesktop;
|
||||||
|
|
||||||
BPoint fLastMousePosition;
|
BPoint fLastMousePosition;
|
||||||
// BPoint fResizingClickOffset;
|
|
||||||
|
|
||||||
// The synchronization, which client drawing commands
|
// The synchronization, which client drawing commands
|
||||||
// belong to the redraw of which dirty region is handled
|
// belong to the redraw of which dirty region is handled
|
||||||
|
|||||||
Reference in New Issue
Block a user