Skip to content

Commit

Permalink
Fix flashing on HiDPI screens, including configurability should the e…
Browse files Browse the repository at this point in the history
…rror exist on no-HiDPI screens too. (Issue stuartlangridge#6)
  • Loading branch information
moqmar committed Nov 18, 2020
1 parent dc94f83 commit 2c65b83
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pick/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ def start_everything_first_time(self, on_window_map=None):
if on_window_map:
self.w.connect("map-event", on_window_map)

# Get the actual cursor scale from gconf so we don't get over the size limit (issue #6)
try:
cursor_scale = 1.0
if os.getenv("CURSOR_SCALE") != None:
cursor_scale = float(os.getenv("CURSOR_SCALE"))
else:
cursor_scale = self.w.get_screen().get_display().get_default_cursor_size() / float(Gio.Settings("org.gnome.desktop.interface").get_int("cursor-size"))
if cursor_scale != 1.0:
cursor_scaled_snapsize = int(math.ceil(self.snapsize[0] / 2 / cursor_scale) * 2)
print "Adjusted cursor size: " + str(cursor_scaled_snapsize)
self.snapsize = (cursor_scaled_snapsize, cursor_scaled_snapsize)
except:
# No gnome/dconf?!
print "Couldn't determine correct cursor size. If you experience any flickering, try launching with CURSOR_SCALE=2"

devman = self.w.get_screen().get_display().get_device_manager()
self.pointer = devman.get_client_pointer()
keyboards = [
Expand Down

0 comments on commit 2c65b83

Please sign in to comment.