-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
X11 backend fullscreen mode doesn't acquire root window, just maximises ap window instead
Suggested code to fix the problem
src/flutter/shell/platform/linux_embedded/window/native_window_x11.cc
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <stdbool.h>
Display *display;
Window window;
int screen;
bool fullscreen = true; // Your condition for fullscreen
unsigned int window_width, window_height;
if (fullscreen) {
// Get the screen dimensions
screen = DefaultScreen(display);
window_width = DisplayWidth(display, screen);
window_height = DisplayHeight(display, screen);
// Define window attributes
XSetWindowAttributes windowAttribs;
windowAttribs.override_redirect = True;
// Create a fullscreen window
window = XCreateWindow(display, RootWindow(display, screen),
0, 0, window_width, window_height,
0, CopyFromParent, InputOutput,
CopyFromParent, CWOverrideRedirect, &windowAttribs);
// You may want to set additional properties, like:
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", False);
Atom fullscreen_state = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
XChangeProperty(display, window, wm_state, XA_ATOM, 32, PropModeReplace,
(unsigned char *)&fullscreen_state, 1);
// Map the window to the screen
XMapWindow(display, window);
// Optional: Ensure the window is focused
XSetInputFocus(display, window, RevertToParent, CurrentTime);
// Your drawing/rendering code would go here
} else {
// Handle windowed mode...
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels