mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03: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:
parent
4e29b6af1d
commit
87b254156d
1 changed files with 8 additions and 1 deletions
|
@ -88,8 +88,15 @@ JNIEXPORT jlong JNICALL Java_android_graphics_drawable_Drawable_native_1construc
|
|||
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) {
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue