mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 616664 - Android code for keeping the screen on. r=mwu a=blocking-fennec
This commit is contained in:
parent
d7e10068a5
commit
f10676ded2
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -638,4 +638,12 @@ class GeckoAppShell
|
||||
GeckoApp.mAppContext.mProgressDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setKeepScreenOn(final boolean on) {
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
GeckoApp.surfaceView.setKeepScreenOn(on);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jShowInputMethodPicker = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "showInputMethodPicker", "()V");
|
||||
jHideProgressDialog = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "hideProgressDialog", "()V");
|
||||
jPerformHapticFeedback = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "performHapticFeedback", "(Z)V");
|
||||
jSetKeepScreenOn = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setKeepScreenOn", "(Z)V");
|
||||
|
||||
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
|
||||
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
|
||||
@ -639,6 +640,13 @@ AndroidBridge::GetStaticStringField(const char *className, const char *fieldName
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetKeepScreenOn(bool on)
|
||||
{
|
||||
JNI()->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
|
||||
sBridge->jSetKeepScreenOn, on);
|
||||
}
|
||||
|
||||
// Available for places elsewhere in the code to link to.
|
||||
PRBool
|
||||
mozilla_AndroidBridge_SetMainThread(void *thr)
|
||||
|
@ -211,6 +211,8 @@ public:
|
||||
|
||||
bool GetStaticStringField(const char *classID, const char *field, nsAString &result);
|
||||
|
||||
void SetKeepScreenOn(bool on);
|
||||
|
||||
protected:
|
||||
static AndroidBridge *sBridge;
|
||||
|
||||
@ -259,6 +261,7 @@ protected:
|
||||
jmethodID jShowInputMethodPicker;
|
||||
jmethodID jHideProgressDialog;
|
||||
jmethodID jPerformHapticFeedback;
|
||||
jmethodID jSetKeepScreenOn;
|
||||
|
||||
// stuff we need for CallEglCreateWindowSurface
|
||||
jclass jEGLSurfaceImplClass;
|
||||
|
@ -100,6 +100,7 @@ DEFINES += -D_IMPL_NS_WIDGET
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/widget/src/xpwidgets \
|
||||
-I$(topsrcdir)/widget/src/shared \
|
||||
-I$(topsrcdir)/dom/system/android \
|
||||
-I$(srcdir) \
|
||||
$(NULL)
|
||||
|
@ -38,8 +38,11 @@
|
||||
|
||||
#include "nsScreenManagerAndroid.h"
|
||||
#include "nsWindow.h"
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsScreenAndroid, nsIScreen)
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsScreenAndroid, nsIScreen, nsIScreen_MOZILLA_2_0_BRANCH)
|
||||
|
||||
nsScreenAndroid::nsScreenAndroid(void *nativeScreen)
|
||||
{
|
||||
@ -88,6 +91,12 @@ nsScreenAndroid::GetColorDepth(PRInt32 *aColorDepth)
|
||||
return GetPixelDepth(aColorDepth);
|
||||
}
|
||||
|
||||
void
|
||||
nsScreenAndroid::ApplyMinimumBrightness(PRUint32 aBrightness)
|
||||
{
|
||||
AndroidBridge::Bridge()->SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsScreenManagerAndroid, nsIScreenManager)
|
||||
|
||||
nsScreenManagerAndroid::nsScreenManagerAndroid()
|
||||
|
@ -43,16 +43,21 @@
|
||||
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsIScreen.h"
|
||||
#include "WidgetUtils.h"
|
||||
|
||||
class nsScreenAndroid :
|
||||
public nsIScreen
|
||||
class nsScreenAndroid
|
||||
: public nsIScreen
|
||||
, public mozilla::widget::BrightnessLockingWidget
|
||||
{
|
||||
public:
|
||||
nsScreenAndroid(void *platformScreen);
|
||||
nsScreenAndroid(void *nativeScreen);
|
||||
~nsScreenAndroid();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCREEN
|
||||
|
||||
protected:
|
||||
void ApplyMinimumBrightness(PRUint32 aBrightness);
|
||||
};
|
||||
|
||||
class nsScreenManagerAndroid :
|
||||
|
Loading…
Reference in New Issue
Block a user