mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 02:16:00 +02:00
This reverts commit bd0a33e467
.
This commit is contained in:
parent
f13ef48cec
commit
fe4094777f
6 changed files with 17 additions and 161 deletions
|
@ -17,7 +17,6 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
|||
extern bool gIsConnectionManager;
|
||||
|
||||
GtkWidget *find_gl_area(GtkWidget *widget);
|
||||
void try_set_transparent(GtkWindow* window, GdkScreen* screen, FlView* view);
|
||||
|
||||
// Implements GApplication::activate.
|
||||
static void my_application_activate(GApplication* application) {
|
||||
|
@ -80,7 +79,21 @@ static void my_application_activate(GApplication* application) {
|
|||
gtk_widget_show(GTK_WIDGET(view));
|
||||
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||
|
||||
try_set_transparent(window, screen, view);
|
||||
// https://github.com/flutter/flutter/issues/152154
|
||||
// Remove this workaround when flutter version is updated.
|
||||
GtkWidget *gl_area = find_gl_area(GTK_WIDGET(view));
|
||||
if (gl_area != NULL) {
|
||||
gtk_gl_area_set_has_alpha(GTK_GL_AREA(gl_area), TRUE);
|
||||
}
|
||||
|
||||
if (screen != NULL) {
|
||||
GdkVisual *visual = NULL;
|
||||
gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
|
||||
visual = gdk_screen_get_rgba_visual(screen);
|
||||
if (visual != NULL && gdk_screen_is_composited(screen)) {
|
||||
gtk_widget_set_visual(GTK_WIDGET(window), visual);
|
||||
}
|
||||
}
|
||||
|
||||
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
||||
|
||||
|
@ -149,84 +162,3 @@ GtkWidget *find_gl_area(GtkWidget *widget)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool is_linux_mint()
|
||||
{
|
||||
bool is_mint = false;
|
||||
char line[256];
|
||||
FILE *fp = fopen("/etc/os-release", "r");
|
||||
if (fp == NULL) {
|
||||
return false;
|
||||
}
|
||||
while (fgets(line, sizeof(line), fp)) {
|
||||
if (strstr(line, "ID=linuxmint") != NULL) {
|
||||
is_mint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
return is_mint;
|
||||
}
|
||||
|
||||
bool is_desktop_mate()
|
||||
{
|
||||
const char* desktop = NULL;
|
||||
desktop = getenv("XDG_CURRENT_DESKTOP");
|
||||
printf("Linux desktop, XDG_CURRENT_DESKTOP: %s\n", desktop == NULL ? "" : desktop);
|
||||
if (desktop == NULL) {
|
||||
desktop = getenv("XDG_SESSION_DESKTOP");
|
||||
printf("Linux desktop, XDG_SESSION_DESKTOP: %s\n", desktop == NULL ? "" : desktop);
|
||||
}
|
||||
if (desktop == NULL) {
|
||||
desktop = getenv("DESKTOP_SESSION");
|
||||
printf("Linux desktop, DESKTOP_SESSION: %s\n", desktop == NULL ? "" : desktop);
|
||||
}
|
||||
if (desktop != NULL && strcasecmp(desktop, "mate") == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool skip_setting_transparent()
|
||||
{
|
||||
if (is_desktop_mate()) {
|
||||
printf("Linux desktop, MATE\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_linux_mint()) {
|
||||
printf("Linux desktop, Linux Mint\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://github.com/flutter/flutter/issues/152154
|
||||
// Remove this workaround when flutter version is updated.
|
||||
void try_set_transparent(GtkWindow* window, GdkScreen* screen, FlView* view)
|
||||
{
|
||||
GtkWidget *gl_area = NULL;
|
||||
|
||||
if (skip_setting_transparent()) {
|
||||
printf("Skip setting transparent\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Try setting transparent\n");
|
||||
|
||||
gl_area = find_gl_area(GTK_WIDGET(view));
|
||||
if (gl_area != NULL) {
|
||||
gtk_gl_area_set_has_alpha(GTK_GL_AREA(gl_area), TRUE);
|
||||
}
|
||||
|
||||
if (screen != NULL) {
|
||||
GdkVisual *visual = NULL;
|
||||
gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
|
||||
visual = gdk_screen_get_rgba_visual(screen);
|
||||
if (visual != NULL && gdk_screen_is_composited(screen)) {
|
||||
gtk_widget_set_visual(GTK_WIDGET(window), visual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue