mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-06-06 16:05:24 -06:00
android: Add Display Listener methods for smoother secondary display updates
Some checks failed
citra-build / source (push) Has been cancelled
citra-build / linux (appimage) (push) Has been cancelled
citra-build / linux (fresh) (push) Has been cancelled
citra-build / macos (arm64) (push) Has been cancelled
citra-build / macos (x86_64) (push) Has been cancelled
citra-build / windows (msvc) (push) Has been cancelled
citra-build / windows (msys2) (push) Has been cancelled
citra-build / android (push) Has been cancelled
citra-format / clang-format (push) Has been cancelled
citra-build / macos-universal (push) Has been cancelled
Some checks failed
citra-build / source (push) Has been cancelled
citra-build / linux (appimage) (push) Has been cancelled
citra-build / linux (fresh) (push) Has been cancelled
citra-build / macos (arm64) (push) Has been cancelled
citra-build / macos (x86_64) (push) Has been cancelled
citra-build / windows (msvc) (push) Has been cancelled
citra-build / windows (msys2) (push) Has been cancelled
citra-build / android (push) Has been cancelled
citra-format / clang-format (push) Has been cancelled
citra-build / macos-universal (push) Has been cancelled
This commit is contained in:
parent
4ac3cab012
commit
01dc2bb776
@ -20,7 +20,7 @@ import org.citra.citra_emu.features.settings.model.IntSetting
|
|||||||
import org.citra.citra_emu.display.SecondaryDisplayLayout
|
import org.citra.citra_emu.display.SecondaryDisplayLayout
|
||||||
import org.citra.citra_emu.NativeLibrary
|
import org.citra.citra_emu.NativeLibrary
|
||||||
|
|
||||||
class SecondaryDisplay(val context: Context) {
|
class SecondaryDisplay(val context: Context) : DisplayManager.DisplayListener {
|
||||||
private var pres: SecondaryDisplayPresentation? = null
|
private var pres: SecondaryDisplayPresentation? = null
|
||||||
private val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
private val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
||||||
private val vd: VirtualDisplay
|
private val vd: VirtualDisplay
|
||||||
@ -34,6 +34,7 @@ class SecondaryDisplay(val context: Context) {
|
|||||||
null,
|
null,
|
||||||
DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION
|
DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION
|
||||||
)
|
)
|
||||||
|
displayManager.registerDisplayListener(this, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateSurface() {
|
fun updateSurface() {
|
||||||
@ -74,8 +75,20 @@ class SecondaryDisplay(val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun releaseVD() {
|
fun releaseVD() {
|
||||||
|
displayManager.unregisterDisplayListener(this)
|
||||||
vd.release()
|
vd.release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDisplayAdded(displayId: Int) {
|
||||||
|
updateDisplay()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDisplayRemoved(displayId: Int) {
|
||||||
|
updateDisplay()
|
||||||
|
}
|
||||||
|
override fun onDisplayChanged(displayId: Int) {
|
||||||
|
updateDisplay()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class SecondaryDisplayPresentation(
|
class SecondaryDisplayPresentation(
|
||||||
context: Context, display: Display, val parent: SecondaryDisplay
|
context: Context, display: Display, val parent: SecondaryDisplay
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user