From 9cb0202b0a7d409b77a68b218e15cfe0b936b24b Mon Sep 17 00:00:00 2001 From: "jinhyung.jo" Date: Tue, 21 Apr 2015 10:53:04 +0900 Subject: [PATCH] display: add a set function for the display type There is a issue on Mac OS, at the time of the setting of the onscreen/offscreen. ns_run_in_event_loop wants to a function pointer with void, but the assigned function has a bool argument. Thus, separate the function, add a set function for the display type. Change-Id: Ie3788234fc78a32170a1ed9d4c8de6f1e29e9669 Signed-off-by: Jinhyung Jo --- tizen/src/display/maru_display.c | 4 ++++ tizen/src/display/qt5.c | 3 ++- tizen/src/display/qt5_supplement.cpp | 2 +- tizen/src/ns_event.h | 2 ++ tizen/src/ns_event.m | 22 +++++++++++++++++++--- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/tizen/src/display/maru_display.c b/tizen/src/display/maru_display.c index db2abfb..ae67fd0 100644 --- a/tizen/src/display/maru_display.c +++ b/tizen/src/display/maru_display.c @@ -65,9 +65,11 @@ void maru_display_early_init(DisplayType display_type) switch (display_type) { #ifdef CONFIG_QT case DT_MARU_QT_ONSCREEN: + INFO("Display Type: Qt5 Onscreen\n"); maru_qt5_display_early_init(true); break; case DT_MARU_QT_OFFSCREEN: + INFO("Display Type: Qt5 Offscreen\n"); maru_qt5_display_early_init(false); break; #endif @@ -86,11 +88,13 @@ void maru_display_init(DisplayState *ds, DisplayType display_type, switch (display_type) { #ifdef CONFIG_SDL case DT_MARU_SDL: + INFO("Display Type: SDL\n"); maru_sdl_pre_init(mdcl); break; #endif #ifdef CONFIG_USE_SHM case DT_MARU_SHM: + INFO("Display Type: SHM\n"); maru_shm_pre_init(mdcl); break; #endif diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c index fda6b97..0fcd230 100644 --- a/tizen/src/display/qt5.c +++ b/tizen/src/display/qt5.c @@ -105,13 +105,14 @@ static const DisplayChangeListenerOps dcl_ops = { #ifdef CONFIG_DARWIN void ns_run_in_event_loop(void (*func)()); +void ns_run_in_event_loop_with_bool(void (*func)(bool bArg), bool isTrue); void set_application_icon(char *path); #endif void maru_qt5_display_early_init(bool isOnscreen) { #ifdef CONFIG_DARWIN - ns_run_in_event_loop(&qt5_early_prepare); + ns_run_in_event_loop_with_bool(&qt5_early_prepare, isOnscreen); /* set emulator icon */ #define ICON_RESOURCE_PATH "../icons/" diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 553d64b..2b41034 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -260,9 +260,9 @@ void qt5_destroy() void qt5_early_prepare(bool isOnscreen) { - qt5IsOnscreen = isOnscreen; Q_INIT_RESOURCE(resource); qInstallMessageHandler(qMessageOutput); + qt5IsOnscreen = isOnscreen; #ifdef CONFIG_DARWIN #define LIBQCOCOA "libqcocoa.dylib" diff --git a/tizen/src/ns_event.h b/tizen/src/ns_event.h index e277ee4..1ca3ff9 100644 --- a/tizen/src/ns_event.h +++ b/tizen/src/ns_event.h @@ -5,6 +5,8 @@ void ns_event_loop(int* keepRunning); void ns_run_in_event_loop(void (*func)()); +void ns_run_in_event_loop_with_bool(void (*func)(bool bArg), bool isTrue); + void set_application_icon(char *path); #endif /* _NS_EVENT_H_ */ diff --git a/tizen/src/ns_event.m b/tizen/src/ns_event.m index 62a097c..3de382f 100644 --- a/tizen/src/ns_event.m +++ b/tizen/src/ns_event.m @@ -16,7 +16,9 @@ void ns_event_loop(int* keepRunning) @interface Runner : NSObject { - @public void (*func)(); + @public void (*func_void)(); + @public void (*func_bool)(bool bArg); + @public bool isTrue; } - (void)run; @end @@ -24,14 +26,28 @@ void ns_event_loop(int* keepRunning) @implementation Runner - (void)run; { - self->func(); + if (self->func_void) { + self->func_void(); + } + if (self->func_bool) { + self->func_bool(self->isTrue); + } } @end void ns_run_in_event_loop(void (*func)()) { Runner *runner = [[Runner alloc] init]; - runner->func = func; + runner->func_void = func; + [runner performSelectorOnMainThread:@selector(run) withObject:nil waitUntilDone:YES]; + [runner release]; +} + +void ns_run_in_event_loop_with_bool(void (*func)(bool bArg), bool isTrue) +{ + Runner *runner = [[Runner alloc] init]; + runner->func_bool = func; + runner->isTrue = isTrue; [runner performSelectorOnMainThread:@selector(run) withObject:nil waitUntilDone:YES]; [runner release]; } -- 2.7.4