Skip to content

Commit 48fc72e

Browse files
committed
DisplayServer: improves display size rounding and argument clarity
1 parent e3d6a85 commit 48fc72e

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

src/detection/displayserver/displayserver_android.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,10 @@ static void detectWithDumpsys(FFDisplayServerResult* ds)
8383

8484
ffStrbufRecalculateLength(&name);
8585
FFDisplayResult* display = ffdsAppendDisplay(ds,
86-
(uint32_t)width,
87-
(uint32_t)height,
86+
(uint32_t)width, (uint32_t)height,
8887
refreshRate,
89-
0,
90-
0,
91-
0,
92-
0,
88+
0, 0,
89+
0, 0,
9390
0,
9491
0,
9592
&name,
@@ -122,13 +119,10 @@ static bool detectWithGetprop(FFDisplayServerResult* ds)
122119
ffStrbufSubstrAfterFirstC(&buffer, ',');
123120
double scaleFactor = (double) ffStrbufToUInt(&buffer, 0) / 160.;
124121
FFDisplayResult* display = ffdsAppendDisplay(ds,
125-
width,
126-
height,
127-
0,
128-
(uint32_t) (width / scaleFactor + .5),
129-
(uint32_t) (height / scaleFactor + .5),
130-
0,
122+
width, height,
131123
0,
124+
(uint32_t) (width / scaleFactor + .5), (uint32_t) (height / scaleFactor + .5),
125+
0, 0,
132126
0,
133127
0,
134128
NULL,

src/detection/displayserver/linux/drm.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,10 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
396396
}
397397

398398
FFDisplayResult* item = ffdsAppendDisplay(result,
399-
width,
400-
height,
399+
width, height,
401400
refreshRate,
402-
0,
403-
0,
404-
preferredWidth,
405-
preferredHeight,
401+
0, 0,
402+
preferredWidth, preferredHeight,
406403
preferredRefreshRate,
407404
0,
408405
&name,

src/detection/displayserver/linux/wayland/global-output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ const char* ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry*
128128
(uint32_t) display.width,
129129
(uint32_t) display.height,
130130
display.refreshRate / 1000.0,
131-
(uint32_t) (display.width / display.scale),
132-
(uint32_t) (display.height / display.scale),
131+
(uint32_t) (display.width / display.scale + .5),
132+
(uint32_t) (display.height / display.scale + .5),
133133
(uint32_t) display.preferredWidth,
134134
(uint32_t) display.preferredHeight,
135135
display.preferredRefreshRate / 1000.0,

src/detection/displayserver/linux/wayland/kde-output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* re
220220
(uint32_t) display.width,
221221
(uint32_t) display.height,
222222
display.refreshRate / 1000.0,
223-
(uint32_t) (display.width / display.scale),
224-
(uint32_t) (display.height / display.scale),
223+
(uint32_t) (display.width / display.scale + .5),
224+
(uint32_t) (display.height / display.scale + .5),
225225
(uint32_t) display.preferredWidth,
226226
(uint32_t) display.preferredHeight,
227227
display.preferredRefreshRate / 1000.0,

0 commit comments

Comments
 (0)