* Added a Desktop::BroadcastToAllWindows() method that sends all ServerWindows
a message. * The DesktopSettings class is now using that to send the new AS_SYSTEM_FONT_CHANGED message to all windows. * The ServerWindow now propagates font changes to its decorator, causing it to update its drawing. That means changing the bold font in the "Fonts" preferences application will instantly change all window titles. * Factored out a _RebuildAndRedrawAfterWindowChange() out of several Desktop methods, simplifying some code. * The DefaultDecorator no longer calls _DoLayout() twice (through SetLook()), but instead calls the new _UpdateFont() method now also called by FontsChanged(), and SetLook(). * BWindow::GetDecoratorSettings() now also includes "tab frame" BRect with the exact footprint of the tab, allowing apps to know the size of the tab to position itself accordingly. * Automatic white space cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28664 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -110,6 +110,7 @@ enum {
|
|||||||
AS_SET_SYSTEM_FONT,
|
AS_SET_SYSTEM_FONT,
|
||||||
AS_GET_SYSTEM_FONTS,
|
AS_GET_SYSTEM_FONTS,
|
||||||
AS_GET_SYSTEM_DEFAULT_FONT,
|
AS_GET_SYSTEM_DEFAULT_FONT,
|
||||||
|
AS_SYSTEM_FONT_CHANGED,
|
||||||
|
|
||||||
AS_GET_FONT_LIST_REVISION,
|
AS_GET_FONT_LIST_REVISION,
|
||||||
AS_GET_FAMILY_AND_STYLES,
|
AS_GET_FAMILY_AND_STYLES,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
/*! \brief Constructor
|
/*! \brief Constructor
|
||||||
|
|
||||||
Does general initialization of internal data members and creates a colorset
|
Does general initialization of internal data members and creates a colorset
|
||||||
object.
|
object.
|
||||||
|
|
||||||
\param rect Size of client area
|
\param rect Size of client area
|
||||||
\param wlook style of window look. See Window.h
|
\param wlook style of window look. See Window.h
|
||||||
@@ -56,7 +56,7 @@ Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look,
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Destructor
|
\brief Destructor
|
||||||
|
|
||||||
Frees the color set and the title string
|
Frees the color set and the title string
|
||||||
*/
|
*/
|
||||||
Decorator::~Decorator()
|
Decorator::~Decorator()
|
||||||
@@ -100,14 +100,11 @@ Decorator::SetFlags(uint32 flags, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Sets the decorator's font
|
/*! \brief Called whenever the system fonts are changed.
|
||||||
\param font The new font object to copy from
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Decorator::SetFont(ServerFont *font)
|
Decorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
if (font)
|
|
||||||
fDrawState.SetFont(*font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +120,7 @@ Decorator::SetLook(DesktopSettings& settings, window_look look,
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Sets the close button's value.
|
/*! \brief Sets the close button's value.
|
||||||
|
|
||||||
Note that this does not update the button's look - it just updates the
|
Note that this does not update the button's look - it just updates the
|
||||||
internal button value
|
internal button value
|
||||||
|
|
||||||
@@ -139,7 +136,7 @@ Decorator::SetClose(bool pressed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Sets the minimize button's value.
|
/*! \brief Sets the minimize button's value.
|
||||||
|
|
||||||
Note that this does not update the button's look - it just updates the
|
Note that this does not update the button's look - it just updates the
|
||||||
internal button value
|
internal button value
|
||||||
|
|
||||||
@@ -155,7 +152,7 @@ Decorator::SetMinimize(bool pressed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Sets the zoom button's value.
|
/*! \brief Sets the zoom button's value.
|
||||||
|
|
||||||
Note that this does not update the button's look - it just updates the
|
Note that this does not update the button's look - it just updates the
|
||||||
internal button value
|
internal button value
|
||||||
|
|
||||||
@@ -271,7 +268,7 @@ Decorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth,
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Changes the focus value of the decorator
|
/*! \brief Changes the focus value of the decorator
|
||||||
|
|
||||||
While this call will not update the screen, it will affect how future
|
While this call will not update the screen, it will affect how future
|
||||||
updates work.
|
updates work.
|
||||||
|
|
||||||
@@ -343,7 +340,7 @@ Decorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Moves the decorator frame and all default rectangles
|
/*! \brief Moves the decorator frame and all default rectangles
|
||||||
|
|
||||||
If a subclass implements this method, be sure to call Decorator::MoveBy
|
If a subclass implements this method, be sure to call Decorator::MoveBy
|
||||||
to ensure that internal members are also updated. All members of the
|
to ensure that internal members are also updated. All members of the
|
||||||
Decorator class are automatically moved in this method
|
Decorator class are automatically moved in this method
|
||||||
@@ -359,7 +356,7 @@ Decorator::MoveBy(float x, float y)
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Moves the decorator frame and all default rectangles
|
/*! \brief Moves the decorator frame and all default rectangles
|
||||||
|
|
||||||
If a subclass implements this method, be sure to call Decorator::MoveBy
|
If a subclass implements this method, be sure to call Decorator::MoveBy
|
||||||
to ensure that internal members are also updated. All members of the
|
to ensure that internal members are also updated. All members of the
|
||||||
Decorator class are automatically moved in this method
|
Decorator class are automatically moved in this method
|
||||||
@@ -381,11 +378,11 @@ Decorator::MoveBy(BPoint offset)
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Resizes the decorator frame
|
/*! \brief Resizes the decorator frame
|
||||||
|
|
||||||
This is a required function for subclasses to implement - the default does
|
This is a required function for subclasses to implement - the default does
|
||||||
nothing. Note that window resize flags should be followed and fFrame should
|
nothing. Note that window resize flags should be followed and fFrame should
|
||||||
be resized accordingly. It would also be a wise idea to ensure that the
|
be resized accordingly. It would also be a wise idea to ensure that the
|
||||||
window's rectangles are not inverted.
|
window's rectangles are not inverted.
|
||||||
|
|
||||||
\param x x offset
|
\param x x offset
|
||||||
\param y y offset
|
\param y y offset
|
||||||
@@ -512,7 +509,7 @@ Decorator::_DrawFrame(BRect rect)
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Actually draws the tab
|
/*! \brief Actually draws the tab
|
||||||
|
|
||||||
This function is called when the tab itself needs drawn. Other items,
|
This function is called when the tab itself needs drawn. Other items,
|
||||||
like the window title or buttons, should not be drawn here.
|
like the window title or buttons, should not be drawn here.
|
||||||
|
|
||||||
@@ -553,7 +550,7 @@ Decorator::_DrawTitle(BRect rect)
|
|||||||
|
|
||||||
|
|
||||||
/*! \brief Actually draws the zoom button
|
/*! \brief Actually draws the zoom button
|
||||||
|
|
||||||
Unless a subclass has a particularly large button, it is probably
|
Unless a subclass has a particularly large button, it is probably
|
||||||
unnecessary to check the update rectangle.
|
unnecessary to check the update rectangle.
|
||||||
|
|
||||||
@@ -566,7 +563,7 @@ Decorator::_DrawZoom(BRect rect)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Actually draws the minimize button
|
\brief Actually draws the minimize button
|
||||||
|
|
||||||
Unless a subclass has a particularly large button, it is probably
|
Unless a subclass has a particularly large button, it is probably
|
||||||
unnecessary to check the update rectangle.
|
unnecessary to check the update rectangle.
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ enum click_type {
|
|||||||
DEC_DRAG,
|
DEC_DRAG,
|
||||||
DEC_MOVETOBACK,
|
DEC_MOVETOBACK,
|
||||||
DEC_SLIDETAB,
|
DEC_SLIDETAB,
|
||||||
|
|
||||||
DEC_RESIZE,
|
DEC_RESIZE,
|
||||||
CLICK_RESIZE_L,
|
CLICK_RESIZE_L,
|
||||||
CLICK_RESIZE_T,
|
CLICK_RESIZE_T,
|
||||||
CLICK_RESIZE_R,
|
CLICK_RESIZE_R,
|
||||||
CLICK_RESIZE_B,
|
CLICK_RESIZE_B,
|
||||||
CLICK_RESIZE_LT,
|
CLICK_RESIZE_LT,
|
||||||
CLICK_RESIZE_RT,
|
CLICK_RESIZE_RT,
|
||||||
CLICK_RESIZE_LB,
|
CLICK_RESIZE_LB,
|
||||||
CLICK_RESIZE_RB
|
CLICK_RESIZE_RB
|
||||||
};
|
};
|
||||||
@@ -53,8 +53,9 @@ public:
|
|||||||
void SetDrawingEngine(DrawingEngine *driver);
|
void SetDrawingEngine(DrawingEngine *driver);
|
||||||
inline DrawingEngine* GetDrawingEngine() const
|
inline DrawingEngine* GetDrawingEngine() const
|
||||||
{ return fDrawingEngine; }
|
{ return fDrawingEngine; }
|
||||||
void SetFont(ServerFont *font);
|
|
||||||
|
|
||||||
|
virtual void FontsChanged(DesktopSettings& settings,
|
||||||
|
BRegion* updateRegion = NULL);
|
||||||
virtual void SetLook(DesktopSettings& settings, window_look look,
|
virtual void SetLook(DesktopSettings& settings, window_look look,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
virtual void SetFlags(uint32 flags,
|
virtual void SetFlags(uint32 flags,
|
||||||
@@ -74,7 +75,7 @@ public:
|
|||||||
|
|
||||||
BRect BorderRect() const;
|
BRect BorderRect() const;
|
||||||
BRect TabRect() const;
|
BRect TabRect() const;
|
||||||
|
|
||||||
bool GetClose();
|
bool GetClose();
|
||||||
bool GetMinimize();
|
bool GetMinimize();
|
||||||
bool GetZoom();
|
bool GetZoom();
|
||||||
@@ -97,7 +98,7 @@ public:
|
|||||||
virtual void ResizeBy(BPoint offset, BRegion* dirty) = 0;
|
virtual void ResizeBy(BPoint offset, BRegion* dirty) = 0;
|
||||||
|
|
||||||
/*! \return true if tab location updated, false if out of bounds
|
/*! \return true if tab location updated, false if out of bounds
|
||||||
or unsupported
|
or unsupported
|
||||||
*/
|
*/
|
||||||
virtual bool SetTabLocation(float location,
|
virtual bool SetTabLocation(float location,
|
||||||
BRegion* /*updateRegion*/ = NULL)
|
BRegion* /*updateRegion*/ = NULL)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
|
|||||||
fTabLocation(0.0),
|
fTabLocation(0.0),
|
||||||
fLastClicked(0)
|
fLastClicked(0)
|
||||||
{
|
{
|
||||||
DefaultDecorator::SetLook(settings, look);
|
_UpdateFont(settings);
|
||||||
|
|
||||||
// common colors to both focus and non focus state
|
// common colors to both focus and non focus state
|
||||||
fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
|
fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
|
||||||
@@ -159,6 +159,27 @@ DefaultDecorator::SetTitle(const char* string, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DefaultDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
// get previous extent
|
||||||
|
if (updateRegion != NULL) {
|
||||||
|
BRegion extent;
|
||||||
|
GetFootprint(&extent);
|
||||||
|
updateRegion->Include(&extent);
|
||||||
|
}
|
||||||
|
|
||||||
|
_UpdateFont(settings);
|
||||||
|
_DoLayout();
|
||||||
|
|
||||||
|
if (updateRegion != NULL) {
|
||||||
|
BRegion extent;
|
||||||
|
GetFootprint(&extent);
|
||||||
|
updateRegion->Include(&extent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
|
DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
|
||||||
BRegion* updateRegion)
|
BRegion* updateRegion)
|
||||||
@@ -172,19 +193,9 @@ DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
|
|||||||
updateRegion->Include(&extent);
|
updateRegion->Include(&extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerFont font;
|
fLook = look;
|
||||||
if (look == B_FLOATING_WINDOW_LOOK || look == kLeftTitledWindowLook) {
|
|
||||||
settings.GetDefaultPlainFont(font);
|
|
||||||
if (look == kLeftTitledWindowLook)
|
|
||||||
font.SetRotation(90.0f);
|
|
||||||
} else
|
|
||||||
settings.GetDefaultBoldFont(font);
|
|
||||||
|
|
||||||
font.SetFlags(B_FORCE_ANTIALIASING);
|
_UpdateFont(settings);
|
||||||
font.SetSpacing(B_STRING_SPACING);
|
|
||||||
SetFont(&font);
|
|
||||||
|
|
||||||
Decorator::SetLook(settings, look, updateRegion);
|
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
|
|
||||||
if (updateRegion != NULL) {
|
if (updateRegion != NULL) {
|
||||||
@@ -435,6 +446,9 @@ DefaultDecorator::GetSettings(BMessage* settings) const
|
|||||||
if (!fTabRect.IsValid())
|
if (!fTabRect.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (settings->AddRect("tab frame", fTabRect) != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
return settings->AddFloat("tab location", (float)fTabOffset) == B_OK;
|
return settings->AddFloat("tab location", (float)fTabOffset) == B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,8 +683,8 @@ DefaultDecorator::_DoLayout()
|
|||||||
fMinTabSize += offset + size;
|
fMinTabSize += offset + size;
|
||||||
|
|
||||||
// fMaxTabSize contains fMinWidth + the width required for the title
|
// fMaxTabSize contains fMinWidth + the width required for the title
|
||||||
fMaxTabSize = fDrawingEngine ?
|
fMaxTabSize = fDrawingEngine
|
||||||
ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()),
|
? ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()),
|
||||||
fDrawState.Font())) : 0.0;
|
fDrawState.Font())) : 0.0;
|
||||||
if (fMaxTabSize > 0.0)
|
if (fMaxTabSize > 0.0)
|
||||||
fMaxTabSize += fTextOffset;
|
fMaxTabSize += fTextOffset;
|
||||||
@@ -1098,6 +1112,23 @@ DefaultDecorator::_SetColors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DefaultDecorator::_UpdateFont(DesktopSettings& settings)
|
||||||
|
{
|
||||||
|
ServerFont font;
|
||||||
|
if (fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) {
|
||||||
|
settings.GetDefaultPlainFont(font);
|
||||||
|
if (fLook == kLeftTitledWindowLook)
|
||||||
|
font.SetRotation(90.0f);
|
||||||
|
} else
|
||||||
|
settings.GetDefaultBoldFont(font);
|
||||||
|
|
||||||
|
font.SetFlags(B_FORCE_ANTIALIASING);
|
||||||
|
font.SetSpacing(B_STRING_SPACING);
|
||||||
|
fDrawState.SetFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
|
DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public:
|
|||||||
|
|
||||||
virtual void SetTitle(const char* string,
|
virtual void SetTitle(const char* string,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
|
virtual void FontsChanged(DesktopSettings& settings,
|
||||||
|
BRegion* updateRegion);
|
||||||
virtual void SetLook(DesktopSettings& settings,
|
virtual void SetLook(DesktopSettings& settings,
|
||||||
window_look look,
|
window_look look,
|
||||||
BRegion* updateRegion = NULL);
|
BRegion* updateRegion = NULL);
|
||||||
@@ -68,6 +70,7 @@ protected:
|
|||||||
virtual void _SetColors();
|
virtual void _SetColors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _UpdateFont(DesktopSettings& settings);
|
||||||
void _DrawButtonBitmap(ServerBitmap* bitmap,
|
void _DrawButtonBitmap(ServerBitmap* bitmap,
|
||||||
BRect rect);
|
BRect rect);
|
||||||
void _DrawBlendedRect(DrawingEngine *engine,
|
void _DrawBlendedRect(DrawingEngine *engine,
|
||||||
|
|||||||
+58
-62
@@ -709,8 +709,7 @@ Desktop::_ActivateApp(team_id team)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Send a quick (no attachments) message to all applications.
|
||||||
\brief Send a quick (no attachments) message to all applications
|
|
||||||
|
|
||||||
Quite useful for notification for things like server shutdown, system
|
Quite useful for notification for things like server shutdown, system
|
||||||
color changes, etc.
|
color changes, etc.
|
||||||
@@ -726,6 +725,20 @@ Desktop::BroadcastToAllApps(int32 code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief Send a quick (no attachments) message to all windows.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Desktop::BroadcastToAllWindows(int32 code)
|
||||||
|
{
|
||||||
|
AutoWriteLocker _(fWindowLock);
|
||||||
|
|
||||||
|
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
|
window->ServerWindow()->PostMessage(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -1967,22 +1980,12 @@ Desktop::ResizeWindowBy(Window* window, float x, float y)
|
|||||||
bool
|
bool
|
||||||
Desktop::SetWindowTabLocation(Window* window, float location)
|
Desktop::SetWindowTabLocation(Window* window, float location)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
AutoWriteLocker _(fWindowLock);
|
||||||
return false;
|
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
bool changed = window->SetTabLocation(location, dirty);
|
bool changed = window->SetTabLocation(location, dirty);
|
||||||
|
if (changed)
|
||||||
if (changed && window->IsVisible() && dirty.CountRects() > 0) {
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
BRegion stillAvailableOnScreen;
|
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
|
||||||
_SetBackground(stillAvailableOnScreen);
|
|
||||||
|
|
||||||
_WindowChanged(window);
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
|
||||||
}
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@@ -1991,23 +1994,12 @@ Desktop::SetWindowTabLocation(Window* window, float location)
|
|||||||
bool
|
bool
|
||||||
Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
|
Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings)
|
||||||
{
|
{
|
||||||
// TODO: almost exact code duplication to above function...
|
AutoWriteLocker _(fWindowLock);
|
||||||
|
|
||||||
if (!LockAllWindows())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
bool changed = window->SetDecoratorSettings(settings, dirty);
|
bool changed = window->SetDecoratorSettings(settings, dirty);
|
||||||
|
if (changed)
|
||||||
if (changed && window->IsVisible() && dirty.CountRects() > 0) {
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
BRegion stillAvailableOnScreen;
|
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
|
||||||
_SetBackground(stillAvailableOnScreen);
|
|
||||||
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
|
||||||
}
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@@ -2211,32 +2203,36 @@ Desktop::RemoveWindowFromSubset(Window* subset, Window* window)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowLook(Window *window, window_look newLook)
|
Desktop::FontsChanged(Window* window)
|
||||||
|
{
|
||||||
|
AutoWriteLocker _(fWindowLock);
|
||||||
|
|
||||||
|
BRegion dirty;
|
||||||
|
window->FontsChanged(&dirty);
|
||||||
|
|
||||||
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Desktop::SetWindowLook(Window* window, window_look newLook)
|
||||||
{
|
{
|
||||||
if (window->Look() == newLook)
|
if (window->Look() == newLook)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!LockAllWindows())
|
AutoWriteLocker _(fWindowLock);
|
||||||
return;
|
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
window->SetLook(newLook, &dirty);
|
window->SetLook(newLook, &dirty);
|
||||||
// TODO: test what happens when the window
|
// TODO: test what happens when the window
|
||||||
// finds out it needs to resize itself...
|
// finds out it needs to resize itself...
|
||||||
|
|
||||||
BRegion stillAvailableOnScreen;
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
|
||||||
_SetBackground(stillAvailableOnScreen);
|
|
||||||
_WindowChanged(window);
|
|
||||||
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowFeel(Window *window, window_feel newFeel)
|
Desktop::SetWindowFeel(Window* window, window_feel newFeel)
|
||||||
{
|
{
|
||||||
if (window->Feel() == newFeel)
|
if (window->Feel() == newFeel)
|
||||||
return;
|
return;
|
||||||
@@ -2340,43 +2336,26 @@ Desktop::SetWindowFlags(Window *window, uint32 newFlags)
|
|||||||
if (window->Flags() == newFlags)
|
if (window->Flags() == newFlags)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!LockAllWindows())
|
AutoWriteLocker _(fWindowLock);
|
||||||
return;
|
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
window->SetFlags(newFlags, &dirty);
|
window->SetFlags(newFlags, &dirty);
|
||||||
// TODO: test what happens when the window
|
// TODO: test what happens when the window
|
||||||
// finds out it needs to resize itself...
|
// finds out it needs to resize itself...
|
||||||
|
|
||||||
BRegion stillAvailableOnScreen;
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
|
||||||
_SetBackground(stillAvailableOnScreen);
|
|
||||||
_WindowChanged(window);
|
|
||||||
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::SetWindowTitle(Window *window, const char* title)
|
Desktop::SetWindowTitle(Window *window, const char* title)
|
||||||
{
|
{
|
||||||
if (!LockAllWindows())
|
AutoWriteLocker _(fWindowLock);
|
||||||
return;
|
|
||||||
|
|
||||||
BRegion dirty;
|
BRegion dirty;
|
||||||
window->SetTitle(title, dirty);
|
window->SetTitle(title, dirty);
|
||||||
|
|
||||||
if (window->IsVisible() && dirty.CountRects() > 0) {
|
_RebuildAndRedrawAfterWindowChange(window, dirty);
|
||||||
BRegion stillAvailableOnScreen;
|
|
||||||
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
|
||||||
_SetBackground(stillAvailableOnScreen);
|
|
||||||
|
|
||||||
_TriggerWindowRedrawing(dirty);
|
|
||||||
}
|
|
||||||
|
|
||||||
UnlockAllWindows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2755,3 +2734,20 @@ Desktop::_SetBackground(BRegion& background)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! The all window lock must be held when calling this function.
|
||||||
|
void
|
||||||
|
Desktop::_RebuildAndRedrawAfterWindowChange(Window* window, BRegion& dirty)
|
||||||
|
{
|
||||||
|
if (!window->IsVisible() || dirty.CountRects() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BRegion stillAvailableOnScreen;
|
||||||
|
_RebuildClippingForAllWindows(stillAvailableOnScreen);
|
||||||
|
_SetBackground(stillAvailableOnScreen);
|
||||||
|
_WindowChanged(window);
|
||||||
|
|
||||||
|
_TriggerWindowRedrawing(dirty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
::EventDispatcher& EventDispatcher() { return fEventDispatcher; }
|
||||||
|
|
||||||
void BroadcastToAllApps(int32 code);
|
void BroadcastToAllApps(int32 code);
|
||||||
|
void BroadcastToAllWindows(int32 code);
|
||||||
|
|
||||||
// Screen and drawing related methods
|
// Screen and drawing related methods
|
||||||
|
|
||||||
@@ -142,6 +143,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
void RemoveWindowFromSubset(Window* subset,
|
void RemoveWindowFromSubset(Window* subset,
|
||||||
Window* window);
|
Window* window);
|
||||||
|
|
||||||
|
void FontsChanged(Window* window);
|
||||||
|
|
||||||
void SetWindowLook(Window* window, window_look look);
|
void SetWindowLook(Window* window, window_look look);
|
||||||
void SetWindowFeel(Window* window, window_feel feel);
|
void SetWindowFeel(Window* window, window_feel feel);
|
||||||
void SetWindowFlags(Window* window, uint32 flags);
|
void SetWindowFlags(Window* window, uint32 flags);
|
||||||
@@ -240,6 +243,8 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
void _TriggerWindowRedrawing(
|
void _TriggerWindowRedrawing(
|
||||||
BRegion& newDirtyRegion);
|
BRegion& newDirtyRegion);
|
||||||
void _SetBackground(BRegion& background);
|
void _SetBackground(BRegion& background);
|
||||||
|
void _RebuildAndRedrawAfterWindowChange(
|
||||||
|
Window* window, BRegion& dirty);
|
||||||
|
|
||||||
void _UpdateFloating(int32 previousWorkspace = -1,
|
void _UpdateFloating(int32 previousWorkspace = -1,
|
||||||
int32 nextWorkspace = -1,
|
int32 nextWorkspace = -1,
|
||||||
|
|||||||
@@ -235,13 +235,13 @@ DesktopSettingsPrivate::_Load()
|
|||||||
bool subpix;
|
bool subpix;
|
||||||
if (settings.FindBool("subpixel antialiasing", &subpix) == B_OK)
|
if (settings.FindBool("subpixel antialiasing", &subpix) == B_OK)
|
||||||
gSubpixelAntialiasing = subpix;
|
gSubpixelAntialiasing = subpix;
|
||||||
|
|
||||||
int8 averageWeight;
|
int8 averageWeight;
|
||||||
if (settings.FindInt8("subpixel average weight", &averageWeight)
|
if (settings.FindInt8("subpixel average weight", &averageWeight)
|
||||||
== B_OK) {
|
== B_OK) {
|
||||||
gSubpixelAverageWeight = averageWeight;
|
gSubpixelAverageWeight = averageWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subpixelOrdering;
|
bool subpixelOrdering;
|
||||||
if (settings.FindBool("subpixel ordering", &subpixelOrdering)
|
if (settings.FindBool("subpixel ordering", &subpixelOrdering)
|
||||||
== B_OK) {
|
== B_OK) {
|
||||||
@@ -778,6 +778,7 @@ void
|
|||||||
LockedDesktopSettings::SetDefaultBoldFont(const ServerFont &font)
|
LockedDesktopSettings::SetDefaultBoldFont(const ServerFont &font)
|
||||||
{
|
{
|
||||||
fSettings->SetDefaultBoldFont(font);
|
fSettings->SetDefaultBoldFont(font);
|
||||||
|
fDesktop->BroadcastToAllWindows(AS_SYSTEM_FONT_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1082,6 +1082,13 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_SYSTEM_FONT_CHANGED:
|
||||||
|
{
|
||||||
|
fDesktop->FontsChanged(fWindow);
|
||||||
|
// TODO: tell client about this, too, and relayout...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_REDRAW:
|
case AS_REDRAW:
|
||||||
// Nothing to do here - the redraws are actually handled by looking
|
// Nothing to do here - the redraws are actually handled by looking
|
||||||
// at the fRedrawRequested member variable in _MessageLooper().
|
// at the fRedrawRequested member variable in _MessageLooper().
|
||||||
@@ -3692,6 +3699,7 @@ ServerWindow::_MessageNeedsAllWindowsLocked(uint32 code) const
|
|||||||
case AS_WINDOW_MOVE:
|
case AS_WINDOW_MOVE:
|
||||||
case AS_WINDOW_RESIZE:
|
case AS_WINDOW_RESIZE:
|
||||||
case AS_SET_SIZE_LIMITS:
|
case AS_SET_SIZE_LIMITS:
|
||||||
|
case AS_SYSTEM_FONT_CHANGED:
|
||||||
case AS_SET_DECORATOR_SETTINGS:
|
case AS_SET_DECORATOR_SETTINGS:
|
||||||
case AS_GET_MOUSE:
|
case AS_GET_MOUSE:
|
||||||
case AS_DIRECT_WINDOW_SET_FULLSCREEN:
|
case AS_DIRECT_WINDOW_SET_FULLSCREEN:
|
||||||
|
|||||||
@@ -1287,6 +1287,17 @@ Window::GetDecoratorSettings(BMessage* settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Window::FontsChanged(BRegion* updateRegion)
|
||||||
|
{
|
||||||
|
if (fDecorator != NULL) {
|
||||||
|
DesktopSettings settings(fDesktop);
|
||||||
|
fDecorator->FontsChanged(settings, updateRegion);
|
||||||
|
fBorderRegionValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Window::SetLook(window_look look, BRegion* updateRegion)
|
Window::SetLook(window_look look, BRegion* updateRegion)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ public:
|
|||||||
|
|
||||||
void HighlightDecorator(bool active);
|
void HighlightDecorator(bool active);
|
||||||
|
|
||||||
|
void FontsChanged(BRegion* updateRegion);
|
||||||
|
|
||||||
void SetLook(window_look look, BRegion* updateRegion);
|
void SetLook(window_look look, BRegion* updateRegion);
|
||||||
void SetFeel(window_feel feel);
|
void SetFeel(window_feel feel);
|
||||||
void SetFlags(uint32 flags, BRegion* updateRegion);
|
void SetFlags(uint32 flags, BRegion* updateRegion);
|
||||||
|
|||||||
Reference in New Issue
Block a user