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