Skip to content

Commit

Permalink
fix compiling (on X11)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Feb 5, 2025
1 parent 5382aca commit 4874b0c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ifeq ($(RGFW_WAYLAND), 1)
else ifeq ($(CC),emcc)
@echo nostl is not supported on this platform
else ifeq ($(detected_OS),Linux)
$(CC) $(CFLAGS) -I. $< -o $@$(EXT)
$(CC) $(CFLAGS) -I. -lXrandr $< -o $@$(EXT)
else ifeq ($(detected_OS),windows)
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -lgdi32 -o $@$(EXT)
else ifeq ($(detected_OS),Darwin)
Expand Down Expand Up @@ -236,7 +236,7 @@ examples/gl33/gl33: examples/gl33/gl33.c RGFW.h
ifeq ($(RGFW_WAYLAND), 1)
$(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL1) -lwayland-egl -o $@$(EXT)
else ifeq ($(detected_OS),Linux)
$(CC) $(CFLAGS) -I. $< -o $@$(EXT)
$(CC) $(CFLAGS) -I. $< -lXrandr -o $@$(EXT)
else ifeq ($(detected_OS),windows)
$(CC) $(CFLAGS) $(WARNINGS) -I. $< -lgdi32 -o $@$(EXT)
else ifeq ($(detected_OS),Darwin)
Expand Down
4 changes: 2 additions & 2 deletions RGFW.h
Original file line number Diff line number Diff line change
Expand Up @@ -3336,7 +3336,7 @@ RGFW_window* RGFW_createWindowPtr(const char* name, RGFW_rect rect, RGFW_windowF
RGFW_GOTO_WAYLAND(0);
#ifdef RGFW_X11
u64 event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask | FocusChangeMask | LeaveWindowMask | EnterWindowMask | ExposureMask; /*!< X11 events accepted*/

#if defined(RGFW_OPENGL) && !defined(RGFW_EGL)
u32* visual_attribs = (u32*)RGFW_initFormatAttribs(flags & RGFW_windowOpenglSoftware);
i32 fbcount;
Expand Down Expand Up @@ -3451,7 +3451,7 @@ RGFW_window* RGFW_createWindowPtr(const char* name, RGFW_rect rect, RGFW_windowF

GLXContext ctx = NULL;

if (RGFW_root != NULL)
if (RGFW_root != NULL && RGFW_root != win)
ctx = RGFW_root->src.ctx;

win->src.ctx = glXCreateContextAttribsARB(win->src.display, bestFbc, ctx, True, context_attribs);
Expand Down
7 changes: 3 additions & 4 deletions examples/icons/icons.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
int main(void) {
int w, h, c;
unsigned char* icon = stbi_load("logo.png", &w, &h, &c, 0);

RGFW_mouse* mouse = RGFW_loadMouse(icon, RGFW_AREA(w, h), c);

printf("hewwo\n");
RGFW_window* win = RGFW_createWindow("RGFW icons", RGFW_RECT(0, 0, 600, 400), RGFW_windowCenter | RGFW_windowNoResize);

printf("hewwo\n");
RGFW_mouse* mouse = RGFW_loadMouse(icon, RGFW_AREA(w, h), c);
RGFW_window_setIcon(win, icon, RGFW_AREA(w, h), c);
RGFW_window_setMouse(win, mouse);

Expand Down
5 changes: 4 additions & 1 deletion examples/osmesa/osmesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ void clear(RGFW_window* win, u8 color[4]) {

int main(void) {
RGFW_setClassName("RGFW Basic");

RGFW_window* win = RGFW_createWindow("RGFW Example Window", RGFW_RECT(500, 500, 500, 500), RGFW_windowAllowDND | RGFW_windowCenter);
RGFW_window_initBuffer(win);

RGFW_window_makeCurrent(win);
screenSize = RGFW_getScreenSize();
screenSize = RGFW_getScreenSize();

while (RGFW_window_shouldClose(win) == RGFW_FALSE) {
while (RGFW_window_checkEvent(win) != NULL);
Expand Down

0 comments on commit 4874b0c

Please sign in to comment.