@@ -3544,27 +3544,26 @@ RGFW_bool RGFW_loadEGL(void) { return RGFW_FALSE; }
35443544#endif
35453545
35463546void RGFW_window_setFlagsInternal(RGFW_window* win, RGFW_windowFlags flags, RGFW_windowFlags cmpFlags) {
3547- #ifndef RGFW_NO_MONITOR
3548- if (flags & RGFW_windowScaleToMonitor) RGFW_window_scaleToMonitor(win);
3549- #endif
3550-
3551- if (flags & RGFW_windowCenter) RGFW_window_center(win);
3552- if (flags & RGFW_windowCenterCursor) RGFW_window_moveMouse(win, win->x + (win->w / 2), win->y + (win->h / 2));
3553- if (flags & RGFW_windowNoBorder) RGFW_window_setBorder(win, 0);
3554- else if (cmpFlags & RGFW_windowNoBorder) RGFW_window_setBorder(win, 1);
3555- if (flags & RGFW_windowFullscreen) RGFW_window_setFullscreen(win, RGFW_TRUE);
3556- else if (cmpFlags & RGFW_windowFullscreen) RGFW_window_setFullscreen(win, 0);
3557- if (flags & RGFW_windowMaximize) RGFW_window_maximize(win);
3558- else if (cmpFlags & RGFW_windowMaximize) RGFW_window_restore(win);
3559- if (flags & RGFW_windowMinimize) RGFW_window_minimize(win);
3560- else if (cmpFlags & RGFW_windowMinimize) RGFW_window_restore(win);
3561- if (flags & RGFW_windowHideMouse) RGFW_window_showMouse(win, 0);
3562- else if (cmpFlags & RGFW_windowHideMouse) RGFW_window_showMouse(win, 1);
3563- if (flags & RGFW_windowHide) RGFW_window_hide(win);
3564- else if (cmpFlags & RGFW_windowHide) RGFW_window_show(win);
3565- if (flags & RGFW_windowFloating) RGFW_window_setFloating(win, 1);
3566- else if (cmpFlags & RGFW_windowFloating) RGFW_window_setFloating(win, 0);
3567- if (flags & RGFW_windowFocus) RGFW_window_focus(win);
3547+ if (flags & RGFW_windowNoBorder) RGFW_window_setBorder(win, 0);
3548+ else if (cmpFlags & RGFW_windowNoBorder) RGFW_window_setBorder(win, 1);
3549+ #ifndef RGFW_NO_MONITOR
3550+ if (flags & RGFW_windowScaleToMonitor) RGFW_window_scaleToMonitor(win);
3551+ #endif
3552+ if (flags & RGFW_windowMaximize) RGFW_window_maximize(win);
3553+ else if (cmpFlags & RGFW_windowMaximize) RGFW_window_restore(win);
3554+ if (flags & RGFW_windowMinimize) RGFW_window_minimize(win);
3555+ else if (cmpFlags & RGFW_windowMinimize) RGFW_window_restore(win);
3556+ if (flags & RGFW_windowCenter) RGFW_window_center(win);
3557+ if (flags & RGFW_windowCenterCursor) RGFW_window_moveMouse(win, win->x + (win->w / 2), win->y + (win->h / 2));
3558+ if (flags & RGFW_windowFullscreen) RGFW_window_setFullscreen(win, RGFW_TRUE);
3559+ else if (cmpFlags & RGFW_windowFullscreen) RGFW_window_setFullscreen(win, 0);
3560+ if (flags & RGFW_windowHideMouse) RGFW_window_showMouse(win, 0);
3561+ else if (cmpFlags & RGFW_windowHideMouse) RGFW_window_showMouse(win, 1);
3562+ if (flags & RGFW_windowHide) RGFW_window_hide(win);
3563+ else if (cmpFlags & RGFW_windowHide) RGFW_window_show(win);
3564+ if (flags & RGFW_windowFloating) RGFW_window_setFloating(win, 1);
3565+ else if (cmpFlags & RGFW_windowFloating) RGFW_window_setFloating(win, 0);
3566+ if (flags & RGFW_windowFocus) RGFW_window_focus(win);
35683567
35693568 if (flags & RGFW_windowNoResize) {
35703569 RGFW_window_setMaxSize(win, win->w, win->h);
@@ -6049,7 +6048,8 @@ void RGFW_XHandleEvent(void) {
60496048 }
60506049 case FocusIn:
60516050 if ((win->internal.flags & RGFW_windowFullscreen))
6052- XMapRaised(_RGFW->display, win->src.window);
6051+ RGFW_window_raise(win);
6052+
60536053 if ((win->internal.holdMouse)) RGFW_window_holdMouse(win);
60546054
60556055 if (!(win->internal.enabledEvents & RGFW_focusInFlag)) return;
@@ -6266,37 +6266,37 @@ void RGFW_FUNC(RGFW_window_maximize) (RGFW_window* win) {
62666266void RGFW_FUNC(RGFW_window_focus) (RGFW_window* win) {
62676267 RGFW_ASSERT(win);
62686268
6269- XWindowAttributes attr;
6270- XGetWindowAttributes(_RGFW->display, win->src.window, &attr);
6271- if (attr.map_state != IsViewable) return;
6269+ XWindowAttributes attr;
6270+ XGetWindowAttributes(_RGFW->display, win->src.window, &attr);
6271+ if (attr.map_state != IsViewable) return;
62726272
62736273 XSetInputFocus(_RGFW->display, win->src.window, RevertToPointerRoot, CurrentTime);
62746274 XFlush(_RGFW->display);
62756275}
62766276
62776277void RGFW_FUNC(RGFW_window_raise) (RGFW_window* win) {
62786278 RGFW_ASSERT(win);
6279- XRaiseWindow(_RGFW->display, win->src.window);
62806279 XMapRaised(_RGFW->display, win->src.window);
6280+ RGFW_window_setFullscreen(win, RGFW_window_isFullscreen(win));
62816281}
62826282
62836283void RGFW_window_setXAtom(RGFW_window* win, Atom netAtom, RGFW_bool fullscreen);
62846284void RGFW_window_setXAtom(RGFW_window* win, Atom netAtom, RGFW_bool fullscreen) {
62856285 RGFW_ASSERT(win != NULL);
6286- RGFW_LOAD_ATOM(_NET_WM_STATE);
6286+ RGFW_LOAD_ATOM(_NET_WM_STATE);
62876287
62886288 XEvent xev = {0};
6289- xev.xclient.type = ClientMessage;
6290- xev.xclient.serial = 0;
6291- xev.xclient.send_event = True;
6292- xev.xclient.message_type = _NET_WM_STATE;
6293- xev.xclient.window = win->src.window;
6294- xev.xclient.format = 32;
6295- xev.xclient.data.l[0] = fullscreen;
6296- xev.xclient.data.l[1] = (long int)netAtom;
6297- xev.xclient.data.l[2] = 0;
6289+ xev.xclient.type = ClientMessage;
6290+ xev.xclient.serial = 0;
6291+ xev.xclient.send_event = True;
6292+ xev.xclient.message_type = _NET_WM_STATE;
6293+ xev.xclient.window = win->src.window;
6294+ xev.xclient.format = 32;
6295+ xev.xclient.data.l[0] = fullscreen;
6296+ xev.xclient.data.l[1] = (long int)netAtom;
6297+ xev.xclient.data.l[2] = 0;
62986298
6299- XSendEvent(_RGFW->display, DefaultRootWindow(_RGFW->display), False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
6299+ XSendEvent(_RGFW->display, DefaultRootWindow(_RGFW->display), False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
63006300}
63016301
63026302void RGFW_FUNC(RGFW_window_setFullscreen)(RGFW_window* win, RGFW_bool fullscreen) {
@@ -6310,12 +6310,20 @@ void RGFW_FUNC(RGFW_window_setFullscreen)(RGFW_window* win, RGFW_bool fullscreen
63106310 win->internal.oldH = win->h;
63116311 }
63126312 else win->internal.flags &= ~(u32)RGFW_windowFullscreen;
6313- RGFW_LOAD_ATOM(_NET_WM_STATE_FULLSCREEN);
63146313
6314+ XRaiseWindow(_RGFW->display, win->src.window);
6315+
6316+ RGFW_LOAD_ATOM(_NET_WM_STATE_FULLSCREEN);
63156317 RGFW_window_setXAtom(win, _NET_WM_STATE_FULLSCREEN, fullscreen);
63166318
6317- XRaiseWindow(_RGFW->display, win->src.window);
6318- XMapRaised(_RGFW->display, win->src.window);
6319+ if (!(win->internal.flags & RGFW_windowTransparent)) {
6320+ const unsigned char value = fullscreen;
6321+ RGFW_LOAD_ATOM(_NET_WM_BYPASS_COMPOSITOR);
6322+ XChangeProperty(
6323+ _RGFW->display, win->src.window,
6324+ _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
6325+ PropModeReplace, &value, 1);
6326+ }
63196327}
63206328
63216329void RGFW_FUNC(RGFW_window_setFloating)(RGFW_window* win, RGFW_bool floating) {
@@ -6542,6 +6550,7 @@ void RGFW_FUNC(RGFW_window_show) (RGFW_window* win) {
65426550
65436551 XMapWindow(_RGFW->display, win->src.window);
65446552 RGFW_window_move(win, win->x, win->y);
6553+ RGFW_window_setFullscreen(win, RGFW_window_isFullscreen(win));
65456554 return;
65466555}
65476556
@@ -9822,8 +9831,8 @@ void RGFW_window_setMaxSize(RGFW_window* win, i32 w, i32 h) {
98229831
98239832void RGFW_window_focus(RGFW_window* win) {
98249833 RGFW_ASSERT(win);
9825- SetForegroundWindow(win->src.window);
9826- SetFocus(win->src.window);
9834+ SetForegroundWindow(win->src.window);
9835+ SetFocus(win->src.window);
98279836}
98289837
98299838void RGFW_window_raise(RGFW_window* win) {
0 commit comments