compilerplugins/clang/unusedenumconstants.untouched.results | 4 compilerplugins/clang/unusedenumconstants.writeonly.results | 2 fpicker/source/office/RemoteFilesDialog.cxx | 2 fpicker/source/office/iodlg.cxx | 2 framework/source/helper/persistentwindowstate.cxx | 2 include/tools/gen.hxx | 8 include/vcl/WindowPosSize.hxx | 137 ---- include/vcl/syswin.hxx | 6 include/vcl/vclenum.hxx | 39 + include/vcl/weld.hxx | 3 include/vcl/windowstate.hxx | 98 --- include/vcl/wrkwin.hxx | 2 reportdesign/source/ui/dlg/Formula.cxx | 2 reportdesign/source/ui/report/DesignView.cxx | 4 reportdesign/source/ui/report/ReportController.cxx | 2 sc/source/ui/condformat/condformatmgr.cxx | 2 sfx2/source/appl/childwin.cxx | 8 sfx2/source/dialog/basedlgs.cxx | 4 sfx2/source/dialog/recfloat.cxx | 9 solenv/clang-format/excludelist | 1 sw/source/ui/misc/bookmark.cxx | 3 sw/source/uibase/envelp/syncbtn.cxx | 9 vcl/headless/svpframe.cxx | 76 +- vcl/inc/headless/svpframe.hxx | 4 vcl/inc/osx/salframe.h | 4 vcl/inc/qt5/QtFrame.hxx | 4 vcl/inc/salframe.hxx | 12 vcl/inc/salgeom.hxx | 101 --- vcl/inc/salvtables.hxx | 2 vcl/inc/salwtype.hxx | 21 vcl/inc/unx/gtk/gtkframe.hxx | 6 vcl/inc/unx/salframe.h | 4 vcl/inc/win/salframe.h | 8 vcl/inc/window.h | 4 vcl/osx/salframe.cxx | 183 +++-- vcl/osx/salframeview.mm | 34 - vcl/osx/salgdiutils.cxx | 4 vcl/osx/salmenu.cxx | 8 vcl/osx/salnativewidgets.cxx | 4 vcl/qt5/QtFrame.cxx | 92 +- vcl/qt5/QtMainWindow.cxx | 3 vcl/qt5/QtWidget.cxx | 7 vcl/quartz/AquaGraphicsBackend.cxx | 2 vcl/source/app/salvtables.cxx | 2 vcl/source/gdi/salgdilayout.cxx | 4 vcl/source/window/dockwin.cxx | 22 vcl/source/window/event.cxx | 4 vcl/source/window/menu.cxx | 2 vcl/source/window/printdlg.cxx | 2 vcl/source/window/syswin.cxx | 337 +++++----- vcl/source/window/window.cxx | 46 - vcl/source/window/winproc.cxx | 4 vcl/source/window/wrkwin.cxx | 31 vcl/unx/generic/app/wmadaptor.cxx | 87 +- vcl/unx/generic/gdi/gdiimpl.cxx | 4 vcl/unx/generic/window/salframe.cxx | 378 ++++++------ vcl/unx/gtk3/gtkframe.cxx | 204 +++--- vcl/unx/gtk3/gtkinst.cxx | 57 + vcl/unx/gtk3/gtksalmenu.cxx | 4 vcl/win/gdi/gdiimpl.cxx | 4 vcl/win/window/salframe.cxx | 145 ++-- 61 files changed, 1129 insertions(+), 1140 deletions(-)
New commits: commit 1c0f44cbacb4bcefcf383586e7ccd32d47388fa4 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Sep 14 07:53:33 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Sep 14 10:09:32 2022 +0200 tdf#150779 tdf#150856 Revert "VCL add vcl::WindowPosSize ... ... abstract class" for 7-4 According to the commit message, this was mostly meant to be a refactoring, but it caused issues like tdf#150856 ("Opening Forms: Form is minimized in middle of the screen with Linux/KDE") and tdf#150779 ("kf5 - Opening LO only shows left pane of start screen, no recent documents visible (LO 7.4 only)"). The issues are fixed on master, but that can't be easily backported to 7-4 (s. tdf#150779 comment 8), so revert this commit on the 7-4 branch only. From all I can see, the only commit on this branch making use of something introduced in the reverted commit was commit f777a25f32b3c98a45cf1a24e130a5cce153f5d0 Date: Wed Jun 15 12:07:31 2022 +0200 Related tdf#101285 - Remember position of conditional format dialog which was using `vcl::WindowDataMask::Pos`. Since the revert undoes the renaming from `WindowStateState` to `WindowState`, just switch that one to use the old name for the flag, `WindowStateMask::Pos`. This reverts commit ea5a0918c8c32309821ab239c4b95f4d6a3b5c12. Change-Id: Ie62b06e9488a7a2c4f27ce35ef0a9374d1f41b7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139903 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results b/compilerplugins/clang/unusedenumconstants.untouched.results index 1f639cf2a666..58b8091b96f6 100644 --- a/compilerplugins/clang/unusedenumconstants.untouched.results +++ b/compilerplugins/clang/unusedenumconstants.untouched.results @@ -139,9 +139,9 @@ include/vcl/toolkit/treelistbox.hxx:150 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 0d2f68303c8a..07c5ebb31982 100644 --- a/compilerplugins/clang/unusedenumconstants.writeonly.results +++ b/compilerplugins/clang/unusedenumconstants.writeonly.results @@ -3047,7 +3047,7 @@ include/vcl/vclenum.hxx:134 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 adaf756d3d8e..4536690f9154 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -124,7 +124,7 @@ RemoteFilesDialog::~RemoteFilesDialog() 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 80fd8614aae6..a7addbb10121 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -467,7 +467,7 @@ SvtFileDialog::~SvtFileDialog() { // 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 103a4bda7b57..2f7c9971935b 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -215,7 +215,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno:: // 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<SystemWindow*>(pWindow.get())->GetWindowState(nMask), RTL_TEXTENCODING_UTF8); diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 7a8e66e2a6ff..20da07cb99af 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -481,13 +481,6 @@ inline std::basic_ostream<charT, traits> & operator <<( /// 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 @@ public: 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 ed52488be33a..000000000000 --- 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 <vcl/dllapi.h> -#include <o3tl/typed_flags_set.hxx> -#include <rtl/string.hxx> -#include <sal/types.h> -#include <tools/gen.hxx> - -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<tools::Long>(m_nWidth), static_cast<tools::Long>(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 e2faf1337e62..24f41331eb21 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -139,7 +139,7 @@ protected: explicit SystemWindow(WindowType nType, const char* pIdleDebugName); void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); - void SetWindowState(const vcl::WindowData& rData); + void SetWindowStateData( const WindowStateData& rData ); virtual void settingOptimalLayoutSize(Window *pBox); @@ -177,7 +177,7 @@ public: 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 @@ public: VclPtr<NotebookBar> 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 9f1a3c8f6b08..6e0359fa2699 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -118,6 +118,27 @@ namespace o3tl template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x3033> {}; } +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<WindowStateMask> : is_typed_flags<WindowStateMask, 0x0f3f> {}; +} + enum class TimeFormat { Hour12, Hour24 @@ -278,6 +299,24 @@ enum class ToolBoxButtonSize 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<WindowStateState> : is_typed_flags<WindowStateState, 0xffff> {}; +} + 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 bf1952507770..34f22ac57af4 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -22,7 +22,6 @@ #include <vcl/font.hxx> #include <vcl/vclptr.hxx> #include <vcl/uitest/factory.hxx> -#include <vcl/windowstate.hxx> #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> @@ -544,7 +543,7 @@ public: 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<css::awt::XWindow> GetXWindow() = 0; diff --git a/include/vcl/windowstate.hxx b/include/vcl/windowstate.hxx index b78162ddf52e..dcf0f4e9a394 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 <vcl/WindowPosSize.hxx> +#include <vcl/dllapi.h> +#include <vcl/vclenum.hxx> +#include <rtl/string.hxx> -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 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 SetMask(WindowStateMask nValidMask) { mnValidMask = nValidMask; } + WindowStateMask GetMask() const { return mnValidMask; } + 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 @@ public: 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<vcl::WindowState> : is_typed_flags<vcl::WindowState, 0xffff> -{ -}; -template <> struct typed_flags<vcl::WindowDataMask> : is_typed_flags<vcl::WindowDataMask, 0x0f3f> -{ + OString ToStr() const; }; -} #endif // INCLUDED_VCL_WINDOWSTATE_HXX diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx index 615696f94620..dfc6cc1b3fd0 100644 --- a/include/vcl/wrkwin.hxx +++ b/include/vcl/wrkwin.hxx @@ -60,7 +60,7 @@ private: 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 a0b866031631..f2b95e0df1b7 100644 --- a/reportdesign/source/ui/dlg/Formula.cxx +++ b/reportdesign/source/ui/dlg/Formula.cxx @@ -87,7 +87,7 @@ FormulaDialog::~FormulaDialog() 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 b34c8c944fd8..ab213479b9f6 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -136,7 +136,7 @@ void ODesignView::dispose() 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 @@ void ODesignView::dispose() 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 7c588a99791c..7f20a0040c6e 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -294,7 +294,7 @@ void OReportController::disposing() 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 d4a2980a6dfa..79f41bf5c0b5 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -112,7 +112,7 @@ ScCondFormatManagerDlg::~ScCondFormatManagerDlg() // 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 0887e5106137..1740459e7aea 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -310,9 +310,9 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const 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 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const 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<SystemWindow*>(pWindow.get())->GetWindowState( nMask ); } else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get())) diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index ab976093025a..0604f035bcd9 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -173,9 +173,9 @@ void SfxModelessDialogController::ChildWinDispose() { 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 1b674f602b71..1dcbb2f7c416 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -56,10 +56,11 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl(vcl::Window* pParen 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 35257873b649..7f6eb2eeb36b 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14424,6 +14424,7 @@ vcl/inc/salbmp.hxx 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 473c6a99b49f..a25e85164433 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -362,7 +362,8 @@ SwInsertBookmarkDlg::~SwInsertBookmarkDlg() { // 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 0b61ff8a6c72..009525d02ce5 100644 --- a/sw/source/uibase/envelp/syncbtn.cxx +++ b/sw/source/uibase/envelp/syncbtn.cxx @@ -53,10 +53,11 @@ SwSyncChildWin::SwSyncChildWin(vcl::Window* _pParent, 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 62b43dfd0824..c6c8a08e29c0 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -143,7 +143,7 @@ void SvpSalFrame::LoseFocus() 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 @@ void SvpSalFrame::PostPaint() const { 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::SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) 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::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth 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 @@ SalFrame* SvpSalFrame::GetParent() const 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 f2fce5c420b4..84dca0c84cdc 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -90,8 +90,8 @@ public: 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 953a17adbcc9..47f8e62981b8 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -126,8 +126,8 @@ public: 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 dcdca17844ae..2d7c5718d6cf 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -182,8 +182,8 @@ public: 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 b7dcea63e64f..1c5cbbbcd0ee 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -35,7 +35,7 @@ class SalGraphics; class SalBitmap; class SalMenu; -namespace vcl { class WindowData; } +struct SalFrameState; struct SalInputContext; struct SystemEnvData; @@ -126,11 +126,11 @@ public: 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 @@ public: 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 63675b6d9ceb..0bc7335c2977 100644 --- a/vcl/inc/salgeom.hxx +++ b/vcl/inc/salgeom.hxx @@ -23,91 +23,44 @@ #include <iostream> #include <vcl/dllapi.h> -#include <vcl/WindowPosSize.hxx> #include <tools/long.hxx> -// 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; - -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() }; } +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; - // 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<const vcl::WindowPosSize*>(&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 4fab7dfe2bb9..d5605bf942bf 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -480,7 +480,7 @@ public: 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 41e4e04e9a50..c9f50cd63982 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -31,13 +31,10 @@ class LogicalFontInstance; 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 @@ enum class SalObjEvent { 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<LogicalFontInstance> mpFont; diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 2adacd1ee5ba..91a9470a071e 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -443,7 +443,7 @@ public: 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 @@ public: 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 7b804b0cc089..1107ac9feb71 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -222,8 +222,8 @@ public: 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 c37fb5b98915..e3d8b685a229 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -25,12 +25,12 @@ #include <string_view> #include <vcl/sysdata.hxx> -#include <vcl/windowstate.hxx> #include <salframe.hxx> #include <svsys.h> class WinSalGraphics; + class WinSalFrame final: public SalFrame { public: @@ -43,7 +43,7 @@ public: 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 @@ public: 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 18e1a3e1e417..b0395330e19e 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -45,7 +45,7 @@ class VirtualDevice; 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 @@ bool ImplLOKHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEve 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<css::accessibility::XAccessibleEditableText> FindFocusedEditableText(css::uno::Reference<css::accessibility::XAccessibleContext> const&); diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index e90b7edbf258..a5356fcf19be 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -110,7 +110,7 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, SalFrameStyleFlags salFrameStyle AquaSalFrame::~AquaSalFrame() { if (mbFullScreen) - doShowFullScreen(false, maGeometry.screen()); + doShowFullScreen(false, maGeometry.nDisplayScreenNumber); assert( GetSalData()->mpInstance->IsMainThread() ); @@ -168,10 +168,10 @@ void AquaSalFrame::initWindowAndView() NSRect aVisibleRect = [pNSScreen visibleFrame]; CocoaToVCL( aVisibleRect ); - maGeometry.setX(static_cast<sal_Int32>(aVisibleRect.origin.x + aVisibleRect.size.width / 10)); - maGeometry.setY(static_cast<sal_Int32>(aVisibleRect.origin.y + aVisibleRect.size.height / 10)); - maGeometry.setWidth(static_cast<sal_uInt32>(aVisibleRect.size.width * 0.8)); - maGeometry.setHeight(static_cast<sal_uInt32>(aVisibleRect.size.height * 0.8)); + maGeometry.nX = static_cast<int>(aVisibleRect.origin.x + aVisibleRect.size.width / 10); + maGeometry.nY = static_cast<int>(aVisibleRect.origin.y + aVisibleRect.size.height / 10); + maGeometry.nWidth = static_cast<unsigned int>(aVisibleRect.size.width * 0.8); + maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8); // calculate style mask if( (mnStyle & SalFrameStyleFlags::FLOAT) || @@ -184,10 +184,10 @@ void AquaSalFrame::initWindowAndView() NSWindowStyleMaskResizable | NSWindowStyleMaskClosable; // make default window "maximized" - maGeometry.setX(static_cast<sal_Int32>(aVisibleRect.origin.x)); - maGeometry.setY(static_cast<sal_Int32>(aVisibleRect.origin.y)); - maGeometry.setWidth(static_cast<sal_uInt32>(aVisibleRect.size.width)); - maGeometry.setHeight(static_cast<sal_uInt32>(aVisibleRect.size.height)); + maGeometry.nX = static_cast<int>(aVisibleRect.origin.x); + maGeometry.nY = static_cast<int>(aVisibleRect.origin.y); + maGeometry.nWidth = static_cast<int>(aVisibleRect.size.width); + maGeometry.nHeight = static_cast<int>(aVisibleRect.size.height); mbPositioned = mbSized = true; } else @@ -231,7 +231,7 @@ void AquaSalFrame::initWindowAndView() [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(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 @@ void AquaSalFrame::CocoaToVCL( NSRect& io_rRect, bool bRelativeToScreen ) 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 @@ void AquaSalFrame::VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen ) 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 @@ void AquaSalFrame::CocoaToVCL( NSPoint& io_rPoint, bool bRelativeToScreen ) 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 @@ void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen ) 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 @@ void AquaSalFrame::initShow() if( mpParent ) // center relative to parent { // center on parent - tools::Long nNewX = mpParent->maGeometry.x() + (static_cast<tools::Long>(mpParent->maGeometry.width()) - static_cast<tools::Long>(maGeometry.width())) / 2; + tools::Long nNewX = mpParent->maGeometry.nX + (static_cast<tools::Long>(mpParent->maGeometry.nWidth) - static_cast<tools::Long>(maGeometry.nWidth))/2; if( nNewX < aScreenRect.Left() ) nNewX = aScreenRect.Left(); - if (static_cast<tools::Long>(nNewX + maGeometry.width()) > aScreenRect.Right()) - nNewX = aScreenRect.Right() - maGeometry.width() - 1; - tools::Long nNewY = mpParent->maGeometry.y() + (static_cast<tools::Long>(mpParent->maGeometry.height()) - static_cast<tools::Long>(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<tools::Long>(mpParent->maGeometry.nHeight) - static_cast<tools::Long>(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 @@ void AquaSalFrame::SendPaintEvent( const tools::Rectangle* pRect ) { 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 @@ void AquaSalFrame::SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) { // 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<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) }; @@ -529,8 +529,8 @@ void AquaSalFrame::SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) { // 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 @@ void AquaSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) { if (mbShown || mbInitShow || Application::IsBitmapRendering()) { - rWidth = maGeometry.width(); - rHeight = maGeometry.height(); + rWidth = maGeometry.nWidth; + rHeight = maGeometry.nHeight; } else { @@ -578,24 +578,24 @@ SalEvent AquaSalFrame::PreparePosSize(tools::Long nX, tools::Long nY, tools::Lon 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 @@ SalEvent AquaSalFrame::PreparePosSize(tools::Long nX, tools::Long nY, tools::Lon return nEvent; } -void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) +void AquaSalFrame::SetWindowState( const SalFrameState* pState ) { if (!mpNSWindow && !Application::IsBitmapRendering()) return; @@ -612,12 +612,12 @@ void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) 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 @@ void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) 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 @@ void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) 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 @@ void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) } } -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 @@ bool AquaSalFrame::GetWindowState(vcl::WindowData* pState) 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<sal_Int32>(aStateRect.origin.x)); - pState->setY(static_cast<sal_Int32>(aStateRect.origin.y)); - pState->setWidth(static_cast<sal_uInt32>(aStateRect.size.width)); - pState->setHeight(static_cast<sal_uInt32>(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 @@ void AquaSalFrame::SetPointerPos( tools::Long nX, tools::Long nY ) // FIXME: use Cocoa functions // FIXME: multiscreen support - CGPoint aPoint = { static_cast<CGFloat>(nX + maGeometry.x()), static_cast<CGFloat>(nY + maGeometry.y()) }; + CGPoint aPoint = { static_cast<CGFloat>(nX + maGeometry.nX), static_cast<CGFloat>(nY + maGeometry.nY) }; CGDirectDisplayID mainDisplayID = CGMainDisplayID(); CGDisplayMoveCursorToPoint( mainDisplayID, aPoint ); } @@ -1383,9 +1392,9 @@ void AquaSalFrame::SetPosSize( if( AllSettings::GetLayoutRTL() ) { if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 ) - nX = static_cast<tools::Long>(mpParent->maGeometry.width()) - nWidth - 1 - nX; + nX = mpParent->maGeometry.nWidth - nWidth-1 - nX; else - nX = static_cast<tools::Long>(mpParent->maGeometry.width()) - aContentRect.size.width - 1 - nX; + nX = mpParent->maGeometry.nWidth - static_cast<tools::Long>( aContentRect.size.width-1) - nX; } NSRect aParentFrameRect = [mpParent->mpNSWindow frame]; aParentContentRect = [NSWindow contentRectForFrameRect: aParentFrameRect styleMask: mpParent->mnStyleMask]; @@ -1660,10 +1669,10 @@ void AquaSalFrame::UpdateFrameGeometry() 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 @@ void AquaSalFrame::UpdateFrameGeometry() maContentRect = aContentRect; maFrameRect = aFrameRect; - maGeometry.setX(static_cast<sal_Int32>(aContentRect.origin.x)); - maGeometry.setY(static_cast<sal_Int32>(aContentRect.origin.y)); - maGeometry.setWidth(static_cast<sal_uInt32>(aContentRect.size.width)); - maGeometry.setHeight(static_cast<sal_uInt32>(aContentRect.size.height)); - - maGeometry.setLeftDecoration(static_cast<sal_uInt32>(aContentRect.origin.x - aFrameRect.origin.x)); - maGeometry.setRightDecoration(static_cast<sal_uInt32>((aFrameRect.origin.x + aFrameRect.size.width) - - (aContentRect.origin.x + aContentRect.size.width))); - maGeometry.setTopDecoration(static_cast<sal_uInt32>(aContentRect.origin.y - aFrameRect.origin.y)); - maGeometry.setBottomDecoration(static_cast<sal_uInt32>((aFrameRect.origin.y + aFrameRect.size.height) - - (aContentRect.origin.y + aContentRect.size.height))); + maGeometry.nX = static_cast<int>(aContentRect.origin.x); + maGeometry.nY = static_cast<int>(aContentRect.origin.y); + + maGeometry.nLeftDecoration = static_cast<unsigned int>(aContentRect.origin.x - aFrameRect.origin.x); + maGeometry.nRightDecoration = static_cast<unsigned int>((aFrameRect.origin.x + aFrameRect.size.width) - + (aContentRect.origin.x + aContentRect.size.width)); + + maGeometry.nTopDecoration = static_cast<unsigned int>(aContentRect.origin.y - aFrameRect.origin.y); + maGeometry.nBottomDecoration = static_cast<unsigned int>((aFrameRect.origin.y + aFrameRect.size.height) - + (aContentRect.origin.y + aContentRect.size.height)); + + maGeometry.nWidth = static_cast<unsigned int>(aContentRect.size.width); + maGeometry.nHeight = static_cast<unsigned int>(aContentRect.size.height); } } diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index df2c55abf97a..ee245af64820 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -166,8 +166,8 @@ static AquaSalFrame* getMouseContainerFrame() { mDraggingDestinationHandler = nil; mpFrame = pFrame; - NSRect aRect = { { static_cast<CGFloat>(pFrame->maGeometry.x()), static_cast<CGFloat>(pFrame->maGeometry.y()) }, - { static_cast<CGFloat>(pFrame->maGeometry.width()), static_cast<CGFloat>(pFrame->maGeometry.height()) } }; + NSRect aRect = { { static_cast<CGFloat>(pFrame->maGeometry.nX), static_cast<CGFloat>(pFrame->maGeometry.nY) }, + { static_cast<CGFloat>(pFrame->maGeometry.nWidth), static_cast<CGFloat>(pFrame->maGeometry.nHeight) } }; pFrame->VCLToCocoa( aRect ); NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() @@ -473,7 +473,7 @@ static AquaSalFrame* getMouseContainerFrame() 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 @@ static AquaSalFrame* getMouseContainerFrame() SalMouseEvent aEvent; aEvent.mnTime = pDispatchFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - pDispatchFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->maGeometry.nX; + aEvent.mnY = static_cast<tools::Long>(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 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<tools::Long>(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 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<tools::Long>(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 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast<tools::Long>(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 @@ static AquaSalFrame* getMouseContainerFrame() 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 603a8b612d42..7b088864d111 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -148,8 +148,8 @@ bool AquaSharedAttributes::checkContext() { 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 c35e7487f0f6..ab6263cc84a7 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -302,8 +302,8 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectan // 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 @@ SAL_WNODEPRECATED_DECLARATIONS_POP // make coordinates relative to reference frame static_cast<AquaSalFrame*>(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<tools::Long>(aRect.origin.x), static_cast<tools::Long>(aRect.origin.y) diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 3cd368b92a81..328cf9c94eca 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -866,11 +866,11 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, // 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 ec28689199e7..3c63060855ab 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -544,7 +544,7 @@ Size QtFrame::CalcDefaultSize() { if (!m_bFullScreenSpanAll) { - aSize = toSize(QGuiApplication::screens().at(maGeometry.screen())->size()); + aSize = toSize(QGuiApplication::screens().at(maGeometry.nDisplayScreenNumber)->size()); } else { @@ -584,9 +584,9 @@ void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, too 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 @@ void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, too // 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 @@ void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, too { 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 @@ void QtFrame::SetModal(bool bModal) 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 @@ void QtFrame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen) 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 @@ bool QtFrame::ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpAr { 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 @@ SalFrame::SalPointerState QtFrame::GetPointerState() { 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 @@ void QtFrame::SetScreenNumber(unsigned int nScreen) nScreen = static_cast<sal_uInt32>(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 5ff9ac9a8116..1e6ebc81a7be 100644 --- a/vcl/qt5/QtMainWindow.cxx +++ b/vcl/qt5/QtMainWindow.cxx @@ -41,6 +41,7 @@ void QtMainWindow::closeEvent(QCloseEvent* pEvent) 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 5c6fc002ac22..b2451123e7e6 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -93,7 +93,8 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent) 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 @@ void QtWidget::moveEvent(QMoveEvent* pEvent) 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 71b50037c02b..383fdc0f7fd0 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -267,7 +267,7 @@ tools::Long AquaGraphicsBackend::GetGraphicsWidth() const { 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 e43481b50ea8..2c998bd6d0a2 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1621,7 +1621,7 @@ void SalInstanceWindow::set_window_state(const OString& rStr) pSysWin->SetWindowState(rStr); } -OString SalInstanceWindow::get_window_state(vcl::WindowDataMask nMask) const +OString SalInstanceWindow::get_window_state(WindowStateMask nMask) const { SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(m_xWindow.get()); assert(pSysWin); diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 003e7f4d4c02..623afed8c1c6 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -43,8 +43,8 @@ SalFrameGeometry SalFrame::GetGeometry() const 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 471757f6a861..fb216913b803 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -835,10 +835,8 @@ void DockingWindow::setPosSizePixel( tools::Long nX, tools::Long nY, 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 @@ Point DockingWindow::GetFloatingPos() const { 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 @@ Point DockingWindow::GetFloatingPos() const 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 4b4623e8761a..4b94b70bc11c 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -546,11 +546,11 @@ void Window::ImplCallMove() } 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 5fb4c2ca81df..89bd5672088b 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1559,7 +1559,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // 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 b2b3cf67a46d..9944541fb91e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -769,7 +769,7 @@ void PrintDialog::storeToSettings() 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 fa053499d623..40fff00aa7d9 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -399,157 +399,156 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const 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); ... etc. - the rest is truncated