Skip to content

Commit 4dbbabe

Browse files
committed
Improve Roy's iOS compatibility fixes.
1 parent afebb51 commit 4dbbabe

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Gui.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ namespace ofxImGui
167167
// Note : In chaining mode, additional flags can still be set.
168168
io.ConfigFlags |= customFlags_;
169169

170+
// Inject touch flags by default on touch-only platforms
171+
#if defined(OFXIMGUI_TOUCH_EVENTS) && !defined(OFXIMGUI_TOUCH_EVENTS_AUTO_CONFIG)
172+
io.ConfigFlags |= ImGuiConfigFlags_IsTouchScreen;
173+
#endif
174+
170175
// Already-setup window --> slaves exit early
171176
if( !isContextOwned ) {
172177
#ifdef OFXIMGUI_DEBUG

src/ofxImGuiConstants.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
#define OFXIMGUI_COMPILER_MESSAGE(X)
3939
#endif
4040

41+
// Touch events support ?
42+
// - - - - - - - - - - - - - - - -
43+
// Todo: add explicit compiler flag so devices such as Windows/Linux with TouchScreens can use it too ?
44+
#if defined(TARGET_OF_IOS) || defined(TARGET_OF_ANDROID)
45+
#define OFXIMGUI_TOUCH_EVENTS
46+
#define OFXIMGUI_FORCE_OF_BACKEND // Note: force it bcoz there will probably never be GLFW support on mobile devices ?
47+
#endif
48+
4149
// Platform backend selection
4250
#if !defined(OFXIMGUI_FORCE_OF_BACKEND)
4351

@@ -67,7 +75,7 @@
6775

6876
// Default backend : openframeworks
6977
#ifndef OFXIMGUI_LOADED_BACKEND
70-
OFXIMGUI_COMPILER_MESSAGE("ofxImGui is compiling with the default openFrameworks backend.")
78+
OFXIMGUI_COMPILER_MESSAGE("ofxImGui is compiling with the non-default openFrameworks backend.")
7179
#define OFXIMGUI_LOADED_BACKEND "OpenFrameworks"
7280
#define OFXIMGUI_BACKEND_OPENFRAMEWORKS
7381
#endif
@@ -164,9 +172,4 @@
164172
// Prevent using this flag in code
165173
#undef OFXIMGUI_GLFW_FIX_MULTICONTEXT
166174

167-
// Touch events support ?
168-
// - - - - - - - - - - - - - - - -
169-
// Todo: add explicit compiler flag so devices such as Windows/Linux with TouchScreens can use it too ?
170-
#if defined(TARGET_OF_IOS) || defined(TARGET_ANDROID)
171-
#define OFXIMGUI_TOUCH_EVENTS
172-
#endif
175+

0 commit comments

Comments
 (0)