display: add a set function for the display type
authorjinhyung.jo <jinhyung.jo@samsung.com>
Tue, 21 Apr 2015 01:53:04 +0000 (10:53 +0900)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Tue, 21 Apr 2015 07:16:51 +0000 (16:16 +0900)
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 <jinhyung.jo@samsung.com>
tizen/src/display/maru_display.c
tizen/src/display/qt5.c
tizen/src/display/qt5_supplement.cpp
tizen/src/ns_event.h
tizen/src/ns_event.m

index db2abfb..ae67fd0 100644 (file)
@@ -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
index fda6b97..0fcd230 100644 (file)
@@ -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/"
index 41af9f3..421a1a9 100644 (file)
@@ -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"
index e277ee4..1ca3ff9 100644 (file)
@@ -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_ */
index 62a097c..3de382f 100644 (file)
@@ -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];
 }