From 33a0b0cb05c63ca3af08e168ce61a303792d67b2 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 28 Mar 2024 20:25:08 -0500 Subject: [PATCH] API: Fix horizontal placement of app menus on Windows and Linux --- spyder/api/widgets/menus.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spyder/api/widgets/menus.py b/spyder/api/widgets/menus.py index d29fb5bc5b9..61f0c1c6117 100644 --- a/spyder/api/widgets/menus.py +++ b/spyder/api/widgets/menus.py @@ -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())