Skip to content

Commit 32439f9

Browse files
Merge pull request #433 from Hedgehogsoft/main
2 parents 1870957 + 42835e3 commit 32439f9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ In this PR I am redefining how RGFW handles versioning. Breaking changes are goi
3333
- add `RGFW_mouseProgress`
3434
- add `RGFW_window_flash` and enum, `RGFW_flashRequest`
3535
- add new example `examples/flash/flash` to demonstrate `RGFW_window_flash`
36+
- standardize vsync being disabled by default (OpenGL)
3637

3738
Release: RGFW 1.8.0
3839
-----------------------------------------------

RGFW.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3342,7 +3342,10 @@ void RGFW_window_close(RGFW_window* win) {
33423342

33433343
RGFW_window* RGFW_createWindowPtr(const char* name, i32 x, i32 y, i32 w, i32 h, RGFW_windowFlags flags, RGFW_window* win) {
33443344
RGFW_ASSERT(win != NULL);
3345+
if (name == NULL) name = "\0";
3346+
33453347
RGFW_MEMSET(win, 0, sizeof(RGFW_window));
3348+
33463349
if (_RGFW == NULL) RGFW_init();
33473350
_RGFW->windowCount++;
33483351

@@ -6239,7 +6242,7 @@ void RGFW_FUNC(RGFW_pollEvents) (void) {
62396242

62406243
XPending(_RGFW->display);
62416244
/* if there is no unread queued events, get a new one */
6242-
while ((QLength(_RGFW->display) || XEventsQueued(_RGFW->display, QueuedAlready) + XEventsQueued(_RGFW->display, QueuedAfterReading))) {
6245+
while (QLength(_RGFW->display)) {
62436246
RGFW_XHandleEvent();
62446247
}
62456248
}
@@ -6486,6 +6489,7 @@ RGFW_bool RGFW_FUNC(RGFW_window_isFloating)(RGFW_window* win) {
64866489

64876490
void RGFW_FUNC(RGFW_window_setName)(RGFW_window* win, const char* name) {
64886491
RGFW_ASSERT(win != NULL);
6492+
if (name == NULL) name = "\0";
64896493

64906494
XStoreName(_RGFW->display, win->src.window, name);
64916495

@@ -7262,6 +7266,8 @@ RGFW_bool RGFW_FUNC(RGFW_window_createContextPtr_OpenGL) (RGFW_window* win, RGFW
72627266
glXMakeCurrent(_RGFW->display, (Drawable)win->src.ctx.native->window, (GLXContext)win->src.ctx.native->ctx);
72637267
RGFW_sendDebugInfo(RGFW_typeInfo, RGFW_infoOpenGL, "OpenGL context initalized.");
72647268

7269+
RGFW_window_swapInterval_OpenGL(win, 0);
7270+
72657271
return RGFW_TRUE;
72667272
}
72677273

@@ -8766,6 +8772,8 @@ RGFW_bool RGFW_FUNC(RGFW_window_isFloating)(RGFW_window* win) {
87668772

87678773
void RGFW_FUNC(RGFW_window_setName) (RGFW_window* win, const char* name) {
87688774
RGFW_ASSERT(win != NULL);
8775+
if (name == NULL) name = "\0";
8776+
87698777
if (_RGFW->compositor)
87708778
xdg_toplevel_set_title(win->src.xdg_toplevel, name);
87718779
}
@@ -9015,6 +9023,8 @@ RGFW_proc RGFW_FUNC(RGFW_getProcAddress_OpenGL) (const char* procname) { return
90159023
RGFW_bool RGFW_FUNC(RGFW_window_createContextPtr_OpenGL)(RGFW_window* win, RGFW_glContext* ctx, RGFW_glHints* hints) {
90169024
RGFW_bool out = RGFW_window_createContextPtr_EGL(win, &ctx->egl, hints);
90179025
win->src.gfxType = RGFW_gfxNativeOpenGL;
9026+
9027+
RGFW_window_swapInterval_OpenGL(win, 0);
90189028
return out;
90199029
}
90209030
void RGFW_FUNC(RGFW_window_deleteContextPtr_OpenGL) (RGFW_window* win, RGFW_glContext* ctx) { RGFW_window_deleteContextPtr_EGL(win, &ctx->egl); win->src.ctx.native = NULL; }
@@ -10498,6 +10508,7 @@ void RGFW_window_resize(RGFW_window* win, i32 w, i32 h) {
1049810508

1049910509
void RGFW_window_setName(RGFW_window* win, const char* name) {
1050010510
RGFW_ASSERT(win != NULL);
10511+
if (name == NULL) name = "\0";
1050110512

1050210513
wchar_t wide_name[256];
1050310514
MultiByteToWideChar(CP_UTF8, 0, name, -1, wide_name, 256);
@@ -12396,6 +12407,7 @@ RGFW_bool RGFW_window_isFloating(RGFW_window* win) {
1239612407

1239712408
void RGFW_window_setName(RGFW_window* win, const char* name) {
1239812409
RGFW_ASSERT(win != NULL);
12410+
if (name == NULL) name = "\0";
1239912411

1240012412
id str = NSString_stringWithUTF8String(name);
1240112413
objc_msgSend_void_id((id)win->src.window, sel_registerName("setTitle:"), str);
@@ -12923,6 +12935,8 @@ RGFW_bool RGFW_window_createContextPtr_OpenGL(RGFW_window* win, RGFW_glContext*
1292312935
objc_msgSend_void_bool(win->src.view, sel_registerName("setWantsLayer:"), true);
1292412936
objc_msgSend_int((id)win->src.view, sel_registerName("setLayerContentsPlacement:"), 4);
1292512937

12938+
RGFW_window_swapInterval_OpenGL(win, 0);
12939+
1292612940
RGFW_sendDebugInfo(RGFW_typeInfo, RGFW_infoOpenGL, "OpenGL context initalized.");
1292712941
return RGFW_TRUE;
1292812942
}
@@ -13684,6 +13698,9 @@ RGFW_bool RGFW_window_createContextPtr_OpenGL(RGFW_window* win, RGFW_glContext*
1368413698
EM_ASM("Module.useWebGL = true; GLImmediate.init();");
1368513699
RGFW_sendDebugInfo(RGFW_typeInfo, RGFW_infoOpenGL, "OpenGL context initalized.");
1368613700
#endif
13701+
13702+
RGFW_window_swapInterval_OpenGL(win, 0);
13703+
1368713704
return RGFW_TRUE;
1368813705
}
1368913706

@@ -13749,6 +13766,8 @@ void RGFW_captureCursor(RGFW_window* win) {
1374913766

1375013767
void RGFW_window_setName(RGFW_window* win, const char* name) {
1375113768
RGFW_UNUSED(win);
13769+
if (name == NULL) name = "\0";
13770+
1375213771
emscripten_set_window_title(name);
1375313772
}
1375413773

0 commit comments

Comments
 (0)