Skip to content

Commit

Permalink
fixed(bar): screen scaling logic for 4K monitor compatibility
Browse files Browse the repository at this point in the history
Temporary commented out the screen scaling logic in the Bar class to resolve positioning issues on 4K monitors. The previous implementation caused problems when determining the correct bar position, especially on non-primary displays with high pixel density. This change simplifies the geometry calculations by removing unnecessary scaling checks, improving stability across various display configurations. Further testing may be needed to confirm that this adjustment does not introduce new issues.
  • Loading branch information
amnweb committed Nov 14, 2024
1 parent 16a2526 commit f5ba90b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/core/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,22 @@ def position_bar(self, init=False) -> None:
bar_width = self._dimensions['width']
bar_height = self._dimensions['height']

screen_scale = self.screen().devicePixelRatio()
#screen_scale = self.screen().devicePixelRatio()
screen_width = self.screen().geometry().width()
screen_height = self.screen().geometry().height()


# Commented out for now, as it causes issues with the bar position on 4k monitors, probably we don't need it anymore.
# Fix for non-primary display Windows OS scaling on app startup
should_downscale_screen_geometry = (
init and
len(QApplication.screens()) > 1 and
screen_scale >= 2.0 and
QApplication.primaryScreen() != self.screen()
)
# should_downscale_screen_geometry = (
# init and
# len(QApplication.screens()) > 1 and
# screen_scale >= 2.0 and
# QApplication.primaryScreen() != self.screen()
# )

if should_downscale_screen_geometry:
screen_width = screen_width / screen_scale
screen_height = screen_height / screen_scale
# if should_downscale_screen_geometry:
# screen_width = screen_width / screen_scale
# screen_height = screen_height / screen_scale

if is_valid_percentage_str(str(self._dimensions['width'])):
bar_width = int(screen_width * percent_to_float(self._dimensions['width']) - self._padding['left'] - self._padding['right'])
Expand All @@ -178,7 +179,7 @@ def position_bar(self, init=False) -> None:
bar_width,
bar_height
)
self.try_add_app_bar(scale_screen_height=not should_downscale_screen_geometry)
self.try_add_app_bar(scale_screen_height=True)

def _add_widgets(self, widgets: dict[str, list] = None):
bar_layout = QGridLayout()
Expand Down

0 comments on commit f5ba90b

Please sign in to comment.