Skip to content

Black screen when using GTK_PLUG mode on Linux #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AoEiuV020 opened this issue Dec 12, 2024 · 0 comments
Open

Black screen when using GTK_PLUG mode on Linux #519

AoEiuV020 opened this issue Dec 12, 2024 · 0 comments

Comments

@AoEiuV020
Copy link

AoEiuV020 commented Dec 12, 2024

Description

When launching the Flutter application in GTK_PLUG mode on Linux (for embedding into other applications), the window becomes completely black if the project has window_manager as a dependency. This occurs even without calling any window_manager APIs.

Environment

  • OS: Linux
  • Flutter: 3.24.5
  • window_manager version: ^0.4.3

Steps to Reproduce

  1. Create a new Flutter project
  2. Add window_manager as a dependency in pubspec.yaml
  3. Run the application in GTK_PLUG mode using gtk_plug_new()
  4. The window becomes completely black

Example Code

// Linux embedding code
GtkWidget* window = NULL;
if (self->plug_mode) {
  window = gtk_plug_new(0);
} else {
  window = GTK_WIDGET(gtk_application_window_new(GTK_APPLICATION(application)));
}

Expected Behavior

The application should display normally when running in GTK_PLUG mode, regardless of whether window_manager is included as a dependency.

Actual Behavior

The application window becomes completely black when running in GTK_PLUG mode if window_manager is included as a dependency, even without calling any of its APIs.

Additional Information

  • The issue only occurs when window_manager is added as a dependency
  • The application works normally in regular window mode
  • The black screen appears immediately upon launch
  • No error messages are displayed in the console

For reference, check my demo https://github.com/AoEiuV020/FlutterDemo/tree/fa72ddb5daf7e00a9d25499c5e4a1d4243f599c7

This project is a Flutter template project with modifications to ./linux/my_application.cc to support both normal window mode and plug mode operation.

I added a script ./embed_test/test.sh that compiles a wrapper window with a button to embed the Flutter demo. However, when embedded, the Flutter window shows only a black screen.

Comparing with the previous commit, the only change was adding the window_manager dependency - no other code changes were made. This single dependency addition caused the black screen issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant