Set GLArea.has-alpha = true (flutter/engine#54053)
GLArea.has-alpha defaults to false, which makes it impossible for a Flutter app to be transparent. The additional change to glClearColor is to prevent a black flash when the application starts, before Flutter widgets become visible. This will also affect applications that aren't transparent, by showing the default GTK background color instead of black. This will not make the window transparent, because the developer currently has to add some code to their `linux/my_application.cc` to support transparency. Fixes flutter/flutter#152154 Transparent windows were possible before #50754. Would it be ok to add a test for this to prevent breaking transparency again in the future? [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
d29d4a12b3
commit
0325e590ba
@ -445,7 +445,7 @@ void fl_renderer_render(FlRenderer* self, int width, int height) {
|
|||||||
|
|
||||||
g_return_if_fail(FL_IS_RENDERER(self));
|
g_return_if_fail(FL_IS_RENDERER(self));
|
||||||
|
|
||||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
if (priv->has_gl_framebuffer_blit) {
|
if (priv->has_gl_framebuffer_blit) {
|
||||||
|
@ -743,6 +743,7 @@ static void fl_view_init(FlView* self) {
|
|||||||
self);
|
self);
|
||||||
|
|
||||||
self->gl_area = GTK_GL_AREA(gtk_gl_area_new());
|
self->gl_area = GTK_GL_AREA(gtk_gl_area_new());
|
||||||
|
gtk_gl_area_set_has_alpha(self->gl_area, TRUE);
|
||||||
gtk_widget_show(GTK_WIDGET(self->gl_area));
|
gtk_widget_show(GTK_WIDGET(self->gl_area));
|
||||||
gtk_container_add(GTK_CONTAINER(self->event_box), GTK_WIDGET(self->gl_area));
|
gtk_container_add(GTK_CONTAINER(self->event_box), GTK_WIDGET(self->gl_area));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user