Skip to content

Commit

Permalink
API: Fix horizontal placement of app menus on Windows and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Apr 6, 2024
1 parent 99f9ccd commit 33a0b0c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions spyder/api/widgets/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,17 @@ def showEvent(self, event):
self._is_shown = True

# Reposition menus horizontally due to border
if QCursor().pos().x() - self.pos().x() < 40:
# If the difference between the current cursor x position and the
# menu one is small, it means the menu will be shown to the right,
# so we need to move it in that direction.
delta_x = 1
if self.APP_MENU:
delta_x = 0 if MAC else 3
else:
# This happens when the menu is shown to the left.
delta_x = -1
if QCursor().pos().x() - self.pos().x() < 40:
# If the difference between the current cursor x position and
# the menu one is small, it means the menu will be shown to the
# right, so we need to move it in that direction.
delta_x = 1
else:
# This happens when the menu is shown to the left.
delta_x = -1

self.move(self.pos().x() + delta_x, self.pos().y())

Expand Down

0 comments on commit 33a0b0c

Please sign in to comment.