mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-05-01 21:10:10 +02:00
Merge pull request #2878 from emersonrp/flatmenu_multimon
ci-build / build-source-dist (push) Has been cancelled
ci-build / Build wxPython documentation (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.10) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.11) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.12) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.13) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.14) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.11) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.12) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.13) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.14) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.10) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.11) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.12) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.13) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.14) (push) Has been cancelled
ci-build / Publish Python distribution to PyPI (push) Has been cancelled
ci-build / Create GitHub Release and upload source (push) Has been cancelled
ci-build / Upload demo/docs to extras.wxpython.org (push) Has been cancelled
ci-build / Upload wheels to snapshot-builds on wxpython.org (push) Has been cancelled
ci-build / build-source-dist (push) Has been cancelled
ci-build / Build wxPython documentation (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.10) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.11) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.12) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.13) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-15, 3.14) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.11) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.12) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.13) (push) Has been cancelled
ci-build / build-wheels (arm64, windows-11-arm, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, macos-15-intel, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-24.04, 3.14) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2025, 3.14) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.10) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.11) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.12) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.13) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2025, 3.14) (push) Has been cancelled
ci-build / Publish Python distribution to PyPI (push) Has been cancelled
ci-build / Create GitHub Release and upload source (push) Has been cancelled
ci-build / Upload demo/docs to extras.wxpython.org (push) Has been cancelled
ci-build / Upload wheels to snapshot-builds on wxpython.org (push) Has been cancelled
Make FlatMenu's repositioning logic multi-monitor aware
This commit is contained in:
+13
-12
@@ -4312,8 +4312,8 @@ class FlatMenuBase(ShadowPopupWindow):
|
||||
"""
|
||||
|
||||
# Check that the menu can fully appear in the screen
|
||||
scrWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
|
||||
scrHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
|
||||
display = wx.Display(wx.Display.GetFromPoint(pos))
|
||||
displayrect = display.GetGeometry()
|
||||
|
||||
scrollBarButtons = self.GetRenderer().scrollBarButtons
|
||||
scrollBarMenuItems = not scrollBarButtons
|
||||
@@ -4326,14 +4326,14 @@ class FlatMenuBase(ShadowPopupWindow):
|
||||
self._showScrollButtons = False
|
||||
pos.y += self._popupPtOffset
|
||||
|
||||
if size.y + pos.y > scrHeight:
|
||||
if size.y + pos.y > displayrect.GetBottom():
|
||||
# the menu will be truncated
|
||||
if self._parentMenu is None:
|
||||
# try to flip the menu
|
||||
flippedPosy = pos.y - size.y
|
||||
flippedPosy -= self._popupPtOffset
|
||||
|
||||
if flippedPosy >= 0 and flippedPosy + size.y < scrHeight:
|
||||
if flippedPosy >= 0 and flippedPosy + size.y < displayrect.GetHeight():
|
||||
pos.y = flippedPosy
|
||||
return pos
|
||||
else:
|
||||
@@ -4343,19 +4343,20 @@ class FlatMenuBase(ShadowPopupWindow):
|
||||
else:
|
||||
# we are a submenu
|
||||
# try to decrease the y value of the menu position
|
||||
newy = pos.y
|
||||
newy -= (size.y + pos.y) - scrHeight
|
||||
newy = displayrect.GetBottom() - size.y
|
||||
|
||||
if newy + size.y > scrHeight:
|
||||
if newy < displayrect.GetTop():
|
||||
newy = displayrect.GetTop()
|
||||
|
||||
if size.y > displayrect.GetHeight():
|
||||
# probably the menu size is too high to fit
|
||||
# the screen, we need scrollbuttons
|
||||
self._showScrollButtons = True
|
||||
else:
|
||||
pos.y = newy
|
||||
|
||||
menuMaxX = pos.x + size.x
|
||||
# in any case show the menu at the new y position
|
||||
pos.y = newy
|
||||
|
||||
if menuMaxX > scrWidth and pos.x < scrWidth:
|
||||
if (pos.x + size.x) > displayrect.GetRight():
|
||||
|
||||
if self._parentMenu:
|
||||
|
||||
@@ -4366,7 +4367,7 @@ class FlatMenuBase(ShadowPopupWindow):
|
||||
|
||||
else:
|
||||
|
||||
self._shiftePos = ((size.x + pos.x) - scrWidth)
|
||||
self._shiftePos = ((size.x + pos.x) - displayrect.GetWidth())
|
||||
pos.x -= self._shiftePos
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user