You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
View.setSystemUiVisibility(): implement fullscreen
For now we only allow fullscreen for maximized windows
This commit is contained in:
@@ -311,6 +311,14 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1drawBackground
|
|||||||
JNIEXPORT void JNICALL Java_android_view_View_native_1drawContent
|
JNIEXPORT void JNICALL Java_android_view_View_native_1drawContent
|
||||||
(JNIEnv *, jobject, jlong, jlong);
|
(JNIEnv *, jobject, jlong, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: android_view_View
|
||||||
|
* Method: nativeSetFullscreen
|
||||||
|
* Signature: (JZ)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_android_view_View_nativeSetFullscreen
|
||||||
|
(JNIEnv *, jobject, jlong, jboolean);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_view_View
|
* Class: android_view_View
|
||||||
* Method: nativeInvalidate
|
* Method: nativeInvalidate
|
||||||
|
|||||||
@@ -577,3 +577,17 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1drawContent(JNIEnv *env, j
|
|||||||
GdkSnapshot *snapshot = GDK_SNAPSHOT(_PTR(snapshot_ptr));
|
GdkSnapshot *snapshot = GDK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||||
gtk_widget_snapshot_child(&wrapper->parent_instance, wrapper->child, snapshot);
|
gtk_widget_snapshot_child(&wrapper->parent_instance, wrapper->child, snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_android_view_View_nativeSetFullscreen(JNIEnv *env, jobject this, jlong widget_ptr, jboolean fullscreen)
|
||||||
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET(_PTR(widget_ptr));
|
||||||
|
GtkWindow *window = GTK_WINDOW(gtk_widget_get_native(widget));
|
||||||
|
if (fullscreen) {
|
||||||
|
if (gtk_window_is_maximized(window))
|
||||||
|
gtk_window_fullscreen(window);
|
||||||
|
else
|
||||||
|
printf("blocking fullscreen request, because window is not maximized\n");
|
||||||
|
} else {
|
||||||
|
gtk_window_unfullscreen(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1038,7 +1038,10 @@ public class View implements Drawable.Callback {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void nativeSetFullscreen(long widget, boolean fullscreen);
|
||||||
|
|
||||||
public void setSystemUiVisibility(int visibility) {
|
public void setSystemUiVisibility(int visibility) {
|
||||||
|
nativeSetFullscreen(widget, (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0);
|
||||||
system_ui_visibility = visibility;
|
system_ui_visibility = visibility;
|
||||||
}
|
}
|
||||||
public int getSystemUiVisibility() {
|
public int getSystemUiVisibility() {
|
||||||
|
|||||||
Reference in New Issue
Block a user