8000 Adding leave fullscreen for x11. by jusax23 · Pull Request #366 · not-fl3/miniquad · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adding leave fullscreen for x11. #366

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

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/native/linux_x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ impl X11Display {
(self.libx11.XFlush)(self.display);
}

// TODO: _fullscreen is not used, this function always setting window fullscreen
8000 // should be able to able to go back from fullscreen to windowed instead
unsafe fn set_fullscreen(&mut self, window: Window, _fullscreen: bool) {
// Not 100% this is the correct way to leave fullscreen, but seems to work.
// TODO: Restore window size.
unsafe fn set_fullscreen(&mut self, window: Window, fullscreen: bool) {
let wm_state = (self.libx11.XInternAtom)(
self.display,
b"_NET_WM_STATE\x00" as *const u8 as *const _,
Expand All @@ -369,7 +369,7 @@ impl X11Display {
(self.libx11.XUnmapWindow)(self.display, window);
(self.libx11.XSync)(self.display, false as _);

let mut atoms: [Atom; 2] = [wm_fullscreen, 0 as _];
let mut atoms: [Atom; 2] = [if fullscreen { wm_fullscreen } else { 0 as _ }, 0 as _];
(self.libx11.XChangeProperty)(
self.display,
window,
Expand All @@ -378,7 +378,7 @@ impl X11Display {
32,
PropModeReplace,
atoms.as_mut_ptr() as *mut _ as *mut _,
1,
if fullscreen { 1 } else { 0 },
);
(self.libx11.XMapWindow)(self.display, window);
(self.libx11.XRaiseWindow)(self.display, window);
Expand All @@ -390,7 +390,8 @@ impl X11Display {
{
let mut data = [0isize; 5];

data[0] = 1;
// changing this 1 to 0 seems to help with closing fullscreen
data[0] = if fullscreen { 1 } else { 0 };
data[1] = wm_fullscreen as isize;
data[2] = 0;

Expand Down
0