From 6d29bea863954ea46115730842c534a1f05ef13f Mon Sep 17 00:00:00 2001 From: Daniel Ludwig Date: Sat, 17 Apr 2021 20:24:33 +0200 Subject: sokol_app.h: add function to query IDXGISwapChain object --- sokol_app.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sokol_app.h b/sokol_app.h index 3619c005..cfbca133 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1489,6 +1489,8 @@ SOKOL_APP_API_DECL const void* sapp_ios_get_window(void); SOKOL_APP_API_DECL const void* sapp_d3d11_get_device(void); /* D3D11: get pointer to ID3D11DeviceContext object */ SOKOL_APP_API_DECL const void* sapp_d3d11_get_device_context(void); +/* D3D11: get pointer to IDXGISwapChain object */ +SOKOL_APP_API_DECL const void* sapp_d3d11_get_swap_chain(void); /* D3D11: get pointer to ID3D11RenderTargetView object */ SOKOL_APP_API_DECL const void* sapp_d3d11_get_render_target_view(void); /* D3D11: get pointer to ID3D11DepthStencilView */ @@ -10949,6 +10951,15 @@ SOKOL_API_IMPL const void* sapp_d3d11_get_device_context(void) { #endif } +SOKOL_API_IMPL const void* sapp_d3d11_get_swap_chain(void) { + SOKOL_ASSERT(_sapp.valid); +#if defined(SOKOL_D3D11) + return _sapp.d3d11.swap_chain; +#else + return 0; +#endif +} + SOKOL_API_IMPL const void* sapp_d3d11_get_render_target_view(void) { SOKOL_ASSERT(_sapp.valid); #if defined(SOKOL_D3D11) -- cgit v1.2.3 From b347c1201fc84a76ad9be4fcc7b06d75345caabe Mon Sep 17 00:00:00 2001 From: Daniel Ludwig Date: Sat, 17 Apr 2021 20:26:35 +0200 Subject: sokol_time.h: add 100 Hz to common refresh rates --- sokol_time.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sokol_time.h b/sokol_time.h index 8821da70..3bf1167e 100644 --- a/sokol_time.h +++ b/sokol_time.h @@ -284,6 +284,7 @@ static const uint64_t _stm_refresh_rates[][2] = { { 13333333, 250000 }, // 75 Hz: 13.3333 +- 0.25ms { 11764706, 250000 }, // 85 Hz: 11.7647 +- 0.25 { 11111111, 250000 }, // 90 Hz: 11.1111 +- 0.25ms + { 10000000, 500000 }, // 100 Hz: 10.0000 +- 0.5ms { 8333333, 500000 }, // 120 Hz: 8.3333 +- 0.5ms { 6944445, 500000 }, // 144 Hz: 6.9445 +- 0.5ms { 4166667, 1000000 }, // 240 Hz: 4.1666 +- 1ms -- cgit v1.2.3 From fb5c6c48113753e80f0ee0d13171d5264a635167 Mon Sep 17 00:00:00 2001 From: Stephens Nunnally <43077547+stevinz@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:56:44 -0400 Subject: MacOS main menu bar activation fix. On MacOS 10.14.6, after implementing a quit menu item (seen in pull request #362, https://github.com/floooh/sokol/pull/362) and subsequently additional menu items, I found that upon initial App launch the Apple menu and the App's menus in the main menu bar do not respond to mouse clicks. Switching away from the App and then back again resolves the issue. I found others having the same issue (with Swift, not Sokol App) on stack overflow along with a fix: (https://stackoverflow.com/questions/62739862/why-doesnt-activateignoringotherapps-enable-the-menu-bar). Moving the App activation to applicationDidFinishLaunching() seems to work great, after this change, the menus are clickable from first launch. --- sokol_app.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index cfbca133..473c184c 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -2824,10 +2824,8 @@ _SOKOL_PRIVATE void _sapp_macos_run(const sapp_desc* desc) { // set the application dock icon as early as possible, otherwise // the dummy icon will be visible for a short time sapp_set_icon(&_sapp.desc.icon); - NSApp.activationPolicy = NSApplicationActivationPolicyRegular; _sapp.macos.app_dlg = [[_sapp_macos_app_delegate alloc] init]; NSApp.delegate = _sapp.macos.app_dlg; - [NSApp activateIgnoringOtherApps:YES]; [NSApp run]; // NOTE: [NSApp run] never returns, instead cleanup code // must be put into applicationWillTerminate @@ -3170,6 +3168,8 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) { else { [_sapp.macos.window center]; } + NSApp.activationPolicy = NSApplicationActivationPolicyRegular; + [NSApp activateIgnoringOtherApps:YES]; [_sapp.macos.window makeKeyAndOrderFront:nil]; _sapp_macos_update_dimensions(); [NSEvent setMouseCoalescingEnabled:NO]; -- cgit v1.2.3