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
Drawable: queue up invalidate() calls, because GTK can't invalidate from inside draw()
This is analogous to wrapper_widget_queue_draw().
This commit is contained in:
@@ -88,8 +88,15 @@ JNIEXPORT jlong JNICALL Java_android_graphics_drawable_Drawable_native_1construc
|
|||||||
return _INTPTR(paintable);
|
return _INTPTR(paintable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint queue_invalidate_contents(GdkPaintable *paintable)
|
||||||
|
{
|
||||||
|
gdk_paintable_invalidate_contents(paintable);
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_drawable_Drawable_native_1invalidate(JNIEnv *env, jobject this, jlong paintable_ptr) {
|
JNIEXPORT void JNICALL Java_android_graphics_drawable_Drawable_native_1invalidate(JNIEnv *env, jobject this, jlong paintable_ptr) {
|
||||||
gdk_paintable_invalidate_contents(GDK_PAINTABLE(_PTR(paintable_ptr)));
|
// GTK doesn't allow invalidating a paintable while it's being drawn, so we need to queue it up
|
||||||
|
g_idle_add_full(G_PRIORITY_HIGH_IDLE + 20, G_SOURCE_FUNC(queue_invalidate_contents), GDK_PAINTABLE(_PTR(paintable_ptr)), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_drawable_Drawable_native_1draw(JNIEnv *env, jobject this, jlong paintable_ptr, jlong snapshot_ptr, jint width, jint height) {
|
JNIEXPORT void JNICALL Java_android_graphics_drawable_Drawable_native_1draw(JNIEnv *env, jobject this, jlong paintable_ptr, jlong snapshot_ptr, jint width, jint height) {
|
||||||
|
|||||||
Reference in New Issue
Block a user