diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-26 18:22:12 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-28 09:32:33 +0200 |
commit | a499874d9c0685d79b629b4bb246394b6b15691a (patch) | |
tree | 6a683617d953202359190bceefe70e6230b16116 /vcl/qt5/QtMenu.cxx | |
parent | b2743ac25485f0909838fae370401e21ee85950f (diff) |
tdf#160837 qt: Rely on toolkit for frame positions, drop menubar hack
Make `SalFrame::GetUnmirroredGeometry` overridable
(and let it return a copy of the SalFrameGeometry
instead of a const reference) and document that
subclasses can either make sure to keep the
`SalFrame::maGeometry` member (which is returned by
the default implementation of
`SalFrame::GetUnmirroredGeometry`) up to date or override
the latter in order to always return the current
geometry.
Override the method in `QtFrame` and fully rely on Qt
to report and set the position of the frame, via
the corresponding QWidget: Set the position, width
and height in the returned `SalFrameGeometry`
to the ones of the widget (factoring in the
scale factor).
Stop updating `maGeometry` size/position whenever
the widget position or size changes, as that is no
longer used anymore now that `GetUnmirroredGeometry`
is overriden.
This also allows to drop earlier hacks where
position calculation in some places had to be adjusted
by the height of the native menu bar, as that one
doesn't have a corresponding vcl::Window, but results
in everything else being shifted down a bit.
Using Qt directly to set other members of the
returned `SalFrameGeometry` (like the screen number)
would probably be possible, but is not included
in this change. (It can still be done separately
later.)
This makes Accerciser highlight the correct area
when using the qt6 VCL plugin and using Writer
with the standard interface (where the y position
reported via AT-SPI2 would previously always be
too small, missing the menu bar height) and thus
e.g. also allows to make use of it's "select object
under mouse" feature (s. tdf#160837).
The position via AT-SPI is however currently only
correct on X11/XWayland where global/screen coordinates
are reported via AT-SPI2.
Wayland, where window-relative coordinates are used,
still suffers from another issue that will be addressed
in a separate commit.
The highlighting in Accerciser is also still wrong
when a screen scaling factor other than 100% is set,
but that's broken for other applications (e.g. gtk3-demo)
just the same, so might be an issue in Accerciser instead.
I successfully tested that these behave as expected
when using the qt6 VCL plugin with this change in place:
* Combobox popup positions, with either 100% screen scaling
or a scaling factor of 150% or 200% on both, X11 and
Wayland.
* When enabling RTL mode via env var `SAL_RTL_ENABLED=1`,
RTL layout is used and things look OK at a quick glance.
* The following bugs (somewhat related to positioning and/or
the now dropped menu bar hacks) are still fixed, i.e. don't
reappear:
* tdf#149805 "kf5: Gap when expanding comboboxes in toolbar"
* tdf#151677 "tip on "formula bar" for "formula making" is
displaying over the formula itself."
* tdf#152217 "Black box in Basic IDE where the status bar
should be (kf5 only)"
* tdf#153458 "Connecting to database: wrong cursor position
for dropping data to Calc sheet"
* tdf#153800 "Calc sheet tab drag-and-drop target area has
shifted vertically (kf5-only)"
* tdf#154043 "Change object layer via drag and drop has target
shifted down (KF5-only)"
* tdf#154447 "Clicking a dropdown tool button shouldn't
place the context menu on top of the button (kf5)"
Unrelated to this commit, popup positioning and rendering in
in a multi-screen setup on Wayland with different scaling
factors set for the single screens is still broken (see
tdf#141578).
Change-Id: Ifa0eff271c7d3fa2b6db9bdc1669e62333bd3094
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173996
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'vcl/qt5/QtMenu.cxx')
-rw-r--r-- | vcl/qt5/QtMenu.cxx | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index 5b76706f22b3..284c45f8eee7 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -881,10 +881,8 @@ bool QtMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& r const VclPtr<vcl::Window> xParent = pWin->ImplGetWindowImpl()->mpRealParent; AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); - // tdf#154447 Menu bar height has to be added QtFrame* pFrame = static_cast<QtFrame*>(pWin->ImplGetFrame()); assert(pFrame); - aFloatRect.SetPosY(aFloatRect.getY() + pFrame->menuBarOffset()); const QRect aRect = toQRect(aFloatRect, 1 / pFrame->devicePixelRatioF()); mpQMenu->exec(aRect.bottomLeft()); |