mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Properly check for fullscreen toggle made through the Window Manager
This commit is contained in:
parent
1d2b59b941
commit
6e2c670826
@ -1789,6 +1789,49 @@ bool OS_X11::window_maximize_check(const char *p_atom_name) const {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OS_X11::window_fullscreen_check() const {
|
||||||
|
// Using EWMH -- Extended Window Manager Hints
|
||||||
|
Atom property = XInternAtom(x11_display, "_NET_WM_STATE", False);
|
||||||
|
Atom type;
|
||||||
|
int format;
|
||||||
|
unsigned long len;
|
||||||
|
unsigned long remaining;
|
||||||
|
unsigned char *data = nullptr;
|
||||||
|
bool retval = false;
|
||||||
|
|
||||||
|
if (property == None) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = XGetWindowProperty(
|
||||||
|
x11_display,
|
||||||
|
x11_window,
|
||||||
|
property,
|
||||||
|
0,
|
||||||
|
1024,
|
||||||
|
False,
|
||||||
|
XA_ATOM,
|
||||||
|
&type,
|
||||||
|
&format,
|
||||||
|
&len,
|
||||||
|
&remaining,
|
||||||
|
&data);
|
||||||
|
|
||||||
|
if (result == Success) {
|
||||||
|
Atom *atoms = (Atom *)data;
|
||||||
|
Atom wm_fullscreen = XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
|
for (uint64_t i = 0; i < len; i++) {
|
||||||
|
if (atoms[i] == wm_fullscreen) {
|
||||||
|
retval = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XFree(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
bool OS_X11::is_window_maximize_allowed() const {
|
bool OS_X11::is_window_maximize_allowed() const {
|
||||||
return window_maximize_check("_NET_WM_ALLOWED_ACTIONS");
|
return window_maximize_check("_NET_WM_ALLOWED_ACTIONS");
|
||||||
}
|
}
|
||||||
@ -2632,6 +2675,7 @@ void OS_X11::process_xevents() {
|
|||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case Expose: {
|
case Expose: {
|
||||||
DEBUG_LOG_X11("[%u] Expose window=%lu, count='%u' \n", frame, event.xexpose.window, event.xexpose.count);
|
DEBUG_LOG_X11("[%u] Expose window=%lu, count='%u' \n", frame, event.xexpose.window, event.xexpose.count);
|
||||||
|
current_videomode.fullscreen = window_fullscreen_check();
|
||||||
|
|
||||||
Main::force_redraw();
|
Main::force_redraw();
|
||||||
} break;
|
} break;
|
||||||
|
@ -246,6 +246,7 @@ protected:
|
|||||||
void _window_changed(XEvent *event);
|
void _window_changed(XEvent *event);
|
||||||
|
|
||||||
bool window_maximize_check(const char *p_atom_name) const;
|
bool window_maximize_check(const char *p_atom_name) const;
|
||||||
|
bool window_fullscreen_check() const;
|
||||||
bool is_window_maximize_allowed() const;
|
bool is_window_maximize_allowed() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user