mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +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.
|
||||
*/
|
||||
private fun outputSize(): Pair<Int, Int> {
|
||||
val metrics = resources.displayMetrics
|
||||
var width = maxOf(metrics.widthPixels, metrics.heightPixels)
|
||||
var height = minOf(metrics.widthPixels, metrics.heightPixels)
|
||||
// The panel, not the window: resources.displayMetrics is what is left after the system
|
||||
// bars and the cutout are taken out, which sized the first session 1920x968 on a 1080p
|
||||
// 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
|
||||
// nothing anyone can see on a phone panel.
|
||||
if (height > 1080) {
|
||||
|
||||
Reference in new issue
Block a user