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
remove incorrect offset correction from GLSurfaceView; handle ATL_DISABLE_WINDOW_DECORATIONS env
This commit is contained in:
@@ -164,6 +164,20 @@ static void check_program_link_error(GLuint program)
|
|||||||
struct jni_gl_callback_data { JavaVM *jvm; jobject this; jobject renderer; bool first_time;};
|
struct jni_gl_callback_data { JavaVM *jvm; jobject this; jobject renderer; bool first_time;};
|
||||||
static void on_realize(GtkGLArea *gl_area, struct jni_gl_callback_data *d)
|
static void on_realize(GtkGLArea *gl_area, struct jni_gl_callback_data *d)
|
||||||
{
|
{
|
||||||
|
// ---
|
||||||
|
// compensate for offset between the widget coordinates and the surface coordinates
|
||||||
|
double off_x;
|
||||||
|
double off_y;
|
||||||
|
|
||||||
|
GtkWidget *window = GTK_WIDGET(gtk_widget_get_native(gl_area));
|
||||||
|
gtk_native_get_surface_transform(GTK_NATIVE(window), &off_x, &off_y);
|
||||||
|
|
||||||
|
FIXME__WIDTH -= off_x;
|
||||||
|
FIXME__HEIGHT -= off_y;
|
||||||
|
// ---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gtk_gl_area_make_current(gl_area);
|
gtk_gl_area_make_current(gl_area);
|
||||||
|
|
||||||
struct render_priv *render_priv = g_object_get_data(G_OBJECT(gl_area), "render_priv");
|
struct render_priv *render_priv = g_object_get_data(G_OBJECT(gl_area), "render_priv");
|
||||||
@@ -435,20 +449,6 @@ static void call_ontouch_callback(GtkEventControllerLegacy* event_controller, in
|
|||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
(*d->jvm)->GetEnv(d->jvm, (void**)&env, JNI_VERSION_1_6);
|
(*d->jvm)->GetEnv(d->jvm, (void**)&env, JNI_VERSION_1_6);
|
||||||
|
|
||||||
// translate to the GLSurfaceArea widget's coordinates, since that's what the app expects
|
|
||||||
|
|
||||||
double off_x;
|
|
||||||
double off_y;
|
|
||||||
|
|
||||||
GtkWidget *gl_area = gtk_event_controller_get_widget(event_controller);
|
|
||||||
GtkWidget *window = GTK_WIDGET(gtk_widget_get_native(gl_area));
|
|
||||||
|
|
||||||
// compensate for offset between the widget coordinates and the surface coordinates
|
|
||||||
gtk_native_get_surface_transform(GTK_NATIVE(window), &off_x, &off_y);
|
|
||||||
x -= off_x;
|
|
||||||
y -= off_y;
|
|
||||||
gtk_widget_translate_coordinates(window, gl_area, x, y, &x, &y);
|
|
||||||
|
|
||||||
// execute the Java callback function
|
// execute the Java callback function
|
||||||
|
|
||||||
jobject motion_event = (*env)->NewObject(env, handle_cache.motion_event.class, handle_cache.motion_event.constructor, action, (float)x, (float)y);
|
jobject motion_event = (*env)->NewObject(env, handle_cache.motion_event.class, handle_cache.motion_event.constructor, action, (float)x, (float)y);
|
||||||
|
|||||||
@@ -310,6 +310,9 @@ static void open(GtkApplication *app, GFile** files, gint nfiles, const gchar* h
|
|||||||
// TODO: set icon according to how android gets it for the purposes of displaying it in the launcher
|
// TODO: set icon according to how android gets it for the purposes of displaying it in the launcher
|
||||||
// gtk_window_set_icon_name(window, "weather-clear");
|
// gtk_window_set_icon_name(window, "weather-clear");
|
||||||
|
|
||||||
|
if(getenv("ATL_DISABLE_WINDOW_DECORATIONS"))
|
||||||
|
gtk_window_set_decorated(GTK_WINDOW(window), 0);
|
||||||
|
|
||||||
gtk_widget_show(window);
|
gtk_widget_show(window);
|
||||||
|
|
||||||
/* -- register our JNI library under the appropriate classloader -- */
|
/* -- register our JNI library under the appropriate classloader -- */
|
||||||
|
|||||||
Reference in New Issue
Block a user