mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-12-04 15:46:07 +00:00
fix(linux): keep the window background transparent with Flutter >= 3.27 (#17347)
* fix(linux): keep the window background transparent with Flutter >= 3.27 Since Flutter 3.27, FlView fills itself with an opaque black background unless fl_view_set_background_color() is called (flutter/engine#54575, the fix for flutter/flutter#152154). Newer versions also draw without a GtkGLArea, so find_gl_area() returns nothing and the window border and rounded corners are drawn black (e.g. with Flutter 3.44, which apply_flutter_3.44_source_patches.sh supports and distributions use). Make the view transparent with fl_view_set_background_color(), the API Flutter provides for this. Flutter >= 3.27 also sets up its GtkGLArea for transparency itself, so this replaces the GtkGLArea workaround there. The function is declared weak so that Flutter 3.24, which does not have it, still builds and keeps using the workaround. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yichao Yu <yyc1992@gmail.com> * chore(flutter): bump desktop_multi_window for transparent Linux sub-windows Pulls in rustdesk-org/rustdesk_desktop_multi_window#41, the sub-window counterpart of this fix: with Flutter >= 3.27 the sub-window FlView needs fl_view_set_background_color() to stay transparent, otherwise remote-session windows get black borders and corners. It is a weak symbol, so the Flutter 3.24.5 builds are unchanged. The Flutter 3.44 and 3.22 bridge lock diffs do not touch this entry and still apply unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b --------- Signed-off-by: Yichao Yu <yyc1992@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
3 files changed
+17
-3
No files matched your search
@@ -27,6 +27,12 @@ void host_channel_call_handler(FlMethodChannel* channel, FlMethodCall* method_ca
|
||||
GtkWidget *find_gl_area(GtkWidget *widget);
|
||||
void try_set_transparent(GtkWindow* window, GdkScreen* screen, FlView* view);
|
||||
|
||||
// Added in Flutter 3.27. Declared weak so that this builds with Flutter 3.24,
|
||||
// where it is NULL.
|
||||
extern "C" void fl_view_set_background_color(FlView* view,
|
||||
const GdkRGBA* color)
|
||||
__attribute__((weak));
|
||||
|
||||
extern bool gIsConnectionManager;
|
||||
|
||||
// --- Side mouse button support (back/forward) ---
|
||||
@@ -330,6 +336,14 @@ void try_set_transparent(GtkWindow* window, GdkScreen* screen, FlView* view)
|
||||
gtk_gl_area_set_has_alpha(GTK_GL_AREA(gl_area), TRUE);
|
||||
}
|
||||
|
||||
// Flutter >= 3.27 sets up its GtkGLArea for transparency itself (newer
|
||||
// versions do not use one), but fills the view with an opaque black
|
||||
// background unless a transparent background color is set.
|
||||
if (fl_view_set_background_color != NULL) {
|
||||
const GdkRGBA transparent = {0.0, 0.0, 0.0, 0.0};
|
||||
fl_view_set_background_color(view, &transparent);
|
||||
}
|
||||
|
||||
if (screen != NULL) {
|
||||
GdkVisual *visual = NULL;
|
||||
gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
|
||||
|
||||
@@ -339,8 +339,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: cddc2e64f8fefce4f80db87b20bcda2dd019bed6
|
||||
resolved-ref: cddc2e64f8fefce4f80db87b20bcda2dd019bed6
|
||||
ref: 27d0a46fcff13153b46e0777fe92ff03a5834286
|
||||
resolved-ref: 27d0a46fcff13153b46e0777fe92ff03a5834286
|
||||
url: "https://github.com/rustdesk-org/rustdesk_desktop_multi_window"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
|
||||
@@ -58,7 +58,7 @@ dependencies:
|
||||
desktop_multi_window:
|
||||
git:
|
||||
url: https://github.com/rustdesk-org/rustdesk_desktop_multi_window
|
||||
ref: cddc2e64f8fefce4f80db87b20bcda2dd019bed6
|
||||
ref: 27d0a46fcff13153b46e0777fe92ff03a5834286
|
||||
freezed_annotation: ^2.0.3
|
||||
flutter_custom_cursor:
|
||||
git:
|
||||
|
||||
Reference in new issue
Block a user