diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results b/compilerplugins/clang/unusedenumconstants.untouched.results index 1f639cf..58b8091 100644 --- a/compilerplugins/clang/unusedenumconstants.untouched.results +++ b/compilerplugins/clang/unusedenumconstants.untouched.results @@ -139,9 +139,9 @@ include/vcl/toolkit/treelistbox.hxx:154 enum DragDropMode ALL include/vcl/vclenum.hxx:310 - enum vcl::WindowState Rollup + enum WindowStateState Rollup include/vcl/vclenum.hxx:313 - enum vcl::WindowState FullScreen + enum WindowStateState FullScreen include/vcl/vclenum.hxx:408 enum TrackingEventFlags Focus libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx:70 diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results b/compilerplugins/clang/unusedenumconstants.writeonly.results index 0d2f683..07c5ebb 100644 --- a/compilerplugins/clang/unusedenumconstants.writeonly.results +++ b/compilerplugins/clang/unusedenumconstants.writeonly.results @@ -3047,7 +3047,7 @@ include/vcl/vclenum.hxx:143 enum TimeFormat Hour24 include/vcl/vclenum.hxx:314 - enum vcl::WindowState SystemMask + enum WindowStateState SystemMask include/vcl/vclenum.hxx:331 enum vcl::ImageType Small include/vcl/vclenum.hxx:353 diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index adaf756..4536690 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -124,7 +124,7 @@ if( !m_sIniKey.isEmpty() ) { SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8)); Size aSize(m_xDialog->get_size()); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 80fd861..a7addbb 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -467,7 +467,7 @@ { // save window state SvtViewOptions aDlgOpt( EViewType::Dialog, m_xImpl->m_aIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8)); OUString sUserData = m_xFileView->GetConfigString(); aDlgOpt.SetUserItem( "UserData", Any( sUserData ) ); diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 103a4bd..2f7c997 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -215,7 +215,7 @@ // check for system window is necessary to guarantee correct pointer cast! if ( pWindow && pWindow->IsSystemWindow() ) { - vcl::WindowDataMask const nMask = vcl::WindowDataMask::All & ~vcl::WindowDataMask::Minimized; + WindowStateMask const nMask = WindowStateMask::All & ~WindowStateMask::Minimized; sWindowState = OStringToOUString( static_cast(pWindow.get())->GetWindowState(nMask), RTL_TEXTENCODING_UTF8); diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 7a8e66e..20da07c 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -481,13 +481,6 @@ /// etc. methods interpret the interval as closed, while the lowercase /// getWidth() / getHeight() etc. methods interpret the interval as half-open. /// Ok, now is the time for despair. -/// -/// If you want to work with Size, you must use the closed interval functions! -/// And don't add getSize / setSize; this will probably just introduce bugs, -/// especially when used in combination with list-initialization. -/// -/// (Eventually you might notice, that the same engineer was also working on -/// Qt at some point; see documentation on QRect::bottom / QRect::right ;-). namespace tools { class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Rectangle final @@ -500,7 +493,6 @@ tools::Long nRight, tools::Long nBottom ); /// Constructs an empty Rectangle, with top/left at the specified params constexpr Rectangle( tools::Long nLeft, tools::Long nTop ); - /// Constructs a closed interval rectangle constexpr Rectangle( const Point& rLT, const Size& rSize ); constexpr inline static Rectangle Justify(const Point& rLT, const Point& rRB); diff --git a/include/vcl/WindowPosSize.hxx b/include/vcl/WindowPosSize.hxx deleted file mode 100644 index ed52488..0000000 --- a/include/vcl/WindowPosSize.hxx +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_FRAMEPOSSIZE_HXX -#define INCLUDED_VCL_FRAMEPOSSIZE_HXX - -#include -#include -#include -#include -#include - -namespace vcl -{ -/** - * There are multiple ways to store the two different areas of a vcl::Window. - * But this representation is hopefully less error prone from the used types - * and more clear in what values in- or exclude the non-drawable window frame. - * - * There are especially two things to remember: - * * pos() is the top-left position of the window frame - * * size() returns just the drawable client area - * - * So these values actually don't represent any "real" geometry of either the - * outer frame or the inner client area of the window. That's my reason for - * naming the rectangle function posSize() instead of geometry(). Also to not - * be confused with Qt's geometry() function. YMMV. - * - * LO already is supposed to use this schema. FWIW, the Qt documentation claims - * "The differentiation is done in a way that covers the most common usage - * transparently." AFAIK this is common for most/all platforms / UI toolkits. - * - * The API is kept largely overload free, as we can now use list-initialization. - */ -class VCL_PLUGIN_PUBLIC WindowPosSize -{ - // position of the window frames left-top corner - sal_Int32 m_nX; - sal_Int32 m_nY; - // size of the client / drawable area, i.e. without decorations / borders - sal_Int32 m_nWidth; - sal_Int32 m_nHeight; - -protected: - WindowPosSize() - : m_nX(0) - , m_nY(0) - , m_nWidth(1) - , m_nHeight(1) - { - } - -public: - constexpr sal_Int32 x() const { return m_nX; } - void setX(sal_Int32 nX) { m_nX = nX; } - constexpr sal_Int32 y() const { return m_nY; } - void setY(sal_Int32 nY) { m_nY = nY; } - - constexpr Point pos() const { return { m_nX, m_nY }; } - void setPos(const Point& aPos) - { - setX(aPos.getX()); - setY(aPos.getY()); - } - void move(sal_Int32 nDX, sal_Int32 nDY) - { - m_nX += nDX; - m_nY += nDY; - } - - constexpr sal_Int32 width() const { return m_nWidth; } - void setWidth(sal_Int32 nWidth) - { - assert(nWidth >= 0); - if (nWidth >= 0) - m_nWidth = nWidth; - else - m_nWidth = 0; - } - - constexpr sal_Int32 height() const { return m_nHeight; } - void setHeight(sal_Int32 nHeight) - { - assert(nHeight >= 0); - if (nHeight >= 0) - m_nHeight = nHeight; - else - m_nHeight = 0; - } - - constexpr Size size() const - { - return { static_cast(m_nWidth), static_cast(m_nHeight) }; - } - void setSize(const Size& rSize) - { - setWidth(rSize.Width()); - setHeight(rSize.Height()); - } - - constexpr tools::Rectangle posSize() const { return { pos(), size() }; } - void setPosSize(const tools::Rectangle& rRect) - { - setPos(rRect.GetPos()); - setSize(rRect.GetSize()); - } - // because tools::Rectangle has the ambiguous (Point&, Point&) constructor, which we don't want here - void setPosSize(const Point& rPos, const Size& rSize) { setPosSize({ rPos, rSize }); } -}; - -inline std::ostream& operator<<(std::ostream& s, const WindowPosSize& rGeom) -{ - s << rGeom.width() << "x" << rGeom.height() << "@(" << rGeom.x() << "," << rGeom.y() << ")"; - return s; -} - -} // namespace vcl - -#endif // INCLUDED_VCL_FRAMEPOSSIZE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index e2faf13..24f4133 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -139,7 +139,7 @@ explicit SystemWindow(WindowType nType, const char* pIdleDebugName); void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference &rFrame = css::uno::Reference()); - void SetWindowState(const vcl::WindowData& rData); + void SetWindowStateData( const WindowStateData& rData ); virtual void settingOptimalLayoutSize(Window *pBox); @@ -177,7 +177,7 @@ const Size& GetMaxOutputSizePixel() const; void SetWindowState(std::string_view rStr); - OString GetWindowState(vcl::WindowDataMask nMask = vcl::WindowDataMask::All) const; + OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const; void SetMenuBar(MenuBar* pMenuBar); MenuBar* GetMenuBar() const { return mpMenuBar; } @@ -194,7 +194,7 @@ VclPtr const & GetNotebookBar() const; TaskPaneList* GetTaskPaneList(); - void GetWindowState(vcl::WindowData& rData) const; + void GetWindowStateData( WindowStateData& rData ) const; virtual void SetText( const OUString& rStr ) override; virtual OUString GetText() const override; diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 9f1a3c8..6e0359f 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -118,6 +118,27 @@ template<> struct typed_flags : is_typed_flags {}; } +enum class WindowStateMask { + NONE = 0x0000, + X = 0x0001, + Y = 0x0002, + Width = 0x0004, + Height = 0x0008, + State = 0x0010, + Minimized = 0x0020, + MaximizedX = 0x0100, + MaximizedY = 0x0200, + MaximizedWidth = 0x0400, + MaximizedHeight = 0x0800, + Pos = X | Y, + Size = Width | Height, + All = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight | State | Minimized +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + enum class TimeFormat { Hour12, Hour24 @@ -278,6 +299,24 @@ Size32, }; +enum class WindowStateState { + NONE = 0x0000, + Normal = 0x0001, + Minimized = 0x0002, + Maximized = 0x0004, + // Rollup is no longer used, but retained because WindowStateState is serialized + // from/to strings describing window state that are stored in a users config + Rollup = 0x0008, + MaximizedHorz = 0x0010, + MaximizedVert = 0x0020, + FullScreen = 0x0040, + SystemMask = 0xffff +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + namespace vcl { // The exact sizes of the icons in each size grouping are not necessarily diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index bf19525..34f22ac 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -544,7 +543,7 @@ virtual bool is_default_widget(const weld::Widget* pCandidate) const = 0; virtual void set_window_state(const OString& rStr) = 0; - virtual OString get_window_state(vcl::WindowDataMask nMask) const = 0; + virtual OString get_window_state(WindowStateMask nMask) const = 0; virtual css::uno::Reference GetXWindow() = 0; diff --git a/include/vcl/windowstate.hxx b/include/vcl/windowstate.hxx index b78162d..dcf0f4e 100644 --- a/include/vcl/windowstate.hxx +++ b/include/vcl/windowstate.hxx @@ -20,78 +20,52 @@ #ifndef INCLUDED_VCL_WINDOWSTATE_HXX #define INCLUDED_VCL_WINDOWSTATE_HXX -#include +#include +#include +#include -namespace vcl +class VCL_PLUGIN_PUBLIC WindowStateData { -enum class WindowState -{ - NONE = 0x0000, - Normal = 0x0001, - Minimized = 0x0002, - Maximized = 0x0004, - // Rollup is no longer used, but the bit is retained because WindowData is serialized - // from/to strings describing window state that are stored in a users config - // Rollup = 0x0008, - MaximizedHorz = 0x0010, - MaximizedVert = 0x0020, - FullScreen = 0x0040, - SystemMask = 0xffff -}; - -enum class WindowDataMask -{ - NONE = 0x0000, - X = 0x0001, - Y = 0x0002, - Width = 0x0004, - Height = 0x0008, - State = 0x0010, - Minimized = 0x0020, - MaximizedX = 0x0100, - MaximizedY = 0x0200, - MaximizedWidth = 0x0400, - MaximizedHeight = 0x0800, - Pos = X | Y, - Size = Width | Height, - PosSize = Pos | Size, - PosSizeState = Pos | Size | State, - All = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight - | State | Minimized -}; - -class VCL_PLUGIN_PUBLIC WindowData final : public WindowPosSize -{ - WindowState m_nState; - WindowDataMask m_nMask; - +private: + WindowStateMask mnValidMask; + int mnX; + int mnY; + unsigned int mnWidth; + unsigned int mnHeight; int mnMaximizedX; int mnMaximizedY; unsigned int mnMaximizedWidth; unsigned int mnMaximizedHeight; + WindowStateState mnState; public: - WindowData() - : m_nState(WindowState::NONE) - , m_nMask(WindowDataMask::NONE) + WindowStateData() + : mnValidMask(WindowStateMask::NONE) + , mnX(0) + , mnY(0) + , mnWidth(0) + , mnHeight(0) , mnMaximizedX(0) , mnMaximizedY(0) , mnMaximizedWidth(0) , mnMaximizedHeight(0) + , mnState(WindowStateState::NONE) { } - // serialize values to a string (the original WindowState representation) - OString toStr() const; + void SetMask(WindowStateMask nValidMask) { mnValidMask = nValidMask; } + WindowStateMask GetMask() const { return mnValidMask; } - void setState(WindowState nState) { m_nState = nState; } - WindowState state() const { return m_nState; } - WindowState& rState() { return m_nState; } - - void setMask(WindowDataMask nMask) { m_nMask = nMask; } - WindowDataMask mask() const { return m_nMask; } - WindowDataMask& rMask() { return m_nMask; } - + void SetX(int nX) { mnX = nX; } + int GetX() const { return mnX; } + void SetY(int nY) { mnY = nY; } + int GetY() const { return mnY; } + void SetWidth(unsigned int nWidth) { mnWidth = nWidth; } + unsigned int GetWidth() const { return mnWidth; } + void SetHeight(unsigned int nHeight) { mnHeight = nHeight; } + unsigned int GetHeight() const { return mnHeight; } + void SetState(WindowStateState nState) { mnState = nState; } + WindowStateState GetState() const { return mnState; } void SetMaximizedX(int nRX) { mnMaximizedX = nRX; } int GetMaximizedX() const { return mnMaximizedX; } void SetMaximizedY(int nRY) { mnMaximizedY = nRY; } @@ -100,19 +74,9 @@ unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; } void SetMaximizedHeight(unsigned int nRHeight) { mnMaximizedHeight = nRHeight; } unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; } -}; -} // namespace vcl - -namespace o3tl -{ -template <> struct typed_flags : is_typed_flags -{ + OString ToStr() const; }; -template <> struct typed_flags : is_typed_flags -{ -}; -} #endif // INCLUDED_VCL_WINDOWSTATE_HXX diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx index 615696f..dfc6cc1 100644 --- a/include/vcl/wrkwin.hxx +++ b/include/vcl/wrkwin.hxx @@ -60,7 +60,7 @@ protected: explicit WorkWindow( WindowType nType ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData = nullptr ); - SAL_DLLPRIVATE void ImplSetFrameState(vcl::WindowState); + SAL_DLLPRIVATE void ImplSetFrameState( WindowStateState aFrameState ); public: explicit WorkWindow( vcl::Window* pParent, WinBits nStyle = WB_STDWORK ); diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx index a0b8660..f2b95e0 100644 --- a/reportdesign/source/ui/dlg/Formula.cxx +++ b/reportdesign/source/ui/dlg/Formula.cxx @@ -87,7 +87,7 @@ if ( m_xAddField ) { SvtViewOptions aDlgOpt( EViewType::Window, HID_RPT_FIELD_SEL_WIN ); - aDlgOpt.SetWindowState(OStringToOUString(m_xAddField->getDialog()->get_window_state(vcl::WindowDataMask::Pos | vcl::WindowDataMask::State | vcl::WindowDataMask::Minimized), RTL_TEXTENCODING_ASCII_US)); + aDlgOpt.SetWindowState(OStringToOUString(m_xAddField->getDialog()->get_window_state(WindowStateMask::X | WindowStateMask::Y | WindowStateMask::State | WindowStateMask::Minimized), RTL_TEXTENCODING_ASCII_US)); if (m_xAddField->getDialog()->get_visible()) m_xAddField->response(RET_CANCEL); diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index b34c8c9..ab21347 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -136,7 +136,7 @@ if ( m_xAddField ) { SvtViewOptions aDlgOpt( EViewType::Window, UID_RPT_RPT_APP_VIEW ); - aDlgOpt.SetWindowState(OStringToOUString(m_xAddField->getDialog()->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_ASCII_US)); + aDlgOpt.SetWindowState(OStringToOUString(m_xAddField->getDialog()->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_ASCII_US)); if (m_xAddField->getDialog()->get_visible()) m_xAddField->response(RET_CANCEL); @@ -146,7 +146,7 @@ if ( m_xReportExplorer ) { SvtViewOptions aDlgOpt(EViewType::Window, OStringToOUString(m_xReportExplorer->get_help_id(), RTL_TEXTENCODING_UTF8)); - aDlgOpt.SetWindowState(OStringToOUString(m_xReportExplorer->getDialog()->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_ASCII_US)); + aDlgOpt.SetWindowState(OStringToOUString(m_xReportExplorer->getDialog()->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_ASCII_US)); if (m_xReportExplorer->getDialog()->get_visible()) m_xReportExplorer->response(RET_CANCEL); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 7c588a9..7f20a00 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -294,7 +294,7 @@ if ( m_xGroupsFloater ) { SvtViewOptions aDlgOpt(EViewType::Window, OStringToOUString(m_xGroupsFloater->get_help_id(), RTL_TEXTENCODING_UTF8)); - aDlgOpt.SetWindowState(OStringToOUString(m_xGroupsFloater->getDialog()->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_ASCII_US)); + aDlgOpt.SetWindowState(OStringToOUString(m_xGroupsFloater->getDialog()->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_ASCII_US)); if (m_xGroupsFloater->getDialog()->get_visible()) m_xGroupsFloater->response(RET_CANCEL); m_xGroupsFloater.reset(); diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index d4a2980..79f41bf 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -112,7 +112,7 @@ // tdf#101285 - Remember position of dialog SvtViewOptions aDlgOpt(EViewType::Dialog, "CondFormatDialog"); OString sWindowState - = m_xDialog->get_window_state(vcl::WindowDataMask::Pos); + = m_xDialog->get_window_state(WindowStateMask::Pos); aDlgOpt.SetWindowState(OUString::fromUtf8(sWindowState)); } diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 0887e51..1740459 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -310,9 +310,9 @@ weld::Dialog* pDialog = xController->getDialog(); aInfo.aPos = pDialog->get_position(); aInfo.aSize = pDialog->get_size(); - vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State; + WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; if (pDialog->get_resizable()) - nMask |= vcl::WindowDataMask::Size; + nMask |= WindowStateMask::Size; aInfo.aWinState = pDialog->get_window_state(nMask); } else if (pWindow) @@ -321,9 +321,9 @@ aInfo.aSize = pWindow->GetSizePixel(); if ( pWindow->IsSystemWindow() ) { - vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State; + WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; if ( pWindow->GetStyle() & WB_SIZEABLE ) - nMask |= vcl::WindowDataMask::Size; + nMask |= WindowStateMask::Size; aInfo.aWinState = static_cast(pWindow.get())->GetWindowState( nMask ); } else if (DockingWindow* pDockingWindow = dynamic_cast(pWindow.get())) diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index ab97609..0604f03 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -173,9 +173,9 @@ { if (m_xImpl->pMgr) { - vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State; + WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State; if (m_xDialog->get_resizable()) - nMask |= vcl::WindowDataMask::Size; + nMask |= WindowStateMask::Size; m_xImpl->aWinState = m_xDialog->get_window_state(nMask); GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() ); } diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 1b674f6..1dcbb2f 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -56,10 +56,11 @@ aPos.AdjustX(20); aPos.AdjustY(10); - vcl::WindowData aState; - aState.setMask(vcl::WindowDataMask::Pos); - aState.setPos(aPos); - pDlg->set_window_state(aState.toStr()); + WindowStateData aState; + aState.SetMask(WindowStateMask::Pos); + aState.SetX(aPos.X()); + aState.SetY(aPos.Y()); + pDlg->set_window_state(aState.ToStr()); pFloatDlg->Initialize(pInfo); } diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 3525787..7f6eb2e 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14424,6 +14424,7 @@ vcl/inc/salframe.hxx vcl/inc/salgdi.hxx vcl/inc/salgdiimpl.hxx +vcl/inc/salgeom.hxx vcl/inc/salinst.hxx vcl/inc/sallayout.hxx vcl/inc/salmenu.hxx diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 473c6a9..a25e851 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -362,7 +362,8 @@ { // tdf#146261 - Remember size of bookmark dialog SvtViewOptions aDlgOpt(EViewType::Dialog, "BookmarkDialog"); - OString sWindowState = m_xDialog->get_window_state(vcl::WindowDataMask::PosSize); + OString sWindowState + = m_xDialog->get_window_state(WindowStateMask::Pos | WindowStateMask::Size); aDlgOpt.SetWindowState(OUString::fromUtf8(sWindowState)); } diff --git a/sw/source/uibase/envelp/syncbtn.cxx b/sw/source/uibase/envelp/syncbtn.cxx index 0b61ff8..009525d 100644 --- a/sw/source/uibase/envelp/syncbtn.cxx +++ b/sw/source/uibase/envelp/syncbtn.cxx @@ -53,10 +53,11 @@ else aPos = _pParent->OutputToScreenPixel(Point(0, 0)); - vcl::WindowData aState; - aState.setMask(vcl::WindowDataMask::Pos); - aState.setPos(aPos); - pDlg->set_window_state(aState.toStr()); + WindowStateData aState; + aState.SetMask(WindowStateMask::Pos); + aState.SetX(aPos.X()); + aState.SetY(aPos.Y()); + pDlg->set_window_state(aState.ToStr()); pInfo->aPos = pDlg->get_position(); pInfo->aSize = pDlg->get_size(); diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 62b43df..c6c8a08 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -143,7 +143,7 @@ basegfx::B2IVector SvpSalFrame::GetSurfaceFrameSize() const { - basegfx::B2IVector aFrameSize( maGeometry.width(), maGeometry.height() ); + basegfx::B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight ); if( aFrameSize.getX() == 0 ) aFrameSize.setX( 1 ); if( aFrameSize.getY() == 0 ) @@ -181,7 +181,7 @@ { if( m_bVisible ) { - SalPaintEvent aPEvt(0, 0, maGeometry.width(), maGeometry.height()); + SalPaintEvent aPEvt(0, 0, maGeometry.nWidth, maGeometry.nHeight); aPEvt.mbImmediateUpdate = false; CallCallback( SalEvent::Paint, &aPEvt ); } @@ -248,24 +248,24 @@ void SvpSalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) { if( (nFlags & SAL_FRAME_POSSIZE_X) != 0 ) - maGeometry.setX(nX); + maGeometry.nX = nX; if( (nFlags & SAL_FRAME_POSSIZE_Y) != 0 ) - maGeometry.setY(nY); + maGeometry.nY = nY; if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 ) { - maGeometry.setWidth(nWidth); - if (m_nMaxWidth > 0 && maGeometry.width() > m_nMaxWidth) - maGeometry.setWidth(m_nMaxWidth); - if (m_nMinWidth > 0 && maGeometry.width() < m_nMinWidth) - maGeometry.setWidth(m_nMinWidth); + maGeometry.nWidth = nWidth; + if( m_nMaxWidth > 0 && maGeometry.nWidth > o3tl::make_unsigned(m_nMaxWidth) ) + maGeometry.nWidth = m_nMaxWidth; + if( m_nMinWidth > 0 && maGeometry.nWidth < o3tl::make_unsigned(m_nMinWidth) ) + maGeometry.nWidth = m_nMinWidth; } if( (nFlags & SAL_FRAME_POSSIZE_HEIGHT) != 0 ) { - maGeometry.setHeight(nHeight); - if (m_nMaxHeight > 0 && maGeometry.height() > m_nMaxHeight) - maGeometry.setHeight(m_nMaxHeight); - if (m_nMinHeight > 0 && maGeometry.height() < m_nMinHeight) - maGeometry.setHeight(m_nMinHeight); + maGeometry.nHeight = nHeight; + if( m_nMaxHeight > 0 && maGeometry.nHeight > o3tl::make_unsigned(m_nMaxHeight) ) + maGeometry.nHeight = m_nMaxHeight; + if( m_nMinHeight > 0 && maGeometry.nHeight < o3tl::make_unsigned(m_nMinHeight) ) + maGeometry.nHeight = m_nMinHeight; } #ifndef IOS basegfx::B2IVector aFrameSize = GetSurfaceFrameSize(); @@ -292,8 +292,8 @@ void SvpSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) { - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; } void SvpSalFrame::GetWorkArea( tools::Rectangle& rRect ) @@ -307,40 +307,48 @@ return m_pParent; } -void SvpSalFrame::SetWindowState(const vcl::WindowData *pState) +constexpr auto FRAMESTATE_MASK_GEOMETRY = + WindowStateMask::X | WindowStateMask::Y | + WindowStateMask::Width | WindowStateMask::Height; + +void SvpSalFrame::SetWindowState( const SalFrameState *pState ) { if (pState == nullptr) return; // Request for position or size change - if (!(pState->mask() & vcl::WindowDataMask::PosSize)) + if (!(pState->mnMask & FRAMESTATE_MASK_GEOMETRY)) return; - tools::Long nX = maGeometry.x(); - tools::Long nY = maGeometry.y(); - tools::Long nWidth = maGeometry.width(); - tools::Long nHeight = maGeometry.height(); + tools::Long nX = maGeometry.nX; + tools::Long nY = maGeometry.nY; + tools::Long nWidth = maGeometry.nWidth; + tools::Long nHeight = maGeometry.nHeight; // change requested properties - if (pState->mask() & vcl::WindowDataMask::X) - nX = pState->x(); - if (pState->mask() & vcl::WindowDataMask::Y) - nY = pState->y(); - if (pState->mask() & vcl::WindowDataMask::Width) - nWidth = pState->width(); - if (pState->mask() & vcl::WindowDataMask::Height) - nHeight = pState->height(); + if (pState->mnMask & WindowStateMask::X) + nX = pState->mnX; + if (pState->mnMask & WindowStateMask::Y) + nY = pState->mnY; + if (pState->mnMask & WindowStateMask::Width) + nWidth = pState->mnWidth; + if (pState->mnMask & WindowStateMask::Height) + nHeight = pState->mnHeight; SetPosSize( nX, nY, nWidth, nHeight, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); } -bool SvpSalFrame::GetWindowState(vcl::WindowData* pState) +bool SvpSalFrame::GetWindowState( SalFrameState* pState ) { - pState->setPosSize(maGeometry.posSize()); - pState->setState(vcl::WindowState::Normal); - pState->setMask(vcl::WindowDataMask::PosSizeState); + pState->mnState = WindowStateState::Normal; + pState->mnX = maGeometry.nX; + pState->mnY = maGeometry.nY; + pState->mnWidth = maGeometry.nWidth; + pState->mnHeight = maGeometry.nHeight; + pState->mnMask = FRAMESTATE_MASK_GEOMETRY | WindowStateMask::State; + return true; } diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index f2fce5c..84dca0c 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -90,8 +90,8 @@ virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState( const SalFrameState* pState ) override; + virtual bool GetWindowState( SalFrameState* pState ) override; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; virtual void StartPresentation( bool bStart ) override; virtual void SetAlwaysOnTop( bool bOnTop ) override; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 953a17a..47f8e62 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -126,8 +126,8 @@ virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState( const SalFrameState* pState ) override; + virtual bool GetWindowState( SalFrameState* pState ) override; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; virtual void StartPresentation( bool bStart ) override; virtual void SetAlwaysOnTop( bool bOnTop ) override; diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index dcdca17..2d7c571 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -182,8 +182,8 @@ virtual SalFrame* GetParent() const override; virtual void SetModal(bool bModal) override; virtual bool GetModal() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState(const SalFrameState* pState) override; + virtual bool GetWindowState(SalFrameState* pState) override; virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override; virtual void StartPresentation(bool bStart) override; virtual void SetAlwaysOnTop(bool bOnTop) override; diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index b7dcea6..1c5cbbb 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -35,7 +35,7 @@ class SalBitmap; class SalMenu; -namespace vcl { class WindowData; } +struct SalFrameState; struct SalInputContext; struct SystemEnvData; @@ -126,11 +126,11 @@ SalFrame(); virtual ~SalFrame() override; - SalFrameGeometry maGeometry; ///< absolute, unmirrored values + SalFrameGeometry maGeometry = {}; ///< absolute, unmirrored values // SalGeometryProvider - virtual tools::Long GetWidth() const override { return maGeometry.width(); } - virtual tools::Long GetHeight() const override { return maGeometry.height(); } + virtual tools::Long GetWidth() const override { return maGeometry.nWidth; } + virtual tools::Long GetHeight() const override { return maGeometry.nHeight; } virtual bool IsOffScreen() const override { return false; } // SalGraphics or NULL, but two Graphics for all SalFrames @@ -166,11 +166,11 @@ SalFrameGeometry GetGeometry() const; const SalFrameGeometry& GetUnmirroredGeometry() const { return maGeometry; } - virtual void SetWindowState(const vcl::WindowData*) = 0; + virtual void SetWindowState( const SalFrameState* pState ) = 0; // return the absolute, unmirrored system frame state // if this returns false the structure is uninitialised [[nodiscard]] - virtual bool GetWindowState(vcl::WindowData*) = 0; + virtual bool GetWindowState( SalFrameState* pState ) = 0; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) = 0; virtual void PositionByToolkit( const tools::Rectangle&, FloatWinPopupFlags ) {}; diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx index 63675b6..0bc7335 100644 --- a/vcl/inc/salgeom.hxx +++ b/vcl/inc/salgeom.hxx @@ -23,91 +23,44 @@ #include #include -#include #include -// There are some unused functions, which I would keep to ease understanding. -class SalFrameGeometry : public vcl::WindowPosSize -{ - // non-drawable area / margins / frame / decorations around the client area - sal_uInt32 m_nLeftDecoration, m_nTopDecoration, m_nRightDecoration, m_nBottomDecoration; - unsigned int m_nDisplayScreenNumber; +struct SalFrameGeometry { + // screen position of upper left corner of drawable area in pixel + tools::Long nX, nY; + // dimensions of the drawable area in pixel + tools::ULong nWidth, nHeight; + // thickness of the decoration in pixel + tools::ULong nLeftDecoration, + nTopDecoration, + nRightDecoration, + nBottomDecoration; + unsigned int nDisplayScreenNumber; -public: - SalFrameGeometry() - : m_nLeftDecoration(0) - , m_nTopDecoration(0) - , m_nRightDecoration(0) - , m_nBottomDecoration(0) - , m_nDisplayScreenNumber(0) - { - } - - constexpr tools::Rectangle clientArea() const - { - tools::Long nX(x() + m_nLeftDecoration), nY(y() + m_nTopDecoration); - return { { nX, nY }, size() }; - } - void setClientArea(const tools::Rectangle& rRect) - { - setX(rRect.getX() - m_nLeftDecoration); - setY(rRect.getY() - m_nTopDecoration); - setSize(rRect.GetSize()); - } - constexpr tools::Rectangle clientRect() const { return { { 0, 0 }, size() }; } - - // returns the position and size of the window, including all margins - constexpr tools::Rectangle frameArea() const - { - tools::Long nWidth(width() + m_nLeftDecoration + m_nRightDecoration); - tools::Long nHeight(height() + m_nTopDecoration + m_nBottomDecoration); - return { pos(), Size(nWidth, nHeight) }; - } - // no setFrameArea, as it can't really be implemented, e.g. what happens, if size() > frameArea.size() etc. - - constexpr sal_uInt32 leftDecoration() const { return m_nLeftDecoration; } - void setLeftDecoration(sal_uInt32 nLeftDecoration) { m_nLeftDecoration = nLeftDecoration; } - constexpr sal_uInt32 topDecoration() const { return m_nTopDecoration; } - void setTopDecoration(sal_uInt32 nTopDecoration) { m_nTopDecoration = nTopDecoration; } - constexpr sal_uInt32 rightDecoration() const { return m_nRightDecoration; } - void setRightDecoration(sal_uInt32 nRightDecoration) { m_nRightDecoration = nRightDecoration; } - constexpr sal_uInt32 bottomDecoration() const { return m_nBottomDecoration; } - void setBottomDecoration(sal_uInt32 nBottomDecoration) - { - m_nBottomDecoration = nBottomDecoration; - } - void decorations(sal_uInt32& nLeft, sal_uInt32& nTop, sal_uInt32& nRight, - sal_uInt32& nBottom) const - { - nLeft = m_nLeftDecoration; - nTop = m_nTopDecoration; - nRight = m_nRightDecoration; - nBottom = m_nBottomDecoration; - } - void setDecorations(sal_uInt32 nLeft, sal_uInt32 nTop, sal_uInt32 nRight, sal_uInt32 nBottom) - { - m_nLeftDecoration = nLeft; - m_nTopDecoration = nTop; - m_nRightDecoration = nRight; - m_nBottomDecoration = nBottom; - } - - unsigned int screen() const { return m_nDisplayScreenNumber; } - void setScreen(unsigned int nScreen) { m_nDisplayScreenNumber = nScreen; } + SalFrameGeometry() : + nX( 0 ), + nY( 0 ), + nWidth( 1 ), + nHeight( 1 ), + nLeftDecoration( 0 ), + nTopDecoration( 0 ), + nRightDecoration( 0 ), + nBottomDecoration( 0 ), + nDisplayScreenNumber( 0 ) + {} }; -inline std::ostream& operator<<(std::ostream& s, const SalFrameGeometry& rGeom) +inline std::ostream &operator <<(std::ostream& s, const SalFrameGeometry& rGeom) { - s << static_cast(&rGeom) << ":{" << rGeom.leftDecoration() << "," - << rGeom.topDecoration() << "," << rGeom.rightDecoration() << "," << rGeom.bottomDecoration() - << "}s" << rGeom.screen(); + s << rGeom.nWidth << "x" << rGeom.nHeight << "@(" << rGeom.nX << "," << rGeom.nY << "):{" + << rGeom.nLeftDecoration << "," << rGeom.nTopDecoration << "," << rGeom.nRightDecoration << "," << rGeom.nBottomDecoration << "}"; + return s; } /// Interface used to share logic on sizing between /// SalVirtualDevices and SalFrames -class VCL_PLUGIN_PUBLIC SalGeometryProvider -{ +class VCL_PLUGIN_PUBLIC SalGeometryProvider { public: virtual ~SalGeometryProvider() {} virtual tools::Long GetWidth() const = 0; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 4fab7df..d5605bf 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -480,7 +480,7 @@ virtual void set_window_state(const OString& rStr) override; - virtual OString get_window_state(vcl::WindowDataMask nMask) const override; + virtual OString get_window_state(WindowStateMask nMask) const override; virtual SystemEnvData get_system_data() const override; diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 41e4e04..c9f50cd 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -31,13 +31,10 @@ class SalGraphics; class SalFrame; class SalObject; -namespace vcl -{ - class Window; - enum class WindowState; -} +namespace vcl { class Window; } enum class InputContextFlags; enum class WindowStateMask; +enum class WindowStateState; enum class ExtTextInputAttr; enum class ModKeyFlags; @@ -234,6 +231,20 @@ ToTop = 3 }; +struct SalFrameState +{ + tools::Long mnX; + tools::Long mnY; + tools::Long mnWidth; + tools::Long mnHeight; + tools::Long mnMaximizedX; + tools::Long mnMaximizedY; + tools::Long mnMaximizedWidth; + tools::Long mnMaximizedHeight; + WindowStateMask mnMask; + WindowStateState mnState; +}; + struct SalInputContext { rtl::Reference mpFont; diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 2adacd1..91a9470 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -443,7 +443,7 @@ GtkWidget* getMouseEventWidget() const; GtkGrid* getTopLevelGridWidget() const { return m_pTopLevelGrid; } const SalX11Screen& getXScreenNumber() const { return m_nXScreen; } - int GetDisplayScreen() const { return maGeometry.screen(); } + int GetDisplayScreen() const { return maGeometry.nDisplayScreenNumber; } void updateScreenNumber(); cairo_t* getCairoContext() const; @@ -521,8 +521,8 @@ virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState( const SalFrameState* pState ) override; + virtual bool GetWindowState( SalFrameState* pState ) override; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; // Enable/Disable ScreenSaver, SystemAgents, ... virtual void StartPresentation( bool bStart ) override; diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index 7b804b0..1107ac9 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -222,8 +222,8 @@ virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState( const SalFrameState* pState ) override; + virtual bool GetWindowState( SalFrameState* pState ) override; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nMonitor ) override; virtual void StartPresentation( bool bStart ) override; virtual void SetAlwaysOnTop( bool bOnTop ) override; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index c37fb5b..e3d8b68 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -25,12 +25,12 @@ #include #include -#include #include #include class WinSalGraphics; + class WinSalFrame final: public SalFrame { public: @@ -43,7 +43,7 @@ HMENU mSelectedhMenu; // the menu where highlighting is currently going on HMENU mLastActivatedhMenu; // the menu that was most recently opened SystemEnvData maSysData; // system data - vcl::WindowData maState; ///< frame state + SalFrameState maState = {}; // frame state int mnShowState; // show state LONG mnWidth; // client width in pixeln LONG mnHeight; // client height in pixeln @@ -112,8 +112,8 @@ virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; - virtual void SetWindowState(const vcl::WindowData*) override; - virtual bool GetWindowState(vcl::WindowData*) override; + virtual void SetWindowState( const SalFrameState* pState ) override; + virtual bool GetWindowState( SalFrameState* pState ) override; virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; virtual void StartPresentation( bool bStart ) override; virtual void SetAlwaysOnTop( bool bOnTop ) override; diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 18e1a3e..b039533 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -45,7 +45,7 @@ namespace vcl::font { class PhysicalFontCollection; } class ImplFontCache; class VCLXWindow; -namespace vcl { class WindowData; } +class WindowStateData; class SalFrame; class SalObject; enum class MouseEventModifiers; @@ -433,7 +433,7 @@ void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight ); -VCL_DLLPUBLIC void ImplWindowStateFromStr(vcl::WindowData& rData, std::string_view rStr); +VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr); VCL_DLLPUBLIC css::uno::Reference FindFocusedEditableText(css::uno::Reference const&); diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index e90b7ed..a5356fc 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -110,7 +110,7 @@ AquaSalFrame::~AquaSalFrame() { if (mbFullScreen) - doShowFullScreen(false, maGeometry.screen()); + doShowFullScreen(false, maGeometry.nDisplayScreenNumber); assert( GetSalData()->mpInstance->IsMainThread() ); @@ -168,10 +168,10 @@ NSRect aVisibleRect = [pNSScreen visibleFrame]; CocoaToVCL( aVisibleRect ); - maGeometry.setX(static_cast(aVisibleRect.origin.x + aVisibleRect.size.width / 10)); - maGeometry.setY(static_cast(aVisibleRect.origin.y + aVisibleRect.size.height / 10)); - maGeometry.setWidth(static_cast(aVisibleRect.size.width * 0.8)); - maGeometry.setHeight(static_cast(aVisibleRect.size.height * 0.8)); + maGeometry.nX = static_cast(aVisibleRect.origin.x + aVisibleRect.size.width / 10); + maGeometry.nY = static_cast(aVisibleRect.origin.y + aVisibleRect.size.height / 10); + maGeometry.nWidth = static_cast(aVisibleRect.size.width * 0.8); + maGeometry.nHeight = static_cast(aVisibleRect.size.height * 0.8); // calculate style mask if( (mnStyle & SalFrameStyleFlags::FLOAT) || @@ -184,10 +184,10 @@ NSWindowStyleMaskResizable | NSWindowStyleMaskClosable; // make default window "maximized" - maGeometry.setX(static_cast(aVisibleRect.origin.x)); - maGeometry.setY(static_cast(aVisibleRect.origin.y)); - maGeometry.setWidth(static_cast(aVisibleRect.size.width)); - maGeometry.setHeight(static_cast(aVisibleRect.size.height)); + maGeometry.nX = static_cast(aVisibleRect.origin.x); + maGeometry.nY = static_cast(aVisibleRect.origin.y); + maGeometry.nWidth = static_cast(aVisibleRect.size.width); + maGeometry.nHeight = static_cast(aVisibleRect.size.height); mbPositioned = mbSized = true; } else @@ -231,7 +231,7 @@ [mpNSWindow setDelegate: static_cast >(mpNSWindow)]; [mpNSWindow setRestorable:NO]; - const NSRect aRect = { NSZeroPoint, NSMakeSize(maGeometry.width(), maGeometry.height()) }; + const NSRect aRect = { NSZeroPoint, NSMakeSize( maGeometry.nWidth, maGeometry.nHeight )}; mnTrackingRectTag = [mpNSView addTrackingRect: aRect owner: mpNSView userData: nil assumeInside: NO]; maSysData.mpNSView = mpNSView; @@ -246,7 +246,7 @@ if( bRelativeToScreen ) io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height); else - io_rRect.origin.y = maGeometry.height() - (io_rRect.origin.y+io_rRect.size.height); + io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height); } void AquaSalFrame::VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen ) @@ -254,7 +254,7 @@ if( bRelativeToScreen ) io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height); else - io_rRect.origin.y = maGeometry.height() - (io_rRect.origin.y+io_rRect.size.height); + io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height); } void AquaSalFrame::CocoaToVCL( NSPoint& io_rPoint, bool bRelativeToScreen ) @@ -262,7 +262,7 @@ if( bRelativeToScreen ) io_rPoint.y = maScreenRect.size.height - io_rPoint.y; else - io_rPoint.y = maGeometry.height() - io_rPoint.y; + io_rPoint.y = maGeometry.nHeight - io_rPoint.y; } void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen ) @@ -270,7 +270,7 @@ if( bRelativeToScreen ) io_rPoint.y = maScreenRect.size.height - io_rPoint.y; else - io_rPoint.y = maGeometry.height() - io_rPoint.y; + io_rPoint.y = maGeometry.nHeight - io_rPoint.y; } void AquaSalFrame::screenParametersChanged() @@ -393,25 +393,25 @@ if( mpParent ) // center relative to parent { // center on parent - tools::Long nNewX = mpParent->maGeometry.x() + (static_cast(mpParent->maGeometry.width()) - static_cast(maGeometry.width())) / 2; + tools::Long nNewX = mpParent->maGeometry.nX + (static_cast(mpParent->maGeometry.nWidth) - static_cast(maGeometry.nWidth))/2; if( nNewX < aScreenRect.Left() ) nNewX = aScreenRect.Left(); - if (static_cast(nNewX + maGeometry.width()) > aScreenRect.Right()) - nNewX = aScreenRect.Right() - maGeometry.width() - 1; - tools::Long nNewY = mpParent->maGeometry.y() + (static_cast(mpParent->maGeometry.height()) - static_cast(maGeometry.height())) / 2; + if( tools::Long(nNewX + maGeometry.nWidth) > aScreenRect.Right() ) + nNewX = aScreenRect.Right() - maGeometry.nWidth-1; + tools::Long nNewY = mpParent->maGeometry.nY + (static_cast(mpParent->maGeometry.nHeight) - static_cast(maGeometry.nHeight))/2; if( nNewY < aScreenRect.Top() ) nNewY = aScreenRect.Top(); if( nNewY > aScreenRect.Bottom() ) - nNewY = aScreenRect.Bottom() - maGeometry.height() - 1; - SetPosSize( nNewX - mpParent->maGeometry.x(), - nNewY - mpParent->maGeometry.y(), + nNewY = aScreenRect.Bottom() - maGeometry.nHeight-1; + SetPosSize( nNewX - mpParent->maGeometry.nX, + nNewY - mpParent->maGeometry.nY, 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); } else if( ! (mnStyle & SalFrameStyleFlags::SIZEABLE) ) { // center on screen - tools::Long nNewX = (aScreenRect.GetWidth() - maGeometry.width()) / 2; - tools::Long nNewY = (aScreenRect.GetHeight() - maGeometry.height()) / 2; + tools::Long nNewX = (aScreenRect.GetWidth() - maGeometry.nWidth)/2; + tools::Long nNewY = (aScreenRect.GetHeight() - maGeometry.nHeight)/2; SetPosSize( nNewX, nNewY, 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); } } @@ -424,7 +424,7 @@ { OSX_SALDATA_RUNINMAIN( SendPaintEvent( pRect ) ) - SalPaintEvent aPaintEvt(0, 0, maGeometry.width(), maGeometry.height(), true); + SalPaintEvent aPaintEvt( 0, 0, maGeometry.nWidth, maGeometry.nHeight, true ); if( pRect ) { aPaintEvt.mnBoundX = pRect->Left(); @@ -507,8 +507,8 @@ { // Always add the decoration as the dimension concerns only // the content rectangle - nWidth += maGeometry.leftDecoration() + maGeometry.rightDecoration(); - nHeight += maGeometry.topDecoration() + maGeometry.bottomDecoration(); + nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration; + nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration; NSSize aSize = { static_cast(nWidth), static_cast(nHeight) }; @@ -529,8 +529,8 @@ { // Always add the decoration as the dimension concerns only // the content rectangle - nWidth += maGeometry.leftDecoration() + maGeometry.rightDecoration(); - nHeight += maGeometry.topDecoration() + maGeometry.bottomDecoration(); + nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration; + nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration; // Carbon windows can't have a size greater than 32767x32767 if (nWidth>32767) nWidth=32767; @@ -548,8 +548,8 @@ { if (mbShown || mbInitShow || Application::IsBitmapRendering()) { - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; } else { @@ -578,24 +578,24 @@ if (Application::IsBitmapRendering()) { if (nFlags & SAL_FRAME_POSSIZE_X) - maGeometry.setX(nX); + maGeometry.nX = nX; if (nFlags & SAL_FRAME_POSSIZE_Y) - maGeometry.setY(nY); + maGeometry.nY = nY; if (nFlags & SAL_FRAME_POSSIZE_WIDTH) { - maGeometry.setWidth(nWidth); - if (mnMaxWidth > 0 && maGeometry.width() > mnMaxWidth) - maGeometry.setWidth(mnMaxWidth); - if (mnMinWidth > 0 && maGeometry.width() < mnMinWidth) - maGeometry.setWidth(mnMinWidth); + maGeometry.nWidth = nWidth; + if (mnMaxWidth > 0 && maGeometry.nWidth > o3tl::make_unsigned(mnMaxWidth)) + maGeometry.nWidth = mnMaxWidth; + if (mnMinWidth > 0 && maGeometry.nWidth < o3tl::make_unsigned(mnMinWidth)) + maGeometry.nWidth = mnMinWidth; } if (nFlags & SAL_FRAME_POSSIZE_HEIGHT) { - maGeometry.setHeight(nHeight); - if (mnMaxHeight > 0 && maGeometry.height() > mnMaxHeight) - maGeometry.setHeight(mnMaxHeight); - if (mnMinHeight > 0 && maGeometry.height() < mnMinHeight) - maGeometry.setHeight(mnMinHeight); + maGeometry.nHeight = nHeight; + if (mnMaxHeight > 0 && maGeometry.nHeight > o3tl::make_unsigned(mnMaxHeight)) + maGeometry.nHeight = mnMaxHeight; + if (mnMinHeight > 0 && maGeometry.nHeight < o3tl::make_unsigned(mnMinHeight)) + maGeometry.nHeight = mnMinHeight; } if (nEvent != SalEvent::NONE) CallCallback(nEvent, nullptr); @@ -604,7 +604,7 @@ return nEvent; } -void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) +void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { if (!mpNSWindow && !Application::IsBitmapRendering()) return; @@ -612,12 +612,12 @@ OSX_SALDATA_RUNINMAIN( SetWindowState( pState ) ) sal_uInt16 nFlags = 0; - nFlags |= ((pState->mask() & vcl::WindowDataMask::X) ? SAL_FRAME_POSSIZE_X : 0); - nFlags |= ((pState->mask() & vcl::WindowDataMask::Y) ? SAL_FRAME_POSSIZE_Y : 0); - nFlags |= ((pState->mask() & vcl::WindowDataMask::Width) ? SAL_FRAME_POSSIZE_WIDTH : 0); - nFlags |= ((pState->mask() & vcl::WindowDataMask::Height) ? SAL_FRAME_POSSIZE_HEIGHT : 0); + nFlags |= ((pState->mnMask & WindowStateMask::X) ? SAL_FRAME_POSSIZE_X : 0); + nFlags |= ((pState->mnMask & WindowStateMask::Y) ? SAL_FRAME_POSSIZE_Y : 0); + nFlags |= ((pState->mnMask & WindowStateMask::Width) ? SAL_FRAME_POSSIZE_WIDTH : 0); + nFlags |= ((pState->mnMask & WindowStateMask::Height) ? SAL_FRAME_POSSIZE_HEIGHT : 0); - SalEvent nEvent = PreparePosSize(pState->x(), pState->y(), pState->width(), pState->height(), nFlags); + SalEvent nEvent = PreparePosSize(pState->mnX, pState->mnY, pState->mnWidth, pState->mnHeight, nFlags); if (Application::IsBitmapRendering()) return; @@ -625,19 +625,19 @@ NSRect aStateRect = [mpNSWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; CocoaToVCL(aStateRect); - if (pState->mask() & vcl::WindowDataMask::X) - aStateRect.origin.x = float(pState->x()); - if (pState->mask() & vcl::WindowDataMask::Y) - aStateRect.origin.y = float(pState->y()); - if (pState->mask() & vcl::WindowDataMask::Width) - aStateRect.size.width = float(pState->width()); - if (pState->mask() & vcl::WindowDataMask::Height) - aStateRect.size.height = float(pState->height()); + if (pState->mnMask & WindowStateMask::X) + aStateRect.origin.x = float(pState->mnX); + if (pState->mnMask & WindowStateMask::Y) + aStateRect.origin.y = float(pState->mnY); + if (pState->mnMask & WindowStateMask::Width) + aStateRect.size.width = float(pState->mnWidth); + if (pState->mnMask & WindowStateMask::Height) + aStateRect.size.height = float(pState->mnHeight); VCLToCocoa(aStateRect); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; [mpNSWindow setFrame: aStateRect display: NO]; - if (pState->state() == vcl::WindowState::Minimized) + if (pState->mnState == WindowStateState::Minimized) [mpNSWindow miniaturize: NSApp]; else if ([mpNSWindow isMiniaturized]) [mpNSWindow deminiaturize: NSApp]; @@ -646,7 +646,7 @@ the program specified one), but comes closest since the default behavior is "maximized" if the user did not intervene */ - if (pState->state() == vcl::WindowState::Maximized) + if (pState->mnState == WindowStateState::Maximized) { if (![mpNSWindow isZoomed]) [mpNSWindow zoom: NSApp]; @@ -674,15 +674,20 @@ } } -bool AquaSalFrame::GetWindowState(vcl::WindowData* pState) +bool AquaSalFrame::GetWindowState( SalFrameState* pState ) { if (!mpNSWindow) { if (Application::IsBitmapRendering()) { - pState->setMask(vcl::WindowDataMask::PosSizeState); - pState->setPosSize(maGeometry.posSize()); - pState->setState(vcl::WindowState::Normal); + pState->mnMask = WindowStateMask::X | WindowStateMask::Y + | WindowStateMask::Width | WindowStateMask::Height + | WindowStateMask::State; + pState->mnX = maGeometry.nX; + pState->mnY = maGeometry.nY; + pState->mnWidth = maGeometry.nWidth; + pState->mnHeight = maGeometry.nHeight; + pState->mnState = WindowStateState::Normal; return true; } return false; @@ -690,22 +695,26 @@ OSX_SALDATA_RUNINMAIN_UNION( GetWindowState( pState ), boolean ) - pState->setMask(vcl::WindowDataMask::PosSizeState); + pState->mnMask = WindowStateMask::X | + WindowStateMask::Y | + WindowStateMask::Width | + WindowStateMask::Height | + WindowStateMask::State; NSRect aStateRect = [mpNSWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; CocoaToVCL( aStateRect ); - pState->setX(static_cast(aStateRect.origin.x)); - pState->setY(static_cast(aStateRect.origin.y)); - pState->setWidth(static_cast(aStateRect.size.width)); - pState->setHeight(static_cast(aStateRect.size.height)); + pState->mnX = tools::Long(aStateRect.origin.x); + pState->mnY = tools::Long(aStateRect.origin.y); + pState->mnWidth = tools::Long(aStateRect.size.width); + pState->mnHeight = tools::Long(aStateRect.size.height); if( [mpNSWindow isMiniaturized] ) - pState->setState(vcl::WindowState::Minimized); + pState->mnState = WindowStateState::Minimized; else if( ! [mpNSWindow isZoomed] ) - pState->setState(vcl::WindowState::Normal); + pState->mnState = WindowStateState::Normal; else - pState->setState(vcl::WindowState::Maximized); + pState->mnState = WindowStateState::Maximized; return true; } @@ -952,7 +961,7 @@ // FIXME: use Cocoa functions // FIXME: multiscreen support - CGPoint aPoint = { static_cast(nX + maGeometry.x()), static_cast(nY + maGeometry.y()) }; + CGPoint aPoint = { static_cast(nX + maGeometry.nX), static_cast(nY + maGeometry.nY) }; CGDirectDisplayID mainDisplayID = CGMainDisplayID(); CGDisplayMoveCursorToPoint( mainDisplayID, aPoint ); } @@ -1383,9 +1392,9 @@ if( AllSettings::GetLayoutRTL() ) { if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 ) - nX = static_cast(mpParent->maGeometry.width()) - nWidth - 1 - nX; + nX = mpParent->maGeometry.nWidth - nWidth-1 - nX; else - nX = static_cast(mpParent->maGeometry.width()) - aContentRect.size.width - 1 - nX; + nX = mpParent->maGeometry.nWidth - static_cast( aContentRect.size.width-1) - nX; } NSRect aParentFrameRect = [mpParent->mpNSWindow frame]; aParentContentRect = [NSWindow contentRectForFrameRect: aParentFrameRect styleMask: mpParent->mnStyleMask]; @@ -1660,10 +1669,10 @@ if( pScreens ) { unsigned int nNewDisplayScreenNumber = [pScreens indexOfObject: pScreen]; - if (bFirstTime || maGeometry.screen() != nNewDisplayScreenNumber) + if (bFirstTime || maGeometry.nDisplayScreenNumber != nNewDisplayScreenNumber) { mbGeometryDidChange = true; - maGeometry.setScreen(nNewDisplayScreenNumber); + maGeometry.nDisplayScreenNumber = nNewDisplayScreenNumber; } } } @@ -1695,17 +1704,19 @@ maContentRect = aContentRect; maFrameRect = aFrameRect; - maGeometry.setX(static_cast(aContentRect.origin.x)); - maGeometry.setY(static_cast(aContentRect.origin.y)); - maGeometry.setWidth(static_cast(aContentRect.size.width)); - maGeometry.setHeight(static_cast(aContentRect.size.height)); + maGeometry.nX = static_cast(aContentRect.origin.x); + maGeometry.nY = static_cast(aContentRect.origin.y); - maGeometry.setLeftDecoration(static_cast(aContentRect.origin.x - aFrameRect.origin.x)); - maGeometry.setRightDecoration(static_cast((aFrameRect.origin.x + aFrameRect.size.width) - - (aContentRect.origin.x + aContentRect.size.width))); - maGeometry.setTopDecoration(static_cast(aContentRect.origin.y - aFrameRect.origin.y)); - maGeometry.setBottomDecoration(static_cast((aFrameRect.origin.y + aFrameRect.size.height) - - (aContentRect.origin.y + aContentRect.size.height))); + maGeometry.nLeftDecoration = static_cast(aContentRect.origin.x - aFrameRect.origin.x); + maGeometry.nRightDecoration = static_cast((aFrameRect.origin.x + aFrameRect.size.width) - + (aContentRect.origin.x + aContentRect.size.width)); + + maGeometry.nTopDecoration = static_cast(aContentRect.origin.y - aFrameRect.origin.y); + maGeometry.nBottomDecoration = static_cast((aFrameRect.origin.y + aFrameRect.size.height) - + (aContentRect.origin.y + aContentRect.size.height)); + + maGeometry.nWidth = static_cast(aContentRect.size.width); + maGeometry.nHeight = static_cast(aContentRect.size.height); } } diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index df2c55a..ee245af 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -166,8 +166,8 @@ { mDraggingDestinationHandler = nil; mpFrame = pFrame; - NSRect aRect = { { static_cast(pFrame->maGeometry.x()), static_cast(pFrame->maGeometry.y()) }, - { static_cast(pFrame->maGeometry.width()), static_cast(pFrame->maGeometry.height()) } }; + NSRect aRect = { { static_cast(pFrame->maGeometry.nX), static_cast(pFrame->maGeometry.nY) }, + { static_cast(pFrame->maGeometry.nWidth), static_cast(pFrame->maGeometry.nHeight) } }; pFrame->VCLToCocoa( aRect ); NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() @@ -473,7 +473,7 @@ if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { // FIXME: does this leak the returned NSCursor of getCurrentCursor ? - const NSRect aRect = { NSZeroPoint, NSMakeSize(mpFrame->maGeometry.width(), mpFrame->maGeometry.height()) }; + const NSRect aRect = { NSZeroPoint, NSMakeSize( mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight) }; [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()]; } } @@ -600,13 +600,13 @@ SalMouseEvent aEvent; aEvent.mnTime = pDispatchFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - pDispatchFrame->maGeometry.x(); - aEvent.mnY = static_cast(aPt.y) - pDispatchFrame->maGeometry.y(); + aEvent.mnX = static_cast(aPt.x) - pDispatchFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - pDispatchFrame->maGeometry.nY; aEvent.mnButton = nButton; aEvent.mnCode = aEvent.mnButton | nModMask; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = pDispatchFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = pDispatchFrame->maGeometry.nWidth-1-aEvent.mnX; pDispatchFrame->CallCallback( nEvent, &aEvent ); } @@ -760,14 +760,14 @@ SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling aEvent.mbDeltaIsPixel = true; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX; aEvent.mnDelta = nDeltaZ; aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1; @@ -817,13 +817,13 @@ SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = true; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX; if( dX != 0.0 ) { @@ -876,13 +876,13 @@ SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = false; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX; if( dX != 0.0 ) { @@ -1666,8 +1666,8 @@ NSRect rect; - rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.x(); - rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.y() + 4; // add some space for underlines + rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.nX; + rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.nY + 4; // add some space for underlines rect.size.width = aPosEvent.mnWidth; rect.size.height = aPosEvent.mnHeight; diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx index 603a8b6..7b08886 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -148,8 +148,8 @@ { if (mbWindow && mpFrame && (mpFrame->getNSWindow() || Application::IsBitmapRendering())) { - const unsigned int nWidth = mpFrame->maGeometry.width(); - const unsigned int nHeight = mpFrame->maGeometry.height(); + const unsigned int nWidth = mpFrame->maGeometry.nWidth; + const unsigned int nHeight = mpFrame->maGeometry.nHeight; const float fScale = sal::aqua::getWindowScaling(); CGLayerRef rReleaseLayer = nullptr; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index c35e748..ab6263c 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -302,8 +302,8 @@ // in mirrored UI case; best done by actually executing the same code sal_uInt16 nArrangeIndex; pWin->SetPosPixel( FloatingWindow::ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ) ); - displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.x() - pParentAquaSalFrame->maGeometry.x() + offset; - displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.y() - pParentAquaSalFrame->maGeometry.y() + offset; + displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.nX - pParentAquaSalFrame->maGeometry.nX + offset; + displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset; pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false); // #i111992# if this menu was opened due to a key event, prevent dispatching that yet again @@ -819,8 +819,8 @@ // make coordinates relative to reference frame static_cast(i_pReferenceFrame)->CocoaToVCL( aRect.origin ); - aRect.origin.x -= i_pReferenceFrame->maGeometry.x(); - aRect.origin.y -= i_pReferenceFrame->maGeometry.y() + aRect.size.height; + aRect.origin.x -= i_pReferenceFrame->maGeometry.nX; + aRect.origin.y -= i_pReferenceFrame->maGeometry.nY + aRect.size.height; return tools::Rectangle( Point(static_cast(aRect.origin.x), static_cast(aRect.origin.y) diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 3cd368b..328cf9c 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -866,11 +866,11 @@ // strange effects start to happen when HIThemeDrawFrame meets the border of the window. // These can be avoided by clipping to the boundary of the frame (see issue 84756) - if (rc.origin.y + rc.size.height >= mpFrame->maGeometry.height() - 3) + if (rc.origin.y + rc.size.height >= mpFrame->maGeometry.nHeight - 3) { CGMutablePathRef rPath = CGPathCreateMutable(); CGPathAddRect(rPath, nullptr, - CGRectMake(0, 0, mpFrame->maGeometry.width() - 1, mpFrame->maGeometry.height() - 1)); + CGRectMake(0, 0, mpFrame->maGeometry.nWidth - 1, mpFrame->maGeometry.nHeight - 1)); CGContextBeginPath(context); CGContextAddPath(context, rPath); CGContextClip(context); diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index ec28689..3c63060 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -544,7 +544,7 @@ { if (!m_bFullScreenSpanAll) { - aSize = toSize(QGuiApplication::screens().at(maGeometry.screen())->size()); + aSize = toSize(QGuiApplication::screens().at(maGeometry.nDisplayScreenNumber)->size()); } else { @@ -584,9 +584,9 @@ if (isChild(false) || !m_pQWidget->isMaximized()) { if (!(nFlags & SAL_FRAME_POSSIZE_WIDTH)) - nWidth = maGeometry.width(); + nWidth = maGeometry.nWidth; else if (!(nFlags & SAL_FRAME_POSSIZE_HEIGHT)) - nHeight = maGeometry.height(); + nHeight = maGeometry.nHeight; if (nWidth > 0 && nHeight > 0) { @@ -602,9 +602,9 @@ // assume the resize happened // needed for calculations and will eventually be corrected by events if (nWidth > 0) - maGeometry.setWidth(nWidth); + maGeometry.nWidth = nWidth; if (nHeight > 0) - maGeometry.setHeight(nHeight); + maGeometry.nHeight = nHeight; } } @@ -619,20 +619,21 @@ { const SalFrameGeometry& aParentGeometry = m_pParent->maGeometry; if (QGuiApplication::isRightToLeft()) - nX = aParentGeometry.x() + aParentGeometry.width() - nX - maGeometry.width() - 1; + nX = aParentGeometry.nX + aParentGeometry.nWidth - nX - maGeometry.nWidth - 1; else - nX += aParentGeometry.x(); - nY += aParentGeometry.y() + menuBarOffset(); + nX += aParentGeometry.nX; + nY += aParentGeometry.nY + menuBarOffset(); } if (!(nFlags & SAL_FRAME_POSSIZE_X)) - nX = maGeometry.x(); + nX = maGeometry.nX; else if (!(nFlags & SAL_FRAME_POSSIZE_Y)) - nY = maGeometry.y(); + nY = maGeometry.nY; // assume the reposition happened // needed for calculations and will eventually be corrected by events later - maGeometry.setPos({ nX, nY }); + maGeometry.nX = nX; + maGeometry.nY = nY; m_bDefaultPos = false; asChild()->move(round(nX / devicePixelRatioF()), round(nY / devicePixelRatioF())); @@ -683,64 +684,71 @@ bool QtFrame::GetModal() const { return isWindow() && windowHandle()->isModal(); } -void QtFrame::SetWindowState(const vcl::WindowData* pState) +void QtFrame::SetWindowState(const SalFrameState* pState) { if (!isWindow() || !pState || isChild(true, false)) return; - const vcl::WindowDataMask nMaxGeometryMask - = vcl::WindowDataMask::PosSize | vcl::WindowDataMask::MaximizedX - | vcl::WindowDataMask::MaximizedY | vcl::WindowDataMask::MaximizedWidth - | vcl::WindowDataMask::MaximizedHeight; + const WindowStateMask nMaxGeometryMask + = WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width | WindowStateMask::Height + | WindowStateMask::MaximizedX | WindowStateMask::MaximizedY + | WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; - if ((pState->mask() & vcl::WindowDataMask::State) - && (pState->state() & vcl::WindowState::Maximized) && !isMaximized() - && (pState->mask() & nMaxGeometryMask) == nMaxGeometryMask) + if ((pState->mnMask & WindowStateMask::State) && (pState->mnState & WindowStateState::Maximized) + && !isMaximized() && (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask) { const qreal fRatio = devicePixelRatioF(); QWidget* const pChild = asChild(); - pChild->resize(ceil(pState->width() / fRatio), ceil(pState->height() / fRatio)); - pChild->move(ceil(pState->x() / fRatio), ceil(pState->y() / fRatio)); + pChild->resize(ceil(pState->mnWidth / fRatio), ceil(pState->mnHeight / fRatio)); + pChild->move(ceil(pState->mnX / fRatio), ceil(pState->mnY / fRatio)); SetWindowStateImpl(Qt::WindowMaximized); } - else if (pState->mask() & vcl::WindowDataMask::PosSize) + else if (pState->mnMask + & (WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width + | WindowStateMask::Height)) { sal_uInt16 nPosSizeFlags = 0; - if (pState->mask() & vcl::WindowDataMask::X) + if (pState->mnMask & WindowStateMask::X) nPosSizeFlags |= SAL_FRAME_POSSIZE_X; - if (pState->mask() & vcl::WindowDataMask::Y) + if (pState->mnMask & WindowStateMask::Y) nPosSizeFlags |= SAL_FRAME_POSSIZE_Y; - if (pState->mask() & vcl::WindowDataMask::Width) + if (pState->mnMask & WindowStateMask::Width) nPosSizeFlags |= SAL_FRAME_POSSIZE_WIDTH; - if (pState->mask() & vcl::WindowDataMask::Height) + if (pState->mnMask & WindowStateMask::Height) nPosSizeFlags |= SAL_FRAME_POSSIZE_HEIGHT; - SetPosSize(pState->x(), pState->y(), pState->width(), pState->height(), nPosSizeFlags); + SetPosSize(pState->mnX, pState->mnY, pState->mnWidth, pState->mnHeight, nPosSizeFlags); } - else if (pState->mask() & vcl::WindowDataMask::State && !isChild()) + else if (pState->mnMask & WindowStateMask::State && !isChild()) { - if (pState->state() & vcl::WindowState::Maximized) + if (pState->mnState & WindowStateState::Maximized) SetWindowStateImpl(Qt::WindowMaximized); - else if (pState->state() & vcl::WindowState::Minimized) + else if (pState->mnState & WindowStateState::Minimized) SetWindowStateImpl(Qt::WindowMinimized); else SetWindowStateImpl(Qt::WindowNoState); } } -bool QtFrame::GetWindowState(vcl::WindowData* pState) +bool QtFrame::GetWindowState(SalFrameState* pState) { - pState->setState(vcl::WindowState::Normal); - pState->setMask(vcl::WindowDataMask::State); - if (isMinimized()) - pState->rState() |= vcl::WindowState::Minimized; + pState->mnState = WindowStateState::Normal; + pState->mnMask = WindowStateMask::State; + if (isMinimized() /*|| !windowHandle()*/) + pState->mnState |= WindowStateState::Minimized; else if (isMaximized()) - pState->rState() |= vcl::WindowState::Maximized; + { + pState->mnState |= WindowStateState::Maximized; + } else { // we want the frame position and the client area size QRect rect = scaledQRect({ asChild()->pos(), asChild()->size() }, devicePixelRatioF()); - pState->setPosSize(toRectangle(rect)); - pState->rMask() |= vcl::WindowDataMask::PosSize; + pState->mnX = rect.x(); + pState->mnY = rect.y(); + pState->mnWidth = rect.width(); + pState->mnHeight = rect.height(); + pState->mnMask |= WindowStateMask::X | WindowStateMask::Y | WindowStateMask::Width + | WindowStateMask::Height; } return true; @@ -764,7 +772,7 @@ if (m_bFullScreen) { m_aRestoreGeometry = m_pTopLevel->geometry(); - m_nRestoreScreen = maGeometry.screen(); + m_nRestoreScreen = maGeometry.nDisplayScreenNumber; SetScreenNumber(m_bFullScreenSpanAll ? m_nRestoreScreen : nScreen); if (!m_bFullScreenSpanAll) windowHandle()->showFullScreen(); @@ -867,7 +875,7 @@ { QRect aHelpArea(toQRect(rHelpArea)); if (QGuiApplication::isRightToLeft()) - aHelpArea.moveLeft(maGeometry.width() - aHelpArea.width() - aHelpArea.left() - 1); + aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - aHelpArea.left() - 1); m_aTooltipText = rText; m_aTooltipArea = aHelpArea; return true; @@ -1266,7 +1274,7 @@ { SalPointerState aState; aState.maPos = toPoint(QCursor::pos() * devicePixelRatioF()); - aState.maPos.Move(-maGeometry.x(), -maGeometry.y()); + aState.maPos.Move(-maGeometry.nX, -maGeometry.nY); aState.mnState = GetMouseModCode(QGuiApplication::mouseButtons()) | GetKeyModCode(QGuiApplication::keyboardModifiers()); return aState; @@ -1352,7 +1360,7 @@ nScreen = static_cast(screenNumber(primaryScreen)); } - maGeometry.setScreen(nScreen); + maGeometry.nDisplayScreenNumber = nScreen; } void QtFrame::SetApplicationID(const OUString& rWMClass) diff --git a/vcl/qt5/QtMainWindow.cxx b/vcl/qt5/QtMainWindow.cxx index 5ff9ac9..1e6ebc8 100644 --- a/vcl/qt5/QtMainWindow.cxx +++ b/vcl/qt5/QtMainWindow.cxx @@ -41,6 +41,7 @@ void QtMainWindow::moveEvent(QMoveEvent* pEvent) { const qreal fRatio = m_rFrame.devicePixelRatioF(); - m_rFrame.maGeometry.setPos(toPoint(pEvent->pos() * fRatio)); + m_rFrame.maGeometry.nX = round(pEvent->pos().x() * fRatio); + m_rFrame.maGeometry.nY = round(pEvent->pos().y() * fRatio); m_rFrame.CallCallback(SalEvent::Move, nullptr); } diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 5c6fc00..b245112 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -93,7 +93,8 @@ const int nWidth = ceil(pEvent->size().width() * fRatio); const int nHeight = ceil(pEvent->size().height() * fRatio); - m_rFrame.maGeometry.setSize({ nWidth, nHeight }); + m_rFrame.maGeometry.nWidth = nWidth; + m_rFrame.maGeometry.nHeight = nHeight; if (m_rFrame.m_bUseCairo) { @@ -299,7 +300,9 @@ if (m_rFrame.m_pTopLevel) return; - m_rFrame.maGeometry.setPos(toPoint(pEvent->pos() * m_rFrame.devicePixelRatioF())); + const Point aPos = toPoint(pEvent->pos() * m_rFrame.devicePixelRatioF()); + m_rFrame.maGeometry.nX = aPos.X(); + m_rFrame.maGeometry.nY = aPos.Y(); m_rFrame.CallCallback(SalEvent::Move, nullptr); } diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 71b5003..383fdc0 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -267,7 +267,7 @@ { if (mrShared.mbWindow && mrShared.mpFrame) { - width = mrShared.mpFrame->maGeometry.width(); + width = mrShared.mpFrame->maGeometry.nWidth; } } #endif diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e43481b..2c998bd 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1621,7 +1621,7 @@ pSysWin->SetWindowState(rStr); } -OString SalInstanceWindow::get_window_state(vcl::WindowDataMask nMask) const +OString SalInstanceWindow::get_window_state(WindowStateMask nMask) const { SystemWindow* pSysWin = dynamic_cast(m_xWindow.get()); assert(pSysWin); diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 003e7f4..623afed8 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -43,8 +43,8 @@ if( pParent && AllSettings::GetLayoutRTL() ) { SalFrameGeometry aGeom = maGeometry; - const int nParentX = aGeom.x() - pParent->maGeometry.x(); - aGeom.setX(pParent->maGeometry.x() + pParent->maGeometry.width() - maGeometry.width() - nParentX); + int parent_x = aGeom.nX - pParent->maGeometry.nX; + aGeom.nX = pParent->maGeometry.nX + pParent->maGeometry.nWidth - maGeometry.nWidth - parent_x; return aGeom; } else diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 471757f..fb21691 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -835,10 +835,8 @@ Window::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); else if (comphelper::LibreOfficeKit::isActive()) { - if ((nFlags & PosSizeFlags::Size) == PosSizeFlags::Size) - mpFloatWin->SetOutputSizePixel({ nWidth, nHeight }); - if ((nFlags & PosSizeFlags::Pos) == PosSizeFlags::Pos) - mpFloatWin->SetPosPixel({ nX, nY }); + mpFloatWin->SetOutputSizePixel(Size(nWidth, nHeight)); + mpFloatWin->SetPosPixel(Point(nX, nY)); } } @@ -922,10 +920,10 @@ { if ( pWrapper->mpFloatWin ) { - vcl::WindowData aData; - aData.setMask(vcl::WindowDataMask::Pos); - pWrapper->mpFloatWin->GetWindowState( aData ); - Point aPos(aData.x(), aData.y()); + WindowStateData aData; + aData.SetMask( WindowStateMask::Pos ); + pWrapper->mpFloatWin->GetWindowStateData( aData ); + Point aPos( aData.GetX(), aData.GetY() ); // LOK needs logic coordinates not absolute screen position for autofilter menu if (!comphelper::LibreOfficeKit::isActive() || get_id() != "check_list_menu") aPos = pWrapper->mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); @@ -937,10 +935,10 @@ if ( mpFloatWin ) { - vcl::WindowData aData; - aData.setMask(vcl::WindowDataMask::Pos); - mpFloatWin->GetWindowState( aData ); - Point aPos(aData.x(), aData.y()); + WindowStateData aData; + aData.SetMask( WindowStateMask::Pos ); + mpFloatWin->GetWindowStateData( aData ); + Point aPos( aData.GetX(), aData.GetY() ); aPos = mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); return aPos; } diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 4b4623e..4b94b70 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -546,11 +546,11 @@ } SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); - mpWindowImpl->maPos = Point(g.x(), g.y()); + mpWindowImpl->maPos = Point( g.nX, g.nY ); if( pParentFrame ) { g = pParentFrame->GetGeometry(); - mpWindowImpl->maPos -= Point(g.x(), g.y()); + mpWindowImpl->maPos -= Point( g.nX, g.nY ); } // the client window and all its subclients have the same position as the borderframe // this is important for floating toolbars where the borderwindow is a floating window diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 5fb4c2c..89bd567 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1559,7 +1559,7 @@ // except on rather small screens // TODO: move GetScreenNumber from SystemWindow to Window ? // currently we rely on internal privileges - unsigned int nDisplayScreen = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.screen(); + unsigned int nDisplayScreen = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nDisplayScreenNumber; tools::Rectangle aDispRect( Application::GetScreenPosSizePixel( nDisplayScreen ) ); tools::Long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800; if( nMaxWidth > nScreenWidth/2 ) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index b2b3cf6..9944541 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -769,7 +769,7 @@ pItem->setValue( "PrintDialog", "WindowState", - OStringToOUString(m_xDialog->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_UTF8) ); + OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8) ); pItem->setValue( "PrintDialog", "CopyCount", diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index fa05349..40fff00 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -399,157 +399,156 @@ return mpImplData->maMaxOutSize; } -void ImplWindowStateFromStr(vcl::WindowData& rData, std::string_view rStr) +void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr) { - vcl::WindowDataMask nValidMask = vcl::WindowDataMask::NONE; + WindowStateMask nValidMask = WindowStateMask::NONE; sal_Int32 nIndex = 0; std::string_view aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { - rData.setX(o3tl::toInt32(aTokenStr)); - if (rData.x() > -16384 && rData.x() < 16384) - nValidMask |= vcl::WindowDataMask::X; + rData.SetX(o3tl::toInt32(aTokenStr)); + if( rData.GetX() > -16384 && rData.GetX() < 16384 ) + nValidMask |= WindowStateMask::X; else - rData.setX(0); + rData.SetX( 0 ); } else - rData.setX(0); + rData.SetX( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { - rData.setY(o3tl::toInt32(aTokenStr)); - if (rData.y() > -16384 && rData.y() < 16384) - nValidMask |= vcl::WindowDataMask::Y; + rData.SetY(o3tl::toInt32(aTokenStr)); + if( rData.GetY() > -16384 && rData.GetY() < 16384 ) + nValidMask |= WindowStateMask::Y; else - rData.setY(0); + rData.SetY( 0 ); } else - rData.setY(0); + rData.SetY( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { - rData.setWidth(o3tl::toInt32(aTokenStr)); - if (rData.width() > 0 && rData.width() < 16384) - nValidMask |= vcl::WindowDataMask::Width; + rData.SetWidth(o3tl::toInt32(aTokenStr)); + if( rData.GetWidth() > 0 && rData.GetWidth() < 16384 ) + nValidMask |= WindowStateMask::Width; else - rData.setWidth(0); + rData.SetWidth( 0 ); } else - rData.setWidth(0); + rData.SetWidth( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); if (!aTokenStr.empty()) { - rData.setHeight(o3tl::toInt32(aTokenStr)); - if (rData.height() > 0 && rData.height() < 16384) - nValidMask |= vcl::WindowDataMask::Height; + rData.SetHeight(o3tl::toInt32(aTokenStr)); + if( rData.GetHeight() > 0 && rData.GetHeight() < 16384 ) + nValidMask |= WindowStateMask::Height; else - rData.setHeight(0); + rData.SetHeight( 0 ); } else - rData.setHeight(0); + rData.SetHeight( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); if (!aTokenStr.empty()) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - vcl::WindowState nState = static_cast(o3tl::toInt32(aTokenStr)); - //nState &= ~vcl::WindowState::Minimized; - rData.setState(nState); - nValidMask |= vcl::WindowDataMask::State; + WindowStateState nState = static_cast(o3tl::toInt32(aTokenStr)); + //nState &= ~(WindowStateState::Minimized); + rData.SetState( nState ); + nValidMask |= WindowStateMask::State; } else - rData.setState(vcl::WindowState::NONE); + rData.SetState( WindowStateState::NONE ); // read maximized pos/size aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { rData.SetMaximizedX(o3tl::toInt32(aTokenStr)); - if (rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384) - nValidMask |= vcl::WindowDataMask::MaximizedX; + if( rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384 ) + nValidMask |= WindowStateMask::MaximizedX; else - rData.SetMaximizedX(0); + rData.SetMaximizedX( 0 ); } else - rData.SetMaximizedX(0); + rData.SetMaximizedX( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { rData.SetMaximizedY(o3tl::toInt32(aTokenStr)); - if (rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384) - nValidMask |= vcl::WindowDataMask::MaximizedY; + if( rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384 ) + nValidMask |= WindowStateMask::MaximizedY; else - rData.SetMaximizedY(0); + rData.SetMaximizedY( 0 ); } else - rData.SetMaximizedY(0); + rData.SetMaximizedY( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { rData.SetMaximizedWidth(o3tl::toInt32(aTokenStr)); - if (rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384) - nValidMask |= vcl::WindowDataMask::MaximizedWidth; + if( rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384 ) + nValidMask |= WindowStateMask::MaximizedWidth; else - rData.SetMaximizedWidth(0); + rData.SetMaximizedWidth( 0 ); } else - rData.SetMaximizedWidth(0); + rData.SetMaximizedWidth( 0 ); aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); if (!aTokenStr.empty()) { rData.SetMaximizedHeight(o3tl::toInt32(aTokenStr)); - if (rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384) - nValidMask |= vcl::WindowDataMask::MaximizedHeight; + if( rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384 ) + nValidMask |= WindowStateMask::MaximizedHeight; else - rData.SetMaximizedHeight(0); + rData.SetMaximizedHeight( 0 ); } else - rData.SetMaximizedHeight(0); + rData.SetMaximizedHeight( 0 ); // mark valid fields - rData.setMask(nValidMask); + rData.SetMask( nValidMask ); } -OString vcl::WindowData::toStr() const +OString WindowStateData::ToStr() const { - const vcl::WindowDataMask nValidMask = mask(); - if ( nValidMask == vcl::WindowDataMask::NONE ) + const WindowStateMask nValidMask = GetMask(); + if ( nValidMask == WindowStateMask::NONE ) return OString(); OStringBuffer rStrBuf(64); - tools::Rectangle aRect = posSize(); - - if (nValidMask & vcl::WindowDataMask::X) - rStrBuf.append(static_cast(aRect.Left())); + if ( nValidMask & WindowStateMask::X ) + rStrBuf.append(static_cast(GetX())); rStrBuf.append(','); - if (nValidMask & vcl::WindowDataMask::Y) - rStrBuf.append(static_cast(aRect.Top())); + if ( nValidMask & WindowStateMask::Y ) + rStrBuf.append(static_cast(GetY())); rStrBuf.append(','); - if (nValidMask & vcl::WindowDataMask::Width) - rStrBuf.append(static_cast(aRect.GetWidth())); + if ( nValidMask & WindowStateMask::Width ) + rStrBuf.append(static_cast(GetWidth())); rStrBuf.append(','); - if (nValidMask & vcl::WindowDataMask::Height) - rStrBuf.append(static_cast(aRect.GetHeight())); + if ( nValidMask & WindowStateMask::Height ) + rStrBuf.append(static_cast(GetHeight())); rStrBuf.append( ';' ); - if (nValidMask & vcl::WindowDataMask::State) + if ( nValidMask & WindowStateMask::State ) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - rStrBuf.append(static_cast(state())); + WindowStateState nState = GetState(); + rStrBuf.append(static_cast(nState)); } rStrBuf.append(';'); - if (nValidMask & vcl::WindowDataMask::MaximizedX) + if ( nValidMask & WindowStateMask::MaximizedX ) rStrBuf.append(static_cast(GetMaximizedX())); rStrBuf.append(','); - if (nValidMask & vcl::WindowDataMask::MaximizedY) + if ( nValidMask & WindowStateMask::MaximizedY ) rStrBuf.append(static_cast(GetMaximizedY())); rStrBuf.append( ',' ); - if (nValidMask & vcl::WindowDataMask::MaximizedWidth) + if ( nValidMask & WindowStateMask::MaximizedWidth ) rStrBuf.append(static_cast(GetMaximizedWidth())); rStrBuf.append(','); - if (nValidMask & vcl::WindowDataMask::MaximizedHeight) + if ( nValidMask & WindowStateMask::MaximizedHeight ) rStrBuf.append(static_cast(GetMaximizedHeight())); rStrBuf.append(';'); @@ -601,7 +600,7 @@ vcl::Window* pParent = i_pConfigureWin->GetParent(); if( bMove && pParent ) { - // calculate absolute screen pos here, since that is what is contained in WindowData + // calculate absolute screen pos here, since that is what is contained in WindowState Point aParentAbsPos( pParent->OutputToAbsoluteScreenPixel( Point(0,0) ) ); Size aParentSizePixel( pParent->GetOutputSizePixel() ); Point aPos( (aParentSizePixel.Width() - i_nWidth) / 2, @@ -611,10 +610,10 @@ } } -void SystemWindow::SetWindowState(const vcl::WindowData& rData) +void SystemWindow::SetWindowStateData( const WindowStateData& rData ) { - const vcl::WindowDataMask nValidMask = rData.mask(); - if ( nValidMask == vcl::WindowDataMask::NONE ) + const WindowStateMask nValidMask = rData.GetMask(); + if ( nValidMask == WindowStateMask::NONE ) return; if ( mbSysChild ) @@ -626,38 +625,41 @@ if ( pWindow->mpWindowImpl->mbFrame ) { - const vcl::WindowState nState = rData.state(); - vcl::WindowData aState = rData; + const WindowStateState nState = rData.GetState(); + SalFrameState aState; + aState.mnMask = rData.GetMask(); + aState.mnX = rData.GetX(); + aState.mnY = rData.GetY(); + aState.mnWidth = rData.GetWidth(); + aState.mnHeight = rData.GetHeight(); - if (rData.mask() & vcl::WindowDataMask::Size) + if( rData.GetMask() & (WindowStateMask::Width|WindowStateMask::Height) ) { // #i43799# adjust window state sizes if a minimal output size was set // otherwise the frame and the client might get different sizes - if (maMinOutSize.Width() > static_cast(aState.width())) - aState.setWidth(maMinOutSize.Width()); - if (maMinOutSize.Height() > static_cast(aState.width())) - aState.setHeight(maMinOutSize.Height()); + if( maMinOutSize.Width() > aState.mnWidth ) + aState.mnWidth = maMinOutSize.Width(); + if( maMinOutSize.Height() > aState.mnHeight ) + aState.mnHeight = maMinOutSize.Height(); } + aState.mnMaximizedX = rData.GetMaximizedX(); + aState.mnMaximizedY = rData.GetMaximizedY(); + aState.mnMaximizedWidth = rData.GetMaximizedWidth(); + aState.mnMaximizedHeight = rData.GetMaximizedHeight(); // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - //nState &= ~(WindowState::Minimized); - aState.rState() &= vcl::WindowState::SystemMask; + //nState &= ~(WindowStateState::Minimized); + aState.mnState = nState & WindowStateState::SystemMask; // normalize window positions onto screen - tools::Long nX = aState.x(), nY = aState.y(); - ImplMoveToScreen(nX, nY, aState.width(), aState.height(), pWindow); - aState.setPos({ nX, nY }); - nX = aState.GetMaximizedX(); - nY = aState.GetMaximizedY(); - ImplMoveToScreen(nX, nY, aState.GetMaximizedWidth(), aState.GetMaximizedHeight(), pWindow); - aState.SetMaximizedX(nX); - aState.SetMaximizedY(nY); + ImplMoveToScreen( aState.mnX, aState.mnY, aState.mnWidth, aState.mnHeight, pWindow ); + ImplMoveToScreen( aState.mnMaximizedX, aState.mnMaximizedY, aState.mnMaximizedWidth, aState.mnMaximizedHeight, pWindow ); // #96568# avoid having multiple frames at the same screen location // do the check only if not maximized - if( !((rData.mask() & vcl::WindowDataMask::State) && (nState & vcl::WindowState::Maximized)) ) - if (rData.mask() & vcl::WindowDataMask::PosSize) + if( !((rData.GetMask() & WindowStateMask::State) && (nState & WindowStateState::Maximized)) ) + if( rData.GetMask() & (WindowStateMask::Pos|WindowStateMask::Width|WindowStateMask::Height) ) { tools::Rectangle aDesktop = GetDesktopRectPixel(); ImplSVData *pSVData = ImplGetSVData(); @@ -669,24 +671,28 @@ pWin->ImplGetWindow()->IsTopWindow() && pWin->mpWindowImpl->mbReallyVisible ) { SalFrameGeometry g = pWin->mpWindowImpl->mpFrame->GetGeometry(); - if( std::abs(g.x()-aState.x()) < 2 && std::abs(g.y()-aState.y()) < 5 ) + if( std::abs(g.nX-aState.mnX) < 2 && std::abs(g.nY-aState.mnY) < 5 ) { - tools::Long displacement = g.topDecoration() ? g.topDecoration() : 20; - if( static_cast(aState.x() + displacement + aState.width() + g.rightDecoration()) > aDesktop.Right() || - static_cast(aState.y() + displacement + aState.height() + g.bottomDecoration()) > aDesktop.Bottom() ) + tools::Long displacement = g.nTopDecoration ? g.nTopDecoration : 20; + if( static_cast(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > aDesktop.Right() || + static_cast(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > aDesktop.Bottom() ) { // displacing would leave screen - aState.setX(g.leftDecoration() ? g.leftDecoration() : 10); // should result in (0,0) - aState.setY(displacement); + aState.mnX = g.nLeftDecoration ? g.nLeftDecoration : 10; // should result in (0,0) + aState.mnY = displacement; if( bWrapped || - static_cast(aState.x() + displacement + aState.width() + g.rightDecoration()) > aDesktop.Right() || - static_cast(aState.y() + displacement + aState.height() + g.bottomDecoration()) > aDesktop.Bottom() ) + static_cast(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > aDesktop.Right() || + static_cast(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > aDesktop.Bottom() ) break; // further displacement not possible -> break // avoid endless testing bWrapped = true; } else - aState.move(displacement, displacement); + { + // displace + aState.mnX += displacement; + aState.mnY += displacement; + } pWin = pSVData->maFrameData.mpFirstFrame; // check new pos again } } @@ -699,7 +705,7 @@ // do a synchronous resize for layout reasons // but use rData only when the window is not to be maximized (#i38089#) // otherwise we have no useful size information - if( (rData.mask() & vcl::WindowDataMask::State) && (nState & vcl::WindowState::Maximized) ) + if( (rData.GetMask() & WindowStateMask::State) && (nState & WindowStateState::Maximized) ) { // query maximized size from frame SalFrameGeometry aGeometry = mpWindowImpl->mpFrame->GetGeometry(); @@ -707,51 +713,51 @@ // but use it only if it is different from the restore size (rData) // as currently only on windows the exact size of a maximized window // can be computed without actually showing the window - if (aGeometry.width() != rData.width() || aGeometry.height() != rData.height()) - ImplHandleResize(pWindow, aGeometry.width(), aGeometry.height()); + if( aGeometry.nWidth != rData.GetWidth() || aGeometry.nHeight != rData.GetHeight() ) + ImplHandleResize( pWindow, aGeometry.nWidth, aGeometry.nHeight ); } else - if (rData.mask() & vcl::WindowDataMask::Size) - ImplHandleResize(pWindow, aState.width(), aState.height()); // #i43799# use aState and not rData, see above + if( rData.GetMask() & (WindowStateMask::Width|WindowStateMask::Height) ) + ImplHandleResize( pWindow, aState.mnWidth, aState.mnHeight ); // #i43799# use aState and not rData, see above } else { PosSizeFlags nPosSize = PosSizeFlags::NONE; - if ( nValidMask & vcl::WindowDataMask::X ) + if ( nValidMask & WindowStateMask::X ) nPosSize |= PosSizeFlags::X; - if ( nValidMask & vcl::WindowDataMask::Y ) + if ( nValidMask & WindowStateMask::Y ) nPosSize |= PosSizeFlags::Y; - if ( nValidMask & vcl::WindowDataMask::Width ) + if ( nValidMask & WindowStateMask::Width ) nPosSize |= PosSizeFlags::Width; - if ( nValidMask & vcl::WindowDataMask::Height ) + if ( nValidMask & WindowStateMask::Height ) nPosSize |= PosSizeFlags::Height; - tools::Long nX = rData.x(); - tools::Long nY = rData.y(); - tools::Long nWidth = rData.width(); - tools::Long nHeight = rData.height(); + tools::Long nX = rData.GetX(); + tools::Long nY = rData.GetY(); + tools::Long nWidth = rData.GetWidth(); + tools::Long nHeight = rData.GetHeight(); const SalFrameGeometry& rGeom = pWindow->mpWindowImpl->mpFrame->GetGeometry(); if( nX < 0 ) nX = 0; - if( nX + nWidth > static_cast(rGeom.width()) ) - nX = rGeom.width() - nWidth; + if( nX + nWidth > static_cast(rGeom.nWidth) ) + nX = rGeom.nWidth - nWidth; if( nY < 0 ) nY = 0; - if( nY + nHeight > static_cast(rGeom.height()) ) - nY = rGeom.height() - nHeight; + if( nY + nHeight > static_cast(rGeom.nHeight) ) + nY = rGeom.nHeight - nHeight; setPosSizePixel( nX, nY, nWidth, nHeight, nPosSize ); } // tdf#146648 if an explicit size state was set, then use it as the preferred // size for layout - if (nValidMask & vcl::WindowDataMask::Size) + if (nValidMask & WindowStateMask::Size) mbInitialLayoutSizeCalculated = true; } -void SystemWindow::GetWindowState(vcl::WindowData& rData) const +void SystemWindow::GetWindowStateData( WindowStateData& rData ) const { - vcl::WindowDataMask nValidMask = rData.mask(); - if ( nValidMask == vcl::WindowDataMask::NONE ) + WindowStateMask nValidMask = rData.GetMask(); + if ( nValidMask == WindowStateMask::NONE ) return; if ( mbSysChild ) @@ -763,67 +769,67 @@ if ( pWindow->mpWindowImpl->mbFrame ) { - vcl::WindowData aState; - aState.setMask(vcl::WindowDataMask::All); + SalFrameState aState; + aState.mnMask = WindowStateMask::All; if ( mpWindowImpl->mpFrame->GetWindowState( &aState ) ) { - if ( nValidMask & vcl::WindowDataMask::X ) - rData.setX( aState.x() ); - if ( nValidMask & vcl::WindowDataMask::Y ) - rData.setY( aState.y() ); - if ( nValidMask & vcl::WindowDataMask::Width ) - rData.setWidth( aState.width() ); - if ( nValidMask & vcl::WindowDataMask::Height ) - rData.setHeight( aState.height() ); - if ( aState.mask() & vcl::WindowDataMask::MaximizedX ) + if ( nValidMask & WindowStateMask::X ) + rData.SetX( aState.mnX ); + if ( nValidMask & WindowStateMask::Y ) + rData.SetY( aState.mnY ); + if ( nValidMask & WindowStateMask::Width ) + rData.SetWidth( aState.mnWidth ); + if ( nValidMask & WindowStateMask::Height ) + rData.SetHeight( aState.mnHeight ); + if ( aState.mnMask & WindowStateMask::MaximizedX ) { - rData.SetMaximizedX( aState.GetMaximizedX() ); - nValidMask |= vcl::WindowDataMask::MaximizedX; + rData.SetMaximizedX( aState.mnMaximizedX ); + nValidMask |= WindowStateMask::MaximizedX; } - if ( aState.mask() & vcl::WindowDataMask::MaximizedY ) + if ( aState.mnMask & WindowStateMask::MaximizedY ) { - rData.SetMaximizedY( aState.GetMaximizedY() ); - nValidMask |= vcl::WindowDataMask::MaximizedY; + rData.SetMaximizedY( aState.mnMaximizedY ); + nValidMask |= WindowStateMask::MaximizedY; } - if ( aState.mask() & vcl::WindowDataMask::MaximizedWidth ) + if ( aState.mnMask & WindowStateMask::MaximizedWidth ) { - rData.SetMaximizedWidth( aState.GetMaximizedWidth() ); - nValidMask |= vcl::WindowDataMask::MaximizedWidth; + rData.SetMaximizedWidth( aState.mnMaximizedWidth ); + nValidMask |= WindowStateMask::MaximizedWidth; } - if ( aState.mask() & vcl::WindowDataMask::MaximizedHeight ) + if ( aState.mnMask & WindowStateMask::MaximizedHeight ) { - rData.SetMaximizedHeight( aState.GetMaximizedHeight() ); - nValidMask |= vcl::WindowDataMask::MaximizedHeight; + rData.SetMaximizedHeight( aState.mnMaximizedHeight ); + nValidMask |= WindowStateMask::MaximizedHeight; } - if ( nValidMask & vcl::WindowDataMask::State ) + if ( nValidMask & WindowStateMask::State ) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - if (!(nValidMask & vcl::WindowDataMask::Minimized)) - aState.rState() &= ~vcl::WindowState::Minimized; - rData.setState(aState.state()); + if ( !(nValidMask&WindowStateMask::Minimized) ) + aState.mnState &= ~WindowStateState::Minimized; + rData.SetState( aState.mnState ); } - rData.setMask( nValidMask ); + rData.SetMask( nValidMask ); } else - rData.setMask(vcl::WindowDataMask::NONE); + rData.SetMask( WindowStateMask::NONE ); } else { Point aPos = GetPosPixel(); Size aSize = GetSizePixel(); - vcl::WindowState nState = vcl::WindowState::NONE; + WindowStateState nState = WindowStateState::NONE; - if (nValidMask & vcl::WindowDataMask::X) - rData.setX(aPos.X()); - if (nValidMask & vcl::WindowDataMask::Y) - rData.setY(aPos.Y()); - if (nValidMask & vcl::WindowDataMask::Width) - rData.setWidth(aSize.Width()); - if (nValidMask & vcl::WindowDataMask::Height) - rData.setHeight(aSize.Height()); - if (nValidMask & vcl::WindowDataMask::State) - rData.setState(nState); + if ( nValidMask & WindowStateMask::X ) + rData.SetX( aPos.X() ); + if ( nValidMask & WindowStateMask::Y ) + rData.SetY( aPos.Y() ); + if ( nValidMask & WindowStateMask::Width ) + rData.SetWidth( aSize.Width() ); + if ( nValidMask & WindowStateMask::Height ) + rData.SetHeight( aSize.Height() ); + if ( nValidMask & WindowStateMask::State ) + rData.SetState( nState ); } } @@ -832,17 +838,18 @@ if (rStr.empty()) return; - vcl::WindowData aData; + WindowStateData aData; ImplWindowStateFromStr( aData, rStr ); - SetWindowState( aData ); + SetWindowStateData( aData ); } -OString SystemWindow::GetWindowState(vcl::WindowDataMask nMask) const +OString SystemWindow::GetWindowState( WindowStateMask nMask ) const { - vcl::WindowData aData; - aData.setMask(nMask); - GetWindowState(aData); - return aData.toStr(); + WindowStateData aData; + aData.SetMask( nMask ); + GetWindowStateData( aData ); + + return aData.ToStr(); } void SystemWindow::SetMenuBar(MenuBar* pMenuBar) @@ -960,7 +967,7 @@ unsigned int SystemWindow::GetScreenNumber() const { - return mpWindowImpl->mpFrame->maGeometry.screen(); + return mpWindowImpl->mpFrame->maGeometry.nDisplayScreenNumber; } void SystemWindow::SetScreenNumber(unsigned int nDisplayScreen) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 9835165..fe6f788 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2718,7 +2718,7 @@ } if( !comphelper::LibreOfficeKit::isActive() && !(nFlags & PosSizeFlags::X) && bHasValidSize && - pWindow->mpWindowImpl->mpFrame->maGeometry.width() ) + pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth ) { // RTL: make sure the old right aligned position is not changed // system windows will always grow to the right @@ -2732,13 +2732,13 @@ pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry(); tools::Long myWidth = nOldWidth; if( !myWidth ) - myWidth = aSysGeometry.width(); + myWidth = aSysGeometry.nWidth; if( !myWidth ) myWidth = nWidth; nFlags |= PosSizeFlags::X; nSysFlags |= SAL_FRAME_POSSIZE_X; - nX = aParentSysGeometry.x() - aSysGeometry.leftDecoration() + aParentSysGeometry.width() - - myWidth - 1 - aSysGeometry.x(); + nX = aParentSysGeometry.nX - aSysGeometry.nLeftDecoration + aParentSysGeometry.nWidth + - myWidth - 1 - aSysGeometry.nX; } } } @@ -2859,8 +2859,8 @@ // relative to the screen Point p = OutputToScreenPixel( rPos ); SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); - p.AdjustX(g.x() ); - p.AdjustY(g.y() ); + p.AdjustX(g.nX ); + p.AdjustY(g.nY ); return p; } @@ -2869,8 +2869,8 @@ // relative to the screen Point p = ScreenToOutputPixel( rPos ); SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); - p.AdjustX( -(g.x()) ); - p.AdjustY( -(g.y()) ); + p.AdjustX( -(g.nX) ); + p.AdjustY( -(g.nY) ); return p; } @@ -2882,13 +2882,13 @@ Point p1 = rRect.TopRight(); p1 = OutputToScreenPixel(p1); - p1.setX( g.x()+g.width()-p1.X() ); - p1.AdjustY(g.y() ); + p1.setX( g.nX+g.nWidth-p1.X() ); + p1.AdjustY(g.nY ); Point p2 = rRect.BottomLeft(); p2 = OutputToScreenPixel(p2); - p2.setX( g.x()+g.width()-p2.X() ); - p2.AdjustY(g.y() ); + p2.setX( g.nX+g.nWidth-p2.X() ); + p2.AdjustY(g.nY ); return tools::Rectangle( p1, p2 ); } @@ -2899,13 +2899,13 @@ SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry(); Point p1 = rRect.TopRight(); - p1.AdjustY(-g.y() ); - p1.setX( g.x()+g.width()-p1.X() ); + p1.AdjustY(-g.nY ); + p1.setX( g.nX+g.nWidth-p1.X() ); p1 = ScreenToOutputPixel(p1); Point p2 = rRect.BottomLeft(); - p2.AdjustY(-g.y()); - p2.setX( g.x()+g.width()-p2.X() ); + p2.AdjustY(-g.nY); + p2.setX( g.nX+g.nWidth-p2.X() ); p2 = ScreenToOutputPixel(p2); return tools::Rectangle( p1, p2 ); @@ -2926,16 +2926,16 @@ const vcl::Window *pWin = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow : this; Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) ); - aPos.AdjustX(g.x() ); - aPos.AdjustY(g.y() ); + aPos.AdjustX(g.nX ); + aPos.AdjustY(g.nY ); Size aSize ( pWin->GetSizePixel() ); // #104088# do not add decoration to the workwindow to be compatible to java accessibility api if( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WindowType::WORKWINDOW) ) { - aPos.AdjustX( -sal_Int32(g.leftDecoration()) ); - aPos.AdjustY( -sal_Int32(g.topDecoration()) ); - aSize.AdjustWidth(g.leftDecoration() + g.rightDecoration() ); - aSize.AdjustHeight(g.topDecoration() + g.bottomDecoration() ); + aPos.AdjustX( -sal_Int32(g.nLeftDecoration) ); + aPos.AdjustY( -sal_Int32(g.nTopDecoration) ); + aSize.AdjustWidth(g.nLeftDecoration + g.nRightDecoration ); + aSize.AdjustHeight(g.nTopDecoration + g.nBottomDecoration ); } if( pRelativeWindow ) { @@ -3589,7 +3589,7 @@ void Window::ImplMirrorFramePos( Point &pt ) const { - pt.setX( mpWindowImpl->mpFrame->maGeometry.width()-1-pt.X() ); + pt.setX( mpWindowImpl->mpFrame->maGeometry.nWidth-1-pt.X() ); } // frame based modal counter (dialogs are not modal to the whole application anymore) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 73e2dae..5a1b36e 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2721,7 +2721,7 @@ if( AllSettings::GetLayoutRTL() ) { SalFrame* pSalFrame = pWindow->ImplGetWindowImpl()->mpFrame; - const_cast(pPaintEvt)->mnBoundX = pSalFrame->maGeometry.width() - pPaintEvt->mnBoundWidth - pPaintEvt->mnBoundX; + const_cast(pPaintEvt)->mnBoundX = pSalFrame->maGeometry.nWidth-pPaintEvt->mnBoundWidth-pPaintEvt->mnBoundX; } tools::Rectangle aBoundRect( Point( pPaintEvt->mnBoundX, pPaintEvt->mnBoundY ), @@ -2746,7 +2746,7 @@ case SalEvent::MoveResize: { SalFrameGeometry g = pWindow->ImplGetWindowImpl()->mpFrame->GetGeometry(); - ImplHandleMoveResize(pWindow, g.width(), g.height()); + ImplHandleMoveResize( pWindow, g.nWidth, g.nHeight ); } break; diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index a04c46a..6dfdd4c 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -197,9 +197,10 @@ bool WorkWindow::IsMinimized() const { - vcl::WindowData aData; - if (mpWindowImpl->mpFrame->GetWindowState(&aData)) - return bool(aData.state() & vcl::WindowState::Minimized); + //return mpWindowImpl->mpFrameData->mbMinimized; + SalFrameState aState; + if (mpWindowImpl->mpFrame->GetWindowState(&aState)) + return bool(aState.mnState & WindowStateState::Minimized); else return false; } @@ -219,22 +220,22 @@ Window::ImplStartDnd(); } -void WorkWindow::ImplSetFrameState(vcl::WindowState aFrameState ) +void WorkWindow::ImplSetFrameState( WindowStateState aFrameState ) { - vcl::WindowData aState; - aState.setMask(vcl::WindowDataMask::State); - aState.setState(aFrameState); - mpWindowImpl->mpFrame->SetWindowState(&aState); + SalFrameState aState; + aState.mnMask = WindowStateMask::State; + aState.mnState = aFrameState; + mpWindowImpl->mpFrame->SetWindowState( &aState ); } void WorkWindow::Minimize() { - ImplSetFrameState( vcl::WindowState::Minimized ); + ImplSetFrameState( WindowStateState::Minimized ); } void WorkWindow::Restore() { - ImplSetFrameState( vcl::WindowState::Normal ); + ImplSetFrameState( WindowStateState::Normal ); } bool WorkWindow::Close() @@ -250,19 +251,19 @@ void WorkWindow::Maximize( bool bMaximize ) { - ImplSetFrameState( bMaximize ? vcl::WindowState::Maximized : vcl::WindowState::Normal ); + ImplSetFrameState( bMaximize ? WindowStateState::Maximized : WindowStateState::Normal ); } bool WorkWindow::IsMaximized() const { bool bRet = false; - vcl::WindowData aState; + SalFrameState aState; if( mpWindowImpl->mpFrame->GetWindowState( &aState ) ) { - if( aState.state() & (vcl::WindowState::Maximized | - vcl::WindowState::MaximizedHorz | - vcl::WindowState::MaximizedVert ) ) + if( aState.mnState & (WindowStateState::Maximized | + WindowStateState::MaximizedHorz | + WindowStateState::MaximizedVert ) ) bRet = true; } return bRet; diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index dd8a657..37384c7 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -1139,14 +1139,14 @@ } tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); - aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.leftDecoration(), - aPosSize.Top() + rGeom.topDecoration() ), + aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration, + aPosSize.Top() + rGeom.nTopDecoration ), Size( aPosSize.GetWidth() - - rGeom.leftDecoration() - - rGeom.rightDecoration(), + - rGeom.nLeftDecoration + - rGeom.nRightDecoration, aPosSize.GetHeight() - - rGeom.topDecoration() - - rGeom.bottomDecoration() ) + - rGeom.nTopDecoration + - rGeom.nBottomDecoration ) ); pFrame->SetPosSize( aPosSize ); @@ -1227,14 +1227,14 @@ } tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); - aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.leftDecoration(), - aPosSize.Top() + rGeom.topDecoration() ), + aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.nLeftDecoration, + aPosSize.Top() + rGeom.nTopDecoration ), Size( aPosSize.GetWidth() - - rGeom.leftDecoration() - - rGeom.rightDecoration(), + - rGeom.nLeftDecoration + - rGeom.nRightDecoration, aPosSize.GetHeight() - - rGeom.topDecoration() - - rGeom.bottomDecoration() ) + - rGeom.nTopDecoration + - rGeom.nBottomDecoration ) ); pFrame->SetPosSize( aPosSize ); @@ -1442,10 +1442,10 @@ if( bHorizontal || bVertical ) { Size aScreenSize( m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ) ); - Point aTL( rGeom.leftDecoration(), rGeom.topDecoration() ); + Point aTL( rGeom.nLeftDecoration, rGeom.nTopDecoration ); if( m_pSalDisplay->IsXinerama() ) { - Point aMed( aTL.X() + rGeom.width()/2, aTL.Y() + rGeom.height()/2 ); + Point aMed( aTL.X() + rGeom.nWidth/2, aTL.Y() + rGeom.nHeight/2 ); const std::vector< tools::Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens(); for(const auto & rScreen : rScreens) if( rScreen.Contains( aMed ) ) @@ -1456,24 +1456,37 @@ } } tools::Rectangle aTarget( aTL, - Size( aScreenSize.Width() - rGeom.leftDecoration() - rGeom.topDecoration(), - aScreenSize.Height() - rGeom.topDecoration() - rGeom.bottomDecoration() ) + Size( aScreenSize.Width() - rGeom.nLeftDecoration - rGeom.nTopDecoration, + aScreenSize.Height() - rGeom.nTopDecoration - rGeom.nBottomDecoration ) ); - - const tools::Rectangle aReferenceGeometry = !pFrame->maRestorePosSize.IsEmpty() ? - pFrame->maRestorePosSize : rGeom.posSize(); if( ! bHorizontal ) { - aTarget.SetSize({ aReferenceGeometry.GetWidth(), aTarget.GetHeight() }); - aTarget.SetLeft(aReferenceGeometry.Left()); + aTarget.SetSize( + Size( + pFrame->maRestorePosSize.IsEmpty() ? + rGeom.nWidth : pFrame->maRestorePosSize.GetWidth(), + aTarget.GetHeight() + ) + ); + aTarget.SetLeft( + pFrame->maRestorePosSize.IsEmpty() ? + rGeom.nX : pFrame->maRestorePosSize.Left() ); } else if( ! bVertical ) { - aTarget.SetSize({ aTarget.GetWidth(), aReferenceGeometry.GetHeight() }); - aTarget.SetTop(aReferenceGeometry.Top()); + aTarget.SetSize( + Size( + aTarget.GetWidth(), + pFrame->maRestorePosSize.IsEmpty() ? + rGeom.nHeight : pFrame->maRestorePosSize.GetHeight() + ) + ); + aTarget.SetTop( + pFrame->maRestorePosSize.IsEmpty() ? + rGeom.nY : pFrame->maRestorePosSize.Top() ); } - tools::Rectangle aRestore(rGeom.posSize()); + tools::Rectangle aRestore( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) ); if( pFrame->bMapped_ ) { XSetInputFocus( m_pDisplay, @@ -1502,8 +1515,8 @@ { pFrame->SetPosSize( pFrame->maRestorePosSize ); pFrame->maRestorePosSize = tools::Rectangle(); - pFrame->nWidth_ = rGeom.width(); - pFrame->nHeight_ = rGeom.height(); + pFrame->nWidth_ = rGeom.nWidth; + pFrame->nHeight_ = rGeom.nHeight; } } @@ -1567,7 +1580,7 @@ { const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), Size( rGeom.width(), rGeom.height() ) ); + tools::Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) ); } } else @@ -1621,7 +1634,7 @@ { const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), Size( rGeom.width(), rGeom.height() ) ); + tools::Rectangle( Point( rGeom.nX, rGeom.nY ), Size( rGeom.nWidth, rGeom.nHeight ) ); } } else @@ -1804,8 +1817,8 @@ // the current geometry may already be changed by the corresponding // ConfigureNotify, but this cannot be helped pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), - Size( rGeom.width(), rGeom.height() ) ); + tools::Rectangle( Point( rGeom.nX, rGeom.nY ), + Size( rGeom.nWidth, rGeom.nHeight ) ); } } else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] ) @@ -1867,8 +1880,8 @@ // the current geometry may already be changed by the corresponding // ConfigureNotify, but this cannot be helped pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), - Size( rGeom.width(), rGeom.height() ) ); + tools::Rectangle( Point( rGeom.nX, rGeom.nY ), + Size( rGeom.nWidth, rGeom.nHeight ) ); } } else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] ) @@ -1951,7 +1964,10 @@ { if( rScreen.Contains( aMousePoint ) ) { - pFrame->maGeometry.setPosSize(rScreen); + pFrame->maGeometry.nX = rScreen.Left(); + pFrame->maGeometry.nY = rScreen.Top(); + pFrame->maGeometry.nWidth = rScreen.GetWidth(); + pFrame->maGeometry.nHeight = rScreen.GetHeight(); break; } } @@ -1959,7 +1975,10 @@ else { Size aSize = m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ); - pFrame->maGeometry.setPosSize({ { 0, 0 }, aSize }); + pFrame->maGeometry.nX = 0; + pFrame->maGeometry.nY = 0; + pFrame->maGeometry.nWidth = aSize.Width(); + pFrame->maGeometry.nHeight = aSize.Height(); } pFrame->CallCallback( SalEvent::MoveResize, nullptr ); } diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 5806841..d5fc4d6 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -1437,7 +1437,7 @@ tools::Long X11SalGraphicsImpl::GetGraphicsHeight() const { if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.height(); + return mrParent.m_pFrame->maGeometry.nHeight; else if( mrParent.m_pVDev ) return static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetHeight(); else @@ -1971,7 +1971,7 @@ tools::Long X11SalGraphicsImpl::GetGraphicsWidth() const { if( mrParent.m_pFrame ) - return mrParent.m_pFrame->maGeometry.width(); + return mrParent.m_pFrame->maGeometry.nWidth; else if( mrParent.m_pVDev ) return static_cast< X11SalVirtualDevice* >(mrParent.m_pVDev)->GetWidth(); else diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index c203616..98b68c9 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -391,10 +391,10 @@ if( bUseGeometry ) { - x = maGeometry.x(); - y = maGeometry.y(); - w = maGeometry.width(); - h = maGeometry.height(); + x = maGeometry.nX; + y = maGeometry.nY; + w = maGeometry.nWidth; + h = maGeometry.nHeight; } if( (nSalFrameStyle & SalFrameStyleFlags::FLOAT) && @@ -503,8 +503,8 @@ if( !pFrame->mpParent && !pFrame->mbFullScreen && ( pFrame->nStyle_ & SalFrameStyleFlags::SIZEABLE ) - && pFrame->GetUnmirroredGeometry().width() - && pFrame->GetUnmirroredGeometry().height() ) + && pFrame->GetUnmirroredGeometry().nWidth + && pFrame->GetUnmirroredGeometry().nHeight ) { bIsDocumentWindow = true; break; @@ -516,8 +516,8 @@ // set a document position and size // the first frame gets positioned by the window manager const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); - x = rGeom.x(); - y = rGeom.y(); + x = rGeom.nX; + y = rGeom.nY; if( x+static_cast(w)+40 <= static_cast(aScreenSize.Width()) && y+static_cast(h)+40 <= static_cast(aScreenSize.Height()) ) @@ -647,7 +647,10 @@ Hints.window_group = GetShellWindow(); } - maGeometry.setPosSize({ x, y }, { w, h }); + maGeometry.nX = x; + maGeometry.nY = y; + maGeometry.nWidth = w; + maGeometry.nHeight = h; updateScreenNumber(); XSync( GetXDisplay(), False ); @@ -1252,13 +1255,13 @@ } XSelectInput( GetXDisplay(), GetWindow(), CLIENT_EVENTS ); - if( maGeometry.width() > 0 - && maGeometry.height() > 0 - && ( nWidth_ != static_cast(maGeometry.width()) - || nHeight_ != static_cast(maGeometry.height()) ) ) + if( maGeometry.nWidth > 0 + && maGeometry.nHeight > 0 + && ( nWidth_ != static_cast(maGeometry.nWidth) + || nHeight_ != static_cast(maGeometry.nHeight) ) ) { - nWidth_ = maGeometry.width(); - nHeight_ = maGeometry.height(); + nWidth_ = maGeometry.nWidth; + nHeight_ = maGeometry.nHeight; } XSync( GetXDisplay(), False ); @@ -1413,8 +1416,8 @@ return; } - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; if( !rWidth || !rHeight ) { @@ -1422,17 +1425,22 @@ XGetWindowAttributes( GetXDisplay(), GetWindow(), &aAttrib ); - rWidth = aAttrib.width; - rHeight = aAttrib.height; - maGeometry.setSize({ aAttrib.width, aAttrib.height }); + maGeometry.nWidth = rWidth = aAttrib.width; + maGeometry.nHeight = rHeight = aAttrib.height; } } void X11SalFrame::Center( ) { - int nX, nY; - Size aRealScreenSize(GetDisplay()->getDataForScreen(m_nXScreen).m_aSize); - tools::Rectangle aScreen({ 0, 0 }, aRealScreenSize); + int nX, nY, nScreenWidth, nScreenHeight; + int nRealScreenWidth, nRealScreenHeight; + int nScreenX = 0, nScreenY = 0; + + const Size& aScreenSize = GetDisplay()->getDataForScreen( m_nXScreen ).m_aSize; + nScreenWidth = aScreenSize.Width(); + nScreenHeight = aScreenSize.Height(); + nRealScreenWidth = nScreenWidth; + nRealScreenHeight = nScreenHeight; if( GetDisplay()->IsXinerama() ) { @@ -1444,8 +1452,8 @@ unsigned int mask; if( mpParent ) { - root_x = mpParent->maGeometry.x() + mpParent->maGeometry.width() / 2; - root_y = mpParent->maGeometry.y() + mpParent->maGeometry.height() / 2; + root_x = mpParent->maGeometry.nX + mpParent->maGeometry.nWidth/2; + root_y = mpParent->maGeometry.nY + mpParent->maGeometry.nHeight/2; } else XQueryPointer( GetXDisplay(), @@ -1458,8 +1466,10 @@ for(const auto & rScreen : rScreens) if( rScreen.Contains( Point( root_x, root_y ) ) ) { - aScreen.SetPos(rScreen.GetPos()); - aRealScreenSize = rScreen.GetSize(); + nScreenX = rScreen.Left(); + nScreenY = rScreen.Top(); + nRealScreenWidth = rScreen.GetWidth(); + nRealScreenHeight = rScreen.GetHeight(); break; } } @@ -1469,50 +1479,57 @@ X11SalFrame* pFrame = mpParent; while( pFrame->mpParent ) pFrame = pFrame->mpParent; - if( pFrame->maGeometry.width() < 1 || pFrame->maGeometry.height() < 1 ) + if( pFrame->maGeometry.nWidth < 1 || pFrame->maGeometry.nHeight < 1 ) { tools::Rectangle aRect; pFrame->GetPosSize( aRect ); - pFrame->maGeometry.setPosSize(aRect); + pFrame->maGeometry.nX = aRect.Left(); + pFrame->maGeometry.nY = aRect.Top(); + pFrame->maGeometry.nWidth = aRect.GetWidth(); + pFrame->maGeometry.nHeight = aRect.GetHeight(); } if( pFrame->nStyle_ & SalFrameStyleFlags::PLUG ) { ::Window aRoot; - unsigned int nScreenWidth, nScreenHeight, bw, depth; - int nScreenX, nScreenY; + unsigned int bw, depth; XGetGeometry( GetXDisplay(), pFrame->GetShellWindow(), &aRoot, &nScreenX, &nScreenY, - &nScreenWidth, &nScreenHeight, + reinterpret_cast(&nScreenWidth), + reinterpret_cast(&nScreenHeight), &bw, &depth ); - aScreen = {{ nScreenX, nScreenY }, Size(nScreenWidth, nScreenHeight)}; } else - aScreen = pFrame->maGeometry.posSize(); + { + nScreenX = pFrame->maGeometry.nX; + nScreenY = pFrame->maGeometry.nY; + nScreenWidth = pFrame->maGeometry.nWidth; + nScreenHeight = pFrame->maGeometry.nHeight; + } } if( mpParent && mpParent->nShowState_ == X11ShowState::Normal ) { - if( maGeometry.width() >= mpParent->maGeometry.width() && - maGeometry.height() >= mpParent->maGeometry.height() ) + if( maGeometry.nWidth >= mpParent->maGeometry.nWidth && + maGeometry.nHeight >= mpParent->maGeometry.nHeight ) { - nX = aScreen.getX() + 40; - nY = aScreen.getY() + 40; + nX = nScreenX + 40; + nY = nScreenY + 40; } else { // center the window relative to the top level frame - nX = (aScreen.GetWidth() - static_cast(maGeometry.width()) ) / 2 + aScreen.getX(); - nY = (aScreen.GetHeight() - static_cast(maGeometry.height())) / 2 + aScreen.getY(); + nX = (nScreenWidth - static_cast(maGeometry.nWidth) ) / 2 + nScreenX; + nY = (nScreenHeight - static_cast(maGeometry.nHeight)) / 2 + nScreenY; } } else { // center the window relative to screen - nX = (aRealScreenSize.getWidth() - static_cast(maGeometry.width()) ) / 2 + aScreen.getX(); - nY = (aRealScreenSize.getHeight() - static_cast(maGeometry.height())) / 2 + aScreen.getY(); + nX = (nRealScreenWidth - static_cast(maGeometry.nWidth) ) / 2 + nScreenX; + nY = (nRealScreenHeight - static_cast(maGeometry.nHeight)) / 2 + nScreenY; } nX = nX < 0 ? 0 : nX; nY = nY < 0 ? 0 : nY; @@ -1520,31 +1537,32 @@ bDefaultPosition_ = False; if( mpParent ) { - nX -= mpParent->maGeometry.x(); - nY -= mpParent->maGeometry.y(); + nX -= mpParent->maGeometry.nX; + nY -= mpParent->maGeometry.nY; } - SetPosSize({ { nX, nY }, maGeometry.size() }); + Point aPoint(nX, nY); + SetPosSize( tools::Rectangle( aPoint, Size( maGeometry.nWidth, maGeometry.nHeight ) ) ); } void X11SalFrame::updateScreenNumber() { if( GetDisplay()->IsXinerama() && GetDisplay()->GetXineramaScreens().size() > 1 ) { - Point aPoint( maGeometry.x(), maGeometry.y() ); + Point aPoint( maGeometry.nX, maGeometry.nY ); const std::vector& rScreenRects( GetDisplay()->GetXineramaScreens() ); size_t nScreens = rScreenRects.size(); for( size_t i = 0; i < nScreens; i++ ) { if( rScreenRects[i].Contains( aPoint ) ) { - maGeometry.setScreen(static_cast(i)); + maGeometry.nDisplayScreenNumber = static_cast(i); break; } } } else - maGeometry.setScreen(m_nXScreen.getXScreen()); + maGeometry.nDisplayScreenNumber = m_nXScreen.getXScreen(); } void X11SalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) @@ -1553,20 +1571,20 @@ return; // relative positioning in X11SalFrame::SetPosSize - tools::Rectangle aPosSize( Point( maGeometry.x(), maGeometry.y() ), Size( maGeometry.width(), maGeometry.height() ) ); + tools::Rectangle aPosSize( Point( maGeometry.nX, maGeometry.nY ), Size( maGeometry.nWidth, maGeometry.nHeight ) ); aPosSize.Justify(); if( ! ( nFlags & SAL_FRAME_POSSIZE_X ) ) { nX = aPosSize.Left(); if( mpParent ) - nX -= mpParent->maGeometry.x(); + nX -= mpParent->maGeometry.nX; } if( ! ( nFlags & SAL_FRAME_POSSIZE_Y ) ) { nY = aPosSize.Top(); if( mpParent ) - nY -= mpParent->maGeometry.y(); + nY -= mpParent->maGeometry.nY; } if( ! ( nFlags & SAL_FRAME_POSSIZE_WIDTH ) ) nWidth = aPosSize.GetWidth(); @@ -1579,7 +1597,8 @@ { if( bDefaultPosition_ ) { - maGeometry.setSize(aPosSize.GetSize()); + maGeometry.nWidth = aPosSize.GetWidth(); + maGeometry.nHeight = aPosSize.GetHeight(); Center(); } else @@ -1600,26 +1619,30 @@ } } +constexpr auto FRAMESTATE_MASK_GEOMETRY = + WindowStateMask::X | WindowStateMask::Y | + WindowStateMask::Width | WindowStateMask::Height; constexpr auto FRAMESTATE_MASK_MAXIMIZED_GEOMETRY = - vcl::WindowDataMask::MaximizedX | vcl::WindowDataMask::MaximizedY | - vcl::WindowDataMask::MaximizedWidth | vcl::WindowDataMask::MaximizedHeight; + WindowStateMask::MaximizedX | WindowStateMask::MaximizedY | + WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; -void X11SalFrame::SetWindowState( const vcl::WindowData *pState ) +void X11SalFrame::SetWindowState( const SalFrameState *pState ) { if (pState == nullptr) return; // Request for position or size change - if (pState->mask() & vcl::WindowDataMask::PosSize) + if (pState->mnMask & FRAMESTATE_MASK_GEOMETRY) { /* #i44325# * if maximized, set restore size and guess maximized size from last time * in state change below maximize window */ if( ! IsChildWindow() && - (pState->mask() & vcl::WindowDataMask::PosSizeState) == vcl::WindowDataMask::PosSizeState && - (pState->state() & vcl::WindowState::Maximized) && - (pState->mask() & FRAMESTATE_MASK_MAXIMIZED_GEOMETRY) == FRAMESTATE_MASK_MAXIMIZED_GEOMETRY + (pState->mnMask & WindowStateMask::State) && + (pState->mnState & WindowStateState::Maximized) && + (pState->mnMask & FRAMESTATE_MASK_GEOMETRY) == FRAMESTATE_MASK_GEOMETRY && + (pState->mnMask & FRAMESTATE_MASK_MAXIMIZED_GEOMETRY) == FRAMESTATE_MASK_MAXIMIZED_GEOMETRY ) { XSizeHints* pHints = XAllocSizeHints(); @@ -1629,17 +1652,22 @@ pHints, &nSupplied ); pHints->flags |= PPosition | PWinGravity; - pHints->x = pState->x(); - pHints->y = pState->y(); + pHints->x = pState->mnX; + pHints->y = pState->mnY; pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity(); - XSetWMNormalHints(GetXDisplay(), GetShellWindow(), pHints); + XSetWMNormalHints( GetXDisplay(), + GetShellWindow(), + pHints ); XFree( pHints ); - XMoveResizeWindow(GetXDisplay(), GetShellWindow(), pState->x(), pState->y(), - pState->width(), pState->height()); + XMoveResizeWindow( GetXDisplay(), GetShellWindow(), + pState->mnX, pState->mnY, + pState->mnWidth, pState->mnHeight ); // guess maximized geometry from last time - maGeometry.setPos({ pState->GetMaximizedX(), pState->GetMaximizedY() }); - maGeometry.setSize({ pState->GetMaximizedWidth(), pState->GetMaximizedHeight() }); + maGeometry.nX = pState->mnMaximizedX; + maGeometry.nY = pState->mnMaximizedY; + maGeometry.nWidth = pState->mnMaximizedWidth; + maGeometry.nHeight = pState->mnMaximizedHeight; updateScreenNumber(); } else @@ -1647,31 +1675,31 @@ bool bDoAdjust = false; tools::Rectangle aPosSize; // initialize with current geometry - if ((pState->mask() & vcl::WindowDataMask::PosSize) != vcl::WindowDataMask::PosSize) - GetPosSize(aPosSize); + if ((pState->mnMask & FRAMESTATE_MASK_GEOMETRY) != FRAMESTATE_MASK_GEOMETRY) + GetPosSize (aPosSize); sal_uInt16 nPosFlags = 0; // change requested properties - if (pState->mask() & vcl::WindowDataMask::X) + if (pState->mnMask & WindowStateMask::X) { - aPosSize.SetPosX(pState->x() - (mpParent ? mpParent->maGeometry.x() : 0)); + aPosSize.SetPosX(pState->mnX - (mpParent ? mpParent->maGeometry.nX : 0)); nPosFlags |= SAL_FRAME_POSSIZE_X; } - if (pState->mask() & vcl::WindowDataMask::Y) + if (pState->mnMask & WindowStateMask::Y) { - aPosSize.SetPosY(pState->y() - (mpParent ? mpParent->maGeometry.y() : 0)); + aPosSize.SetPosY(pState->mnY - (mpParent ? mpParent->maGeometry.nY : 0)); nPosFlags |= SAL_FRAME_POSSIZE_Y; } - if (pState->mask() & vcl::WindowDataMask::Width) + if (pState->mnMask & WindowStateMask::Width) { - tools::Long nWidth = pState->width() > 0 ? pState->width() - 1 : 0; + tools::Long nWidth = pState->mnWidth > 0 ? pState->mnWidth - 1 : 0; aPosSize.setWidth (nWidth); bDoAdjust = true; } - if (pState->mask() & vcl::WindowDataMask::Height) + if (pState->mnMask & WindowStateMask::Height) { - int nHeight = pState->height() > 0 ? pState->height() - 1 : 0; + int nHeight = pState->mnHeight > 0 ? pState->mnHeight - 1 : 0; aPosSize.setHeight (nHeight); bDoAdjust = true; } @@ -1684,27 +1712,35 @@ SalFrameGeometry aGeom = maGeometry; if( ! (nStyle_ & ( SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::PLUG ) ) && - mpParent && aGeom.leftDecoration() == 0 && aGeom.topDecoration() == 0) + mpParent && + aGeom.nLeftDecoration == 0 && + aGeom.nTopDecoration == 0 ) { aGeom = mpParent->maGeometry; - if (aGeom.leftDecoration() == 0 && aGeom.topDecoration() == 0) - aGeom.setDecorations(5, 20, 5, 5); + if( aGeom.nLeftDecoration == 0 && + aGeom.nTopDecoration == 0 ) + { + aGeom.nLeftDecoration = 5; + aGeom.nTopDecoration = 20; + aGeom.nRightDecoration = 5; + aGeom.nBottomDecoration = 5; + } } - auto nRight = aPosSize.Right() + (mpParent ? mpParent->maGeometry.x() : 0); - auto nBottom = aPosSize.Bottom() + (mpParent ? mpParent->maGeometry.y() : 0); - auto nLeft = aPosSize.Left() + (mpParent ? mpParent->maGeometry.x() : 0); - auto nTop = aPosSize.Top() + (mpParent ? mpParent->maGeometry.y() : 0); + auto nRight = aPosSize.Right() + (mpParent ? mpParent->maGeometry.nX : 0); + auto nBottom = aPosSize.Bottom() + (mpParent ? mpParent->maGeometry.nY : 0); + auto nLeft = aPosSize.Left() + (mpParent ? mpParent->maGeometry.nX : 0); + auto nTop = aPosSize.Top() + (mpParent ? mpParent->maGeometry.nY : 0); // adjust position so that frame fits onto screen - if( nRight+static_cast(aGeom.rightDecoration()) > aScreenSize.Width()-1 ) - aPosSize.Move( aScreenSize.Width() - nRight - static_cast(aGeom.rightDecoration()), 0 ); - if( nBottom+static_cast(aGeom.bottomDecoration()) > aScreenSize.Height()-1 ) - aPosSize.Move( 0, aScreenSize.Height() - nBottom - static_cast(aGeom.bottomDecoration()) ); - if( nLeft < static_cast(aGeom.leftDecoration()) ) - aPosSize.Move( static_cast(aGeom.leftDecoration()) - nLeft, 0 ); - if( nTop < static_cast(aGeom.topDecoration()) ) - aPosSize.Move( 0, static_cast(aGeom.topDecoration()) - nTop ); + if( nRight+static_cast(aGeom.nRightDecoration) > aScreenSize.Width()-1 ) + aPosSize.Move( aScreenSize.Width() - nRight - static_cast(aGeom.nRightDecoration), 0 ); + if( nBottom+static_cast(aGeom.nBottomDecoration) > aScreenSize.Height()-1 ) + aPosSize.Move( 0, aScreenSize.Height() - nBottom - static_cast(aGeom.nBottomDecoration) ); + if( nLeft < static_cast(aGeom.nLeftDecoration) ) + aPosSize.Move( static_cast(aGeom.nLeftDecoration) - nLeft, 0 ); + if( nTop < static_cast(aGeom.nTopDecoration) ) + aPosSize.Move( 0, static_cast(aGeom.nTopDecoration) - nTop ); } SetPosSize(aPosSize.getX(), aPosSize.getY(), @@ -1715,44 +1751,47 @@ } // request for status change - if (!(pState->mask() & vcl::WindowDataMask::State)) + if (!(pState->mnMask & WindowStateMask::State)) return; - if (pState->state() & vcl::WindowState::Maximized) + if (pState->mnState & WindowStateState::Maximized) { nShowState_ = X11ShowState::Normal; - if( ! (pState->state() & (vcl::WindowState::MaximizedHorz|vcl::WindowState::MaximizedVert) ) ) + if( ! (pState->mnState & (WindowStateState::MaximizedHorz|WindowStateState::MaximizedVert) ) ) Maximize(); else { - bool bHorz(pState->state() & vcl::WindowState::MaximizedHorz); - bool bVert(pState->state() & vcl::WindowState::MaximizedVert); + bool bHorz(pState->mnState & WindowStateState::MaximizedHorz); + bool bVert(pState->mnState & WindowStateState::MaximizedVert); GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert ); } - maRestorePosSize = pState->posSize(); + maRestorePosSize.SetLeft( pState->mnX ); + maRestorePosSize.SetTop( pState->mnY ); + maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnWidth ); + maRestorePosSize.SetRight( maRestorePosSize.Left() + pState->mnHeight ); } else if( mbMaximizedHorz || mbMaximizedVert ) GetDisplay()->getWMAdaptor()->maximizeFrame( this, false, false ); - if (pState->state() & vcl::WindowState::Minimized) + if (pState->mnState & WindowStateState::Minimized) { if (nShowState_ == X11ShowState::Unknown) nShowState_ = X11ShowState::Normal; Minimize(); } - if (pState->state() & vcl::WindowState::Normal) + if (pState->mnState & WindowStateState::Normal) { if (nShowState_ != X11ShowState::Normal) Restore(); } } -bool X11SalFrame::GetWindowState( vcl::WindowData* pState ) +bool X11SalFrame::GetWindowState( SalFrameState* pState ) { if( X11ShowState::Minimized == nShowState_ ) - pState->setState(vcl::WindowState::Minimized); + pState->mnState = WindowStateState::Minimized; else - pState->setState(vcl::WindowState::Normal); + pState->mnState = WindowStateState::Normal; tools::Rectangle aPosSize; if( maRestorePosSize.IsEmpty() ) @@ -1761,22 +1800,26 @@ aPosSize = maRestorePosSize; if( mbMaximizedHorz ) - pState->rState() |= vcl::WindowState::MaximizedHorz; + pState->mnState |= WindowStateState::MaximizedHorz; if( mbMaximizedVert ) - pState->rState() |= vcl::WindowState::MaximizedVert; + pState->mnState |= WindowStateState::MaximizedVert; - pState->setPosSize(aPosSize); - pState->setMask(vcl::WindowDataMask::PosSizeState); + pState->mnX = aPosSize.Left(); + pState->mnY = aPosSize.Top(); + pState->mnWidth = aPosSize.GetWidth(); + pState->mnHeight = aPosSize.GetHeight(); + + pState->mnMask = FRAMESTATE_MASK_GEOMETRY | WindowStateMask::State; if (! maRestorePosSize.IsEmpty() ) { GetPosSize( aPosSize ); - pState->rState() |= vcl::WindowState::Maximized; - pState->SetMaximizedX(aPosSize.Left()); - pState->SetMaximizedY(aPosSize.Top()); - pState->SetMaximizedWidth(aPosSize.GetWidth()); - pState->SetMaximizedHeight(aPosSize.GetHeight()); - pState->rMask() |= FRAMESTATE_MASK_MAXIMIZED_GEOMETRY; + pState->mnState |= WindowStateState::Maximized; + pState->mnMaximizedX = aPosSize.Left(); + pState->mnMaximizedY = aPosSize.Top(); + pState->mnMaximizedWidth = aPosSize.GetWidth(); + pState->mnMaximizedHeight = aPosSize.GetHeight(); + pState->mnMask |= FRAMESTATE_MASK_MAXIMIZED_GEOMETRY; } return true; @@ -1793,17 +1836,17 @@ void X11SalFrame::GetPosSize( tools::Rectangle &rPosSize ) { - if( maGeometry.width() < 1 || maGeometry.height() < 1 ) + if( maGeometry.nWidth < 1 || maGeometry.nHeight < 1 ) { const Size& aScreenSize = pDisplay_->getDataForScreen( m_nXScreen ).m_aSize; - tools::Long w = aScreenSize.Width() - maGeometry.leftDecoration() - maGeometry.rightDecoration(); - tools::Long h = aScreenSize.Height() - maGeometry.topDecoration() - maGeometry.bottomDecoration(); + tools::Long w = aScreenSize.Width() - maGeometry.nLeftDecoration - maGeometry.nRightDecoration; + tools::Long h = aScreenSize.Height() - maGeometry.nTopDecoration - maGeometry.nBottomDecoration; - rPosSize = tools::Rectangle( Point( maGeometry.x(), maGeometry.y() ), Size( w, h ) ); + rPosSize = tools::Rectangle( Point( maGeometry.nX, maGeometry.nY ), Size( w, h ) ); } else - rPosSize = tools::Rectangle( Point( maGeometry.x(), maGeometry.y() ), - Size( maGeometry.width(), maGeometry.height() ) ); + rPosSize = tools::Rectangle( Point( maGeometry.nX, maGeometry.nY ), + Size( maGeometry.nWidth, maGeometry.nHeight ) ); } void X11SalFrame::SetSize( const Size &rSize ) @@ -1841,7 +1884,8 @@ XResizeWindow( GetXDisplay(), GetWindow(), rSize.Width(), rSize.Height() ); } - maGeometry.setSize(rSize); + maGeometry.nWidth = rSize.Width(); + maGeometry.nHeight = rSize.Height(); // allow the external status window to reposition if (mbInputFocus && mpInputContext != nullptr) @@ -1862,7 +1906,7 @@ if( mpParent && ! IsSysChildWindow() ) { if( AllSettings::GetLayoutRTL() ) - values.x = mpParent->maGeometry.width()-values.width-1-values.x; + values.x = mpParent->maGeometry.nWidth-values.width-1-values.x; ::Window aChild; // coordinates are relative to parent, so translate to root coordinates @@ -1876,9 +1920,9 @@ bool bMoved = false; bool bSized = false; - if( values.x != maGeometry.x() || values.y != maGeometry.y() ) + if( values.x != maGeometry.nX || values.y != maGeometry.nY ) bMoved = true; - if( values.width != static_cast(maGeometry.width()) || values.height != static_cast(maGeometry.height()) ) + if( values.width != static_cast(maGeometry.nWidth) || values.height != static_cast(maGeometry.nHeight) ) bSized = true; // do not set WMNormalHints for... @@ -1937,10 +1981,16 @@ XMoveResizeWindow( GetXDisplay(), GetWindow(), values.x, values.y, values.width, values.height ); } - maGeometry.setPosSize({ values.x, values.y }, { values.width, values.height }); + maGeometry.nX = values.x; + maGeometry.nY = values.y; + maGeometry.nWidth = values.width; + maGeometry.nHeight = values.height; if( IsSysChildWindow() && mpParent ) + { // translate back to root coordinates - maGeometry.move(mpParent->maGeometry.x(), mpParent->maGeometry.y()); + maGeometry.nX += mpParent->maGeometry.nX; + maGeometry.nY += mpParent->maGeometry.nY; + } updateScreenNumber(); if( bSized && ! bMoved ) @@ -2010,7 +2060,7 @@ void X11SalFrame::SetScreenNumber( unsigned int nNewScreen ) { - if( nNewScreen == maGeometry.screen() ) + if( nNewScreen == maGeometry.nDisplayScreenNumber ) return; if( GetDisplay()->IsXinerama() && GetDisplay()->GetXineramaScreens().size() > 1 ) @@ -2018,17 +2068,17 @@ if( nNewScreen >= GetDisplay()->GetXineramaScreens().size() ) return; - tools::Rectangle aOldScreenRect( GetDisplay()->GetXineramaScreens()[maGeometry.screen()] ); + tools::Rectangle aOldScreenRect( GetDisplay()->GetXineramaScreens()[maGeometry.nDisplayScreenNumber] ); tools::Rectangle aNewScreenRect( GetDisplay()->GetXineramaScreens()[nNewScreen] ); bool bVisible = bMapped_; if( bVisible ) Show( false ); - maGeometry.setX(aNewScreenRect.Left() + (maGeometry.x() - aOldScreenRect.Left())); - maGeometry.setY(aNewScreenRect.Top() + (maGeometry.y() - aOldScreenRect.Top())); + maGeometry.nX = aNewScreenRect.Left() + (maGeometry.nX - aOldScreenRect.Left()); + maGeometry.nY = aNewScreenRect.Top() + (maGeometry.nY - aOldScreenRect.Top()); createNewWindow( None, m_nXScreen ); if( bVisible ) Show( true ); - maGeometry.setScreen(nNewScreen); + maGeometry.nDisplayScreenNumber = nNewScreen; } else if( nNewScreen < GetDisplay()->GetXScreenCount() ) { @@ -2038,7 +2088,7 @@ createNewWindow( None, SalX11Screen( nNewScreen ) ); if( bVisible ) Show( true ); - maGeometry.setScreen(nNewScreen); + maGeometry.nDisplayScreenNumber = nNewScreen; } } @@ -2076,7 +2126,8 @@ return; if( bFullScreen ) { - maRestorePosSize = maGeometry.posSize(); + maRestorePosSize = tools::Rectangle( Point( maGeometry.nX, maGeometry.nY ), + Size( maGeometry.nWidth, maGeometry.nHeight ) ); tools::Rectangle aRect; if( nScreen < 0 || o3tl::make_unsigned(nScreen) >= GetDisplay()->GetXineramaScreens().size() ) aRect = tools::Rectangle( Point(0,0), GetDisplay()->GetScreenSize( m_nXScreen ) ); @@ -2086,7 +2137,10 @@ bool bVisible = bMapped_; if( bVisible ) Show( false ); - maGeometry.setPosSize(aRect); + maGeometry.nX = aRect.Left(); + maGeometry.nY = aRect.Top(); + maGeometry.nWidth = aRect.GetWidth(); + maGeometry.nHeight = aRect.GetHeight(); mbMaximizedHorz = mbMaximizedVert = false; mbFullScreen = true; createNewWindow( None, m_nXScreen ); @@ -2181,8 +2235,8 @@ /* when the application tries to center the mouse in the dialog the * window isn't mapped already. So use coordinates relative to the root window. */ - unsigned int nWindowLeft = maGeometry.x() + nX; - unsigned int nWindowTop = maGeometry.y() + nY; + unsigned int nWindowLeft = maGeometry.nX + nX; + unsigned int nWindowTop = maGeometry.nY + nY; XWarpPointer( GetXDisplay(), None, pDisplay_->GetRootWindow( pDisplay_->GetDefaultXScreen() ), 0, 0, 0, 0, nWindowLeft, nWindowTop); @@ -2584,8 +2638,8 @@ if( nVisibleFloats > 0 && mpParent ) { Cursor aCursor = mpParent->GetCursor(); - if( pEvent->xmotion.x >= 0 && pEvent->xmotion.x < static_cast(maGeometry.width()) && - pEvent->xmotion.y >= 0 && pEvent->xmotion.y < static_cast(maGeometry.height()) ) + if( pEvent->xmotion.x >= 0 && pEvent->xmotion.x < static_cast(maGeometry.nWidth) && + pEvent->xmotion.y >= 0 && pEvent->xmotion.y < static_cast(maGeometry.nHeight) ) aCursor = None; XChangeActivePointerGrab( GetXDisplay(), @@ -2612,10 +2666,10 @@ const X11SalFrame* pFrame = static_cast< const X11SalFrame* >( pSalFrame ); if( pFrame->IsFloatGrabWindow() && pFrame->bMapped_ && - pEvent->xbutton.x_root >= pFrame->maGeometry.x() && - pEvent->xbutton.x_root < pFrame->maGeometry.x() + static_cast(pFrame->maGeometry.width()) && - pEvent->xbutton.y_root >= pFrame->maGeometry.y() && - pEvent->xbutton.y_root < pFrame->maGeometry.y() + static_cast(pFrame->maGeometry.height()) ) + pEvent->xbutton.x_root >= pFrame->maGeometry.nX && + pEvent->xbutton.x_root < pFrame->maGeometry.nX + static_cast(pFrame->maGeometry.nWidth) && + pEvent->xbutton.y_root >= pFrame->maGeometry.nY && + pEvent->xbutton.y_root < pFrame->maGeometry.nY + static_cast(pFrame->maGeometry.nHeight) ) { bInside = true; break; @@ -2657,8 +2711,8 @@ { // #i63638# check that pointer is inside window, not // only inside stacking window - if( root_x >= pFrame->maGeometry.x() && root_x < sal::static_int_cast< int >(pFrame->maGeometry.x()+pFrame->maGeometry.width()) && - root_y >= pFrame->maGeometry.y() && root_y < sal::static_int_cast< int >(pFrame->maGeometry.x()+pFrame->maGeometry.height()) ) + if( root_x >= pFrame->maGeometry.nX && root_x < sal::static_int_cast< int >(pFrame->maGeometry.nX+pFrame->maGeometry.nWidth) && + root_y >= pFrame->maGeometry.nY && root_y < sal::static_int_cast< int >(pFrame->maGeometry.nX+pFrame->maGeometry.nHeight) ) { bClosePopups = false; } @@ -3444,9 +3498,10 @@ if( pEvent->window == GetStackingWindow() ) { - if( maGeometry.x() != pEvent->x || maGeometry.y() != pEvent->y ) + if( maGeometry.nX != pEvent->x || maGeometry.nY != pEvent->y ) { - maGeometry.setPos({ pEvent->x, pEvent->y }); + maGeometry.nX = pEvent->x; + maGeometry.nY = pEvent->y; CallCallback( SalEvent::Move, nullptr ); } return true; @@ -3469,10 +3524,13 @@ nWidth_ = pEvent->width; nHeight_ = pEvent->height; - bool bMoved = ( pEvent->x != maGeometry.x() || pEvent->y != maGeometry.y() ); - bool bSized = ( pEvent->width != static_cast(maGeometry.width()) || pEvent->height != static_cast(maGeometry.height()) ); + bool bMoved = ( pEvent->x != maGeometry.nX || pEvent->y != maGeometry.nY ); + bool bSized = ( pEvent->width != static_cast(maGeometry.nWidth) || pEvent->height != static_cast(maGeometry.nHeight) ); - maGeometry.setPosSize({ pEvent->x, pEvent->y }, { pEvent->width, pEvent->height }); + maGeometry.nX = pEvent->x; + maGeometry.nY = pEvent->y; + maGeometry.nWidth = pEvent->width; + maGeometry.nHeight = pEvent->height; updateScreenNumber(); // update children's position @@ -3603,8 +3661,8 @@ &nLeft, &nTop, &hDummy ); - maGeometry.setLeftDecoration(nLeft > 0 ? nLeft-1 : 0); - maGeometry.setTopDecoration(nTop > 0 ? nTop-1 : 0); + maGeometry.nLeftDecoration = nLeft > 0 ? nLeft-1 : 0; + maGeometry.nTopDecoration = nTop > 0 ? nTop-1 : 0; /* * decorations are not symmetric, @@ -3632,15 +3690,17 @@ if( ! bError ) { - maGeometry.setRightDecoration(wp - w - maGeometry.leftDecoration()); - maGeometry.setBottomDecoration(hp - h - maGeometry.topDecoration()); - bResized = w != o3tl::make_unsigned(maGeometry.width()) || - h != o3tl::make_unsigned(maGeometry.height()); + maGeometry.nRightDecoration = wp - w - maGeometry.nLeftDecoration; + maGeometry.nBottomDecoration = hp - h - maGeometry.nTopDecoration; /* * note: this works because hWM_Parent is direct child of root, * not necessarily parent of GetShellWindow() */ - maGeometry.setPosSize({ xp + nLeft, yp + nTop }, { w, h }); + maGeometry.nX = xp + nLeft; + maGeometry.nY = yp + nTop; + bResized = w != maGeometry.nWidth || h != maGeometry.nHeight; + maGeometry.nWidth = w; + maGeometry.nHeight = h; } // limit width and height if we are too large: #47757 @@ -3652,17 +3712,17 @@ Size aScreenSize = GetDisplay()->GetScreenSize( m_nXScreen ); int nScreenWidth = aScreenSize.Width(); int nScreenHeight = aScreenSize.Height(); - int nFrameWidth = maGeometry.width() + maGeometry.leftDecoration() + maGeometry.rightDecoration(); - int nFrameHeight = maGeometry.height() + maGeometry.topDecoration() + maGeometry.bottomDecoration(); + int nFrameWidth = maGeometry.nWidth + maGeometry.nLeftDecoration + maGeometry.nRightDecoration; + int nFrameHeight = maGeometry.nHeight + maGeometry.nTopDecoration + maGeometry.nBottomDecoration; if ((nFrameWidth > nScreenWidth) || (nFrameHeight > nScreenHeight)) { - Size aSize(maGeometry.width(), maGeometry.height()); + Size aSize(maGeometry.nWidth, maGeometry.nHeight); if (nFrameWidth > nScreenWidth) - aSize.setWidth( nScreenWidth - maGeometry.rightDecoration() - maGeometry.leftDecoration() ); + aSize.setWidth( nScreenWidth - maGeometry.nRightDecoration - maGeometry.nLeftDecoration ); if (nFrameHeight > nScreenHeight) - aSize.setHeight( nScreenHeight - maGeometry.bottomDecoration() - maGeometry.topDecoration() ); + aSize.setHeight( nScreenHeight - maGeometry.nBottomDecoration - maGeometry.nTopDecoration ); SetSize( aSize ); bResized = false; diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index c2430bb..3684dd5 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -774,7 +774,7 @@ { gtk_fixed_move( GTK_FIXED(pParent), m_pWindow, - nX - m_pParent->maGeometry.x(), nY - m_pParent->maGeometry.y() ); + nX - m_pParent->maGeometry.nX, nY - m_pParent->maGeometry.nY ); } } #if !GTK_CHECK_VERSION(4,0,0) @@ -880,8 +880,8 @@ int nScreen = 0; GdkScreen *pScreen = gtk_widget_get_screen( m_pWindow ); if( pScreen ) - nScreen = getDisplay()->getSystem()->getScreenMonitorIdx( pScreen, maGeometry.x(), maGeometry.y() ); - maGeometry.setScreen(nScreen); + nScreen = getDisplay()->getSystem()->getScreenMonitorIdx( pScreen, maGeometry.nX, maGeometry.nY ); + maGeometry.nDisplayScreenNumber = nScreen; #endif } @@ -1185,8 +1185,14 @@ if (m_bDefaultPos || m_bDefaultSize) { Size aDefSize = calcDefaultSize(); - maGeometry.setPosSize({ -1, -1 }, aDefSize); - maGeometry.setDecorations(0, 0, 0, 0); + maGeometry.nX = -1; + maGeometry.nY = -1; + maGeometry.nWidth = aDefSize.Width(); + maGeometry.nHeight = aDefSize.Height(); + maGeometry.nTopDecoration = 0; + maGeometry.nBottomDecoration = 0; + maGeometry.nLeftDecoration = 0; + maGeometry.nRightDecoration = 0; } updateScreenNumber(); @@ -1851,7 +1857,7 @@ void GtkSalFrame::AllocateFrame() { - basegfx::B2IVector aFrameSize( maGeometry.width(), maGeometry.height() ); + basegfx::B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight ); if (m_pSurface && m_aFrameSize.getX() == aFrameSize.getX() && m_aFrameSize.getY() == aFrameSize.getY() ) return; @@ -1871,7 +1877,7 @@ m_aFrameSize = aFrameSize; cairo_surface_set_user_data(m_pSurface, SvpSalGraphics::getDamageKey(), &m_aDamageHandler, nullptr); - SAL_INFO("vcl.gtk3", "allocated Frame size of " << maGeometry.width() << " x " << maGeometry.height()); + SAL_INFO("vcl.gtk3", "allocated Frame size of " << maGeometry.nWidth << " x " << maGeometry.nHeight); if (m_pGraphics) m_pGraphics->setSurface(m_pSurface, m_aFrameSize); @@ -1888,7 +1894,13 @@ { m_bDefaultSize = false; - maGeometry.setSize({ nWidth, nHeight }); + // tdf#131031 Just setting maGeometry.nWidth/nHeight will delete + // the evtl. implicitly existing space at top for the gtk native MenuBar, + // will make the Window too big and the StatusBar at the bottom vanish + // and thus breaks the fix in tdf#130841. + const int nImplicitMenuBarHeight(m_pSalMenu ? m_pSalMenu->GetMenuBarHeight() : 0); + maGeometry.nWidth = nWidth; + maGeometry.nHeight = nHeight - nImplicitMenuBarHeight; if( isChild( false ) ) widget_set_size_request(nWidth, nHeight); @@ -1907,20 +1919,20 @@ if( m_pParent ) { if( AllSettings::GetLayoutRTL() ) - nX = m_pParent->maGeometry.width()-m_nWidthRequest-1-nX; - nX += m_pParent->maGeometry.x(); - nY += m_pParent->maGeometry.y(); + nX = m_pParent->maGeometry.nWidth-m_nWidthRequest-1-nX; + nX += m_pParent->maGeometry.nX; + nY += m_pParent->maGeometry.nY; } if (nFlags & SAL_FRAME_POSSIZE_X) - maGeometry.setX(nX); + maGeometry.nX = nX; if (nFlags & SAL_FRAME_POSSIZE_Y) - maGeometry.setY(nY); + maGeometry.nY = nY; m_bGeometryIsProvisional = true; m_bDefaultPos = false; - moveWindow(maGeometry.x(), maGeometry.y()); + moveWindow(maGeometry.nX, maGeometry.nY); updateScreenNumber(); } @@ -1934,8 +1946,8 @@ { if( m_pWindow && !(m_nState & GDK_TOPLEVEL_STATE_MINIMIZED) ) { - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; } else rWidth = rHeight = 0; @@ -1969,52 +1981,56 @@ return m_pParent; } -void GtkSalFrame::SetWindowState(const vcl::WindowData* pState) +void GtkSalFrame::SetWindowState( const SalFrameState* pState ) { if( ! m_pWindow || ! pState || isChild( true, false ) ) return; - const vcl::WindowDataMask nMaxGeometryMask = vcl::WindowDataMask::PosSize | - vcl::WindowDataMask::MaximizedX | vcl::WindowDataMask::MaximizedY | - vcl::WindowDataMask::MaximizedWidth | vcl::WindowDataMask::MaximizedHeight; + const WindowStateMask nMaxGeometryMask = + WindowStateMask::X | WindowStateMask::Y | + WindowStateMask::Width | WindowStateMask::Height | + WindowStateMask::MaximizedX | WindowStateMask::MaximizedY | + WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; - if( (pState->mask() & vcl::WindowDataMask::State) && + if( (pState->mnMask & WindowStateMask::State) && ! ( m_nState & GDK_TOPLEVEL_STATE_MAXIMIZED ) && - (pState->state() & vcl::WindowState::Maximized) && - (pState->mask() & nMaxGeometryMask) == nMaxGeometryMask ) + (pState->mnState & WindowStateState::Maximized) && + (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask ) { - resizeWindow(pState->width(), pState->height()); - moveWindow(pState->x(), pState->y()); + resizeWindow( pState->mnWidth, pState->mnHeight ); + moveWindow( pState->mnX, pState->mnY ); m_bDefaultPos = m_bDefaultSize = false; updateScreenNumber(); m_nState = GdkToplevelState(m_nState | GDK_TOPLEVEL_STATE_MAXIMIZED); - m_aRestorePosSize = pState->posSize(); + m_aRestorePosSize = tools::Rectangle( Point( pState->mnX, pState->mnY ), + Size( pState->mnWidth, pState->mnHeight ) ); } - else if (pState->mask() & vcl::WindowDataMask::PosSize) + else if( pState->mnMask & (WindowStateMask::X | WindowStateMask::Y | + WindowStateMask::Width | WindowStateMask::Height ) ) { sal_uInt16 nPosSizeFlags = 0; - tools::Long nX = pState->x() - (m_pParent ? m_pParent->maGeometry.x() : 0); - tools::Long nY = pState->y() - (m_pParent ? m_pParent->maGeometry.y() : 0); - if (pState->mask() & vcl::WindowDataMask::X) + tools::Long nX = pState->mnX - (m_pParent ? m_pParent->maGeometry.nX : 0); + tools::Long nY = pState->mnY - (m_pParent ? m_pParent->maGeometry.nY : 0); + if( pState->mnMask & WindowStateMask::X ) nPosSizeFlags |= SAL_FRAME_POSSIZE_X; else - nX = maGeometry.x() - (m_pParent ? m_pParent->maGeometry.x() : 0); - if (pState->mask() & vcl::WindowDataMask::Y) + nX = maGeometry.nX - (m_pParent ? m_pParent->maGeometry.nX : 0); + if( pState->mnMask & WindowStateMask::Y ) nPosSizeFlags |= SAL_FRAME_POSSIZE_Y; else - nY = maGeometry.y() - (m_pParent ? m_pParent->maGeometry.y() : 0); - if (pState->mask() & vcl::WindowDataMask::Width) + nY = maGeometry.nY - (m_pParent ? m_pParent->maGeometry.nY : 0); + if( pState->mnMask & WindowStateMask::Width ) nPosSizeFlags |= SAL_FRAME_POSSIZE_WIDTH; - if (pState->mask() & vcl::WindowDataMask::Height) + if( pState->mnMask & WindowStateMask::Height ) nPosSizeFlags |= SAL_FRAME_POSSIZE_HEIGHT; - SetPosSize(nX, nY, pState->width(), pState->height(), nPosSizeFlags); + SetPosSize( nX, nY, pState->mnWidth, pState->mnHeight, nPosSizeFlags ); } - if (pState->mask() & vcl::WindowDataMask::State && !isChild()) + if( pState->mnMask & WindowStateMask::State && ! isChild() ) { - if (pState->state() & vcl::WindowState::Maximized) + if( pState->mnState & WindowStateState::Maximized ) gtk_window_maximize( GTK_WINDOW(m_pWindow) ); else gtk_window_unmaximize( GTK_WINDOW(m_pWindow) ); @@ -2026,7 +2042,7 @@ * on windows with a parent (that is transient frames) since these tend * to not be represented in an icon task list. */ - bool bMinimize = pState->state() & vcl::WindowState::Minimized && !m_pParent; + bool bMinimize = pState->mnState & WindowStateState::Minimized && !m_pParent; #if GTK_CHECK_VERSION(4, 0, 0) if (bMinimize) gtk_window_minimize(GTK_WINDOW(m_pWindow)); @@ -2071,30 +2087,38 @@ } } -bool GtkSalFrame::GetWindowState(vcl::WindowData* pState) +bool GtkSalFrame::GetWindowState( SalFrameState* pState ) { - pState->setState(vcl::WindowState::Normal); - pState->setMask(vcl::WindowDataMask::PosSizeState); + pState->mnState = WindowStateState::Normal; + pState->mnMask = WindowStateMask::State; // rollup ? gtk 2.2 does not seem to support the shaded state if( m_nState & GDK_TOPLEVEL_STATE_MINIMIZED ) - pState->rState() |= vcl::WindowState::Minimized; + pState->mnState |= WindowStateState::Minimized; if( m_nState & GDK_TOPLEVEL_STATE_MAXIMIZED ) { - pState->rState() |= vcl::WindowState::Maximized; - pState->setPosSize(m_aRestorePosSize); - tools::Rectangle aPosSize = GetPosAndSize(GTK_WINDOW(m_pWindow)); - pState->SetMaximizedX(aPosSize.Left()); - pState->SetMaximizedY(aPosSize.Top()); - pState->SetMaximizedWidth(aPosSize.GetWidth()); - pState->SetMaximizedHeight(aPosSize.GetHeight()); - pState->rMask() |= vcl::WindowDataMask::MaximizedX | - vcl::WindowDataMask::MaximizedY | - vcl::WindowDataMask::MaximizedWidth | - vcl::WindowDataMask::MaximizedHeight; + pState->mnState |= WindowStateState::Maximized; + pState->mnX = m_aRestorePosSize.Left(); + pState->mnY = m_aRestorePosSize.Top(); + pState->mnWidth = m_aRestorePosSize.GetWidth(); + pState->mnHeight = m_aRestorePosSize.GetHeight(); + GetPosAndSize(GTK_WINDOW(m_pWindow), pState->mnMaximizedX, pState->mnMaximizedY, + pState->mnMaximizedWidth, pState->mnMaximizedHeight); + pState->mnMask |= WindowStateMask::MaximizedX | + WindowStateMask::MaximizedY | + WindowStateMask::MaximizedWidth | + WindowStateMask::MaximizedHeight; } else - pState->setPosSize(GetPosAndSize(GTK_WINDOW(m_pWindow))); + { + GetPosAndSize(GTK_WINDOW(m_pWindow), pState->mnX, pState->mnY, + pState->mnWidth, pState->mnHeight); + } + + pState->mnMask |= WindowStateMask::X | + WindowStateMask::Y | + WindowStateMask::Width | + WindowStateMask::Height; return true; } @@ -2104,12 +2128,12 @@ if( !m_pWindow ) return; - if (maGeometry.screen() == nNewScreen && eType == SetType::RetainSize) + if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SetType::RetainSize) return; #if !GTK_CHECK_VERSION(4, 0, 0) - int nX = maGeometry.x(), nY = maGeometry.y(), - nWidth = maGeometry.width(), nHeight = maGeometry.height(); + int nX = maGeometry.nX, nY = maGeometry.nY, + nWidth = maGeometry.nWidth, nHeight = maGeometry.nHeight; GdkScreen *pScreen = nullptr; GdkRectangle aNewMonitor; @@ -2504,8 +2528,8 @@ /* when the application tries to center the mouse in the dialog the * window isn't mapped already. So use coordinates relative to the root window. */ - unsigned int nWindowLeft = maGeometry.x() + nX; - unsigned int nWindowTop = maGeometry.y() + nY; + unsigned int nWindowLeft = maGeometry.nX + nX; + unsigned int nWindowTop = maGeometry.nY + nY; GdkDeviceManager* pManager = gdk_display_get_device_manager(pDisplay); gdk_device_warp(gdk_device_manager_get_client_pointer(pManager), pScreen, nWindowLeft, nWindowTop); @@ -2638,7 +2662,7 @@ gint x, y; GdkModifierType aMask; gdk_display_get_pointer( getGdkDisplay(), &pScreen, &x, &y, &aMask ); - aState.maPos = Point( x - maGeometry.x(), y - maGeometry.y() ); + aState.maPos = Point( x - maGeometry.nX, y - maGeometry.nY ); aState.mnState = GetMouseModCode( aMask ); #endif return aState; @@ -2841,7 +2865,7 @@ aHelpArea.width = pThis->m_aHelpArea.GetWidth(); aHelpArea.height = pThis->m_aHelpArea.GetHeight(); if (AllSettings::GetLayoutRTL()) - aHelpArea.x = pThis->maGeometry.width()-aHelpArea.width-1-aHelpArea.x; + aHelpArea.x = pThis->maGeometry.nWidth-aHelpArea.width-1-aHelpArea.x; gtk_tooltip_set_tip_area(tooltip, &aHelpArea); return true; } @@ -2876,7 +2900,7 @@ void set_pointing_to(GtkPopover *pPopOver, vcl::Window* pParent, const tools::Rectangle& rHelpArea, const SalFrameGeometry& rGeometry) { GdkRectangle aRect; - aRect.x = FloatingWindow::ImplConvertToAbsPos(pParent, rHelpArea).Left() - rGeometry.x(); + aRect.x = FloatingWindow::ImplConvertToAbsPos(pParent, rHelpArea).Left() - rGeometry.nX; aRect.y = rHelpArea.Top(); aRect.width = 1; aRect.height = 1; @@ -3061,7 +3085,7 @@ aEvent.mnCode = GetMouseModCode(nState); if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = maGeometry.width()-1-aEvent.mnX; + aEvent.mnX = maGeometry.nWidth-1-aEvent.mnX; CallCallbackExc(nEventType, &aEvent); @@ -3129,10 +3153,11 @@ { int frame_x = static_cast(pEvent->x_root - nEventX); int frame_y = static_cast(pEvent->y_root - nEventY); - if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.x() || frame_y != pThis->maGeometry.y()) + if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY) { pThis->m_bGeometryIsProvisional = false; - pThis->maGeometry.setPos({ frame_x, frame_y }); + pThis->maGeometry.nX = frame_x; + pThis->maGeometry.nY = frame_y; ImplSVData* pSVData = ImplGetSVData(); if (pSVData->maNWFData.mbCanDetermineWindowPosition) pThis->CallCallbackExc(SalEvent::Move, nullptr); @@ -3143,8 +3168,8 @@ if (!aDel.isDeleted()) { bRet = pThis->DrawingAreaButton(nEventType, - pEvent->x_root - pThis->maGeometry.x(), - pEvent->y_root - pThis->maGeometry.y(), + pEvent->x_root - pThis->maGeometry.nX, + pEvent->y_root - pThis->maGeometry.nY, pEvent->button, pEvent->time, pEvent->state); @@ -3199,7 +3224,7 @@ aEvent.mnX = nEventX; // --- RTL --- (mirror mouse pos) if (AllSettings::GetLayoutRTL()) - aEvent.mnX = maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = maGeometry.nWidth - 1 - aEvent.mnX; aEvent.mnY = nEventY; aEvent.mnCode = GetMouseModCode(nState); @@ -3326,7 +3351,7 @@ // --- RTL --- (mirror mouse pos) if (AllSettings::GetLayoutRTL()) - aEvent.mnX = pThis->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = pThis->maGeometry.nWidth - 1 - aEvent.mnX; pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent); @@ -3400,7 +3425,7 @@ aEvent.mnButton = 0; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = maGeometry.nWidth-1-aEvent.mnX; CallCallbackExc(SalEvent::MouseMove, &aEvent); } @@ -3438,10 +3463,11 @@ int frame_x = static_cast(pEvent->x_root - nEventX); int frame_y = static_cast(pEvent->y_root - nEventY); - if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.x() || frame_y != pThis->maGeometry.y()) + if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY) { pThis->m_bGeometryIsProvisional = false; - pThis->maGeometry.setPos({ frame_x, frame_y }); + pThis->maGeometry.nX = frame_x; + pThis->maGeometry.nY = frame_y; ImplSVData* pSVData = ImplGetSVData(); if (pSVData->maNWFData.mbCanDetermineWindowPosition) pThis->CallCallbackExc(SalEvent::Move, nullptr); @@ -3449,8 +3475,8 @@ if (!aDel.isDeleted()) { - pThis->DrawingAreaMotion(pEvent->x_root - pThis->maGeometry.x(), - pEvent->y_root - pThis->maGeometry.y(), + pThis->DrawingAreaMotion(pEvent->x_root - pThis->maGeometry.nX, + pEvent->y_root - pThis->maGeometry.nY, pEvent->time, pEvent->state); } @@ -3478,7 +3504,7 @@ aEvent.mnButton = 0; if (AllSettings::GetLayoutRTL()) - aEvent.mnX = maGeometry.width()-1-aEvent.mnX; + aEvent.mnX = maGeometry.nWidth-1-aEvent.mnX; CallCallbackExc(nEventType, &aEvent); } @@ -3504,8 +3530,8 @@ { GtkSalFrame* pThis = static_cast(frame); pThis->DrawingAreaCrossing((pEvent->type == GDK_ENTER_NOTIFY) ? SalEvent::MouseMove : SalEvent::MouseLeave, - pEvent->x_root - pThis->maGeometry.x(), - pEvent->y_root - pThis->maGeometry.y(), + pEvent->x_root - pThis->maGeometry.nX, + pEvent->y_root - pThis->maGeometry.nY, pEvent->time, pEvent->state); return true; @@ -3575,7 +3601,8 @@ // ignore size-allocations that occur during configuring an embedded SalObject if (m_bSalObjectSetPosSize) return; - maGeometry.setSize({ nWidth, nHeight }); + maGeometry.nWidth = nWidth; + maGeometry.nHeight = nHeight; bool bRealized = gtk_widget_get_realized(pWidget); if (bRealized) AllocateFrame(); @@ -3660,7 +3687,7 @@ tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect); if (gdk_window_get_window_type(widget_get_surface(pThis->m_pParent->m_pWindow)) != GDK_WINDOW_TOPLEVEL) - aFloatRect.Move(-pThis->m_pParent->maGeometry.x(), -pThis->m_pParent->maGeometry.y()); + aFloatRect.Move(-pThis->m_pParent->maGeometry.nX, -pThis->m_pParent->maGeometry.nY); GdkRectangle rect {static_cast(aFloatRect.Left()), static_cast(aFloatRect.Top()), static_cast(aFloatRect.GetWidth()), static_cast(aFloatRect.GetHeight())}; @@ -3683,20 +3710,21 @@ * yet the gdkdisplay-x11.c code handling configure_events has * done this XTranslateCoordinates work since the day ~zero. */ - if (pThis->m_bGeometryIsProvisional || x != pThis->maGeometry.x() || y != pThis->maGeometry.y() ) + if (pThis->m_bGeometryIsProvisional || x != pThis->maGeometry.nX || y != pThis->maGeometry.nY ) { bMoved = true; pThis->m_bGeometryIsProvisional = false; - pThis->maGeometry.setPos({ x, y }); + pThis->maGeometry.nX = x; + pThis->maGeometry.nY = y; } // update decoration hints GdkRectangle aRect; gdk_window_get_frame_extents( widget_get_surface(GTK_WIDGET(pThis->m_pWindow)), &aRect ); - pThis->maGeometry.setTopDecoration(y - aRect.y); - pThis->maGeometry.setBottomDecoration(aRect.y + aRect.height - y - pEvent->height); - pThis->maGeometry.setLeftDecoration(x - aRect.x); - pThis->maGeometry.setRightDecoration(aRect.x + aRect.width - x - pEvent->width); + pThis->maGeometry.nTopDecoration = y - aRect.y; + pThis->maGeometry.nBottomDecoration = aRect.y + aRect.height - y - pEvent->height; + pThis->maGeometry.nLeftDecoration = x - aRect.x; + pThis->maGeometry.nRightDecoration = aRect.x + aRect.width - x - pEvent->width; pThis->updateScreenNumber(); if (bMoved) @@ -3729,8 +3757,8 @@ // //The other alternative was to always paint everything on "draw", but //that duplicates the amount of drawing and is hideously slow - SAL_INFO("vcl.gtk3", "force painting" << 0 << "," << 0 << " " << maGeometry.width() << "x" << maGeometry.height()); - SalPaintEvent aPaintEvt(0, 0, maGeometry.width(), maGeometry.height(), true); + SAL_INFO("vcl.gtk3", "force painting" << 0 << "," << 0 << " " << maGeometry.nWidth << "x" << maGeometry.nHeight); + SalPaintEvent aPaintEvt(0, 0, maGeometry.nWidth, maGeometry.nHeight, true); CallCallbackExc(SalEvent::Paint, &aPaintEvt); queue_draw(); } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index ec706e5..ca36152 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2254,7 +2254,7 @@ // this is the relatively unusual case where pParent is the toplevel GtkSalFrame and not a stock GtkWidget // so use the same style of logic as GtkSalMenu::ShowNativePopupMenu to get the right position tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pFrame->GetWindow(), rInRect); - aFloatRect.Move(-pFrame->maGeometry.x(), -pFrame->maGeometry.y()); + aFloatRect.Move(-pFrame->maGeometry.nX, -pFrame->maGeometry.nY); rOutRect = GdkRectangle{static_cast(aFloatRect.Left()), static_cast(aFloatRect.Top()), static_cast(aFloatRect.GetWidth()), static_cast(aFloatRect.GetHeight())}; @@ -6334,57 +6334,66 @@ virtual void set_window_state(const OString& rStr) override { - vcl::WindowData aData; + WindowStateData aData; ImplWindowStateFromStr( aData, rStr ); - const auto nMask = aData.mask(); - const auto nState = aData.state() & vcl::WindowState::SystemMask; + auto nMask = aData.GetMask(); + auto nState = aData.GetState() & WindowStateState::SystemMask; - if ((nMask & vcl::WindowDataMask::Size) == vcl::WindowDataMask::Size) + if (nMask & WindowStateMask::Width && nMask & WindowStateMask::Height) { - gtk_window_set_default_size(m_pWindow, aData.width(), aData.height()); + gtk_window_set_default_size(m_pWindow, aData.GetWidth(), aData.GetHeight()); } - if (nMask & vcl::WindowDataMask::State) + if (nMask & WindowStateMask::State) { - if (nState & vcl::WindowState::Maximized) + if (nState & WindowStateState::Maximized) gtk_window_maximize(m_pWindow); else gtk_window_unmaximize(m_pWindow); } #if !GTK_CHECK_VERSION(4, 0, 0) - if (isPositioningAllowed() && ((nMask & vcl::WindowDataMask::Pos) == vcl::WindowDataMask::Pos)) + if (isPositioningAllowed() && (nMask & WindowStateMask::X && nMask & WindowStateMask::Y)) { - gtk_window_move(m_pWindow, aData.x(), aData.y()); + gtk_window_move(m_pWindow, aData.GetX(), aData.GetY()); } #endif } - virtual OString get_window_state(vcl::WindowDataMask nMask) const override + virtual OString get_window_state(WindowStateMask nMask) const override { bool bPositioningAllowed = isPositioningAllowed(); - vcl::WindowData aData; - vcl::WindowDataMask nAvailable = vcl::WindowDataMask::State | vcl::WindowDataMask::Size; + WindowStateData aData; + WindowStateMask nAvailable = WindowStateMask::State | + WindowStateMask::Width | WindowStateMask::Height; if (bPositioningAllowed) - nAvailable |= vcl::WindowDataMask::Pos; - aData.setMask(nMask & nAvailable); + nAvailable |= WindowStateMask::X | WindowStateMask::Y; + aData.SetMask(nMask & nAvailable); - if (nMask & vcl::WindowDataMask::State) + if (nMask & WindowStateMask::State) { - vcl::WindowState nState = vcl::WindowState::Normal; + WindowStateState nState = WindowStateState::Normal; if (gtk_window_is_maximized(m_pWindow)) - nState |= vcl::WindowState::Maximized; - aData.setState(nState); + nState |= WindowStateState::Maximized; + aData.SetState(nState); } - if (bPositioningAllowed && (nMask & vcl::WindowDataMask::Pos)) - aData.setPos(get_position()); + if (bPositioningAllowed && (nMask & (WindowStateMask::X | WindowStateMask::Y))) + { + auto aPos = get_position(); + aData.SetX(aPos.X()); + aData.SetY(aPos.Y()); + } - if (nMask & vcl::WindowDataMask::Size) - aData.setSize(get_size()); + if (nMask & (WindowStateMask::Width | WindowStateMask::Height)) + { + auto aSize = get_size(); + aData.SetWidth(aSize.Width()); + aData.SetHeight(aSize.Height()); + } - return aData.toStr(); + return aData.ToStr(); } virtual void connect_container_focus_changed(const Link& rLink) override diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index bcae159..c2677d6 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -468,7 +468,7 @@ #if GTK_CHECK_VERSION(4, 0, 0) tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); - aFloatRect.Move(-mpFrame->maGeometry.x(), -mpFrame->maGeometry.y()); + aFloatRect.Move(-mpFrame->maGeometry.nX, -mpFrame->maGeometry.nY); GdkRectangle rect {static_cast(aFloatRect.Left()), static_cast(aFloatRect.Top()), static_cast(aFloatRect.GetWidth()), static_cast(aFloatRect.GetHeight())}; @@ -489,7 +489,7 @@ if (gtk_check_version(3, 22, 0) == nullptr) { tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); - aFloatRect.Move(-mpFrame->maGeometry.x(), -mpFrame->maGeometry.y()); + aFloatRect.Move(-mpFrame->maGeometry.nX, -mpFrame->maGeometry.nY); GdkRectangle rect {static_cast(aFloatRect.Left()), static_cast(aFloatRect.Top()), static_cast(aFloatRect.GetWidth()), static_cast(aFloatRect.GetHeight())}; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index afe4492..2c41873 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -964,8 +964,8 @@ WinSalFrame* pFrame = GetWindowPtr( mrParent.gethWnd() ); if( pFrame ) { - if (pFrame->maGeometry.width()) - return pFrame->maGeometry.width(); + if( pFrame->maGeometry.nWidth ) + return pFrame->maGeometry.nWidth; else { // TODO: perhaps not needed, maGeometry should always be up-to-date diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 44ca954..2ae47ec 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -131,12 +131,6 @@ static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame ); static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = nullptr ); -static void SetGeometrySize(vcl::WindowPosSize& rWinPosSize, const Size& rSize) -{ - rWinPosSize.setWidth(rSize.Width() < 0 ? 0 : rSize.Width()); - rWinPosSize.setHeight(rSize.Height() < 0 ? 0 : rSize.Height()); -} - static void UpdateGeometry(WinSalFrame* pFrame, RECT& aRect) { RECT aRect2 = aRect; @@ -147,10 +141,10 @@ tools::Long nBottomDeco = abs(aRect.bottom - aRect2.bottom); tools::Long nRightDeco = abs(aRect.right - aRect2.right); - pFrame->maState.setPos({ aRect.left + nLeftDeco, aRect.top + nTopDeco }); - tools::Long nWidth(aRect.right - aRect.left - nLeftDeco - nRightDeco); - tools::Long nHeight(aRect.bottom - aRect.top - nTopDeco - nBottomDeco); - SetGeometrySize(pFrame->maState, { nWidth, nHeight }); + pFrame->maState.mnX = aRect.left + nLeftDeco; + pFrame->maState.mnY = aRect.top + nTopDeco; + pFrame->maState.mnWidth = aRect.right - aRect.left - nLeftDeco - nRightDeco; + pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco - nBottomDeco; } static void ImplSaveFrameState( WinSalFrame* pFrame ) @@ -161,14 +155,14 @@ bool bVisible = (GetWindowStyle( pFrame->mhWnd ) & WS_VISIBLE) != 0; if ( IsIconic( pFrame->mhWnd ) ) { - pFrame->maState.rState() |= vcl::WindowState::Minimized; + pFrame->maState.mnState |= WindowStateState::Minimized; if ( bVisible ) pFrame->mnShowState = SW_SHOWMAXIMIZED; } else if ( IsZoomed( pFrame->mhWnd ) ) { - pFrame->maState.rState() &= ~vcl::WindowState::Minimized; - pFrame->maState.rState() |= vcl::WindowState::Maximized; + pFrame->maState.mnState &= ~WindowStateState::Minimized; + pFrame->maState.mnState |= WindowStateState::Maximized; if ( bVisible ) pFrame->mnShowState = SW_SHOWMAXIMIZED; pFrame->mbRestoreMaximize = true; @@ -183,7 +177,8 @@ RECT aRect; GetWindowRect( pFrame->mhWnd, &aRect ); UpdateGeometry(pFrame, aRect); - pFrame->maState.rState() &= ~vcl::WindowState(vcl::WindowState::Minimized | vcl::WindowState::Maximized); + + pFrame->maState.mnState &= ~WindowStateState(WindowStateState::Minimized | WindowStateState::Maximized); if ( bVisible ) pFrame->mnShowState = SW_SHOWNORMAL; pFrame->mbRestoreMaximize = false; @@ -916,14 +911,14 @@ { const std::vector& rMonitors = pSys->getMonitors(); - Point aPoint(maGeometry.pos()); + Point aPoint( maGeometry.nX, maGeometry.nY ); size_t nMon = rMonitors.size(); for( size_t i = 0; i < nMon; i++ ) { if( rMonitors[i].m_aArea.Contains( aPoint ) ) { mnDisplay = static_cast(i); - maGeometry.setScreen(static_cast(i)); + maGeometry.nDisplayScreenNumber = static_cast(i); } } } @@ -1316,8 +1311,8 @@ // #i42485#: parent will be shown maximized in which case // a ClientToScreen uses the wrong coordinates (i.e. those from the restore pos) // so use the (already updated) frame geometry for the transformation - aPt.x += pParentFrame->maGeometry.x(); - aPt.y += pParentFrame->maGeometry.y(); + aPt.x += pParentFrame->maGeometry.nX; + aPt.y += pParentFrame->maGeometry.nY; } else ClientToScreen( parentHwnd, &aPt ); @@ -1592,11 +1587,11 @@ void WinSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) { - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; } -void WinSalFrame::SetWindowState(const vcl::WindowData* pState) +void WinSalFrame::SetWindowState( const SalFrameState* pState ) { // Check if the window fits into the screen, in case the screen // resolution changed @@ -1632,24 +1627,24 @@ tools::Long nRightDeco = abs( aWinRect.right - aRect2.right ); // adjust window position/size to fit the screen - if ( !(pState->mask() & vcl::WindowDataMask::Pos) ) + if ( !(pState->mnMask & (WindowStateMask::X | WindowStateMask::Y)) ) nPosSize |= SWP_NOMOVE; - if ( !(pState->mask() & vcl::WindowDataMask::Size) ) + if ( !(pState->mnMask & (WindowStateMask::Width | WindowStateMask::Height)) ) nPosSize |= SWP_NOSIZE; - if ( pState->mask() & vcl::WindowDataMask::X ) - nX = static_cast(pState->x()) - nLeftDeco; + if ( pState->mnMask & WindowStateMask::X ) + nX = static_cast(pState->mnX) - nLeftDeco; else nX = aWinRect.left; - if ( pState->mask() & vcl::WindowDataMask::Y ) - nY = static_cast(pState->y()) - nTopDeco; + if ( pState->mnMask & WindowStateMask::Y ) + nY = static_cast(pState->mnY) - nTopDeco; else nY = aWinRect.top; - if ( pState->mask() & vcl::WindowDataMask::Width ) - nWidth = static_cast(pState->width()) + nLeftDeco + nRightDeco; + if ( pState->mnMask & WindowStateMask::Width ) + nWidth = static_cast(pState->mnWidth) + nLeftDeco + nRightDeco; else nWidth = aWinRect.right-aWinRect.left; - if ( pState->mask() & vcl::WindowDataMask::Height ) - nHeight = static_cast(pState->height()) + nTopDeco + nBottomDeco; + if ( pState->mnMask & WindowStateMask::Height ) + nHeight = static_cast(pState->mnHeight) + nTopDeco + nBottomDeco; else nHeight = aWinRect.bottom-aWinRect.top; @@ -1683,33 +1678,33 @@ if ( mbOverwriteState ) { - if ( pState->mask() & vcl::WindowDataMask::State ) + if ( pState->mnMask & WindowStateMask::State ) { - if ( pState->state() & vcl::WindowState::Minimized ) + if ( pState->mnState & WindowStateState::Minimized ) mnShowState = SW_SHOWMINIMIZED; - else if ( pState->state() & vcl::WindowState::Maximized ) + else if ( pState->mnState & WindowStateState::Maximized ) { mnShowState = SW_SHOWMAXIMIZED; bUpdateHiddenFramePos = true; } - else if ( pState->state() & vcl::WindowState::Normal ) + else if ( pState->mnState & WindowStateState::Normal ) mnShowState = SW_SHOWNORMAL; } } } else { - if ( pState->mask() & vcl::WindowDataMask::State ) + if ( pState->mnMask & WindowStateMask::State ) { - if ( pState->state() & vcl::WindowState::Minimized ) + if ( pState->mnState & WindowStateState::Minimized ) { - if ( pState->state() & vcl::WindowState::Maximized ) + if ( pState->mnState & WindowStateState::Maximized ) aPlacement.flags |= WPF_RESTORETOMAXIMIZED; aPlacement.showCmd = SW_SHOWMINIMIZED; } - else if ( pState->state() & vcl::WindowState::Maximized ) + else if ( pState->mnState & WindowStateState::Maximized ) aPlacement.showCmd = SW_SHOWMAXIMIZED; - else if ( pState->state() & vcl::WindowState::Normal ) + else if ( pState->mnState & WindowStateState::Normal ) aPlacement.showCmd = SW_RESTORE; } } @@ -1731,7 +1726,7 @@ // the window will not be maximized (and the size updated) before show() SetMaximizedFrameGeometry( mhWnd, this, &aStateRect ); SetWindowPos( mhWnd, nullptr, - maGeometry.x(), maGeometry.y(), maGeometry.width(), maGeometry.height(), + maGeometry.nX, maGeometry.nY, maGeometry.nWidth, maGeometry.nHeight, SWP_NOZORDER | SWP_NOACTIVATE | nPosSize ); } else @@ -1755,15 +1750,16 @@ mbDefPos = false; // window was positioned } -bool WinSalFrame::GetWindowState(vcl::WindowData* pState) +bool WinSalFrame::GetWindowState( SalFrameState* pState ) { - if (maState.width() && maState.height()) + if ( maState.mnWidth && maState.mnHeight ) { *pState = maState; // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - Don't save minimize - if ( !(pState->state() & (vcl::WindowState::Minimized | vcl::WindowState::Maximized)) ) - pState->rState() |= vcl::WindowState::Normal; + //if ( !(pState->mnState & WindowStateState::Maximized) ) + if ( !(pState->mnState & (WindowStateState::Minimized | WindowStateState::Maximized)) ) + pState->mnState |= WindowStateState::Normal; return true; } @@ -1781,7 +1777,7 @@ if( nNewScreen < nMon ) { Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); - Point aCurPos(maGeometry.pos()); + Point aCurPos( maGeometry.nX, maGeometry.nY ); for( size_t i = 0; i < nMon; i++ ) { if( rMonitors[i].m_aArea.Contains( aCurPos ) ) @@ -1791,9 +1787,9 @@ } } mnDisplay = nNewScreen; - maGeometry.setScreen(nNewScreen); - SetPosSize( aNewMonPos.X() + (maGeometry.x() - aOldMonPos.X()), - aNewMonPos.Y() + (maGeometry.y() - aOldMonPos.Y()), + maGeometry.nDisplayScreenNumber = nNewScreen; + SetPosSize( aNewMonPos.X() + (maGeometry.nX - aOldMonPos.X()), + aNewMonPos.Y() + (maGeometry.nY - aOldMonPos.Y()), 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); } @@ -2924,7 +2920,7 @@ POINT pt; GetCursorPos( &pt ); - aState.maPos = Point(pt.x - maGeometry.x(), pt.y - maGeometry.y()); + aState.maPos = Point( pt.x - maGeometry.nX, pt.y - maGeometry.nY ); return aState; } @@ -3227,7 +3223,7 @@ UpdateWindow( hWnd ); if( AllSettings::GetLayoutRTL() ) - aMouseEvt.mnX = pFrame->maGeometry.width() - 1 - aMouseEvt.mnX; + aMouseEvt.mnX = pFrame->maGeometry.nWidth-1-aMouseEvt.mnX; nRet = pFrame->CallCallback( nEvent, &aMouseEvt ); if ( nMsg == WM_MOUSEMOVE ) @@ -3310,7 +3306,7 @@ aWheelEvt.mnCode |= KEY_MOD2; if( AllSettings::GetLayoutRTL() ) - aWheelEvt.mnX = pFrame->maGeometry.width() - 1 - aWheelEvt.mnX; + aWheelEvt.mnX = pFrame->maGeometry.nWidth-1-aWheelEvt.mnX; nRet = pFrame->CallCallback( SalEvent::WheelMouse, &aWheelEvt ); } @@ -3940,11 +3936,14 @@ ImplSalGetWorkArea( hWnd, &aRect, pParentRect ); // a maximized window has no other borders than the caption - pFrame->maGeometry.setDecorations(0, pFrame->mbCaption ? GetSystemMetrics(SM_CYCAPTION) : 0, 0, 0); + pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; + pFrame->maGeometry.nTopDecoration = pFrame->mbCaption ? GetSystemMetrics( SM_CYCAPTION ) : 0; - aRect.top += pFrame->maGeometry.topDecoration(); - pFrame->maGeometry.setPos({ aRect.left, aRect.top }); - SetGeometrySize(pFrame->maGeometry, { aRect.right - aRect.left, aRect.bottom - aRect.top }); + aRect.top += pFrame->maGeometry.nTopDecoration; + pFrame->maGeometry.nX = aRect.left; + pFrame->maGeometry.nY = aRect.top; + pFrame->maGeometry.nWidth = aRect.right - aRect.left; + pFrame->maGeometry.nHeight = aRect.bottom - aRect.top; } static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame ) @@ -3954,9 +3953,15 @@ RECT aRect; GetWindowRect( hWnd, &aRect ); - pFrame->maGeometry.setPosSize({ 0, 0 }, { 0, 0 }); - pFrame->maGeometry.setDecorations(0, 0, 0, 0); - pFrame->maGeometry.setScreen(0); + pFrame->maGeometry.nX = 0; + pFrame->maGeometry.nY = 0; + pFrame->maGeometry.nWidth = 0; + pFrame->maGeometry.nHeight = 0; + pFrame->maGeometry.nLeftDecoration = 0; + pFrame->maGeometry.nTopDecoration = 0; + pFrame->maGeometry.nRightDecoration = 0; + pFrame->maGeometry.nBottomDecoration = 0; + pFrame->maGeometry.nDisplayScreenNumber = 0; if ( IsIconic( hWnd ) ) return; @@ -3966,9 +3971,13 @@ aPt.y=0; ClientToScreen(hWnd, &aPt); int cx = aPt.x - aRect.left; + pFrame->maGeometry.nTopDecoration = aPt.y - aRect.top; - pFrame->maGeometry.setDecorations(cx, aPt.y - aRect.top, cx, 0); - pFrame->maGeometry.setPos({ aPt.x, aPt.y }); + pFrame->maGeometry.nLeftDecoration = cx; + pFrame->maGeometry.nRightDecoration = cx; + + pFrame->maGeometry.nX = aPt.x; + pFrame->maGeometry.nY = aPt.y; RECT aInnerRect; GetClientRect( hWnd, &aInnerRect ); @@ -3978,19 +3987,21 @@ aPt.x=aInnerRect.right; aPt.y=aInnerRect.top; ClientToScreen(hWnd, &aPt); - pFrame->maGeometry.setRightDecoration(aRect.right - aPt.x); + pFrame->maGeometry.nRightDecoration = aRect.right - aPt.x; } if( aInnerRect.bottom ) // may be zero if window was not shown yet - pFrame->maGeometry.setBottomDecoration(aRect.bottom - aPt.y - aInnerRect.bottom); + pFrame->maGeometry.nBottomDecoration += aRect.bottom - aPt.y - aInnerRect.bottom; else // bottom border is typically the same as left/right - pFrame->maGeometry.setBottomDecoration(pFrame->maGeometry.leftDecoration()); + pFrame->maGeometry.nBottomDecoration = pFrame->maGeometry.nLeftDecoration; int nWidth = aRect.right - aRect.left - - pFrame->maGeometry.rightDecoration() - pFrame->maGeometry.leftDecoration(); + - pFrame->maGeometry.nRightDecoration - pFrame->maGeometry.nLeftDecoration; int nHeight = aRect.bottom - aRect.top - - pFrame->maGeometry.bottomDecoration() - pFrame->maGeometry.topDecoration(); - SetGeometrySize(pFrame->maGeometry, { nWidth, nHeight }); + - pFrame->maGeometry.nBottomDecoration - pFrame->maGeometry.nTopDecoration; + // clamp to zero + pFrame->maGeometry.nHeight = nHeight < 0 ? 0 : nHeight; + pFrame->maGeometry.nWidth = nWidth < 0 ? 0 : nWidth; pFrame->updateScreenNumber(); }