diff --git a/glfw/cocoa_init.m b/glfw/cocoa_init.m index 44c40e732..bb09aa005 100644 --- a/glfw/cocoa_init.m +++ b/glfw/cocoa_init.m @@ -197,7 +197,7 @@ static void createKeyTables(void) // Retrieve Unicode data for the current keyboard layout // -static GLFWbool updateUnicodeDataNS(void) +static bool updateUnicodeDataNS(void) { if (_glfw.ns.inputSource) { @@ -232,7 +232,7 @@ static GLFWbool updateUnicodeDataNS(void) // Load HIToolbox.framework and the TIS symbols we need from it // -static GLFWbool initializeTIS(void) +static bool initializeTIS(void) { // This works only because Cocoa has already loaded it properly _glfw.ns.tis.bundle = @@ -558,7 +558,7 @@ void _glfwPlatformRemoveTimer(unsigned long long timer_id) { } } -void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, GLFWbool enabled) { +void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, bool enabled) { for (size_t i = 0; i < num_timers; i++) { if (timers[i].id == timer_id) { Timer *t = timers + i; diff --git a/glfw/cocoa_monitor.m b/glfw/cocoa_monitor.m index dab1e03b1..8f02be8f8 100644 --- a/glfw/cocoa_monitor.m +++ b/glfw/cocoa_monitor.m @@ -116,7 +116,7 @@ static char* getDisplayName(CGDirectDisplayID displayID) // Check whether the display mode should be included in enumeration // -static GLFWbool modeIsGood(CGDisplayModeRef mode) +static bool modeIsGood(CGDisplayModeRef mode) { uint32_t flags = CGDisplayModeGetIOFlags(mode); @@ -215,7 +215,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token) // Finds and caches the NSScreen corresponding to the specified monitor // -GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor) +bool refreshMonitorScreen(_GLFWmonitor* monitor) { if (monitor->ns.screen) return GLFW_TRUE; @@ -265,7 +265,7 @@ static CVReturn displayLinkCallback( { CGDirectDisplayID displayID = (CGDirectDisplayID)userInfo; [_glfw.ns.displayLinks.lock lock]; - GLFWbool notify = GLFW_FALSE; + bool notify = GLFW_FALSE; for (size_t i = 0; i < _glfw.ns.displayLinks.count; i++) { if (_glfw.ns.displayLinks.entries[i].displayID == displayID) { if (_glfw.ns.displayLinks.entries[i].renderFrameRequested) { @@ -542,7 +542,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode) CVDisplayLinkRelease(link); } -GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID); CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); diff --git a/glfw/cocoa_platform.h b/glfw/cocoa_platform.h index 755a605a8..15e500dc4 100644 --- a/glfw/cocoa_platform.h +++ b/glfw/cocoa_platform.h @@ -116,8 +116,8 @@ typedef struct _GLFWwindowNS id view; id layer; - GLFWbool maximized; - GLFWbool retina; + bool maximized; + bool retina; // Cached window properties to filter out duplicate events int width, height; @@ -136,7 +136,7 @@ typedef struct _GLFWwindowNS // Dead key state UInt32 deadKeyState; // Whether a render frame has been requested for this window - GLFWbool renderFrameRequested; + bool renderFrameRequested; GLFWcocoarenderframefun renderFrameCallback; } _GLFWwindowNS; @@ -144,8 +144,8 @@ typedef struct _GLFWDisplayLinkNS { CVDisplayLinkRef displayLink; CGDirectDisplayID displayID; - GLFWbool displayLinkStarted; - GLFWbool renderFrameRequested; + bool displayLinkStarted; + bool renderFrameRequested; } _GLFWDisplayLinkNS; // Cocoa-specific global data @@ -154,7 +154,7 @@ typedef struct _GLFWlibraryNS { CGEventSourceRef eventSource; id delegate; - GLFWbool cursorHidden; + bool cursorHidden; TISInputSourceRef inputSource; IOHIDManagerRef hidManager; id unicodeData; diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 9b90667ba..d4621ef8f 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -100,7 +100,7 @@ _glfwRestartDisplayLinks(void) { // Returns whether the cursor is in the content area of the specified window // -static GLFWbool cursorInContentArea(_GLFWwindow* window) +static bool cursorInContentArea(_GLFWwindow* window) { const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; return [window->ns.view mouse:pos inRect:[window->ns.view frame]]; @@ -263,7 +263,7 @@ safe_name_for_scancode(unsigned int scancode) { // Translates a macOS keycode to a GLFW keycode // -static int translateKey(unsigned int key, GLFWbool apply_keymap) +static int translateKey(unsigned int key, bool apply_keymap) { if (apply_keymap) { // Look for the effective key name after applying any keyboard layouts/mappings @@ -860,7 +860,7 @@ convert_utf16_to_utf8(UniChar *src, UniCharCount src_length, char *dest, size_t CFRelease(string); } -static inline GLFWbool +static inline bool is_ascii_control_char(char x) { return x == 0 || (1 <= x && x <= 31) || x == 127; } @@ -871,7 +871,7 @@ is_ascii_control_char(char x) { const NSUInteger flags = [event modifierFlags]; const int mods = translateFlags(flags); const int key = translateKey(scancode, GLFW_TRUE); - const GLFWbool process_text = !window->ns.textInputFilterCallback || window->ns.textInputFilterCallback(key, mods, scancode, flags) != 1; + const bool process_text = !window->ns.textInputFilterCallback || window->ns.textInputFilterCallback(key, mods, scancode, flags) != 1; const bool previous_has_marked_text = [self hasMarkedText]; [self unmarkText]; _glfw.ns.text[0] = 0; @@ -1285,7 +1285,7 @@ static void createMenuBar(void) // Initialize the Cocoa Application Kit // -static GLFWbool initializeAppKit(void) +static bool initializeAppKit(void) { if (_glfw.ns.delegate) return GLFW_TRUE; @@ -1329,7 +1329,7 @@ static GLFWbool initializeAppKit(void) // Create the Cocoa window // -static GLFWbool createNativeWindow(_GLFWwindow* window, +static bool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig) { @@ -1800,18 +1800,18 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) return ![window->ns.object isOpaque] && ![window->ns.view isOpaque]; } -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled) { [window->ns.object setStyleMask:getStyleMask(window)]; } -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) { [window->ns.object setStyleMask:getStyleMask(window)]; [window->ns.object makeFirstResponder:window->ns.view]; } -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) { if (enabled) [window->ns.object setLevel:NSFloatingWindowLevel]; diff --git a/glfw/context.c b/glfw/context.c index 1d7fefff7..51178a5f7 100644 --- a/glfw/context.c +++ b/glfw/context.c @@ -44,7 +44,7 @@ // exists and whether all relevant options have supported and non-conflicting // values // -GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) +bool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) { if (ctxconfig->share) { @@ -341,7 +341,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, // Retrieves the attributes of the current context // -GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, +bool _glfwRefreshContextAttribs(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig) { int i; @@ -577,7 +577,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, // Searches an extension string for the specified extension // -GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions) +bool _glfwStringInExtensionString(const char* string, const char* extensions) { const char* start = extensions; diff --git a/glfw/dbus_glfw.c b/glfw/dbus_glfw.c index 97bb907cb..9c7762bc4 100644 --- a/glfw/dbus_glfw.c +++ b/glfw/dbus_glfw.c @@ -45,7 +45,7 @@ report_error(DBusError *err, const char *fmt, ...) { static _GLFWDBUSData *dbus_data = NULL; static DBusConnection *session_bus = NULL; -GLFWbool +bool glfw_dbus_init(_GLFWDBUSData *dbus, EventLoopData *eld) { dbus->eld = eld; dbus_data = dbus; @@ -136,7 +136,7 @@ toggle_dbus_timeout(DBusTimeout *timeout, void *data) { DBusConnection* -glfw_dbus_connect_to(const char *path, const char* err_msg, const char *name, GLFWbool register_on_bus) { +glfw_dbus_connect_to(const char *path, const char* err_msg, const char *name, bool register_on_bus) { DBusError err; dbus_error_init(&err); DBusConnection *ans = dbus_connection_open_private(path, &err); @@ -195,14 +195,14 @@ glfw_dbus_close_connection(DBusConnection *conn) { dbus_connection_unref(conn); } -GLFWbool +bool glfw_dbus_get_args(DBusMessage *msg, const char *failmsg, ...) { DBusError err; dbus_error_init(&err); va_list ap; va_start(ap, failmsg); int firstarg = va_arg(ap, int); - GLFWbool ret = dbus_message_get_args_valist(msg, &err, firstarg, ap) ? GLFW_TRUE : GLFW_FALSE; + bool ret = dbus_message_get_args_valist(msg, &err, firstarg, ap) ? GLFW_TRUE : GLFW_FALSE; va_end(ap); if (!ret) report_error(&err, failmsg); return ret; @@ -233,9 +233,9 @@ method_reply_received(DBusPendingCall *pending, void *user_data) { } } -GLFWbool +bool call_method_with_msg(DBusConnection *conn, DBusMessage *msg, int timeout, dbus_pending_callback callback, void *user_data) { - GLFWbool retval = GLFW_FALSE; + bool retval = GLFW_FALSE; #define REPORT(errs) _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to call DBUS method: node=%s path=%s interface=%s method=%s, with error: %s", dbus_message_get_destination(msg), dbus_message_get_path(msg), dbus_message_get_interface(msg), dbus_message_get_member(msg), errs) if (callback) { DBusPendingCall *pending = NULL; @@ -260,12 +260,12 @@ call_method_with_msg(DBusConnection *conn, DBusMessage *msg, int timeout, dbus_p #undef REPORT } -static GLFWbool +static bool call_method(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, int timeout, dbus_pending_callback callback, void *user_data, va_list ap) { if (!conn) return GLFW_FALSE; DBusMessage *msg = dbus_message_new_method_call(node, path, interface, method); if (!msg) return GLFW_FALSE; - GLFWbool retval = GLFW_FALSE; + bool retval = GLFW_FALSE; int firstarg = va_arg(ap, int); if ((firstarg == DBUS_TYPE_INVALID) || dbus_message_append_args_valist(msg, firstarg, ap)) { @@ -278,9 +278,9 @@ call_method(DBusConnection *conn, const char *node, const char *path, const char return retval; } -GLFWbool +bool glfw_dbus_call_method_with_reply(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, int timeout, dbus_pending_callback callback, void* user_data, ...) { - GLFWbool retval; + bool retval; va_list ap; va_start(ap, user_data); retval = call_method(conn, node, path, interface, method, timeout, callback, user_data, ap); @@ -288,9 +288,9 @@ glfw_dbus_call_method_with_reply(DBusConnection *conn, const char *node, const c return retval; } -GLFWbool +bool glfw_dbus_call_method_no_reply(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) { - GLFWbool retval; + bool retval; va_list ap; va_start(ap, method); retval = call_method(conn, node, path, interface, method, DBUS_TIMEOUT_USE_DEFAULT, NULL, NULL, ap); diff --git a/glfw/dbus_glfw.h b/glfw/dbus_glfw.h index 26776f015..bcc49b7b9 100644 --- a/glfw/dbus_glfw.h +++ b/glfw/dbus_glfw.h @@ -37,18 +37,18 @@ typedef struct { } _GLFWDBUSData; -GLFWbool glfw_dbus_init(_GLFWDBUSData *dbus, EventLoopData *eld); +bool glfw_dbus_init(_GLFWDBUSData *dbus, EventLoopData *eld); void glfw_dbus_terminate(_GLFWDBUSData *dbus); -DBusConnection* glfw_dbus_connect_to(const char *path, const char* err_msg, const char* name, GLFWbool register_on_bus); +DBusConnection* glfw_dbus_connect_to(const char *path, const char* err_msg, const char* name, bool register_on_bus); void glfw_dbus_close_connection(DBusConnection *conn); -GLFWbool +bool call_method_with_msg(DBusConnection *conn, DBusMessage *msg, int timeout, dbus_pending_callback callback, void *user_data); -GLFWbool +bool glfw_dbus_call_method_no_reply(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); -GLFWbool +bool glfw_dbus_call_method_with_reply(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, int timeout_ms, dbus_pending_callback callback, void *user_data, ...); void glfw_dbus_dispatch(DBusConnection *); void glfw_dbus_session_bus_dispatch(void); -GLFWbool glfw_dbus_get_args(DBusMessage *msg, const char *failmsg, ...); +bool glfw_dbus_get_args(DBusMessage *msg, const char *failmsg, ...); int glfw_dbus_match_signal(DBusMessage *msg, const char *interface, ...); DBusConnection* glfw_dbus_session_bus(void); diff --git a/glfw/egl_context.c b/glfw/egl_context.c index 604582c1b..f12d121fb 100644 --- a/glfw/egl_context.c +++ b/glfw/egl_context.c @@ -85,7 +85,7 @@ static int getEGLConfigAttrib(EGLConfig config, int attrib) // Return the EGLConfig most closely matching the specified hints // -static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, +static bool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* desired, EGLConfig* result) { @@ -297,7 +297,7 @@ static void destroyContextEGL(_GLFWwindow* window) // Initialize EGL // -GLFWbool _glfwInitEGL(void) +bool _glfwInitEGL(void) { int i; const char* sonames[] = @@ -453,7 +453,7 @@ void _glfwTerminateEGL(void) // Create the OpenGL or OpenGL ES context // -GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, +bool _glfwCreateContextEGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { @@ -714,7 +714,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, // Returns the Visual and depth of the chosen EGLConfig // #if defined(_GLFW_X11) -GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, +bool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth) diff --git a/glfw/egl_context.h b/glfw/egl_context.h index 534beb8c8..5ceb47f6a 100644 --- a/glfw/egl_context.h +++ b/glfw/egl_context.h @@ -173,13 +173,13 @@ typedef struct _GLFWlibraryEGL { EGLDisplay display; EGLint major, minor; - GLFWbool prefix; + bool prefix; - GLFWbool KHR_create_context; - GLFWbool KHR_create_context_no_error; - GLFWbool KHR_gl_colorspace; - GLFWbool KHR_get_all_proc_addresses; - GLFWbool KHR_context_flush_control; + bool KHR_create_context; + bool KHR_create_context_no_error; + bool KHR_gl_colorspace; + bool KHR_get_all_proc_addresses; + bool KHR_context_flush_control; void* handle; @@ -203,13 +203,13 @@ typedef struct _GLFWlibraryEGL } _GLFWlibraryEGL; -GLFWbool _glfwInitEGL(void); +bool _glfwInitEGL(void); void _glfwTerminateEGL(void); -GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, +bool _glfwCreateContextEGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); #if defined(_GLFW_X11) -GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, +bool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth); diff --git a/glfw/glx_context.c b/glfw/glx_context.c index b8cab7154..e6ae717ec 100644 --- a/glfw/glx_context.c +++ b/glfw/glx_context.c @@ -47,7 +47,7 @@ static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib) // Return the GLXFBConfig most closely matching the specified hints // -static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, +static bool chooseGLXFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result) { GLXFBConfig* nativeConfigs; @@ -55,7 +55,7 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, const _GLFWfbconfig* closest; int i, nativeCount, usableCount; const char* vendor; - GLFWbool trustWindowBit = GLFW_TRUE; + bool trustWindowBit = GLFW_TRUE; // HACK: This is a (hopefully temporary) workaround for Chromium // (VirtualBox GL) not setting the window bit on any GLXFBConfigs @@ -248,7 +248,7 @@ static void destroyContextGLX(_GLFWwindow* window) // Initialize GLX // -GLFWbool _glfwInitGLX(void) +bool _glfwInitGLX(void) { int i; const char* sonames[] = @@ -440,7 +440,7 @@ void _glfwTerminateGLX(void) // Create the OpenGL or OpenGL ES context // -GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, +bool _glfwCreateContextGLX(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { @@ -631,7 +631,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, // Returns the Visual and depth of the chosen GLXFBConfig // -GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, +bool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth) diff --git a/glfw/glx_context.h b/glfw/glx_context.h index 9f573900f..6abdb2b6c 100644 --- a/glfw/glx_context.h +++ b/glfw/glx_context.h @@ -153,28 +153,28 @@ typedef struct _GLFWlibraryGLX PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; - GLFWbool SGI_swap_control; - GLFWbool EXT_swap_control; - GLFWbool MESA_swap_control; - GLFWbool ARB_multisample; - GLFWbool ARB_framebuffer_sRGB; - GLFWbool EXT_framebuffer_sRGB; - GLFWbool ARB_create_context; - GLFWbool ARB_create_context_profile; - GLFWbool ARB_create_context_robustness; - GLFWbool EXT_create_context_es2_profile; - GLFWbool ARB_create_context_no_error; - GLFWbool ARB_context_flush_control; + bool SGI_swap_control; + bool EXT_swap_control; + bool MESA_swap_control; + bool ARB_multisample; + bool ARB_framebuffer_sRGB; + bool EXT_framebuffer_sRGB; + bool ARB_create_context; + bool ARB_create_context_profile; + bool ARB_create_context_robustness; + bool EXT_create_context_es2_profile; + bool ARB_create_context_no_error; + bool ARB_context_flush_control; } _GLFWlibraryGLX; -GLFWbool _glfwInitGLX(void); +bool _glfwInitGLX(void); void _glfwTerminateGLX(void); -GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, +bool _glfwCreateContextGLX(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyContextGLX(_GLFWwindow* window); -GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, +bool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth); diff --git a/glfw/ibus_glfw.c b/glfw/ibus_glfw.c index bc165b714..8ef443885 100644 --- a/glfw/ibus_glfw.c +++ b/glfw/ibus_glfw.c @@ -50,7 +50,7 @@ enum Capabilities { }; -static inline GLFWbool +static inline bool test_env_var(const char *name, const char *val) { const char *q = getenv(name); return (q && strcmp(q, val) == 0) ? GLFW_TRUE : GLFW_FALSE; @@ -193,7 +193,7 @@ get_ibus_address_file_name(void) { } -static inline GLFWbool +static inline bool read_ibus_address(_GLFWIBUSData *ibus) { static char buf[1024]; struct stat s; @@ -203,7 +203,7 @@ read_ibus_address(_GLFWIBUSData *ibus) { return GLFW_FALSE; } int stat_result = fstat(fileno(addr_file), &s); - GLFWbool found = GLFW_FALSE; + bool found = GLFW_FALSE; while (fgets(buf, sizeof(buf), addr_file)) { if (strncmp(buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) { size_t sz = strlen(buf); @@ -251,7 +251,7 @@ input_context_created(DBusMessage *msg, const char* errmsg, void *data) { debug("Connected to IBUS daemon for IME input management\n"); } -GLFWbool +bool setup_connection(_GLFWIBUSData *ibus) { const char *client_name = "GLFW_Application"; const char *address_file_name = get_ibus_address_file_name(); @@ -300,7 +300,7 @@ glfw_ibus_terminate(_GLFWIBUSData *ibus) { ibus->ok = GLFW_FALSE; } -static GLFWbool +static bool check_connection(_GLFWIBUSData *ibus) { if (!ibus->inited) return GLFW_FALSE; if (ibus->conn && dbus_connection_get_is_connected(ibus->conn)) { @@ -329,7 +329,7 @@ simple_message(_GLFWIBUSData *ibus, const char *method) { } void -glfw_ibus_set_focused(_GLFWIBUSData *ibus, GLFWbool focused) { +glfw_ibus_set_focused(_GLFWIBUSData *ibus, bool focused) { simple_message(ibus, focused ? "FocusIn" : "FocusOut"); } @@ -394,8 +394,8 @@ void key_event_processed(DBusMessage *msg, const char* errmsg, void *data) { uint32_t handled = 0; KeyEvent *ev = (KeyEvent*)data; - GLFWbool is_release = ev->action == GLFW_RELEASE; - GLFWbool failed = GLFW_FALSE; + bool is_release = ev->action == GLFW_RELEASE; + bool failed = GLFW_FALSE; if (errmsg) { _glfwInputError(GLFW_PLATFORM_ERROR, "IBUS: Failed to process key with error: %s", errmsg); failed = GLFW_TRUE; @@ -407,7 +407,7 @@ key_event_processed(DBusMessage *msg, const char* errmsg, void *data) { free(ev); } -GLFWbool +bool ibus_process_key(const KeyEvent *ev_, _GLFWIBUSData *ibus) { if (!check_connection(ibus)) return GLFW_FALSE; KeyEvent *ev = malloc(sizeof(KeyEvent)); diff --git a/glfw/ibus_glfw.h b/glfw/ibus_glfw.h index e184e8f0d..c7e58e52b 100644 --- a/glfw/ibus_glfw.h +++ b/glfw/ibus_glfw.h @@ -31,7 +31,7 @@ #include typedef struct { - GLFWbool ok, inited; + bool ok, inited; time_t address_file_mtime; DBusConnection *conn; const char *input_ctx_path, *address_file_name, *address; @@ -49,7 +49,7 @@ typedef struct { void glfw_connect_to_ibus(_GLFWIBUSData *ibus); void glfw_ibus_terminate(_GLFWIBUSData *ibus); -void glfw_ibus_set_focused(_GLFWIBUSData *ibus, GLFWbool focused); +void glfw_ibus_set_focused(_GLFWIBUSData *ibus, bool focused); void glfw_ibus_dispatch(_GLFWIBUSData *ibus); -GLFWbool ibus_process_key(const KeyEvent *ev_, _GLFWIBUSData *ibus); +bool ibus_process_key(const KeyEvent *ev_, _GLFWIBUSData *ibus); void glfw_ibus_set_cursor_geometry(_GLFWIBUSData *ibus, int x, int y, int w, int h); diff --git a/glfw/input.c b/glfw/input.c index aeb25347b..89f912a66 100644 --- a/glfw/input.c +++ b/glfw/input.c @@ -58,7 +58,7 @@ static _GLFWmapping* findMapping(const char* guid) // Checks whether a gamepad mapping element is present in the hardware // -static GLFWbool isValidElementForJoystick(const _GLFWmapelement* e, +static bool isValidElementForJoystick(const _GLFWmapelement* e, const _GLFWjoystick* js) { if (e->type == _GLFW_JOYSTICK_HATBIT && (e->index >> 4) >= js->hatCount) @@ -110,7 +110,7 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js) // Parses an SDL_GameControllerDB line and adds it to the mapping list // -static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string) +static bool parseMapping(_GLFWmapping* mapping, const char* string) { const char* c = string; size_t i, length; @@ -260,7 +260,7 @@ void _glfwInputKeyboard(_GLFWwindow* window, int key, int scancode, int action, { if (key >= 0 && key <= GLFW_KEY_LAST) { - GLFWbool repeated = GLFW_FALSE; + bool repeated = GLFW_FALSE; if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE) return; @@ -328,7 +328,7 @@ void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos) // Notifies shared code of a cursor enter/leave event // -void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered) +void _glfwInputCursorEnter(_GLFWwindow* window, bool entered) { if (window->callbacks.cursorEnter) window->callbacks.cursorEnter((GLFWwindow*) window, entered); diff --git a/glfw/internal.h b/glfw/internal.h index bc8c15781..b08ed3988 100644 --- a/glfw/internal.h +++ b/glfw/internal.h @@ -60,7 +60,6 @@ #define _GLFW_MESSAGE_SIZE 1024 -typedef bool GLFWbool; typedef unsigned long long GLFWid; typedef struct _GLFWerror _GLFWerror; @@ -248,12 +247,12 @@ struct _GLFWerror // struct _GLFWinitconfig { - GLFWbool hatButtons; - GLFWbool debugKeyboard; - GLFWbool enableJoysticks; + bool hatButtons; + bool debugKeyboard; + bool enableJoysticks; struct { - GLFWbool menubar; - GLFWbool chdir; + bool menubar; + bool chdir; } ns; }; @@ -268,18 +267,18 @@ struct _GLFWwndconfig int width; int height; const char* title; - GLFWbool resizable; - GLFWbool visible; - GLFWbool decorated; - GLFWbool focused; - GLFWbool autoIconify; - GLFWbool floating; - GLFWbool maximized; - GLFWbool centerCursor; - GLFWbool focusOnShow; - GLFWbool scaleToMonitor; + bool resizable; + bool visible; + bool decorated; + bool focused; + bool autoIconify; + bool floating; + bool maximized; + bool centerCursor; + bool focusOnShow; + bool scaleToMonitor; struct { - GLFWbool retina; + bool retina; char frameName[256]; } ns; struct { @@ -303,15 +302,15 @@ struct _GLFWctxconfig int source; int major; int minor; - GLFWbool forward; - GLFWbool debug; - GLFWbool noerror; + bool forward; + bool debug; + bool noerror; int profile; int robustness; int release; _GLFWwindow* share; struct { - GLFWbool offline; + bool offline; } nsgl; }; @@ -336,11 +335,11 @@ struct _GLFWfbconfig int accumBlueBits; int accumAlphaBits; int auxBuffers; - GLFWbool stereo; + bool stereo; int samples; - GLFWbool sRGB; - GLFWbool doublebuffer; - GLFWbool transparent; + bool sRGB; + bool doublebuffer; + bool transparent; uintptr_t handle; }; @@ -351,7 +350,7 @@ struct _GLFWcontext int client; int source; int major, minor, revision; - GLFWbool forward, debug, noerror; + bool forward, debug, noerror; int profile; int robustness; int release; @@ -382,12 +381,12 @@ struct _GLFWwindow struct _GLFWwindow* next; // Window settings and state - GLFWbool resizable; - GLFWbool decorated; - GLFWbool autoIconify; - GLFWbool floating; - GLFWbool focusOnShow; - GLFWbool shouldClose; + bool resizable; + bool decorated; + bool autoIconify; + bool floating; + bool focusOnShow; + bool shouldClose; void* userPointer; GLFWid id; GLFWvidmode videoMode; @@ -398,9 +397,9 @@ struct _GLFWwindow int maxwidth, maxheight; int numer, denom; - GLFWbool stickyKeys; - GLFWbool stickyMouseButtons; - GLFWbool lockKeyMods; + bool stickyKeys; + bool stickyMouseButtons; + bool lockKeyMods; int cursorMode; char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1]; char keys[GLFW_KEY_LAST + 1]; @@ -491,7 +490,7 @@ struct _GLFWmapping // struct _GLFWjoystick { - GLFWbool present; + bool present; float* axes; int axisCount; unsigned char* buttons; @@ -527,7 +526,7 @@ struct _GLFWmutex // struct _GLFWlibrary { - GLFWbool initialized; + bool initialized; struct { _GLFWinitconfig init; @@ -560,23 +559,23 @@ struct _GLFWlibrary } timer; struct { - GLFWbool available; + bool available; void* handle; char* extensions[2]; #if !defined(_GLFW_VULKAN_STATIC) PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; PFN_vkGetInstanceProcAddr GetInstanceProcAddr; #endif - GLFWbool KHR_surface; + bool KHR_surface; #if defined(_GLFW_WIN32) - GLFWbool KHR_win32_surface; + bool KHR_win32_surface; #elif defined(_GLFW_COCOA) - GLFWbool MVK_macos_surface; + bool MVK_macos_surface; #elif defined(_GLFW_X11) - GLFWbool KHR_xlib_surface; - GLFWbool KHR_xcb_surface; + bool KHR_xlib_surface; + bool KHR_xcb_surface; #elif defined(_GLFW_WAYLAND) - GLFWbool KHR_wayland_surface; + bool KHR_wayland_surface; #endif } vk; @@ -629,7 +628,7 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height); GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count); void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode); -GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); +bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwPlatformSetClipboardString(const char* string); @@ -689,9 +688,9 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window); int _glfwPlatformWindowHovered(_GLFWwindow* window); int _glfwPlatformFramebufferTransparent(_GLFWwindow* window); float _glfwPlatformGetWindowOpacity(_GLFWwindow* window); -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled); -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled); -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled); +void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled); +void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled); +void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled); void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity); void _glfwPlatformUpdateIMEState(_GLFWwindow *w, int which, int a, int b, int c, int d); @@ -709,12 +708,12 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); -GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls); +bool _glfwPlatformCreateTls(_GLFWtls* tls); void _glfwPlatformDestroyTls(_GLFWtls* tls); void* _glfwPlatformGetTls(_GLFWtls* tls); void _glfwPlatformSetTls(_GLFWtls* tls, void* value); -GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex); +bool _glfwPlatformCreateMutex(_GLFWmutex* mutex); void _glfwPlatformDestroyMutex(_GLFWmutex* mutex); void _glfwPlatformLockMutex(_GLFWmutex* mutex); void _glfwPlatformUnlockMutex(_GLFWmutex* mutex); @@ -724,15 +723,15 @@ void _glfwPlatformUnlockMutex(_GLFWmutex* mutex); ////// GLFW event API ////// ////////////////////////////////////////////////////////////////////////// -void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused); -void _glfwInputWindowOcclusion(_GLFWwindow* window, GLFWbool occluded); +void _glfwInputWindowFocus(_GLFWwindow* window, bool focused); +void _glfwInputWindowOcclusion(_GLFWwindow* window, bool occluded); void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos); void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale); -void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified); -void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized); +void _glfwInputWindowIconify(_GLFWwindow* window, bool iconified); +void _glfwInputWindowMaximize(_GLFWwindow* window, bool maximized); void _glfwInputWindowDamage(_GLFWwindow* window); void _glfwInputWindowCloseRequest(_GLFWwindow* window); void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor); @@ -741,7 +740,7 @@ void _glfwInputKeyboard(_GLFWwindow* window, int key, int scancode, int action, void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset, int flags); void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); -void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered); +void _glfwInputCursorEnter(_GLFWwindow* window, bool entered); void _glfwInputDrop(_GLFWwindow* window, int count, const char** names); void _glfwInputJoystick(_GLFWjoystick* js, int event); void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value); @@ -771,13 +770,13 @@ void _glfwDebug(const char* format, ...); ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions); +bool _glfwStringInExtensionString(const char* string, const char* extensions); const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, const _GLFWfbconfig* alternatives, unsigned int count); -GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, +bool _glfwRefreshContextAttribs(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig); -GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); +bool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); @@ -797,7 +796,7 @@ void _glfwFreeJoystick(_GLFWjoystick* js); const char* _glfwGetKeyName(int key); void _glfwCenterCursorInContentArea(_GLFWwindow* window); -GLFWbool _glfwInitVulkan(int mode); +bool _glfwInitVulkan(int mode); void _glfwTerminateVulkan(void); const char* _glfwGetVulkanResultString(VkResult result); _GLFWwindow* _glfwFocusedWindow(void); @@ -806,7 +805,7 @@ void _glfwPlatformRunMainLoop(GLFWtickcallback, void*); void _glfwPlatformRequestTickCallback(void); void _glfwPlatformStopMainLoop(void); unsigned long long _glfwPlatformAddTimer(double interval, bool repeats, GLFWuserdatafun callback, void *callback_data, GLFWuserdatafun free_callback); -void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, GLFWbool enabled); +void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, bool enabled); void _glfwPlatformRemoveTimer(unsigned long long timer_id); char* _glfw_strdup(const char* source); diff --git a/glfw/linux_joystick.c b/glfw/linux_joystick.c index db5a0e7a0..cb0e46734 100644 --- a/glfw/linux_joystick.c +++ b/glfw/linux_joystick.c @@ -124,7 +124,7 @@ static void pollAbsState(_GLFWjoystick* js) // Attempt to open the specified joystick device // -static GLFWbool openJoystickDevice(const char* path) +static bool openJoystickDevice(const char* path) { int jid, code; char name[256] = ""; @@ -264,7 +264,7 @@ static int compareJoysticks(const void* fp, const void* sp) // Initialize joystick interface // -GLFWbool _glfwInitJoysticksLinux(void) +bool _glfwInitJoysticksLinux(void) { DIR* dir; int count = 0; diff --git a/glfw/linux_joystick.h b/glfw/linux_joystick.h index 2eabfa134..82593e448 100644 --- a/glfw/linux_joystick.h +++ b/glfw/linux_joystick.h @@ -52,11 +52,11 @@ typedef struct _GLFWlibraryLinux int inotify; int watch; regex_t regex; - GLFWbool dropped; + bool dropped; } _GLFWlibraryLinux; -GLFWbool _glfwInitJoysticksLinux(void); +bool _glfwInitJoysticksLinux(void); void _glfwTerminateJoysticksLinux(void); void _glfwDetectJoystickConnectionLinux(void); diff --git a/glfw/main_loop.h b/glfw/main_loop.h index 7f8bbc21e..bd8164ce4 100644 --- a/glfw/main_loop.h +++ b/glfw/main_loop.h @@ -12,7 +12,7 @@ #define GLFW_LOOP_BACKEND x11 #endif -static GLFWbool keep_going = GLFW_FALSE; +static bool keep_going = GLFW_FALSE; void _glfwPlatformRequestTickCallback() { } @@ -41,7 +41,7 @@ void _glfwPlatformRemoveTimer(unsigned long long timer_id) { removeTimer(&_glfw.GLFW_LOOP_BACKEND.eventLoopData, timer_id); } -void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, GLFWbool enabled) { +void _glfwPlatformUpdateTimer(unsigned long long timer_id, double interval, bool enabled) { changeTimerInterval(&_glfw.GLFW_LOOP_BACKEND.eventLoopData, timer_id, interval); toggleTimer(&_glfw.GLFW_LOOP_BACKEND.eventLoopData, timer_id, enabled); } diff --git a/glfw/monitor.c b/glfw/monitor.c index 3fe9c03c0..908b38253 100644 --- a/glfw/monitor.c +++ b/glfw/monitor.c @@ -60,7 +60,7 @@ static int compareVideoModes(const void* fp, const void* sp) // Retrieves the available modes for the specified monitor // -static GLFWbool refreshVideoModes(_GLFWmonitor* monitor) +static bool refreshVideoModes(_GLFWmonitor* monitor) { int modeCount; GLFWvidmode* modes; diff --git a/glfw/nsgl_context.h b/glfw/nsgl_context.h index 585ae72fc..961e01286 100644 --- a/glfw/nsgl_context.h +++ b/glfw/nsgl_context.h @@ -47,9 +47,9 @@ typedef struct _GLFWlibraryNSGL } _GLFWlibraryNSGL; -GLFWbool _glfwInitNSGL(void); +bool _glfwInitNSGL(void); void _glfwTerminateNSGL(void); -GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, +bool _glfwCreateContextNSGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyContextNSGL(_GLFWwindow* window); diff --git a/glfw/nsgl_context.m b/glfw/nsgl_context.m index 54cdc56df..08bfb6fe5 100644 --- a/glfw/nsgl_context.m +++ b/glfw/nsgl_context.m @@ -87,7 +87,7 @@ static void destroyContextNSGL(_GLFWwindow* window) // Initialize OpenGL support // -GLFWbool _glfwInitNSGL(void) +bool _glfwInitNSGL(void) { if (_glfw.nsgl.framework) return GLFW_TRUE; @@ -112,7 +112,7 @@ void _glfwTerminateNSGL(void) // Create the OpenGL context // -GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, +bool _glfwCreateContextNSGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { diff --git a/glfw/null_monitor.c b/glfw/null_monitor.c index 136731835..04ea740dd 100644 --- a/glfw/null_monitor.c +++ b/glfw/null_monitor.c @@ -62,7 +62,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { } -GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { return GLFW_FALSE; } diff --git a/glfw/null_window.c b/glfw/null_window.c index bbb57f7b9..344bba7b4 100644 --- a/glfw/null_window.c +++ b/glfw/null_window.c @@ -180,15 +180,15 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) return GLFW_FALSE; } -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled) { } -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) { } -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) { } diff --git a/glfw/osmesa_context.c b/glfw/osmesa_context.c index b4cc89efa..e9421d6dc 100644 --- a/glfw/osmesa_context.c +++ b/glfw/osmesa_context.c @@ -108,7 +108,7 @@ static int extensionSupportedOSMesa(const char* extension) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -GLFWbool _glfwInitOSMesa(void) +bool _glfwInitOSMesa(void) { int i; const char* sonames[] = @@ -193,7 +193,7 @@ void _glfwTerminateOSMesa(void) attribs[index++] = v; \ } -GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, +bool _glfwCreateContextOSMesa(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { diff --git a/glfw/osmesa_context.h b/glfw/osmesa_context.h index 07bb469a6..c41f2cf3d 100644 --- a/glfw/osmesa_context.h +++ b/glfw/osmesa_context.h @@ -86,9 +86,9 @@ typedef struct _GLFWlibraryOSMesa } _GLFWlibraryOSMesa; -GLFWbool _glfwInitOSMesa(void); +bool _glfwInitOSMesa(void); void _glfwTerminateOSMesa(void); -GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, +bool _glfwCreateContextOSMesa(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); diff --git a/glfw/posix_thread.c b/glfw/posix_thread.c index ce0bc39b9..67fda6179 100644 --- a/glfw/posix_thread.c +++ b/glfw/posix_thread.c @@ -35,7 +35,7 @@ ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) +bool _glfwPlatformCreateTls(_GLFWtls* tls) { assert(tls->posix.allocated == GLFW_FALSE); @@ -69,7 +69,7 @@ void _glfwPlatformSetTls(_GLFWtls* tls, void* value) pthread_setspecific(tls->posix.key, value); } -GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) +bool _glfwPlatformCreateMutex(_GLFWmutex* mutex) { assert(mutex->posix.allocated == GLFW_FALSE); diff --git a/glfw/posix_thread.h b/glfw/posix_thread.h index bdddf41a2..2d51c5ff5 100644 --- a/glfw/posix_thread.h +++ b/glfw/posix_thread.h @@ -35,7 +35,7 @@ // typedef struct _GLFWtlsPOSIX { - GLFWbool allocated; + bool allocated; pthread_key_t key; } _GLFWtlsPOSIX; @@ -44,7 +44,7 @@ typedef struct _GLFWtlsPOSIX // typedef struct _GLFWmutexPOSIX { - GLFWbool allocated; + bool allocated; pthread_mutex_t handle; } _GLFWmutexPOSIX; diff --git a/glfw/posix_time.h b/glfw/posix_time.h index f1a69eb24..10d77b63b 100644 --- a/glfw/posix_time.h +++ b/glfw/posix_time.h @@ -34,7 +34,7 @@ // typedef struct _GLFWtimerPOSIX { - GLFWbool monotonic; + bool monotonic; uint64_t frequency; } _GLFWtimerPOSIX; diff --git a/glfw/vulkan.c b/glfw/vulkan.c index 3c8b6def2..8a30d00b3 100644 --- a/glfw/vulkan.c +++ b/glfw/vulkan.c @@ -39,7 +39,7 @@ ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -GLFWbool _glfwInitVulkan(int mode) +bool _glfwInitVulkan(int mode) { VkResult err; VkExtensionProperties* ep; diff --git a/glfw/wgl_context.c b/glfw/wgl_context.c index c826006df..48012a802 100644 --- a/glfw/wgl_context.c +++ b/glfw/wgl_context.c @@ -352,7 +352,7 @@ static void destroyContextWGL(_GLFWwindow* window) // Initialize WGL // -GLFWbool _glfwInitWGL(void) +bool _glfwInitWGL(void) { PIXELFORMATDESCRIPTOR pfd; HGLRC prc, rc; @@ -487,7 +487,7 @@ void _glfwTerminateWGL(void) // Create the OpenGL or OpenGL ES context // -GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, +bool _glfwCreateContextWGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { diff --git a/glfw/wgl_context.h b/glfw/wgl_context.h index c7540386b..3b5dce13f 100644 --- a/glfw/wgl_context.h +++ b/glfw/wgl_context.h @@ -135,25 +135,25 @@ typedef struct _GLFWlibraryWGL PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; - GLFWbool EXT_swap_control; - GLFWbool EXT_colorspace; - GLFWbool ARB_multisample; - GLFWbool ARB_framebuffer_sRGB; - GLFWbool EXT_framebuffer_sRGB; - GLFWbool ARB_pixel_format; - GLFWbool ARB_create_context; - GLFWbool ARB_create_context_profile; - GLFWbool EXT_create_context_es2_profile; - GLFWbool ARB_create_context_robustness; - GLFWbool ARB_create_context_no_error; - GLFWbool ARB_context_flush_control; + bool EXT_swap_control; + bool EXT_colorspace; + bool ARB_multisample; + bool ARB_framebuffer_sRGB; + bool EXT_framebuffer_sRGB; + bool ARB_pixel_format; + bool ARB_create_context; + bool ARB_create_context_profile; + bool EXT_create_context_es2_profile; + bool ARB_create_context_robustness; + bool ARB_create_context_no_error; + bool ARB_context_flush_control; } _GLFWlibraryWGL; -GLFWbool _glfwInitWGL(void); +bool _glfwInitWGL(void); void _glfwTerminateWGL(void); -GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, +bool _glfwCreateContextWGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); diff --git a/glfw/window.c b/glfw/window.c index 5af23c510..ef04264d1 100644 --- a/glfw/window.c +++ b/glfw/window.c @@ -40,7 +40,7 @@ // Notifies shared code that a window has lost or received input focus // -void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused) +void _glfwInputWindowFocus(_GLFWwindow* window, bool focused) { if (window->callbacks.focus) window->callbacks.focus((GLFWwindow*) window, focused); @@ -90,7 +90,7 @@ _GLFWwindow* _glfwWindowForId(GLFWid id) { // Notifies shared code that a window's occlusion state has changed // -void _glfwInputWindowOcclusion(_GLFWwindow* window, GLFWbool occluded) +void _glfwInputWindowOcclusion(_GLFWwindow* window, bool occluded) { if (window->callbacks.occlusion) window->callbacks.occlusion((GLFWwindow*) window, occluded); @@ -116,7 +116,7 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height) // Notifies shared code that a window has been iconified or restored // -void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified) +void _glfwInputWindowIconify(_GLFWwindow* window, bool iconified) { if (window->callbacks.iconify) window->callbacks.iconify((GLFWwindow*) window, iconified); @@ -124,7 +124,7 @@ void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified) // Notifies shared code that a window has been maximized or restored // -void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized) +void _glfwInputWindowMaximize(_GLFWwindow* window, bool maximized) { if (window->callbacks.maximize) window->callbacks.maximize((GLFWwindow*) window, maximized); diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 34e5160a0..ea3096465 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -408,7 +408,7 @@ static void keyboardHandleKey(void* data, return; int action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; glfw_xkb_handle_key_event(window, &_glfw.wl.xkb, key, action); - GLFWbool repeatable = GLFW_FALSE; + bool repeatable = GLFW_FALSE; if (action == GLFW_PRESS && _glfw.wl.keyboardRepeatRate > 0 && glfw_xkb_should_repeat(&_glfw.wl.xkb, key)) { diff --git a/glfw/wl_monitor.c b/glfw/wl_monitor.c index 910ec5411..e94a117ab 100644 --- a/glfw/wl_monitor.c +++ b/glfw/wl_monitor.c @@ -196,7 +196,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) *mode = monitor->modes[monitor->wl.currentMode]; } -GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Gamma ramp access is not available"); diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 5a1db008e..9ef3b6c90 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -133,10 +133,10 @@ typedef struct _GLFWdecorationWayland typedef struct _GLFWwindowWayland { int width, height; - GLFWbool visible; - GLFWbool maximized; - GLFWbool hovered; - GLFWbool transparent; + bool visible; + bool maximized; + bool hovered; + bool transparent; struct wl_surface* surface; struct wl_egl_window* native; struct wl_callback* callback; @@ -167,10 +167,10 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; - GLFWbool fullscreened; + bool fullscreened; struct { - GLFWbool serverSide; + bool serverSide; struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; int focus; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 1c3e6a8a3..200dec48b 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -42,7 +42,7 @@ #define URI_LIST_MIME "text/uri-list" -static GLFWbool checkScaleChange(_GLFWwindow* window) +static bool checkScaleChange(_GLFWwindow* window) { int scale = 1; int i; @@ -137,8 +137,8 @@ clipboard_mime(void) { static void dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height) { if (width <= 0) width = window->wl.width; if (height <= 0) height = window->wl.height; - GLFWbool size_changed = width != window->wl.width || height != window->wl.height; - GLFWbool scale_changed = checkScaleChange(window); + bool size_changed = width != window->wl.width || height != window->wl.height; + bool scale_changed = checkScaleChange(window); if (size_changed) { _glfwInputWindowSize(window, width, height); @@ -281,7 +281,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) static void createDecoration(_GLFWdecorationWayland* decoration, struct wl_surface* parent, - struct wl_buffer* buffer, GLFWbool opaque, + struct wl_buffer* buffer, bool opaque, int x, int y, int width, int height) { @@ -313,7 +313,7 @@ static void createDecorations(_GLFWwindow* window) { unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - GLFWbool opaque = (data[3] == 255); + bool opaque = (data[3] == 255); if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) return; @@ -405,7 +405,7 @@ static void handleLeave(void *data, { _GLFWwindow* window = data; _GLFWmonitor* monitor = wl_output_get_user_data(output); - GLFWbool found; + bool found; int i; for (i = 0, found = GLFW_FALSE; i < window->wl.monitorsCount - 1; ++i) @@ -428,7 +428,7 @@ static const struct wl_surface_listener surfaceListener = { handleLeave }; -static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) +static void setIdleInhibitor(_GLFWwindow* window, bool enable) { if (enable && !window->wl.idleInhibitor && _glfw.wl.idleInhibitManager) { @@ -446,7 +446,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) } } -static GLFWbool createSurface(_GLFWwindow* window, +static bool createSurface(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); @@ -513,9 +513,9 @@ static void xdgToplevelHandleConfigure(void* data, float aspectRatio; float targetRatio; uint32_t* state; - GLFWbool maximized = GLFW_FALSE; - GLFWbool fullscreen = GLFW_FALSE; - GLFWbool activated = GLFW_FALSE; + bool maximized = GLFW_FALSE; + bool fullscreen = GLFW_FALSE; + bool activated = GLFW_FALSE; wl_array_for_each(state, states) { @@ -605,7 +605,7 @@ static void setXdgDecorations(_GLFWwindow* window) } } -static GLFWbool createXdgSurface(_GLFWwindow* window) +static bool createXdgSurface(_GLFWwindow* window) { window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase, window->wl.surface); @@ -773,7 +773,7 @@ handleEvents(double timeout) return; } - GLFWbool display_read_ok = pollForEvents(&_glfw.wl.eventLoopData, timeout); + bool display_read_ok = pollForEvents(&_glfw.wl.eventLoopData, timeout); if (display_read_ok) { wl_display_read_events(display); wl_display_dispatch_pending(display); @@ -801,7 +801,7 @@ try_cursor_names(int arg_count, ...) { struct wl_cursor* _glfwLoadCursor(GLFWCursorShape shape) { - static GLFWbool warnings[GLFW_INVALID_CURSOR] = {0}; + static bool warnings[GLFW_INVALID_CURSOR] = {0}; #define NUMARGS(...) (sizeof((const char*[]){__VA_ARGS__})/sizeof(const char*)) #define C(name, ...) case name: { \ ans = try_cursor_names(NUMARGS(__VA_ARGS__), __VA_ARGS__); \ @@ -1099,7 +1099,7 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { // TODO - static GLFWbool notified = GLFW_FALSE; + static bool notified = GLFW_FALSE; if (!notified) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window attention request not implemented yet"); @@ -1173,14 +1173,14 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) return window->wl.transparent; } -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled) { // TODO _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Window attribute setting not implemented yet"); } -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) { if (!window->monitor) { @@ -1191,7 +1191,7 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) } } -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) { // TODO _glfwInputError(GLFW_PLATFORM_ERROR, @@ -1238,7 +1238,7 @@ void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) *ypos = window->wl.cursorPosY; } -static GLFWbool isPointerLocked(_GLFWwindow* window); +static bool isPointerLocked(_GLFWwindow* window); void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { @@ -1393,7 +1393,7 @@ static void lockPointer(_GLFWwindow* window) NULL, 0, 0); } -static GLFWbool isPointerLocked(_GLFWwindow* window) +static bool isPointerLocked(_GLFWwindow* window) { return window->wl.pointerLock.lockedPointer != NULL; } @@ -1805,7 +1805,7 @@ void _glfwSetupWaylandPrimarySelectionDevice() { if (_glfw.wl.primarySelectionDevice) zwp_primary_selection_device_v1_add_listener(_glfw.wl.primarySelectionDevice, &primary_selection_device_listener, NULL); } -static inline GLFWbool _glfwEnsureDataDevice(void) { +static inline bool _glfwEnsureDataDevice(void) { if (!_glfw.wl.dataDeviceManager) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -1873,7 +1873,7 @@ const char* _glfwPlatformGetClipboardString(void) void _glfwPlatformSetPrimarySelectionString(const char* string) { if (!_glfw.wl.primarySelectionDevice) { - static GLFWbool warned_about_primary_selection_device = GLFW_FALSE; + static bool warned_about_primary_selection_device = GLFW_FALSE; if (!warned_about_primary_selection_device) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Cannot copy no primary selection device available"); @@ -2018,7 +2018,7 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle) return window->wl.surface; } -GLFWAPI int glfwGetXKBScancode(const char* keyName, GLFWbool caseSensitive) { +GLFWAPI int glfwGetXKBScancode(const char* keyName, bool caseSensitive) { return glfw_xkb_keysym_from_name(keyName, caseSensitive); } diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 6c14280a9..0f856c48e 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -154,7 +154,7 @@ static void detectEWMH(void) // Look for and initialize supported X11 extensions // -static GLFWbool initExtensions(void) +static bool initExtensions(void) { _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1"); if (_glfw.x11.vidmode.handle) @@ -462,7 +462,7 @@ static GLFWbool initExtensions(void) // Retrieve system content scale via folklore heuristics // -void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, GLFWbool bypass_cache) +void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cache) { // NOTE: Default to the display-wide DPI as we don't currently have a policy // for which monitor a window is considered to be on diff --git a/glfw/x11_monitor.c b/glfw/x11_monitor.c index 784b64749..154993418 100644 --- a/glfw/x11_monitor.c +++ b/glfw/x11_monitor.c @@ -35,7 +35,7 @@ // Check whether the display mode should be included in enumeration // -static GLFWbool modeIsGood(const XRRModeInfo* mi) +static bool modeIsGood(const XRRModeInfo* mi) { return (mi->modeFlags & RR_Interlace) == 0; } @@ -528,7 +528,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) } } -GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) { diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index 1d180667f..fbe8f5e13 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -182,11 +182,11 @@ typedef struct _GLFWwindowX11 Colormap colormap; Window handle; - GLFWbool iconified; - GLFWbool maximized; + bool iconified; + bool maximized; // Whether the visual supports framebuffer transparency - GLFWbool transparent; + bool transparent; // Cached position and size used to filter out duplicate events int width, height; @@ -284,14 +284,14 @@ typedef struct _GLFWlibraryX11 Atom RESOURCE_MANAGER; struct { - GLFWbool available; + bool available; void* handle; int eventBase; int errorBase; int major; int minor; - GLFWbool gammaBroken; - GLFWbool monitorBroken; + bool gammaBroken; + bool monitorBroken; PFN_XRRAllocGamma AllocGamma; PFN_XRRFreeCrtcInfo FreeCrtcInfo; PFN_XRRFreeGamma FreeGamma; @@ -336,7 +336,7 @@ typedef struct _GLFWlibraryX11 } xcursor; struct { - GLFWbool available; + bool available; void* handle; int major; int minor; @@ -346,7 +346,7 @@ typedef struct _GLFWlibraryX11 } xinerama; struct { - GLFWbool available; + bool available; void* handle; int eventBase; int errorBase; @@ -357,7 +357,7 @@ typedef struct _GLFWlibraryX11 } vidmode; struct { - GLFWbool available; + bool available; void* handle; int majorOpcode; int eventBase; @@ -369,7 +369,7 @@ typedef struct _GLFWlibraryX11 } xi; struct { - GLFWbool available; + bool available; void* handle; int major; int minor; @@ -416,11 +416,11 @@ unsigned long _glfwGetWindowPropertyX11(Window window, Atom property, Atom type, unsigned char** value); -GLFWbool _glfwIsVisualTransparentX11(Visual* visual); +bool _glfwIsVisualTransparentX11(Visual* visual); void _glfwGrabErrorHandlerX11(void); void _glfwReleaseErrorHandlerX11(void); void _glfwInputErrorX11(int error, const char* message); -void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, GLFWbool bypass_cache); +void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cache); void _glfwPushSelectionToManagerX11(void); diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 58f9b5fee..9862c91ad 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -72,7 +72,7 @@ handleEvents(double timeout) { EVDBG("other dispatch done"); } -static GLFWbool +static bool waitForX11Event(double timeout) { // returns true iff there is X11 data waiting to be read, does not run watches and timers double end_time = glfwGetTime() + timeout; @@ -96,7 +96,7 @@ waitForX11Event(double timeout) { // Waits until a VisibilityNotify event arrives for the specified window or the // timeout period elapses (ICCCM section 4.2.2) // -static GLFWbool waitForVisibilityNotify(_GLFWwindow* window) +static bool waitForVisibilityNotify(_GLFWwindow* window) { XEvent dummy; @@ -270,7 +270,7 @@ is_window_fullscreen(_GLFWwindow* window) { Atom* states; unsigned long i; - GLFWbool ans = GLFW_FALSE; + bool ans = GLFW_FALSE; if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_FULLSCREEN) return ans; const unsigned long count = @@ -499,7 +499,7 @@ static void enableCursor(_GLFWwindow* window) // Create the X11 window (and its colormap) // -static GLFWbool createNativeWindow(_GLFWwindow* window, +static bool createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, Visual* visual, int depth) { @@ -1076,7 +1076,7 @@ static void onConfigChange(void) static void processEvent(XEvent *event) { _GLFWwindow* window = NULL; - static GLFWbool keymap_dirty = GLFW_FALSE; + static bool keymap_dirty = GLFW_FALSE; #define UPDATE_KEYMAP_IF_NEEDED if (keymap_dirty) { keymap_dirty = GLFW_FALSE; glfw_xkb_compile_keymap(&_glfw.x11.xkb, NULL); } if (_glfw.x11.randr.available) @@ -1430,7 +1430,7 @@ static void processEvent(XEvent *event) // A drag operation has entered the window unsigned long i, count; Atom* formats = NULL; - const GLFWbool list = event->xclient.data.l[1] & 1; + const bool list = event->xclient.data.l[1] & 1; _glfw.x11.xdnd.source = event->xclient.data.l[0]; _glfw.x11.xdnd.version = event->xclient.data.l[1] >> 24; @@ -1653,7 +1653,7 @@ static void processEvent(XEvent *event) if (state != IconicState && state != NormalState) return; - const GLFWbool iconified = (state == IconicState); + const bool iconified = (state == IconicState); if (window->x11.iconified != iconified) { if (window->monitor) @@ -1670,7 +1670,7 @@ static void processEvent(XEvent *event) } else if (event->xproperty.atom == _glfw.x11.NET_WM_STATE) { - const GLFWbool maximized = _glfwPlatformWindowMaximized(window); + const bool maximized = _glfwPlatformWindowMaximized(window); if (window->x11.maximized != maximized) { window->x11.maximized = maximized; @@ -1720,7 +1720,7 @@ unsigned long _glfwGetWindowPropertyX11(Window window, return itemCount; } -GLFWbool _glfwIsVisualTransparentX11(Visual* visual) +bool _glfwIsVisualTransparentX11(Visual* visual) { if (!_glfw.x11.xrender.available) return GLFW_FALSE; @@ -2293,7 +2293,7 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window) { Atom* states; unsigned long i; - GLFWbool maximized = GLFW_FALSE; + bool maximized = GLFW_FALSE; if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || !_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) @@ -2350,14 +2350,14 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) return XGetSelectionOwner(_glfw.x11.display, _glfw.x11.NET_WM_CM_Sx) != None; } -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); updateNormalHints(window, width, height); } -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) { if (enabled) { @@ -2388,7 +2388,7 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) } } -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) +void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) { if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_ABOVE) return; @@ -2880,7 +2880,7 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* handle) return window->x11.handle; } -GLFWAPI int glfwGetXKBScancode(const char* keyName, GLFWbool caseSensitive) { +GLFWAPI int glfwGetXKBScancode(const char* keyName, bool caseSensitive) { return glfw_xkb_keysym_from_name(keyName, caseSensitive); } diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index 85081bce3..25c7700d8 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -136,7 +136,7 @@ glfw_xkb_sym_for_key(int key) { #ifdef _GLFW_X11 -GLFWbool +bool glfw_xkb_set_x11_events_mask(void) { if (!XkbSelectEvents(_glfw.x11.display, XkbUseCoreKbd, XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask, XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask)) { _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to set XKB events mask"); @@ -145,7 +145,7 @@ glfw_xkb_set_x11_events_mask(void) { return GLFW_TRUE; } -GLFWbool +bool glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb) { xkb->keyboard_device_id = -1; xcb_connection_t* conn = XGetXCBConnection(_glfw.x11.display); @@ -204,7 +204,7 @@ glfw_xkb_release(_GLFWXKBData *xkb) { glfw_ibus_terminate(&xkb->ibus); } -GLFWbool +bool glfw_xkb_create_context(_GLFWXKBData *xkb) { xkb->context = xkb_context_new(0); if (!xkb->context) @@ -260,7 +260,7 @@ load_compose_tables(_GLFWXKBData *xkb) { xkb_compose_table_unref(compose_table); } -GLFWbool +bool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str) { const char *err; release_keyboard_data(xkb); @@ -326,7 +326,7 @@ glfw_xkb_update_modifiers(_GLFWXKBData *xkb, xkb_mod_mask_t depressed, xkb_mod_m update_modifiers(xkb, &xkb->states); } -GLFWbool +bool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t scancode) { #ifdef _GLFW_WAYLAND scancode += 8; @@ -366,7 +366,7 @@ glfw_xkb_keysym_name(xkb_keysym_t sym) { } int -glfw_xkb_keysym_from_name(const char *name, GLFWbool case_sensitive) { +glfw_xkb_keysym_from_name(const char *name, bool case_sensitive) { return (int)xkb_keysym_from_name(name, case_sensitive ? XKB_KEYSYM_NO_FLAGS : XKB_KEYSYM_CASE_INSENSITIVE); } @@ -424,7 +424,7 @@ glfw_xkb_update_ime_state(_GLFWwindow *w, _GLFWXKBData *xkb, int which, int a, i } void -glfw_xkb_key_from_ime(KeyEvent *ev, GLFWbool handled_by_ime, GLFWbool failed) { +glfw_xkb_key_from_ime(KeyEvent *ev, bool handled_by_ime, bool failed) { _GLFWwindow *window = _glfwWindowForId(ev->window_id); if (failed && window && window->callbacks.keyboard) { // notify application to remove any existing pre-edit text @@ -437,7 +437,7 @@ glfw_xkb_key_from_ime(KeyEvent *ev, GLFWbool handled_by_ime, GLFWbool failed) { // you'd need to implement a ring buffer to store pending key presses. xkb_keycode_t prev_handled_press = last_handled_press_keycode; last_handled_press_keycode = 0; - GLFWbool is_release = ev->action == GLFW_RELEASE; + bool is_release = ev->action == GLFW_RELEASE; debug("From IBUS: scancode: 0x%x name: %s is_release: %d\n", ev->keycode, glfw_xkb_keysym_name(ev->keysym), is_release); if (window && !handled_by_ime && !(is_release && ev->keycode == prev_handled_press)) { debug("↳ to application: glfw_keycode: 0x%x (%s) keysym: 0x%x (%s) action: %s %s text: %s\n", @@ -500,7 +500,7 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t if (key_event.text[0]) { debug("%s: %s ", text_type, key_event.text); } } int glfw_keycode = glfw_key_for_sym(glfw_sym); - GLFWbool is_fallback = GLFW_FALSE; + bool is_fallback = GLFW_FALSE; if (glfw_keycode == GLFW_KEY_UNKNOWN && !key_event.text[0]) { int num_default_syms = xkb_state_key_get_syms(sg->default_state, code_for_sym, &default_syms); if (num_default_syms > 0) { diff --git a/glfw/xkb_glfw.h b/glfw/xkb_glfw.h index 422642767..1f3f4d604 100644 --- a/glfw/xkb_glfw.h +++ b/glfw/xkb_glfw.h @@ -67,8 +67,8 @@ typedef struct { #ifdef _GLFW_X11 int32_t keyboard_device_id; - GLFWbool available; - GLFWbool detectable; + bool available; + bool detectable; int majorOpcode; int eventBase; int errorBase; @@ -79,18 +79,18 @@ typedef struct { } _GLFWXKBData; #ifdef _GLFW_X11 -GLFWbool glfw_xkb_set_x11_events_mask(void); -GLFWbool glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb); +bool glfw_xkb_set_x11_events_mask(void); +bool glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb); #endif void glfw_xkb_release(_GLFWXKBData *xkb); -GLFWbool glfw_xkb_create_context(_GLFWXKBData *xkb); -GLFWbool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str); +bool glfw_xkb_create_context(_GLFWXKBData *xkb); +bool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str); void glfw_xkb_update_modifiers(_GLFWXKBData *xkb, xkb_mod_mask_t depressed, xkb_mod_mask_t latched, xkb_mod_mask_t locked, xkb_layout_index_t base_group, xkb_layout_index_t latched_group, xkb_layout_index_t locked_group); -GLFWbool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t scancode); +bool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t scancode); const char* glfw_xkb_keysym_name(xkb_keysym_t sym); xkb_keysym_t glfw_xkb_sym_for_key(int key); void glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t scancode, int action); -int glfw_xkb_keysym_from_name(const char *name, GLFWbool case_sensitive); +int glfw_xkb_keysym_from_name(const char *name, bool case_sensitive); void glfw_xkb_update_ime_state(_GLFWwindow *w, _GLFWXKBData *xkb, int which, int a, int b, int c, int d); -void glfw_xkb_key_from_ime(KeyEvent *ev, GLFWbool handled_by_ime, GLFWbool failed); +void glfw_xkb_key_from_ime(KeyEvent *ev, bool handled_by_ime, bool failed);