[SDL_Tizen] Add SDL Indicator hints 65/136965/6
authorhuiyu.eun <huiyu.eun@samsung.com>
Tue, 4 Jul 2017 01:49:23 +0000 (10:49 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Tue, 4 Jul 2017 05:05:58 +0000 (14:05 +0900)
- "opaque" : Opacifies the indicator
- "translucent" : Be translucent the indicator
- "transparent" : Transparentizes the indicator
- "bg_transparent" : Transparentizes the indicator background

Can use tizen indicator by SDL_SetHint() api.
* SDL_SetHint("SDL_TIZEN_INDICATOR_OPACITY", "bg_transparent");

Change-Id: I8fd7f17a8e9241eb3bd4d4cef925fb3b0ea1eb4d
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
include/SDL_hints.h
src/video/tizen/SDL_tizenvideo.h
src/video/tizen/SDL_tizenwindow.c
src/video/tizen/SDL_tizenwindow.h

index 3bd5435..a076aa9 100644 (file)
@@ -629,6 +629,17 @@ extern "C" {
  *   "1"       - SDL will only do normal key handling for Alt+F4.
  */
 #define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4    "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
+/**
+ *  \brief Set Tizen indicator opacity
+ *
+ * The variable can be one of
+ *    "#opaque"      - Opacifies the indicator
+ *    "#translucent"    - Be translucent the indicator
+ *    "#transparent"      - Transparentizes the indicator (this is the default)
+ *    "#bg_transparent"      - Transparentizes the indicator background
+ */
+#define SDL_HINT_TIZEN_INDICATOR_OPACITY   "SDL_TIZEN_INDICATOR_OPACITY"
+
 
 /**
  *  \brief  An enumeration of hint priorities
index b9c37ad..17df465 100755 (executable)
@@ -42,8 +42,8 @@ typedef struct {
     Eina_Hash *windows;
     Tizen_Prerotation_Data tizen_pre_rotation_data;
 
+    int indicator_mode;
     SDL_bool indicator_on;
-
 } SDL_VideoData;
 
 /* Initialization/Query functions */
index d259673..b959168 100755 (executable)
@@ -117,7 +117,8 @@ static Eina_Bool _cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, vo
 
     int window_w, window_h;
     ecore_wl_screen_size_get(&window_w, &window_h);
-    _tizen_ecore_ipc_client_send(OP_RESIZE, wind->rotation, window_w, window_h);
+
+    _tizen_ecore_ipc_client_send(OP_INDICATOR_SHOW, wind->rotation, 0, videoData->indicator_mode);
 
     return ECORE_CALLBACK_DONE;
 }
@@ -558,6 +559,25 @@ _tizen_output_transform_register(SDL_WindowData *wind)
                              _tizen_cb_ignore_output_transform, NULL);
 }
 
+void
+_tizen_indicator_opacity_hint_callback(void *userdata, const char *name, const char *oldValue, const char *newValue)
+{
+    SDL_VideoData *data = (SDL_VideoData *)userdata;
+
+    if ((oldValue == NULL) && (newValue == NULL))
+        return;
+
+    SDL_assert(SDL_strncmp(name, SDL_HINT_TIZEN_INDICATOR_OPACITY, SDL_strlen(SDL_HINT_TIZEN_INDICATOR_OPACITY)) == 0);
+    char indicator_type[4][20] = {"opaque","translucent","transparent","bg_transparent"};
+    for (int i=0;i<4;i++) {
+        if(SDL_strncmp(newValue, indicator_type[i], SDL_strlen(indicator_type[i])) == 0)
+        {
+            data->indicator_mode = i+1;
+            break;
+        }
+    }
+}
+
 int
 Tizen_CreateWindow(_THIS, SDL_Window *window)
 {
@@ -681,6 +701,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
       }
     // Add orientaiton hint cb
     _tizen_window_orientation_add_hint((void*)wind);
+    SDL_AddHintCallback(SDL_HINT_TIZEN_INDICATOR_OPACITY, _tizen_indicator_opacity_hint_callback, data);
 
     Tizen_rotate_update(wind);
 
index 0193e3a..43c2679 100755 (executable)
@@ -94,7 +94,8 @@ extern void _tizen_ecore_ipc_client_send(int major, int minor, int ref, int ref_
 
 enum
 {
-    OP_RESIZE=1,
+    OP_INDICATOR_SHOW=1,
+    OP_INDICATOR_HIDE,
     OP_RESUME,
     OP_PAUSE,
     OP_TERMINATE