mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182665 - Don't try to call JNI methods in nsScreenManagerAndroid if it's not available r=esawin
This commit is contained in:
parent
d1f8aa4767
commit
4f60b946e3
@ -32,6 +32,12 @@ nsScreenAndroid::GetId(uint32_t *outId)
|
||||
NS_IMETHODIMP
|
||||
nsScreenAndroid::GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
|
||||
{
|
||||
if (!mozilla::jni::IsAvailable()) {
|
||||
// xpcshell most likely
|
||||
*outLeft = *outTop = *outWidth = *outHeight = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
widget::sdk::Rect::LocalRef rect = widget::GeckoAppShell::GetScreenSize();
|
||||
rect->Left(outLeft);
|
||||
rect->Top(outTop);
|
||||
@ -53,7 +59,13 @@ nsScreenAndroid::GetAvailRect(int32_t *outLeft, int32_t *outTop, int32_t *outWid
|
||||
NS_IMETHODIMP
|
||||
nsScreenAndroid::GetPixelDepth(int32_t *aPixelDepth)
|
||||
{
|
||||
*aPixelDepth = AndroidBridge::Bridge()->GetScreenDepth();
|
||||
if (!mozilla::jni::IsAvailable()) {
|
||||
// xpcshell most likely
|
||||
*aPixelDepth = 16;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aPixelDepth = widget::GeckoAppShell::GetScreenDepthWrapper();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -67,7 +79,9 @@ nsScreenAndroid::GetColorDepth(int32_t *aColorDepth)
|
||||
void
|
||||
nsScreenAndroid::ApplyMinimumBrightness(uint32_t aBrightness)
|
||||
{
|
||||
widget::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
|
||||
if (mozilla::jni::IsAvailable()) {
|
||||
widget::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsScreenManagerAndroid, nsIScreenManager)
|
||||
|
Loading…
Reference in New Issue
Block a user