Skip to content

Commit 5d7a61a

Browse files
committed
display: automatically update display scale
This setting has been removed, since there is a property that actually updates properly and dynamically based on which display the mpv window is on. I figured this property existed, but I never bothered actually adding it until now.
1 parent fc714af commit 5d7a61a

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

src/Mouse.moon

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
class Mouse
2-
osdScale = settings['display-scale-factor']
3-
42
@@x, @@y = -1, -1
3+
@@_rawX, @@_rawY = -1, -1
54
@@inWindow, @@dead = false, true
65
@@clickX, @@clickY = -1, -1
76
@@clickPending = false
87

9-
scaledPosition = ->
8+
scaledPosition = =>
109
x, y = mp.get_mouse_pos!
11-
return math.floor( x/osdScale ), math.floor( y/osdScale )
10+
@_rawX, @_rawY = x, y
11+
return math.floor( x/Window.osdScale ), math.floor( y/Window.osdScale )
1212

1313
@update: =>
1414
oldX, oldY = @x, @y
15-
@x, @y = scaledPosition!
15+
@x, @y = scaledPosition @
1616
if @dead and (oldX != @x or oldY != @y)
1717
@dead = false
1818
if not @dead and @clickPending
@@ -22,7 +22,7 @@ class Mouse
2222

2323
@cacheClick: =>
2424
if not @dead
25-
@clickX, @clickY = scaledPosition!
25+
@clickX, @clickY = scaledPosition @
2626
@clickPending = true
2727
else
2828
@dead = false

src/Window.moon

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
class Window
2-
osdScale = settings['display-scale-factor']
2+
@@osdScale = mp.get_property_number("display-hidpi-scale", 1)
33

44
@@w, @@h = 0, 0
5+
@@_rawW, @@_rawH = 0, 0
56

67
@update: =>
78
w, h = mp.get_osd_size!
9+
osdScale = mp.get_property_number("display-hidpi-scale", 1)
10+
11+
@_rawW, @_rawH = w, h
812
w, h = math.floor( w/osdScale ), math.floor( h/osdScale )
9-
if w != @w or h != @h
10-
@w, @h = w, h
13+
14+
if w != @w or h != @h or osdScale != @osdScale
15+
@w, @h, @osdScale = w, h, osdScale
1116
return true
1217
else
1318
return false

src/settings.moon

-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ Sets the height of the rectangular area at the top of the screen that shows the
1414
file name and system time when the mouse is hovered over it.
1515
]]
1616

17-
settings['display-scale-factor'] = 1
18-
helpText['display-scale-factor'] = [[
19-
Acts as a multiplier to increase the size of every UI element. Useful for high-
20-
DPI displays that cause the UI to be rendered too small (happens at least on
21-
macOS).
22-
]]
23-
2417
settings['default-style'] = [[\fnSource Sans Pro\b1\bord2\shad0\fs30\c&HFC799E&\3c&H2D2D2D&]]
2518
helpText['default-style'] = [[
2619
Default style that is applied to all UI elements. A string of ASS override tags.

torque-progressbar.conf

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ hover-zone-height=40
77
# file name and system time when the mouse is hovered over it.
88
top-hover-zone-height=40
99

10-
# Acts as a multiplier to increase the size of every UI element. Useful for high-
11-
# DPI displays that cause the UI to be rendered too small (happens at least on
12-
# macOS).
13-
display-scale-factor=1
14-
1510
# Default style that is applied to all UI elements. A string of ASS override tags.
1611
# Individual elements have their own style settings which override the tags here.
1712
# Changing the font will likely require changing the hover-time margin settings

0 commit comments

Comments
 (0)