Skip to content

Commit 32d8a7a

Browse files
x11: support fullscreen option (sony#389)
This change adds fullscreen option support. Related issues: - sony#37 - sony/flutter-elinux#136 Signed-off-by: Hidenori Matsubayashi <[email protected]>
1 parent 820ee19 commit 32d8a7a

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/flutter/shell/platform/linux_embedded/window/elinux_window_x11.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ bool ELinuxWindowX11::CreateRenderSurface(int32_t width,
132132
}
133133
native_window_ = std::make_unique<NativeWindowX11>(
134134
display_, context_egl->GetAttrib(EGL_NATIVE_VISUAL_ID),
135-
view_properties_.title, width, height, view_properties_.enable_vsync);
135+
view_properties_.title, width, height, view_properties_.enable_vsync,
136+
view_properties_.view_mode == FlutterDesktopViewMode::kFullscreen);
136137
if (!native_window_->IsValid()) {
137138
ELINUX_LOG(ERROR) << "Failed to create the native window";
138139
return false;

src/flutter/shell/platform/linux_embedded/window/native_window_x11.cc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ NativeWindowX11::NativeWindowX11(Display* display,
2323
const char* title,
2424
const size_t width,
2525
const size_t height,
26-
bool enable_vsync) {
26+
bool enable_vsync,
27+
bool fullscreen) {
2728
XVisualInfo visualTemplate;
2829
visualTemplate.visualid = visual_id;
2930

@@ -44,10 +45,20 @@ NativeWindowX11::NativeWindowX11(Display* display,
4445
ButtonReleaseMask | PointerMotionMask | EnterWindowMask |
4546
LeaveWindowMask | FocusChangeMask | StructureNotifyMask;
4647

47-
window_ =
48-
XCreateWindow(display, RootWindow(display, visual->screen), 0, 0, width,
49-
height, 0, visual->depth, InputOutput, visual->visual,
50-
CWBorderPixel | CWColormap | CWEventMask, &windowAttribs);
48+
auto window_width = width;
49+
auto window_height = height;
50+
if (fullscreen) {
51+
XWindowAttributes attr;
52+
XGetWindowAttributes(display, RootWindow(display, visual->screen), &attr);
53+
window_width = attr.width;
54+
window_height = attr.height;
55+
windowAttribs.override_redirect = True;
56+
}
57+
58+
window_ = XCreateWindow(
59+
display, RootWindow(display, visual->screen), 0, 0, window_width,
60+
window_height, 0, visual->depth, InputOutput, visual->visual,
61+
CWBorderPixel | CWColormap | CWEventMask, &windowAttribs);
5162
if (!window_) {
5263
ELINUX_LOG(ERROR) << "Failed to the create window.";
5364
return;

src/flutter/shell/platform/linux_embedded/window/native_window_x11.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class NativeWindowX11 : public NativeWindow {
1818
const char* title,
1919
const size_t width,
2020
const size_t height,
21-
bool enable_vsync);
21+
bool enable_vsync,
22+
bool fullscreen);
2223
~NativeWindowX11() = default;
2324

2425
// |NativeWindow|

0 commit comments

Comments
 (0)