Commit Graph

30 Commits

Author SHA1 Message Date
Julian Winkler
036b5510d3 implement dispatchKeyEvent callback 2024-12-01 14:15:00 +00:00
Julian Winkler
e9cf5e7002 API stubs and fixes for composeUI 2024-12-01 14:15:00 +00:00
Daniel Panero
eba9c7037c JavaWidget: add debug info for GTK Inspector 2024-11-19 16:14:36 +01:00
Julian Winkler
e3c0931714 prevent reference cycles between Java and native objects 2024-08-02 17:02:53 +02:00
Julian Winkler
23e7d32924 Button/ImageButton: consume touch events
Androids button consumes touch events, while GTKs button lets touch
events propagate to the parent. This previously caused some glitches
with buttons inside a CoordinatorLayout.
2024-07-31 18:21:14 +02:00
Mis012
004ba4ff00 remove some old debugging prints, gate others behind verbose log 2024-06-22 14:35:56 +02:00
Julian Winkler
c5e0f8a7fd View.draw(): draw background, content, children in same order as AOSP 2024-05-27 16:37:49 +00:00
Julian Winkler
6f02565920 GskCanavas: draw default content when custom View calls super.onDraw() 2024-05-27 16:37:49 +00:00
Julian Winkler
6575fef58e replace SkArea with GskCanvas
This reduces RAM usage, as we no longer need to have separate graphics
buffers for all Views with custom onDraw() method
2024-05-27 16:37:49 +00:00
Julian Winkler
8afdd181d0 WrapperWidget: simulate GTK_OVERFLOW_HIDDEN for 0x0 allocated Views 2024-05-27 16:37:49 +00:00
Julian Winkler
dd3965df8a WrapperWidget: create SkArea also for Views with custom draw() method
Previously we only handled custom onDraw() methods
2024-05-20 08:12:02 +02:00
Julian Winkler
5fdcff4419 put sk_area behind the widget
Most widgets want to draw something behind the default content.

If we replace SkArea with GskCanvas in the future, we could draw
the default content, when the super.onDraw() gets called.
2024-05-20 08:09:01 +02:00
Julian Winkler
f82af6ecb7 allocate transparent {WrapperWidget / JavaWidget} 0x0 and draw children in overflow area
This prevents overlay widgets from blocking touch events.

Androids ViewGroup.dispatchTouchEvent() loops over all children and only breaks if an eventhandler returns true. Gtk on the other hand stops at the first sensitive child. Even if the eventhandler returned false.
2024-05-11 07:07:24 +02:00
Julian Winkler
e477b56dec OnTouchListener: attach event controllers to WrapperWidget
otherwise, the touch event positions would depend on the scroll offset.
This fixes the glitchy vertical scrolling in ViewPager
2024-03-25 19:50:29 +01:00
Julian Winkler
6eeb6b0232 move performClick implementation to WrapperWidget 2024-02-10 10:28:48 +01:00
Julian Winkler
8c7dbf6ceb start implementing Drawable using underlying GdkPaintable 2023-12-30 23:38:48 +01:00
Julian Winkler
c0804c3329 WrapperWidget: overwrite measured size if layout size is fixed 2023-11-12 12:16:23 +01:00
Julian Winkler
7bb5a1e33a computeScroll: move the allocation instead of only the snapshot 2023-11-04 23:32:29 +01:00
Julian Winkler
4bce3544dd WrapperWidget: handle View.computeScroll()
Currently the scrolling is purely visual.
2023-11-02 23:30:21 +01:00
Julian Winkler
0a8b8a3874 use AndroidLayout class also in View implementation
drop the onMeasure hack from WrapperWidget
2023-11-02 08:20:19 +01:00
Mis012
065fd96308 api-impl-jni: make invalidate() work inside the draw callback
this lets us remove the tick callback, and only call onDraw
when it's actually necessary
2023-10-31 23:14:52 +01:00
Julian Winkler
a2381f4721 fix compiler warnings in WrapperWidget and View 2023-10-29 15:23:11 +01:00
Mis012
4a0755c6e0 api-impl{-jni}: make view.onTouchEvent work, misc stuff to make input work for Unity games
onTouchEvent was previously incorrectly handled in GLSurfaceView; move it
to View so that it works properly with any of it's descendants.

This is done by reusing the existing setOnTouchListener implementation
and changing it to use GtkEventControllerLegacy which provides motion
events.

Technically some of the code is in WrapperWidget.c since every widget
calls wrapper_widget_set_jobject and we already have related code
there.
2023-10-17 21:33:59 +02:00
Mis012
4628cfc66d /api-impl-jni: remove remains of experimental ninepatch implementation, will use skia 2023-09-16 16:30:14 +02:00
Mis012
1e47824a79 src/api-impl: use skia instead of cairo
Using the C API provided by SkiaSharp's skia fork instead of using cairo
significantly improves performance. The API is also closer to the android
Canvas API, which makes the implementation more straightforward.
2023-09-12 13:37:41 +02:00