Prevent SecondaryDisplay from stealing focus
The SecondaryDisplay Activity was stealing focus from the main Activity when it was launched. Set the `FLAG_NOT_FOCUSABLE` and `FLAG_NOT_TOUCH_MODAL` window flags to prevent the SecondaryDisplay from gaining focus.
This commit is contained in:
parent
0be78e9550
commit
eb256fe664
1 changed files with 8 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import android.view.Display
|
||||||
import android.view.Surface
|
import android.view.Surface
|
||||||
import android.view.SurfaceHolder
|
import android.view.SurfaceHolder
|
||||||
import android.view.SurfaceView
|
import android.view.SurfaceView
|
||||||
|
import android.view.WindowManager
|
||||||
import org.citra.citra_emu.NativeLibrary
|
import org.citra.citra_emu.NativeLibrary
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||||
|
|
||||||
|
|
@ -50,7 +51,7 @@ class SecondaryDisplay(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if our presentation is already on the right display, ignore
|
// if our presentation is already on the right display, ignore
|
||||||
if (pres?.display == display) return;
|
if (pres?.display == display) return
|
||||||
|
|
||||||
// otherwise, make a new presentation
|
// otherwise, make a new presentation
|
||||||
releasePresentation()
|
releasePresentation()
|
||||||
|
|
@ -59,7 +60,6 @@ class SecondaryDisplay(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCustomerDisplay(): Display? {
|
private fun getCustomerDisplay(): Display? {
|
||||||
val displays = displayManager.displays
|
|
||||||
// code taken from MelonDS dual screen - should fix odin 2 detection bug
|
// code taken from MelonDS dual screen - should fix odin 2 detection bug
|
||||||
return displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
|
return displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
|
||||||
.firstOrNull { it.displayId != Display.DEFAULT_DISPLAY && it.name != "Built-in Screen" && it.name != "HiddenDisplay"}
|
.firstOrNull { it.displayId != Display.DEFAULT_DISPLAY && it.name != "Built-in Screen" && it.name != "HiddenDisplay"}
|
||||||
|
|
@ -81,6 +81,12 @@ class SecondaryDisplayPresentation(
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
window?.setFlags(
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
|
||||||
|
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||||
|
)
|
||||||
|
|
||||||
// Initialize SurfaceView
|
// Initialize SurfaceView
|
||||||
surfaceView = SurfaceView(context)
|
surfaceView = SurfaceView(context)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue