- removed RootLayer::WinBorderAt(). Use Layer::LayerAt() instead.
- Added a skeleton for RootLayer::SetActive() - removed Workspace::SetFocus(). Use AttemptToSetFocus() instead. - properly implemented Workspace::_SetFocus(). - removed Workspace::fActiveItem - it had/has no use. - fixed a problem with Decorator buttons being drawn improperly when B_MOUSE_UP was generated outside their area. - added 2 TODOs to later fix Decorator's (re)drawing path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14295 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1118,21 +1118,6 @@ RootLayer::ShowWinBorder(WinBorder* winBorder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WinBorder *
|
|
||||||
RootLayer::WinBorderAt(const BPoint& pt) const
|
|
||||||
{
|
|
||||||
#ifndef NEW_INPUT_HANDLING
|
|
||||||
for (int32 i = 0; i < fWinBorderCount; i++)
|
|
||||||
{
|
|
||||||
#ifndef NEW_CLIPPING
|
|
||||||
if (fWinBorderList[i]->fFullVisible.Contains(pt))
|
|
||||||
return fWinBorderList[i];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NEW_INPUT_HANDLING
|
#ifdef NEW_INPUT_HANDLING
|
||||||
void
|
void
|
||||||
RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
||||||
@@ -1233,6 +1218,13 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
RootLayer::SetActive(WinBorder* newActive)
|
||||||
|
{
|
||||||
|
// TODO: properly implement
|
||||||
|
return ActiveWorkspace()->AttemptToActivate(newActive);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Workspace related methods
|
// Workspace related methods
|
||||||
@@ -1258,7 +1250,7 @@ RootLayer::_ProcessMouseMovedEvent(PointerEvent &evt)
|
|||||||
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
|
// TODO: Focus should be a RootLayer option/feature, NOT a Workspace one!!!
|
||||||
WinBorder* exFocus = Focus();
|
WinBorder* exFocus = Focus();
|
||||||
if (ds.MouseMode() != B_NORMAL_MOUSE && exFocus != winBorderTarget) {
|
if (ds.MouseMode() != B_NORMAL_MOUSE && exFocus != winBorderTarget) {
|
||||||
ActiveWorkspace()->SetFocus(winBorderTarget);
|
ActiveWorkspace()->AttemptToSetFocus(winBorderTarget);
|
||||||
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
|
// Workspace::SetFocus() *attempts* to set a new focus WinBorder, it may not succeed
|
||||||
if (exFocus != Focus()) {
|
if (exFocus != Focus()) {
|
||||||
// TODO: invalidate border area and send message to client for the widgets to light up
|
// TODO: invalidate border area and send message to client for the widgets to light up
|
||||||
@@ -2239,7 +2231,7 @@ RootLayer::show_winBorder(WinBorder *winBorder)
|
|||||||
invalid = fWorkspace[i]->ShowWinBorder(winBorder);
|
invalid = fWorkspace[i]->ShowWinBorder(winBorder);
|
||||||
|
|
||||||
// ToDo: this won't work with FFM
|
// ToDo: this won't work with FFM
|
||||||
fWorkspace[i]->SetFocus(winBorder);
|
fWorkspace[i]->AttemptToSetFocus(winBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fActiveWksIndex == i) {
|
if (fActiveWksIndex == i) {
|
||||||
|
|||||||
@@ -86,13 +86,13 @@ public:
|
|||||||
void SetWinBorderWorskpaces(WinBorder *winBorder,
|
void SetWinBorderWorskpaces(WinBorder *winBorder,
|
||||||
uint32 oldIndex,
|
uint32 oldIndex,
|
||||||
uint32 newIndex);
|
uint32 newIndex);
|
||||||
WinBorder* WinBorderAt(const BPoint& pt) const;
|
|
||||||
#ifdef NEW_INPUT_HANDLING
|
#ifdef NEW_INPUT_HANDLING
|
||||||
void RevealNewWMState(Workspace::State &oldWMState);
|
void RevealNewWMState(Workspace::State &oldWMState);
|
||||||
// TODO: we need to replace Winborder* with Layer*
|
// TODO: we need to replace Winborder* with Layer*
|
||||||
inline WinBorder* Focus() const { return fWMState.Focus; }
|
inline WinBorder* Focus() const { return fWMState.Focus; }
|
||||||
inline WinBorder* Front() const { return fWMState.Front; }
|
inline WinBorder* Front() const { return fWMState.Front; }
|
||||||
inline WinBorder* Active() const { return fWMState.Active; }
|
inline WinBorder* Active() const { return fWMState.Active; }
|
||||||
|
bool SetActive(WinBorder* newActive);
|
||||||
#else
|
#else
|
||||||
inline WinBorder* Focus() const { return ActiveWorkspace()->Focus(); }
|
inline WinBorder* Focus() const { return ActiveWorkspace()->Focus(); }
|
||||||
inline WinBorder* Front() const { return ActiveWorkspace()->Front(); }
|
inline WinBorder* Front() const { return ActiveWorkspace()->Front(); }
|
||||||
|
|||||||
@@ -530,11 +530,10 @@ WinBorder::MouseDown(const PointerEvent& evt)
|
|||||||
GetRootLayer()->ActiveWorkspace()->MoveToBack(this);
|
GetRootLayer()->ActiveWorkspace()->MoveToBack(this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (action == DEC_DRAG || action == DEC_RESIZE || action == DEC_SLIDETAB)
|
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
|
||||||
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
|
|
||||||
|
|
||||||
activateWindow:
|
activateWindow:
|
||||||
GetRootLayer()->ActiveWorkspace()->AttemptToActivate(this);
|
GetRootLayer()->SetActive(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetRootLayer()->RevealNewWMState(oldWMState);
|
GetRootLayer()->RevealNewWMState(oldWMState);
|
||||||
@@ -555,47 +554,53 @@ WinBorder::MouseDown(const PointerEvent& evt)
|
|||||||
void
|
void
|
||||||
WinBorder::MouseUp(const PointerEvent& event)
|
WinBorder::MouseUp(const PointerEvent& event)
|
||||||
{
|
{
|
||||||
|
bool invalidate = false;
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
click_type action = _ActionFor(event);
|
click_type action = _ActionFor(event);
|
||||||
|
// 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!
|
||||||
if (fIsZooming) {
|
if (fIsZooming) {
|
||||||
fIsZooming = false;
|
fIsZooming = false;
|
||||||
fDecorator->SetZoom(false);
|
fDecorator->SetZoom(false);
|
||||||
if (action == DEC_ZOOM)
|
if (action == DEC_ZOOM) {
|
||||||
|
invalidate = true;
|
||||||
Window()->NotifyZoom();
|
Window()->NotifyZoom();
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
if (fIsClosing) {
|
if (fIsClosing) {
|
||||||
fIsClosing = false;
|
fIsClosing = false;
|
||||||
fDecorator->SetClose(false);
|
fDecorator->SetClose(false);
|
||||||
if (action == DEC_CLOSE)
|
if (action == DEC_CLOSE) {
|
||||||
|
invalidate = true;
|
||||||
Window()->NotifyQuitRequested();
|
Window()->NotifyQuitRequested();
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
if (fIsMinimizing) {
|
if (fIsMinimizing) {
|
||||||
fIsMinimizing = false;
|
fIsMinimizing = false;
|
||||||
fDecorator->SetMinimize(false);
|
fDecorator->SetMinimize(false);
|
||||||
if (action == DEC_MINIMIZE)
|
if (action == DEC_MINIMIZE) {
|
||||||
|
invalidate = true;
|
||||||
Window()->NotifyMinimize(true);
|
Window()->NotifyMinimize(true);
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fIsDragging = false;
|
fIsDragging = false;
|
||||||
fIsResizing = false;
|
fIsResizing = false;
|
||||||
fIsSlidingTab = false;
|
fIsSlidingTab = false;
|
||||||
|
|
||||||
// TODO: set dirty regions!
|
|
||||||
#ifndef NEW_CLIPPING
|
|
||||||
GetRootLayer()->invalidate_layer(GetRootLayer(), VisibleRegion());
|
|
||||||
#else
|
|
||||||
do_Invalidate(VisibleRegion());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WinBorder::MouseMoved(const PointerEvent& event, uint32 transit)
|
WinBorder::MouseMoved(const PointerEvent& event, uint32 transit)
|
||||||
{
|
{
|
||||||
if (fDecorator) {
|
if (fDecorator) {
|
||||||
|
// 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!
|
||||||
if (fIsZooming) {
|
if (fIsZooming) {
|
||||||
fDecorator->SetZoom(_ActionFor(event) == DEC_ZOOM);
|
fDecorator->SetZoom(_ActionFor(event) == DEC_ZOOM);
|
||||||
} else if (fIsClosing) {
|
} else if (fIsClosing) {
|
||||||
@@ -604,6 +609,7 @@ WinBorder::MouseMoved(const PointerEvent& event, uint32 transit)
|
|||||||
fDecorator->SetMinimize(_ActionFor(event) == DEC_MINIMIZE);
|
fDecorator->SetMinimize(_ActionFor(event) == DEC_MINIMIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fIsDragging) {
|
if (fIsDragging) {
|
||||||
BPoint delta = event.where - fLastMousePosition;
|
BPoint delta = event.where - fLastMousePosition;
|
||||||
#ifndef NEW_CLIPPING
|
#ifndef NEW_CLIPPING
|
||||||
@@ -623,6 +629,7 @@ WinBorder::MouseMoved(const PointerEvent& event, uint32 transit)
|
|||||||
if (fIsSlidingTab) {
|
if (fIsSlidingTab) {
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
|
|
||||||
fLastMousePosition = event.where;
|
fLastMousePosition = event.where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,10 +246,12 @@ Workspace::AttemptToSetFront(WinBorder *newFront)
|
|||||||
return MoveToFront(newFront);
|
return MoveToFront(newFront);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int32
|
||||||
Workspace::AttemptToSetFocus(WinBorder *newFocus)
|
Workspace::AttemptToSetFocus(WinBorder *newFocus)
|
||||||
{
|
{
|
||||||
return SetFocus(newFocus);
|
ListData* newFocusItem = HasItem(newFocus);
|
||||||
|
|
||||||
|
return _SetFocus(newFocusItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -262,7 +264,7 @@ bool
|
|||||||
Workspace::AttemptToActivate(WinBorder *toActivate)
|
Workspace::AttemptToActivate(WinBorder *toActivate)
|
||||||
{
|
{
|
||||||
MoveToFront(toActivate);
|
MoveToFront(toActivate);
|
||||||
SetFocus(toActivate);
|
AttemptToSetFocus(toActivate);
|
||||||
return Active() == toActivate;
|
return Active() == toActivate;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -305,26 +307,71 @@ Workspace::GetWinBorderList(void **list, int32 *itemCount ) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Makes the specified WinBorder the focus one.
|
||||||
|
\param newFocus WinBorder which will try to take focus state.
|
||||||
|
\return 0 - setting focus failed, focus did not change.
|
||||||
|
1 - the new focus WinBorder is \a winBorder
|
||||||
|
2 - focus changed but not to \a winBorder because in front of it there
|
||||||
|
are other modal windows.
|
||||||
|
|
||||||
bool
|
Set a new focus WinBorder if possible.
|
||||||
Workspace::SetFocus(WinBorder* newFocus)
|
*/
|
||||||
|
|
||||||
|
int32
|
||||||
|
Workspace::_SetFocus(ListData *newFocusItem)
|
||||||
{
|
{
|
||||||
// in case this normal window is the front window,
|
if (!newFocusItem || newFocusItem == fFocusItem
|
||||||
// BUT it does not have focus.
|
|| (newFocusItem && !newFocusItem->layerPtr->IsHidden()
|
||||||
ListData* newFocusItem = HasItem(newFocus);
|
&& newFocusItem->layerPtr->WindowFlags() & B_AVOID_FOCUS))
|
||||||
|
return 0L;
|
||||||
|
|
||||||
if (newFocusItem && fFocusItem != newFocusItem
|
WinBorder *newFocus = newFocusItem->layerPtr;
|
||||||
&& !(newFocus->WindowFlags() & B_AVOID_FOCUS)) {
|
bool rv = 1;
|
||||||
// ToDo: for now, the focus item is always the active item...
|
|
||||||
// (it will be changed later on, and fixed with the refactoring)
|
switch(newFocus->Level()) {
|
||||||
fFocusItem = newFocusItem;
|
case B_MODAL_APP:
|
||||||
fActiveItem = newFocusItem;
|
case B_NORMAL: {
|
||||||
return true;
|
ListData *item = newFocusItem->upperItem;
|
||||||
|
while ( item &&
|
||||||
|
!item->layerPtr->IsHidden() &&
|
||||||
|
((item->layerPtr->Level() == B_MODAL_APP &&
|
||||||
|
item->layerPtr->App()->ClientTeam() == newFocus->App()->ClientTeam()) ||
|
||||||
|
item->layerPtr->Level() >= B_MODAL_ALL))
|
||||||
|
{
|
||||||
|
if (item->layerPtr->WindowFlags() & B_AVOID_FOCUS)
|
||||||
|
newFocusItem = NULL;
|
||||||
|
else
|
||||||
|
newFocusItem = item;
|
||||||
|
rv = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_SYSTEM_FIRST:
|
||||||
|
case B_MODAL_ALL: {
|
||||||
|
ListData *item = newFocusItem->upperItem;
|
||||||
|
while ( item &&
|
||||||
|
!item->layerPtr->IsHidden() &&
|
||||||
|
item->layerPtr->Level() >= newFocus->Level())
|
||||||
|
{
|
||||||
|
if (item->layerPtr->WindowFlags() & B_AVOID_FOCUS)
|
||||||
|
newFocusItem = NULL;
|
||||||
|
else
|
||||||
|
newFocusItem = item;
|
||||||
|
rv = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
fFocusItem = newFocusItem;
|
||||||
}
|
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Makes the specified WinBorder the front one.
|
\brief Makes the specified WinBorder the front one.
|
||||||
@@ -584,8 +631,8 @@ Workspace::HideWinBorder(WinBorder *winBorder)
|
|||||||
|
|
||||||
case B_NORMAL:
|
case B_NORMAL:
|
||||||
{
|
{
|
||||||
if (Focus() == winBorder)
|
if (fFrontItem && fFrontItem->layerPtr == winBorder)
|
||||||
saveFloatingWindows(fFocusItem);
|
saveFloatingWindows(fFrontItem);
|
||||||
|
|
||||||
// remove B_MODAL_SUBSET windows present before this window.
|
// remove B_MODAL_SUBSET windows present before this window.
|
||||||
ListData* itemThis = HasItem(winBorder);
|
ListData* itemThis = HasItem(winBorder);
|
||||||
@@ -677,7 +724,6 @@ Workspace::HideWinBorder(WinBorder *winBorder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fFocusItem = nextFocus;
|
fFocusItem = nextFocus;
|
||||||
fActiveItem = nextFocus;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@@ -1282,9 +1328,6 @@ Workspace::RemoveItem(ListData *item)
|
|||||||
|
|
||||||
if (fFrontItem == item)
|
if (fFrontItem == item)
|
||||||
fFrontItem = NULL;
|
fFrontItem = NULL;
|
||||||
|
|
||||||
if (fActiveItem == item)
|
|
||||||
fActiveItem = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,13 +73,12 @@ class Workspace {
|
|||||||
WinBorder* Active() const;
|
WinBorder* Active() const;
|
||||||
void GetState(Workspace::State *state) const;
|
void GetState(Workspace::State *state) const;
|
||||||
bool AttemptToSetFront(WinBorder *newFront);
|
bool AttemptToSetFront(WinBorder *newFront);
|
||||||
bool AttemptToSetFocus(WinBorder *newFocus);
|
int32 AttemptToSetFocus(WinBorder *newFocus);
|
||||||
bool AttemptToMoveToBack(WinBorder *newBack);
|
bool AttemptToMoveToBack(WinBorder *newBack);
|
||||||
bool AttemptToActivate(WinBorder *toActivate);
|
bool AttemptToActivate(WinBorder *toActivate);
|
||||||
|
|
||||||
bool GetWinBorderList(void **list, int32 *itemCount ) const;
|
bool GetWinBorderList(void **list, int32 *itemCount ) const;
|
||||||
|
|
||||||
bool SetFocus(WinBorder* newFocus);
|
|
||||||
bool MoveToBack(WinBorder *newLast);
|
bool MoveToBack(WinBorder *newLast);
|
||||||
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
|
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
|
||||||
|
|
||||||
@@ -113,6 +112,8 @@ private:
|
|||||||
bool placeToBack(ListData *newLast);
|
bool placeToBack(ListData *newLast);
|
||||||
void placeInFront(ListData *item, const bool userBusy);
|
void placeInFront(ListData *item, const bool userBusy);
|
||||||
|
|
||||||
|
int32 _SetFocus(ListData *newFocusItem);
|
||||||
|
|
||||||
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
|
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
|
||||||
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
|
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
|
||||||
|
|
||||||
@@ -154,7 +155,6 @@ private:
|
|||||||
|
|
||||||
// pointer for which "big" actions are intended
|
// pointer for which "big" actions are intended
|
||||||
ListData *fFrontItem;
|
ListData *fFrontItem;
|
||||||
ListData* fActiveItem;
|
|
||||||
|
|
||||||
// settings for each workspace -- example taken from R5's app_server_settings file
|
// settings for each workspace -- example taken from R5's app_server_settings file
|
||||||
display_timing fDisplayTiming;
|
display_timing fDisplayTiming;
|
||||||
|
|||||||
Reference in New Issue
Block a user