mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
Size the session from the panel, not the app window
resources.displayMetrics is the window after the system bars and the cutout are subtracted, so the first session on a 1080p device came up 1920x968 and gamescope patched its EDID to suit. The panel's own bounds are what a client should be told the display is.
This commit is contained in:
1 parent
814ab2cac0
commit
97ee688eff
1 file changed
+13
-3
@@ -140,9 +140,19 @@ class SessionActivity : Activity(), SurfaceHolder.Callback {
|
|||||||
* the panel is, so a 1440p phone can run the client at 1080p without the client knowing.
|
* the panel is, so a 1440p phone can run the client at 1080p without the client knowing.
|
||||||
*/
|
*/
|
||||||
private fun outputSize(): Pair<Int, Int> {
|
private fun outputSize(): Pair<Int, Int> {
|
||||||
val metrics = resources.displayMetrics
|
// The panel, not the window: resources.displayMetrics is what is left after the system
|
||||||
var width = maxOf(metrics.widthPixels, metrics.heightPixels)
|
// bars and the cutout are taken out, which sized the first session 1920x968 on a 1080p
|
||||||
var height = minOf(metrics.widthPixels, metrics.heightPixels)
|
// device and had gamescope patch its EDID to match.
|
||||||
|
val bounds = if (Build.VERSION.SDK_INT >= 30) {
|
||||||
|
windowManager.maximumWindowMetrics.bounds
|
||||||
|
} else {
|
||||||
|
val metrics = android.util.DisplayMetrics()
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
windowManager.defaultDisplay.getRealMetrics(metrics)
|
||||||
|
android.graphics.Rect(0, 0, metrics.widthPixels, metrics.heightPixels)
|
||||||
|
}
|
||||||
|
var width = maxOf(bounds.width(), bounds.height())
|
||||||
|
var height = minOf(bounds.width(), bounds.height())
|
||||||
// The client's CEF is the heaviest thing in the session; above 1080p it costs frames for
|
// The client's CEF is the heaviest thing in the session; above 1080p it costs frames for
|
||||||
// nothing anyone can see on a phone panel.
|
// nothing anyone can see on a phone panel.
|
||||||
if (height > 1080) {
|
if (height > 1080) {
|
||||||
|
|||||||
Reference in new issue
Block a user