Skip to content

Commit eeac7a9

Browse files
authored
Merge pull request #78 from ardera/develop
fixes
2 parents 07cc419 + 0c38c77 commit eeac7a9

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

include/flutter-pi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,6 @@ int flutterpi_respond_to_platform_message(
477477
size_t message_size
478478
);
479479

480+
int flutterpi_schedule_exit(void);
481+
480482
#endif

src/compositor.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,14 @@ static bool on_present_layers(
928928
}
929929

930930
for_each_unreserved_plane_in_atomic_req(req, plane) {
931-
drmdev_atomic_req_put_plane_property(req, plane->plane->plane_id, "FB", 0);
931+
if ((plane->type == DRM_PLANE_TYPE_PRIMARY) || (plane->type == DRM_PLANE_TYPE_OVERLAY)) {
932+
drmdev_atomic_req_put_plane_property(req, plane->plane->plane_id, "FB_ID", 0);
933+
drmdev_atomic_req_put_plane_property(req, plane->plane->plane_id, "CRTC_ID", 0);
934+
}
932935
}
933936

934937
eglMakeCurrent(flutterpi.egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
938+
935939
drmdev_atomic_req_commit(req, req_flags, NULL);
936940

937941
cpset_unlock(&compositor->cbs);

src/flutter-pi.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,10 @@ static int post_platform_task_with_time(
597597
if (pthread_self() != flutterpi.event_loop_thread) {
598598
ok = write(flutterpi.wakeup_event_loop_fd, (uint8_t[8]) {0, 0, 0, 0, 0, 0, 0, 1}, 8);
599599
if (ok < 0) {
600-
perror("[flutter-pi] Error arming main loop for platform task. write");
601-
ok = errno;
602-
goto fail_unlock_event_loop;
603-
}
600+
perror("[flutter-pi] Error arming main loop for platform task. write");
601+
ok = errno;
602+
goto fail_unlock_event_loop;
603+
}
604604
}
605605

606606
if (pthread_self() != flutterpi.event_loop_thread) {
@@ -615,6 +615,9 @@ static int post_platform_task_with_time(
615615
pthread_mutex_unlock(&flutterpi.event_loop_mutex);
616616
}
617617

618+
fail_free_task:
619+
free(task);
620+
618621
return ok;
619622
}
620623

@@ -1779,6 +1782,29 @@ static int init_application(void) {
17791782
return 0;
17801783
}
17811784

1785+
int flutterpi_schedule_exit(void) {
1786+
int ok;
1787+
1788+
if (pthread_self() != flutterpi.event_loop_thread) {
1789+
pthread_mutex_lock(&flutterpi.event_loop_mutex);
1790+
}
1791+
1792+
ok = sd_event_exit(flutterpi.event_loop, 0);
1793+
if (ok < 0) {
1794+
fprintf(stderr, "[flutter-pi] Could not schedule application exit. sd_event_exit: %s\n", strerror(-ok));
1795+
if (pthread_self() != flutterpi.event_loop_thread) {
1796+
pthread_mutex_unlock(&flutterpi.event_loop_mutex);
1797+
}
1798+
return -ok;
1799+
}
1800+
1801+
if (pthread_self() != flutterpi.event_loop_thread) {
1802+
pthread_mutex_unlock(&flutterpi.event_loop_mutex);
1803+
}
1804+
1805+
return 0;
1806+
}
1807+
17821808
/**************
17831809
* USER INPUT *
17841810
**************/
@@ -2049,6 +2075,9 @@ static int on_libinput_ready(sd_event_source *s, int fd, uint32_t revents, void
20492075

20502076
rawkb_on_keyevent(glfw_key, keycode, state == LIBINPUT_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE);
20512077
}
2078+
2079+
libinput_event_destroy(event);
2080+
event = NULL;
20522081
}
20532082

20542083
if (n_pointer_events > 0) {

src/platformchannel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ int platch_send(char *channel, struct platch_obj *object, enum platch_codec resp
10331033
goto fail_release_handle;
10341034
}
10351035

1036+
// TODO: This won't work if we're not on the main thread
10361037
if (on_response) {
10371038
result = flutterpi.flutter.libflutter_engine.FlutterPlatformMessageReleaseResponseHandle(flutterpi.flutter.engine, response_handle);
10381039
if (result != kSuccess) {

src/plugins/services.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int on_receive_platform(char *channel, struct platch_obj *object, Flutter
184184
* systemNavigationBarIconBrightness: null / Brightness
185185
*/
186186
} else if (strcmp(object->method, "SystemNavigator.pop") == 0) {
187-
// do nothing
187+
flutterpi_schedule_exit();
188188
}
189189

190190
return platch_respond_not_implemented(responsehandle);

0 commit comments

Comments
 (0)