update RGFW (fix X11 bug)
This commit is contained in:
parent
f1cf7bf349
commit
77f23bcc6a
32
src/external/RGFW.h
vendored
32
src/external/RGFW.h
vendored
|
|
@ -1790,12 +1790,12 @@ u32 RGFW_window_checkFPS(RGFW_window* win, u32 fpsCap) {
|
|||
u64 deltaTime = RGFW_getTimeNS() - win->event.frameTime;
|
||||
|
||||
u32 output_fps = 0;
|
||||
u64 fps = (u64)round(1e+9 / deltaTime);
|
||||
u64 fps = round(1e+9 / deltaTime);
|
||||
output_fps= fps;
|
||||
|
||||
if (fpsCap && fps > fpsCap) {
|
||||
u64 frameTimeNS = (u64)(1e+9 / fpsCap);
|
||||
u64 sleepTimeMS = (u64)((frameTimeNS - deltaTime) / 1e6);
|
||||
u64 frameTimeNS = 1e+9 / fpsCap;
|
||||
u64 sleepTimeMS = (frameTimeNS - deltaTime) / 1e6;
|
||||
|
||||
if (sleepTimeMS > 0) {
|
||||
RGFW_sleep(sleepTimeMS);
|
||||
|
|
@ -1809,7 +1809,7 @@ u32 RGFW_window_checkFPS(RGFW_window* win, u32 fpsCap) {
|
|||
return (u32) output_fps;
|
||||
|
||||
deltaTime = RGFW_getTimeNS() - win->event.frameTime2;
|
||||
output_fps = (u64)round(1e+9 / deltaTime);
|
||||
output_fps = round(1e+9 / deltaTime);
|
||||
win->event.frameTime2 = RGFW_getTimeNS();
|
||||
|
||||
return output_fps;
|
||||
|
|
@ -2662,13 +2662,14 @@ Start of Linux / Unix defines
|
|||
}
|
||||
|
||||
if (args & RGFW_NO_RESIZE) { /* make it so the user can't resize the window*/
|
||||
XSizeHints* sh = XAllocSizeHints();
|
||||
sh->flags = (1L << 4) | (1L << 5);
|
||||
sh->min_width = sh->max_width = win->r.w;
|
||||
sh->min_height = sh->max_height = win->r.h;
|
||||
XSizeHints sh = {0};
|
||||
sh.flags = (1L << 4) | (1L << 5);
|
||||
sh.min_width = sh.max_width = win->r.w;
|
||||
sh.min_height = sh.max_height = win->r.h;
|
||||
|
||||
XSetWMSizeHints((Display*) win->src.display, (Drawable) win->src.window, sh, XA_WM_NORMAL_HINTS);
|
||||
XFree(sh);
|
||||
XSetWMSizeHints((Display*) win->src.display, (Drawable) win->src.window, &sh, XA_WM_NORMAL_HINTS);
|
||||
|
||||
win->_winArgs |= RGFW_NO_RESIZE;
|
||||
}
|
||||
|
||||
if (args & RGFW_NO_BORDER) {
|
||||
|
|
@ -3234,7 +3235,18 @@ Start of Linux / Unix defines
|
|||
win->r.w = a.w;
|
||||
win->r.h = a.h;
|
||||
|
||||
|
||||
XResizeWindow((Display*) win->src.display, (Window) win->src.window, a.w, a.h);
|
||||
|
||||
if (!(win->_winArgs & RGFW_NO_RESIZE))
|
||||
return;
|
||||
|
||||
XSizeHints sh = {0};
|
||||
sh.flags = (1L << 4) | (1L << 5);
|
||||
sh.min_width = sh.max_width = a.w;
|
||||
sh.min_height = sh.max_height = a.h;
|
||||
|
||||
XSetWMSizeHints((Display*) win->src.display, (Drawable) win->src.window, &sh, XA_WM_NORMAL_HINTS);
|
||||
}
|
||||
|
||||
void RGFW_window_setMinSize(RGFW_window* win, RGFW_area a) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user