Skip to content

Commit

Permalink
x11: support fullscreen option (#389)
Browse files Browse the repository at this point in the history
This change adds fullscreen option support.

Related issues:
- #37
- sony/flutter-elinux#136

Signed-off-by: Hidenori Matsubayashi <Hidenori.Matsubayashi@gmail.com>
  • Loading branch information
HidenoriMatsubayashi authored Sep 29, 2023
1 parent 820ee19 commit 32d8a7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ bool ELinuxWindowX11::CreateRenderSurface(int32_t width,
}
native_window_ = std::make_unique<NativeWindowX11>(
display_, context_egl->GetAttrib(EGL_NATIVE_VISUAL_ID),
view_properties_.title, width, height, view_properties_.enable_vsync);
view_properties_.title, width, height, view_properties_.enable_vsync,
view_properties_.view_mode == FlutterDesktopViewMode::kFullscreen);
if (!native_window_->IsValid()) {
ELINUX_LOG(ERROR) << "Failed to create the native window";
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ NativeWindowX11::NativeWindowX11(Display* display,
const char* title,
const size_t width,
const size_t height,
bool enable_vsync) {
bool enable_vsync,
bool fullscreen) {
XVisualInfo visualTemplate;
visualTemplate.visualid = visual_id;

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

window_ =
XCreateWindow(display, RootWindow(display, visual->screen), 0, 0, width,
height, 0, visual->depth, InputOutput, visual->visual,
CWBorderPixel | CWColormap | CWEventMask, &windowAttribs);
auto window_width = width;
auto window_height = height;
if (fullscreen) {
XWindowAttributes attr;
XGetWindowAttributes(display, RootWindow(display, visual->screen), &attr);
window_width = attr.width;
window_height = attr.height;
windowAttribs.override_redirect = True;
}

window_ = XCreateWindow(
display, RootWindow(display, visual->screen), 0, 0, window_width,
window_height, 0, visual->depth, InputOutput, visual->visual,
CWBorderPixel | CWColormap | CWEventMask, &windowAttribs);
if (!window_) {
ELINUX_LOG(ERROR) << "Failed to the create window.";
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class NativeWindowX11 : public NativeWindow {
const char* title,
const size_t width,
const size_t height,
bool enable_vsync);
bool enable_vsync,
bool fullscreen);
~NativeWindowX11() = default;

// |NativeWindow|
Expand Down

0 comments on commit 32d8a7a

Please sign in to comment.