Quick fix for the broken focus changing I introduced earlier.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15096 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -833,25 +833,25 @@ Layer::CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset)
|
||||
|
||||
|
||||
void
|
||||
Layer::MouseDown(const BMessage *msg)
|
||||
Layer::MouseDown(BMessage *msg, BPoint where)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Layer::MouseUp(const BMessage *msg)
|
||||
Layer::MouseUp(BMessage *msg, BPoint where)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Layer::MouseMoved(const BMessage *msg)
|
||||
Layer::MouseMoved(BMessage *msg, BPoint where)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Layer::MouseWheelChanged(const BMessage *msg)
|
||||
Layer::MouseWheelChanged(BMessage *msg, BPoint where)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -154,10 +154,10 @@ class Layer {
|
||||
int32 xOffset, int32 yOffset);
|
||||
|
||||
// input handling
|
||||
virtual void MouseDown(const BMessage *msg);
|
||||
virtual void MouseUp(const BMessage *msg);
|
||||
virtual void MouseMoved(const BMessage *msg);
|
||||
virtual void MouseWheelChanged(const BMessage *msg);
|
||||
virtual void MouseDown(BMessage *msg, BPoint where);
|
||||
virtual void MouseUp(BMessage *msg, BPoint where);
|
||||
virtual void MouseMoved(BMessage *msg, BPoint where);
|
||||
virtual void MouseWheelChanged(BMessage *msg, BPoint where);
|
||||
|
||||
virtual void WorkspaceActivated(int32 index, bool active);
|
||||
virtual void WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces);
|
||||
|
||||
@@ -13,19 +13,11 @@
|
||||
/** Class used for the top layer of each workspace's Layer tree */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Window.h>
|
||||
#include <List.h>
|
||||
#include <Message.h>
|
||||
//#include <Entry.h>
|
||||
#include <File.h>
|
||||
#include <PortLink.h>
|
||||
|
||||
#include "Decorator.h"
|
||||
#include "DrawingEngine.h"
|
||||
#include "HWInterface.h"
|
||||
#include "Layer.h"
|
||||
#include "RootLayer.h"
|
||||
#include "ServerApp.h"
|
||||
#include "ServerConfig.h"
|
||||
#include "ServerProtocol.h"
|
||||
@@ -35,7 +27,13 @@
|
||||
#include "Workspace.h"
|
||||
#include "WorkspacesLayer.h"
|
||||
|
||||
#include "RootLayer.h"
|
||||
#include <File.h>
|
||||
#include <List.h>
|
||||
#include <Message.h>
|
||||
#include <PortLink.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if DISPLAY_HAIKU_LOGO
|
||||
#include "ServerBitmap.h"
|
||||
@@ -234,20 +232,15 @@ RootLayer::AddWinBorder(WinBorder* winBorder)
|
||||
|
||||
// Subset modals also need to have a main window before appearing in workspace list.
|
||||
int32 feel = winBorder->Feel();
|
||||
if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL)
|
||||
{
|
||||
uint32 wks = winBorder->Workspaces();
|
||||
if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL) {
|
||||
uint32 workspaces = winBorder->Workspaces();
|
||||
// add to current workspace
|
||||
if (wks == 0)
|
||||
{
|
||||
if (workspaces == 0)
|
||||
fWorkspace[fActiveWksIndex]->AddWinBorder(winBorder);
|
||||
}
|
||||
// add to desired workspaces
|
||||
else
|
||||
{
|
||||
for (int32 i = 0; i < fWsCount; i++)
|
||||
{
|
||||
if (fWorkspace[i] && (wks & (0x00000001UL << i)))
|
||||
else {
|
||||
// add to desired workspaces
|
||||
for (int32 i = 0; i < fWsCount; i++) {
|
||||
if (fWorkspace[i] && (workspaces & (0x00000001UL << i)))
|
||||
fWorkspace[i]->AddWinBorder(winBorder);
|
||||
}
|
||||
}
|
||||
@@ -850,29 +843,6 @@ RootLayer::SetActive(WinBorder* newActive, bool activate)
|
||||
// #pragma mark - Input related methods
|
||||
|
||||
|
||||
void
|
||||
RootLayer::_ProcessMouseMovedEvent(BMessage *msg, BPoint where, Layer* target)
|
||||
{
|
||||
// change focus in FFM mode
|
||||
WinBorder* winBorderTarget = dynamic_cast<WinBorder*>(target);
|
||||
if (winBorderTarget) {
|
||||
DesktopSettings desktopSettings(fDesktop);
|
||||
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
|
||||
WinBorder* exFocus = Focus();
|
||||
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && exFocus != winBorderTarget) {
|
||||
ActiveWorkspace()->AttemptToSetFocus(winBorderTarget);
|
||||
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
|
||||
if (exFocus != Focus()) {
|
||||
// TODO: invalidate border area and send message to client for the widgets to light up
|
||||
// What message? Is there a message on Focus change?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
target->MouseMoved(msg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RootLayer::MouseEventHandler(BMessage *event)
|
||||
{
|
||||
@@ -882,30 +852,23 @@ RootLayer::MouseEventHandler(BMessage *event)
|
||||
|
||||
Layer* layer = fMouseEventLayer;
|
||||
if (layer == NULL) {
|
||||
if (fWMState.Focus != NULL) {
|
||||
layer = fWMState.Focus->LayerAt(where);
|
||||
if (layer != NULL)
|
||||
event->AddInt32("_view_token", layer->ViewToken());
|
||||
}
|
||||
if (layer == NULL) {
|
||||
layer = LayerAt(where);
|
||||
if (layer == NULL)
|
||||
return;
|
||||
}
|
||||
layer = LayerAt(where, false);
|
||||
if (layer == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->what) {
|
||||
case B_MOUSE_DOWN:
|
||||
layer->MouseDown(event);
|
||||
layer->MouseDown(event, where);
|
||||
break;
|
||||
|
||||
case B_MOUSE_UP:
|
||||
layer->MouseUp(event);
|
||||
layer->MouseUp(event, where);
|
||||
SetMouseEventLayer(NULL);
|
||||
break;
|
||||
|
||||
case B_MOUSE_MOVED:
|
||||
_ProcessMouseMovedEvent(event, where, layer);
|
||||
layer->MouseMoved(event, where);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -961,15 +924,15 @@ RootLayer::show_winBorder(WinBorder *winBorder)
|
||||
for (int32 i = 0; i < fWsCount; i++) {
|
||||
invalid = false;
|
||||
|
||||
if (fWorkspace[i] &&
|
||||
(fWorkspace[i]->HasWinBorder(winBorder) ||
|
||||
// subset modals are a bit like floating windows, they are being added
|
||||
// and removed from workspace when there's at least a normal window
|
||||
// that uses them.
|
||||
winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL ||
|
||||
// floating windows are inserted/removed on-the-fly so this window,
|
||||
// although needed may not be in workspace's list.
|
||||
winBorder->Level() == B_FLOATING_APP))
|
||||
if (fWorkspace[i]
|
||||
&& (fWorkspace[i]->HasWinBorder(winBorder)
|
||||
|| winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL
|
||||
// subset modals are a bit like floating windows, they are being added
|
||||
// and removed from workspace when there's at least a normal window
|
||||
// that uses them.
|
||||
|| winBorder->Level() == B_FLOATING_APP))
|
||||
// floating windows are inserted/removed on-the-fly so this window,
|
||||
// although needed may not be in workspace's list.
|
||||
{
|
||||
invalid = fWorkspace[i]->ShowWinBorder(winBorder);
|
||||
|
||||
|
||||
@@ -132,9 +132,7 @@ friend class Desktop;
|
||||
|
||||
void change_winBorder_feel(WinBorder *winBorder, int32 newFeel);
|
||||
|
||||
// Input related methods
|
||||
void MouseEventHandler(BMessage *msg);
|
||||
void _ProcessMouseMovedEvent(BMessage *msg, BPoint where, Layer* target);
|
||||
|
||||
Desktop* fDesktop;
|
||||
BMessage* fDragMessage;
|
||||
|
||||
@@ -410,107 +410,93 @@ WinBorder::GetSizeLimits(float* minWidth, float* maxWidth,
|
||||
|
||||
|
||||
void
|
||||
WinBorder::MouseDown(const BMessage *msg)
|
||||
WinBorder::MouseDown(BMessage *msg, BPoint where)
|
||||
{
|
||||
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
|
||||
BPoint where(0, 0);
|
||||
// default action is to drag the WinBorder
|
||||
Layer *target = LayerAt(where);
|
||||
if (target == this) {
|
||||
// clicking WinBorder visible area
|
||||
|
||||
msg->FindPoint("where", &where);
|
||||
click_type action = DEC_DRAG;
|
||||
|
||||
// not in FFM mode?
|
||||
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE) {
|
||||
// default action is to drag the WinBorder
|
||||
Layer *target = LayerAt(where);
|
||||
if (target == this) {
|
||||
// clicking WinBorder visible area
|
||||
winBorderAreaHandle:
|
||||
if (fDecorator)
|
||||
action = _ActionFor(msg);
|
||||
|
||||
click_type action = DEC_DRAG;
|
||||
// deactivate border buttons on first click(select)
|
||||
if (GetRootLayer()->Focus() != this && action != DEC_MOVETOBACK
|
||||
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
|
||||
action = DEC_DRAG;
|
||||
|
||||
if (fDecorator)
|
||||
action = _ActionFor(msg);
|
||||
// set decorator internals
|
||||
switch (action) {
|
||||
case DEC_CLOSE:
|
||||
fIsClosing = true;
|
||||
fDecorator->SetClose(true);
|
||||
STRACE_CLICK(("===> DEC_CLOSE\n"));
|
||||
break;
|
||||
|
||||
// deactivate border buttons on first click(select)
|
||||
if (GetRootLayer()->Focus() != this && action != DEC_MOVETOBACK
|
||||
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
|
||||
action = DEC_DRAG;
|
||||
case DEC_ZOOM:
|
||||
fIsZooming = true;
|
||||
fDecorator->SetZoom(true);
|
||||
STRACE_CLICK(("===> DEC_ZOOM\n"));
|
||||
break;
|
||||
|
||||
// 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_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_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_RESIZE:
|
||||
fIsResizing = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_RESIZE\n"));
|
||||
break;
|
||||
|
||||
case DEC_SLIDETAB:
|
||||
fIsSlidingTab = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_SLIDETAB\n"));
|
||||
break;
|
||||
case DEC_SLIDETAB:
|
||||
fIsSlidingTab = true;
|
||||
fLastMousePosition = where;
|
||||
STRACE_CLICK(("===> DEC_SLIDETAB\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// based on what the Decorator returned, properly place this window.
|
||||
if (action == DEC_MOVETOBACK) {
|
||||
GetRootLayer()->SetActive(this, false);
|
||||
} else {
|
||||
GetRootLayer()->SetMouseEventLayer(this);
|
||||
// based on what the Decorator returned, properly place this window.
|
||||
if (action == DEC_MOVETOBACK) {
|
||||
GetRootLayer()->SetActive(this, false);
|
||||
} else {
|
||||
GetRootLayer()->SetMouseEventLayer(this);
|
||||
GetRootLayer()->SetActive(this);
|
||||
}
|
||||
} else if (target != NULL) {
|
||||
// clicking a simple Layer.
|
||||
if (GetRootLayer()->ActiveWorkspace()->Active() != this) {
|
||||
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
|
||||
|
||||
// not in FFM mode?
|
||||
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
|
||||
GetRootLayer()->SetActive(this);
|
||||
}
|
||||
} else if (target != NULL) {
|
||||
// clicking a simple Layer.
|
||||
if (GetRootLayer()->ActiveWorkspace()->Active() == this) {
|
||||
target->MouseDown(msg);
|
||||
} else {
|
||||
if (WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK)
|
||||
target->MouseDown(msg);
|
||||
else
|
||||
GetRootLayer()->SetActive(this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// in FFM mode
|
||||
Layer *target = LayerAt(where);
|
||||
if (target == this) {
|
||||
// clicking inside our visible area.
|
||||
goto winBorderAreaHandle;
|
||||
} else if (target != NULL) {
|
||||
// clicking a simple Layer; forward event.
|
||||
target->MouseDown(msg);
|
||||
|
||||
if ((WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
msg->AddInt32("_view_token", target->ViewToken());
|
||||
target->MouseDown(msg, where);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WinBorder::MouseUp(const BMessage *msg)
|
||||
WinBorder::MouseUp(BMessage *msg, BPoint where)
|
||||
{
|
||||
bool invalidate = false;
|
||||
if (fDecorator) {
|
||||
@@ -552,12 +538,8 @@ WinBorder::MouseUp(const BMessage *msg)
|
||||
|
||||
|
||||
void
|
||||
WinBorder::MouseMoved(const BMessage *msg)
|
||||
WinBorder::MouseMoved(BMessage *msg, BPoint where)
|
||||
{
|
||||
BPoint where(0,0);
|
||||
|
||||
msg->FindPoint("where", &where);
|
||||
|
||||
if (fDecorator) {
|
||||
// TODO: present behavior is not fine!
|
||||
// Decorator's Set*() methods _actualy draw_! on screen, not
|
||||
@@ -586,6 +568,19 @@ WinBorder::MouseMoved(const BMessage *msg)
|
||||
}
|
||||
|
||||
fLastMousePosition = where;
|
||||
|
||||
// change focus in FFM mode
|
||||
DesktopSettings desktopSettings(GetRootLayer()->GetDesktop());
|
||||
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
|
||||
WinBorder* exFocus = GetRootLayer()->Focus();
|
||||
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && exFocus != this) {
|
||||
GetRootLayer()->ActiveWorkspace()->AttemptToSetFocus(this);
|
||||
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
|
||||
// if (exFocus != Focus()) {
|
||||
// TODO: invalidate border area and send message to client for the widgets to light up
|
||||
// What message? Is there a message on Focus change?
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ class WinBorder : public Layer {
|
||||
float* minHeight,
|
||||
float* maxHeight) const;
|
||||
|
||||
virtual void MouseDown(const BMessage *msg);
|
||||
virtual void MouseUp(const BMessage *msg);
|
||||
virtual void MouseMoved(const BMessage *msg);
|
||||
virtual void MouseDown(BMessage *msg, BPoint where);
|
||||
virtual void MouseUp(BMessage *msg, BPoint where);
|
||||
virtual void MouseMoved(BMessage *msg, BPoint where);
|
||||
|
||||
// click_type ActionFor(const BMessage *msg)
|
||||
// { return _ActionFor(evt); }
|
||||
|
||||
Reference in New Issue
Block a user