From fc21e33e4652fd80ea37736ecd76ea182ccf28f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 2 Dec 2005 10:35:01 +0000 Subject: [PATCH] * B_NOT_H_RESIZABLE/B_NOT_V_RESIZABLE are now correctly supported by the decorators. * Introduced methods WindowLayer::IsModal() and IsFloating(). * Invalid flags for the current feel are now filtered out, like B_AVOID_FOCUS for modal windows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15280 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Decorator.cpp | 8 +++++ src/servers/app/WindowLayer.cpp | 57 ++++++++++++++++++++++++++++++++- src/servers/app/WindowLayer.h | 8 +++-- 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/servers/app/Decorator.cpp b/src/servers/app/Decorator.cpp index ca7da2c3cf..f6516a089f 100644 --- a/src/servers/app/Decorator.cpp +++ b/src/servers/app/Decorator.cpp @@ -104,6 +104,14 @@ Decorator::SetDriver(DrawingEngine *driver) void Decorator::SetFlags(uint32 flags, BRegion* updateRegion) { + // we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE are in sync + // (it's only a semantical simplification, not a necessity) + if ((flags & (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE)) + == (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE)) + flags |= B_NOT_RESIZABLE; + if (flags & B_NOT_RESIZABLE) + flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE; + fFlags = flags; } diff --git a/src/servers/app/WindowLayer.cpp b/src/servers/app/WindowLayer.cpp index 7efee6e7d0..198564b4ba 100644 --- a/src/servers/app/WindowLayer.cpp +++ b/src/servers/app/WindowLayer.cpp @@ -548,6 +548,11 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken) } if (fIsResizing) { BPoint delta = where - fLastMousePosition; + if (WindowFlags() & B_NOT_V_RESIZABLE) + delta.y = 0; + if (WindowFlags() & B_NOT_H_RESIZABLE) + delta.x = 0; + Window()->Desktop()->ResizeWindowBy(this, delta.x, delta.y); } if (fIsSlidingTab) { @@ -706,6 +711,10 @@ WindowLayer::SetFeel(window_feel feel) { fFeel = feel; + // having modal windows with B_AVOID_FRONT or B_AVOID_FOCUS doesn't + // make that much sense, so we filter those flags out on demand + fWindowFlags &= ~ValidWindowFlags(fFeel); + // TODO: this shouldn't be necessary, but we'll see :) // floating and modal windows must appear in every workspace where @@ -732,7 +741,7 @@ WindowLayer::SetFeel(window_feel feel) void WindowLayer::SetWindowFlags(uint32 flags, BRegion* updateRegion) { - fWindowFlags = flags; + fWindowFlags = flags & ~ValidWindowFlags(fFeel); if (fDecorator == NULL) return; @@ -745,6 +754,20 @@ WindowLayer::SetWindowFlags(uint32 flags, BRegion* updateRegion) } +bool +WindowLayer::IsModal() const +{ + return IsModalFeel(fFeel); +} + + +bool +WindowLayer::IsFloating() const +{ + return IsFloatingFeel(fFeel); +} + + click_type WindowLayer::_ActionFor(const BMessage *msg) const { @@ -893,6 +916,26 @@ WindowLayer::IsValidFeel(window_feel feel) } +/*static*/ +bool +WindowLayer::IsModalFeel(window_feel feel) +{ + return feel == B_MODAL_SUBSET_WINDOW_FEEL + || feel == B_MODAL_APP_WINDOW_FEEL + || feel == B_MODAL_ALL_WINDOW_FEEL; +} + + +/*static*/ +bool +WindowLayer::IsFloatingFeel(window_feel feel) +{ + return feel == B_FLOATING_SUBSET_WINDOW_FEEL + || feel == B_FLOATING_APP_WINDOW_FEEL + || feel == B_FLOATING_ALL_WINDOW_FEEL; +} + + /*static*/ uint32 WindowLayer::ValidWindowFlags() @@ -910,3 +953,15 @@ WindowLayer::ValidWindowFlags() | kWindowScreenFlag; } + +/*static*/ +uint32 +WindowLayer::ValidWindowFlags(window_feel feel) +{ + uint32 flags = ValidWindowFlags(); + if (IsModalFeel(feel)) + return flags & ~(B_AVOID_FOCUS | B_AVOID_FRONT); + + return flags; +} + diff --git a/src/servers/app/WindowLayer.h b/src/servers/app/WindowLayer.h index fbc06792fd..a337a6e1f5 100644 --- a/src/servers/app/WindowLayer.h +++ b/src/servers/app/WindowLayer.h @@ -12,7 +12,6 @@ #include "Decorator.h" #include "Layer.h" -#include "SubWindowList.h" #include #include @@ -111,7 +110,8 @@ class WindowLayer : public Layer { void HighlightDecorator(bool active); - SubWindowList fSubWindowList; + bool IsModal() const; + bool IsFloating() const; void RequestClientRedraw(const BRegion& invalid); @@ -121,7 +121,11 @@ class WindowLayer : public Layer { static bool IsValidLook(window_look look); static bool IsValidFeel(window_feel feel); + static bool IsModalFeel(window_feel feel); + static bool IsFloatingFeel(window_feel feel); + static uint32 ValidWindowFlags(); + static uint32 ValidWindowFlags(window_feel feel); protected: virtual void _AllRedraw(const BRegion& invalid);