summaryrefslogtreecommitdiff
path: root/source/sokol
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-02-12 15:36:55 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-02-12 15:36:55 +0100
commit78face694ee2d734f51ecaa3702b1849e1f34346 (patch)
tree7b9486e9b8a37463967eddf3673275de1fc3e5de /source/sokol
parentdf00df5a7a5bcd9076d4423128ea014ab3535626 (diff)
downloadsaw-78face694ee2d734f51ecaa3702b1849e1f34346.zip
UI: add some icons; Update sokol
Diffstat (limited to 'source/sokol')
-rw-r--r--source/sokol/sokol_app.h243
1 files changed, 110 insertions, 133 deletions
diff --git a/source/sokol/sokol_app.h b/source/sokol/sokol_app.h
index fdaed1f..064a72f 100644
--- a/source/sokol/sokol_app.h
+++ b/source/sokol/sokol_app.h
@@ -537,7 +537,7 @@
Like clipboard support, drag'n'drop support must be explicitly enabled
at startup in the sapp_desc struct.
- sapp_desc sokol_main() {
+ sapp_desc sokol_main(void) {
return (sapp_desc) {
.enable_dragndrop = true, // default is false
...
@@ -547,7 +547,7 @@
You can also adjust the maximum number of files that are accepted
in a drop operation, and the maximum path length in bytes if needed:
- sapp_desc sokol_main() {
+ sapp_desc sokol_main(void) {
return (sapp_desc) {
.enable_dragndrop = true, // default is false
.max_dropped_files = 8, // default is 1
@@ -687,7 +687,7 @@
For instance on a Retina Mac, returning the following sapp_desc
struct from sokol_main():
- sapp_desc sokol_main() {
+ sapp_desc sokol_main(void) {
return (sapp_desc) {
.width = 640,
.height = 480,
@@ -941,13 +941,46 @@
sapp_show_keyboard(false);
- Note that on the web platform, the keyboard can only be shown from
- inside an input handler. On such platforms, sapp_show_keyboard()
- will only work as expected when it is called from inside the
- sokol-app event callback function. When called from other places,
- an internal flag will be set, and the onscreen keyboard will be
- called at the next 'legal' opportunity (when the next input event
- is handled).
+ Note that onscreen keyboard functionality is no longer supported
+ on the browser platform (the previous hacks and workarounds to make browser
+ keyboards work for on web applications that don't use HTML UIs
+ never really worked across browsers).
+
+ INPUT EVENT BUBBLING ON THE WEB PLATFORM
+ ========================================
+ By default, input event bubbling on the web platform is configured in
+ a way that makes the most sense for 'full-canvas' apps that cover the
+ entire browser client window area:
+
+ - mouse, touch and wheel events do not bubble up, this prevents various
+ ugly side events, like:
+ - HTML text overlays being selected on double- or triple-click into
+ the canvas
+ - 'scroll bumping' even when the canvas covers the entire client area
+ - key_up/down events for 'character keys' *do* bubble up (otherwise
+ the browser will not generate UNICODE character events)
+ - all other key events *do not* bubble up by default (this prevents side effects
+ like F1 opening help, or F7 starting 'caret browsing')
+ - character events do no bubble up (although I haven't noticed any side effects
+ otherwise)
+
+ Event bubbling can be enabled for input event categories during initialization
+ in the sapp_desc struct:
+
+ sapp_desc sokol_main(int argc, char* argv[]) {
+ return (sapp_desc){
+ //...
+ .html5_bubble_mouse_events = true,
+ .html5_bubble_touch_events = true,
+ .html5_bubble_wheel_events = true,
+ .html5_bubble_key_events = true,
+ .html5_bubble_char_events = true,
+ };
+ }
+
+ This basically opens the floodgates lets *all* input events bubble up to the browser.
+ To prevent individual events from bubbling, call sapp_consume_event() from within
+ the sokol_app.h event callback.
OPTIONAL: DON'T HIJACK main() (#define SOKOL_NO_ENTRY)
======================================================
@@ -1101,10 +1134,7 @@
TEMP NOTE DUMP
==============
- - onscreen keyboard support on Android requires Java :(, should we even bother?
- sapp_desc needs a bool whether to initialize depth-stencil surface
- - GL context initialization needs more control (at least what GL version to initialize)
- - application icon
- the Android implementation calls cleanup_cb() and destroys the egl context in onDestroy
at the latest but should do it earlier, in onStop, as an app is "killable" after onStop
on Android Honeycomb and later (it can't be done at the moment as the app may be started
@@ -1545,7 +1575,6 @@ typedef struct sapp_allocator {
_SAPP_LOGITEM_XMACRO(LINUX_GLX_NO_SUITABLE_GLXFBCONFIG, "failed to find a suitable GLXFBConfig") \
_SAPP_LOGITEM_XMACRO(LINUX_GLX_GET_VISUAL_FROM_FBCONFIG_FAILED, "glXGetVisualFromFBConfig failed") \
_SAPP_LOGITEM_XMACRO(LINUX_GLX_REQUIRED_EXTENSIONS_MISSING, "GLX extensions ARB_create_context and ARB_create_context_profile missing") \
- _SAPP_LOGITEM_XMACRO(LINUX_GLX_ES_REQUIRED_EXTENSIONS_MISSING, "GLX extension EXT_create_context_es_profile missing") \
_SAPP_LOGITEM_XMACRO(LINUX_GLX_CREATE_CONTEXT_FAILED, "Failed to create GL context via glXCreateContextAttribsARB") \
_SAPP_LOGITEM_XMACRO(LINUX_GLX_CREATE_WINDOW_FAILED, "glXCreateWindow() failed") \
_SAPP_LOGITEM_XMACRO(LINUX_X11_CREATE_WINDOW_FAILED, "XCreateWindow() failed") \
@@ -1593,7 +1622,7 @@ typedef struct sapp_allocator {
_SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_DONE, "NativeActivity done") \
_SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_ONCREATE, "NativeActivity onCreate") \
_SAPP_LOGITEM_XMACRO(ANDROID_CREATE_THREAD_PIPE_FAILED, "failed to create thread pipe") \
- _SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS, "NativeActivity sucessfully created") \
+ _SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS, "NativeActivity successfully created") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED, "wgpu: failed to create surface for swapchain") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED, "wgpu: failed to create swapchain object") \
_SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED, "wgpu: failed to create depth-stencil texture for swapchain") \
@@ -1677,6 +1706,11 @@ typedef struct sapp_desc {
bool html5_preserve_drawing_buffer; // HTML5 only: whether to preserve default framebuffer content between frames
bool html5_premultiplied_alpha; // HTML5 only: whether the rendered pixels use premultiplied alpha convention
bool html5_ask_leave_site; // initial state of the internal html5_ask_leave_site flag (see sapp_html5_ask_leave_site())
+ bool html5_bubble_mouse_events; // if true, mouse events will bubble up to the web page
+ bool html5_bubble_touch_events; // same for touch events
+ bool html5_bubble_wheel_events; // same for wheel events
+ bool html5_bubble_key_events; // if true, bubble up *all* key events to browser, not just key events that represent characters
+ bool html5_bubble_char_events; // if true, bubble up character events to browser
bool ios_keyboard_resizes_canvas; // if true, showing the iOS keyboard shrinks the canvas
} sapp_desc;
@@ -1776,7 +1810,7 @@ SOKOL_APP_API_DECL sapp_desc sapp_query_desc(void);
SOKOL_APP_API_DECL void sapp_request_quit(void);
/* cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received) */
SOKOL_APP_API_DECL void sapp_cancel_quit(void);
-/* initiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED) */
+/* initiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUESTED) */
SOKOL_APP_API_DECL void sapp_quit(void);
/* call from inside event callback to consume the current event (don't forward to platform) */
SOKOL_APP_API_DECL void sapp_consume_event(void);
@@ -1898,17 +1932,6 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#define _SAPP_PIXELFORMAT_DEPTH (43)
#define _SAPP_PIXELFORMAT_DEPTH_STENCIL (44)
-#if defined(_SAPP_MACOS) || defined(_SAPP_IOS)
- // this is ARC compatible
- #if defined(__cplusplus)
- #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = type(); }
- #else
- #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; }
- #endif
-#else
- #define _SAPP_CLEAR_ARC_STRUCT(type, item) { _sapp_clear(&item, sizeof(item)); }
-#endif
-
// check if the config defines are alright
#if defined(__APPLE__)
// see https://clang.llvm.org/docs/LanguageExtensions.html#automatic-reference-counting
@@ -1956,11 +1979,11 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#elif defined(__linux__) || defined(__unix__)
/* Linux */
#define _SAPP_LINUX (1)
- #if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3)
+ #if defined(SOKOL_GLCORE33)
#if !defined(SOKOL_FORCE_EGL)
#define _SAPP_GLX (1)
#endif
- #else
+ #elif !defined(SOKOL_GLES3)
#error("sokol_app.h: unknown 3D API selected for Linux, must be SOKOL_GLCORE33, SOKOL_GLES3")
#endif
#else
@@ -2101,6 +2124,18 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#include <time.h>
#endif
+#if defined(_SAPP_APPLE)
+ // this is ARC compatible
+ #if defined(__cplusplus)
+ #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = type(); }
+ #else
+ #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; }
+ #endif
+#else
+ #define _SAPP_CLEAR_ARC_STRUCT(type, item) { _sapp_clear(&item, sizeof(item)); }
+#endif
+
+
// ███████ ██████ █████ ███ ███ ███████ ████████ ██ ███ ███ ██ ███ ██ ██████
// ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ████ ████ ██ ████ ██ ██
// █████ ██████ ███████ ██ ████ ██ █████ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ███
@@ -2607,7 +2642,6 @@ typedef struct {
#define GLX_SAMPLES 0x186a1
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
@@ -2725,8 +2759,6 @@ typedef struct {
bool ARB_multisample;
bool ARB_create_context;
bool ARB_create_context_profile;
- bool EXT_create_context_es_profile;
- bool EXT_create_context_es2_profile;
} _sapp_glx_t;
#else
@@ -3882,6 +3914,20 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
[_sapp.macos.window makeKeyAndOrderFront:nil];
_sapp_macos_update_dimensions();
[NSEvent setMouseCoalescingEnabled:NO];
+
+ // workaround for window not being focused during a long init callback
+ // for details see: https://github.com/floooh/sokol/pull/982
+ // also see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2342
+ NSEvent *focusevent = [NSEvent otherEventWithType:NSEventTypeAppKitDefined
+ location:NSZeroPoint
+ modifierFlags:0x40
+ timestamp:0
+ windowNumber:0
+ context:nil
+ subtype:NSEventSubtypeApplicationActivated
+ data1:0
+ data2:0];
+ [NSApp postEvent:focusevent atStart:YES];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender {
@@ -4050,7 +4096,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
}
#endif
-_SOKOL_PRIVATE void _sapp_macos_poll_input_events() {
+_SOKOL_PRIVATE void _sapp_macos_poll_input_events(void) {
/*
NOTE: late event polling temporarily out-commented to check if this
@@ -5118,7 +5164,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU
_SOKOL_PRIVATE EM_BOOL _sapp_emsc_mouse_cb(int emsc_type, const EmscriptenMouseEvent* emsc_event, void* user_data) {
_SOKOL_UNUSED(user_data);
- bool consume_event = false;
+ bool consume_event = !_sapp.desc.html5_bubble_mouse_events;
_sapp.emsc.mouse_buttons = emsc_event->buttons;
if (_sapp.mouse.locked) {
_sapp.mouse.dx = (float) emsc_event->movementX;
@@ -5179,7 +5225,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_mouse_cb(int emsc_type, const EmscriptenMouseE
} else {
_sapp.event.mouse_button = SAPP_MOUSEBUTTON_INVALID;
}
- consume_event = _sapp_call_event(&_sapp.event);
+ consume_event |= _sapp_call_event(&_sapp.event);
}
// mouse lock can only be activated in mouse button events (not in move, enter or leave)
if (is_button_event) {
@@ -5192,6 +5238,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_mouse_cb(int emsc_type, const EmscriptenMouseE
_SOKOL_PRIVATE EM_BOOL _sapp_emsc_wheel_cb(int emsc_type, const EmscriptenWheelEvent* emsc_event, void* user_data) {
_SOKOL_UNUSED(emsc_type);
_SOKOL_UNUSED(user_data);
+ bool consume_event = !_sapp.desc.html5_bubble_wheel_events;
_sapp.emsc.mouse_buttons = emsc_event->mouse.buttons;
if (_sapp_events_enabled()) {
_sapp_init_event(SAPP_EVENTTYPE_MOUSE_SCROLL);
@@ -5206,12 +5253,10 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_wheel_cb(int emsc_type, const EmscriptenWheelE
}
_sapp.event.scroll_x = scale * (float)emsc_event->deltaX;
_sapp.event.scroll_y = scale * (float)emsc_event->deltaY;
- _sapp_call_event(&_sapp.event);
+ consume_event |= _sapp_call_event(&_sapp.event);
}
_sapp_emsc_update_mouse_lock_state();
- // NOTE: wheel events are always consumed because they try to scroll the
- // page which looks pretty bad
- return true;
+ return consume_event;
}
static struct {
@@ -5335,6 +5380,12 @@ _SOKOL_PRIVATE sapp_keycode _sapp_emsc_translate_key(const char* str) {
return SAPP_KEYCODE_INVALID;
}
+// returns true if the key code is a 'character key', this is used to decide
+// if a key event needs to bubble up to create a char event
+_SOKOL_PRIVATE bool _sapp_emsc_is_char_key(sapp_keycode key_code) {
+ return key_code < SAPP_KEYCODE_WORLD_1;
+}
+
_SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboardEvent* emsc_event, void* user_data) {
_SOKOL_UNUSED(user_data);
bool consume_event = false;
@@ -5362,6 +5413,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard
if (type == SAPP_EVENTTYPE_CHAR) {
// NOTE: charCode doesn't appear to be supported on Android Chrome
_sapp.event.char_code = emsc_event->charCode;
+ consume_event |= !_sapp.desc.html5_bubble_char_events;
} else {
if (0 != emsc_event->code[0]) {
// This code path is for desktop browsers which send untranslated 'physical' key code strings
@@ -5386,83 +5438,17 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard
{
send_keyup_followup = true;
}
- // Only forward alpha-numeric keys to the browser (can further be suppressed by sapp_consume_event())
- // NOTE: it should be possible to disable this behaviour via sapp_desc to give apps more
- // controls over input event bubbling.
- switch (_sapp.event.key_code) {
- case SAPP_KEYCODE_WORLD_1:
- case SAPP_KEYCODE_WORLD_2:
- case SAPP_KEYCODE_ESCAPE:
- case SAPP_KEYCODE_ENTER:
- case SAPP_KEYCODE_TAB:
- case SAPP_KEYCODE_BACKSPACE:
- case SAPP_KEYCODE_INSERT:
- case SAPP_KEYCODE_DELETE:
- case SAPP_KEYCODE_RIGHT:
- case SAPP_KEYCODE_LEFT:
- case SAPP_KEYCODE_DOWN:
- case SAPP_KEYCODE_UP:
- case SAPP_KEYCODE_PAGE_UP:
- case SAPP_KEYCODE_PAGE_DOWN:
- case SAPP_KEYCODE_HOME:
- case SAPP_KEYCODE_END:
- case SAPP_KEYCODE_CAPS_LOCK:
- case SAPP_KEYCODE_SCROLL_LOCK:
- case SAPP_KEYCODE_NUM_LOCK:
- case SAPP_KEYCODE_PRINT_SCREEN:
- case SAPP_KEYCODE_PAUSE:
- case SAPP_KEYCODE_F1:
- case SAPP_KEYCODE_F2:
- case SAPP_KEYCODE_F3:
- case SAPP_KEYCODE_F4:
- case SAPP_KEYCODE_F5:
- case SAPP_KEYCODE_F6:
- case SAPP_KEYCODE_F7:
- case SAPP_KEYCODE_F8:
- case SAPP_KEYCODE_F9:
- case SAPP_KEYCODE_F10:
- case SAPP_KEYCODE_F11:
- case SAPP_KEYCODE_F12:
- case SAPP_KEYCODE_F13:
- case SAPP_KEYCODE_F14:
- case SAPP_KEYCODE_F15:
- case SAPP_KEYCODE_F16:
- case SAPP_KEYCODE_F17:
- case SAPP_KEYCODE_F18:
- case SAPP_KEYCODE_F19:
- case SAPP_KEYCODE_F20:
- case SAPP_KEYCODE_F21:
- case SAPP_KEYCODE_F22:
- case SAPP_KEYCODE_F23:
- case SAPP_KEYCODE_F24:
- case SAPP_KEYCODE_F25:
- case SAPP_KEYCODE_LEFT_SHIFT:
- case SAPP_KEYCODE_LEFT_CONTROL:
- case SAPP_KEYCODE_LEFT_ALT:
- case SAPP_KEYCODE_LEFT_SUPER:
- case SAPP_KEYCODE_RIGHT_SHIFT:
- case SAPP_KEYCODE_RIGHT_CONTROL:
- case SAPP_KEYCODE_RIGHT_ALT:
- case SAPP_KEYCODE_RIGHT_SUPER:
- case SAPP_KEYCODE_MENU:
- // consume the event
- consume_event = true;
- break;
- default:
- // forward key to browser
- consume_event = false;
- break;
+
+ // 'character key events' will always need to bubble up, otherwise the browser
+ // wouldn't be able to generate character events.
+ if (!_sapp_emsc_is_char_key(_sapp.event.key_code)) {
+ consume_event |= !_sapp.desc.html5_bubble_key_events;
}
}
- if (_sapp_call_event(&_sapp.event)) {
- // event was consumed via sapp_consume_event()
- consume_event = true;
- }
+ consume_event |= _sapp_call_event(&_sapp.event);
if (send_keyup_followup) {
_sapp.event.type = SAPP_EVENTTYPE_KEY_UP;
- if (_sapp_call_event(&_sapp.event)) {
- consume_event = true;
- }
+ consume_event |= _sapp_call_event(&_sapp.event);
}
}
}
@@ -5472,7 +5458,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard
_SOKOL_PRIVATE EM_BOOL _sapp_emsc_touch_cb(int emsc_type, const EmscriptenTouchEvent* emsc_event, void* user_data) {
_SOKOL_UNUSED(user_data);
- bool consume_event = false;
+ bool consume_event = !_sapp.desc.html5_bubble_touch_events;
if (_sapp_events_enabled()) {
sapp_event_type type;
switch (emsc_type) {
@@ -5507,7 +5493,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_touch_cb(int emsc_type, const EmscriptenTouchE
dst->pos_y = src->targetY * _sapp.dpi_scale;
dst->changed = src->isChanged;
}
- consume_event = _sapp_call_event(&_sapp.event);
+ consume_event |= _sapp_call_event(&_sapp.event);
}
}
return consume_event;
@@ -5726,7 +5712,7 @@ _SOKOL_PRIVATE void _sapp_emsc_wgpu_request_adapter_cb(WGPURequestAdapterStatus
WGPUDeviceDescriptor dev_desc;
_sapp_clear(&dev_desc, sizeof(dev_desc));
- dev_desc.requiredFeaturesCount = cur_feature_index;
+ dev_desc.requiredFeatureCount = cur_feature_index;
dev_desc.requiredFeatures = requiredFeatures,
wgpuAdapterRequestDevice(adapter, &dev_desc, _sapp_emsc_wgpu_request_device_cb, 0);
}
@@ -5786,7 +5772,7 @@ _SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) {
#endif
}
-_SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() {
+_SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers(void) {
emscripten_set_mousedown_callback(_sapp.html5_canvas_selector, 0, true, 0);
emscripten_set_mouseup_callback(_sapp.html5_canvas_selector, 0, true, 0);
emscripten_set_mousemove_callback(_sapp.html5_canvas_selector, 0, true, 0);
@@ -5804,6 +5790,9 @@ _SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() {
emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, 0);
emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0);
emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0);
+ if (!_sapp.desc.html5_canvas_resize) {
+ emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0);
+ }
sapp_js_remove_beforeunload_listener();
if (_sapp.clipboard.enabled) {
sapp_js_remove_clipboard_listener();
@@ -5896,7 +5885,7 @@ int main(int argc, char* argv[]) {
// ██████ ███████ ██ ██ ███████ ███████ ██ ███████ ██ ██ ███████
//
// >>gl helpers
-#if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3)
+#if defined(SOKOL_GLCORE33)
typedef struct {
int red_bits;
int green_bits;
@@ -8253,8 +8242,8 @@ _SOKOL_PRIVATE bool _sapp_android_touch_event(const AInputEvent* e) {
for (int32_t i = 0; i < _sapp.event.num_touches; i++) {
sapp_touchpoint* dst = &_sapp.event.touches[i];
dst->identifier = (uintptr_t)AMotionEvent_getPointerId(e, (size_t)i);
- dst->pos_x = (AMotionEvent_getRawX(e, (size_t)i) / _sapp.window_width) * _sapp.framebuffer_width;
- dst->pos_y = (AMotionEvent_getRawY(e, (size_t)i) / _sapp.window_height) * _sapp.framebuffer_height;
+ dst->pos_x = (AMotionEvent_getX(e, (size_t)i) / _sapp.window_width) * _sapp.framebuffer_width;
+ dst->pos_y = (AMotionEvent_getY(e, (size_t)i) / _sapp.window_height) * _sapp.framebuffer_height;
dst->android_tooltype = (sapp_android_tooltype) AMotionEvent_getToolType(e, (size_t)i);
if (action == AMOTION_EVENT_ACTION_POINTER_DOWN ||
action == AMOTION_EVENT_ACTION_POINTER_UP) {
@@ -9644,7 +9633,7 @@ _SOKOL_PRIVATE void* _sapp_glx_getprocaddr(const char* procname)
}
}
-_SOKOL_PRIVATE void _sapp_glx_init() {
+_SOKOL_PRIVATE void _sapp_glx_init(void) {
const char* sonames[] = { "libGL.so.1", "libGL.so", 0 };
for (int i = 0; sonames[i]; i++) {
_sapp.glx.libgl = dlopen(sonames[i], RTLD_LAZY|RTLD_GLOBAL);
@@ -9711,8 +9700,6 @@ _SOKOL_PRIVATE void _sapp_glx_init() {
_sapp.glx.ARB_create_context = 0 != _sapp.glx.CreateContextAttribsARB;
}
_sapp.glx.ARB_create_context_profile = _sapp_glx_extsupported("GLX_ARB_create_context_profile", exts);
- _sapp.glx.EXT_create_context_es_profile = _sapp_glx_extsupported("GLX_EXT_create_context_es_profile", exts);
- _sapp.glx.EXT_create_context_es2_profile = _sapp_glx_extsupported("GLX_EXT_create_context_es2_profile", exts);
}
_SOKOL_PRIVATE int _sapp_glx_attrib(GLXFBConfig fbconfig, int attrib) {
@@ -9721,7 +9708,7 @@ _SOKOL_PRIVATE int _sapp_glx_attrib(GLXFBConfig fbconfig, int attrib) {
return value;
}
-_SOKOL_PRIVATE GLXFBConfig _sapp_glx_choosefbconfig() {
+_SOKOL_PRIVATE GLXFBConfig _sapp_glx_choosefbconfig(void) {
GLXFBConfig* native_configs;
_sapp_gl_fbconfig* usable_configs;
const _sapp_gl_fbconfig* closest;
@@ -9816,22 +9803,12 @@ _SOKOL_PRIVATE void _sapp_glx_create_context(void) {
if (!(_sapp.glx.ARB_create_context && _sapp.glx.ARB_create_context_profile)) {
_SAPP_PANIC(LINUX_GLX_REQUIRED_EXTENSIONS_MISSING);
}
-#if defined(SOKOL_GLES3)
- // At least one of extension strings must be exported
- if (!(_sapp.glx.EXT_create_context_es_profile || _sapp.glx.EXT_create_context_es2_profile)) {
- _SAPP_PANIC(LINUX_GLX_ES_REQUIRED_EXTENSIONS_MISSING);
- }
-#endif
_sapp_x11_grab_error_handler();
const int attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, _sapp.desc.gl_major_version,
GLX_CONTEXT_MINOR_VERSION_ARB, _sapp.desc.gl_minor_version,
- #if defined(SOKOL_GLES3)
- GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES_PROFILE_BIT_EXT,
- #else
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
- #endif
0, 0
};
_sapp.glx.ctx = _sapp.glx.CreateContextAttribsARB(_sapp.x11.display, native, NULL, True, attribs);