Skip to content

Commit 7ac13a3

Browse files
committed
vdisp/gl: old GLFW compat
1 parent bddb505 commit 7ac13a3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/video_display/gl.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ static constexpr pair<int64_t, string_view> keybindings[] = {
366366
pair<int64_t, string_view>{K_CTRL_UP, "make window 10% bigger"}
367367
};
368368

369+
#ifdef GLFW_PLATFORM
369370
const static struct {
370371
int platform_id;
371372
const char *name;
@@ -375,6 +376,7 @@ const static struct {
375376
{ GLFW_PLATFORM_WAYLAND, "Wayland" },
376377
{ GLFW_PLATFORM_X11, "X11" },
377378
};
379+
#endif // defined GLFW_PLATFORM
378380

379381
/* Prototyping */
380382
static bool check_display_gl_version(bool print_ver);
@@ -542,6 +544,7 @@ static void gl_print_monitors(bool fullhelp) {
542544
printf("\n");
543545
}
544546

547+
#ifdef GLFW_PLATFORM
545548
static void
546549
gl_print_platforms()
547550
{
@@ -572,6 +575,18 @@ gl_print_current_platform()
572575
#endif
573576
log_msg(ll, MOD_NAME "Using platform: %s\n", name);
574577
}
578+
#else // mot defined GLFW_PLATFORM
579+
static void
580+
gl_print_platforms()
581+
{
582+
MSG(ERROR, "platforms unsupported (old GLFW)\n");
583+
}
584+
// NOOP
585+
static void
586+
gl_print_current_platform()
587+
{
588+
}
589+
#endif // not defined GLFW_PLATFORM
575590

576591
#define FEATURE_PRESENT(x) (strcmp(STRINGIFY(x), "1") == 0 ? "on" : "off")
577592

@@ -753,6 +768,7 @@ parse_hints(struct state_gl *s, bool window_hints, char *hints)
753768
static bool
754769
set_platform(struct state_gl *s, const char *platform)
755770
{
771+
#ifdef GLFW_PLATFORM
756772
for (unsigned i = 0; i < ARR_COUNT(platform_map); ++i) {
757773
if (strcasecmp(platform_map[i].name, platform) == 0) {
758774
s->init_hints[GLFW_PLATFORM] = platform_map[i].platform_id;
@@ -761,6 +777,11 @@ set_platform(struct state_gl *s, const char *platform)
761777
}
762778
MSG(ERROR, "Unknown platform: %s\n", platform);
763779
return false;
780+
#else
781+
(void) s, (void) platform;
782+
MSG(ERROR, "platforms unsupported (old GLFW)\n");
783+
return false;
784+
#endif
764785
}
765786

766787
static void

0 commit comments

Comments
 (0)