Update Wayland porting code
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 12 May 2015 08:10:42 +0000 (17:10 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 12 May 2015 08:10:42 +0000 (17:10 +0900)
Currently it is empty now.

Change-Id: Ibefd3cd39ef92669c28f7806f7529fe403a2aac6

src/virtual_window_wayland.c

index 5bd2c80..424d8cd 100644 (file)
  * limitations under the License.
  */
 
+#define _GNU_SOURCE
+
 #include <Elementary.h>
 #include <string.h>
 #include <Ecore_Evas.h>
-#include <Ecore_X.h>
 #include <Evas.h>
+#include <dlfcn.h>
+#include <Eina.h>
+#include <math.h>
 
 #include <dlog.h>
 #include <widget_errno.h>
 #include <widget_service.h>
+#include <widget_service_internal.h>
+#include <widget_conf.h>
+#include <widget_buffer.h>
+#include <widget_provider.h>
+#include <widget_util.h>
 
-#include "binder.h"
 #include "widget.h"
+#include "widget_internal.h"
 #include "debug.h"
+#include "binder.h"
 
 #define IS_GBAR 1
 
 #define PUBLIC __attribute__((visibility("default")))
 #define WIDGET_WIN_TAG "dynamic,box,win"
+#define WIN_INFO_TAG "dynamic,box,info"
 
 #define WIDGET_DEFAULT_WIDTH 1
 #define WIDGET_DEFAULT_HEIGHT 1
-#define GL_ENGINE "opengl_x11"
 
 static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
 {
@@ -92,11 +102,11 @@ static inline void apply_orientation(int degree, int *x, int *y, int width, int
        }
 }
 
-/*!
- * \note
+/**
+ * @note
  * Every user event (mouse) on the buffer will be passed via this event callback
  */
-static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_event_data *event_info, void *data)
+static int event_handler_cb(widget_buffer_h handler, struct widget_buffer_event_data *event_info, void *data)
 {
        vwin_info_t info = data;
        Elm_Access_Action_Info action_info;
@@ -106,8 +116,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
        unsigned int flags = 0;
        double timestamp;
 
-
-       if (!info->handle) {
+       if (!info || info->state != VWIN_INFO_CREATED || !info->handle) {
                /* Just ignore this event */
                return 0;
        }
@@ -117,7 +126,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        struct timeval tv;
 
                        if (gettimeofday(&tv, NULL) < 0) {
-                               ErrPrint("gettimeofday: %s\n", strerror(errno));
+                               ErrPrint("gettimeofday: %d\n", errno);
                        } else {
                                timestamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
                                timestamp -= event_info->timestamp;
@@ -148,8 +157,8 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                timestamp = event_info->timestamp * 1000.0f;
        }
 
-       /*!
-        * \note
+       /**
+        * @note
         * Feed up events
         */
        switch (event_info->type) {
@@ -182,6 +191,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                break;
        case WIDGET_BUFFER_EVENT_DOWN:
                apply_orientation(info->orientation, &event_info->info.pointer.x, &event_info->info.pointer.y, info->w, info->h, event_info->info.pointer.source);
+
                if (info->pressed) {
                        ErrPrint("MOUSE UP is not called\n");
                        ErrPrint("UP[%s] %dx%d - %lf\n", info->id, event_info->info.pointer.x, event_info->info.pointer.y, timestamp);
@@ -236,7 +246,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_HIGHLIGHT;
+               action_type = 0; //ELM_ACCESS_ACTION_HIGHLIGHT;
                /**
                 * @note
                 * Calculate the event occurred X & Y on the buffer
@@ -264,7 +274,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
+               action_type = 0; //ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
                action_info.highlight_cycle = EINA_FALSE;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_LAST : WIDGET_ACCESS_STATUS_DONE;
@@ -276,7 +286,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
+               action_type = 0; //ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
                action_info.highlight_cycle = EINA_FALSE;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_FIRST : WIDGET_ACCESS_STATUS_DONE;
@@ -288,7 +298,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_ACTIVATE;
+               action_type = 0; //ELM_ACCESS_ACTION_ACTIVATE;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_ERROR : WIDGET_ACCESS_STATUS_DONE;
                break;
@@ -299,7 +309,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_UP;
+               action_type = 0; //ELM_ACCESS_ACTION_UP;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_ERROR : WIDGET_ACCESS_STATUS_DONE;
                break;
@@ -310,7 +320,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_DOWN;
+               action_type = 0; //ELM_ACCESS_ACTION_DOWN;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_ERROR : WIDGET_ACCESS_STATUS_DONE;
                break;
@@ -321,7 +331,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_SCROLL;
+               action_type = 0; //ELM_ACCESS_ACTION_SCROLL;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -335,7 +345,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_SCROLL;
+               action_type = 0; //ELM_ACCESS_ACTION_SCROLL;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -349,7 +359,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_SCROLL;
+               action_type = 0; //ELM_ACCESS_ACTION_SCROLL;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -363,7 +373,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
+               action_type = 0; //ELM_ACCESS_ACTION_UNHIGHLIGHT;
                ret = elm_access_action(parent_elm, action_type, &action_info);
                ret = (ret == EINA_FALSE) ? WIDGET_ACCESS_STATUS_ERROR : WIDGET_ACCESS_STATUS_DONE;
                break;
@@ -374,7 +384,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_VALUE_CHANGE;
+               action_type = 0; //ELM_ACCESS_ACTION_VALUE_CHANGE;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -388,7 +398,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_MOUSE;
+               action_type = 0; //ELM_ACCESS_ACTION_MOUSE;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -402,7 +412,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_BACK;
+               action_type = 0; //ELM_ACCESS_ACTION_BACK;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -416,7 +426,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_OVER;
+               action_type = 0; //ELM_ACCESS_ACTION_OVER;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -430,7 +440,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_READ;
+               action_type = 0; //ELM_ACCESS_ACTION_READ;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -444,7 +454,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_ENABLE;
+               action_type = 0; //ELM_ACCESS_ACTION_ENABLE;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -458,7 +468,7 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
                memset(&action_info, 0, sizeof(action_info));
-               action_type = ELM_ACCESS_ACTION_DISABLE;
+               action_type = 0; //ELM_ACCESS_ACTION_DISABLE;
                action_info.x = event_info->info.access.x;
                action_info.y = event_info->info.access.y;
                action_info.mouse_type = event_info->info.access.mouse_type;
@@ -472,6 +482,11 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
 
+               /**
+                * @TODO
+                * Fills me
+                */
+
                ret = WIDGET_KEY_STATUS_ERROR;
                break;
        case WIDGET_BUFFER_EVENT_KEY_UP:
@@ -481,6 +496,10 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
 
+               /**
+                * @TODO
+                * Fills me
+                */
                ret = WIDGET_KEY_STATUS_ERROR;
                break;
        case WIDGET_BUFFER_EVENT_KEY_FOCUS_IN:
@@ -490,6 +509,10 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
 
+               /**
+                * @TODO
+                * Fills me
+                */
                ret = WIDGET_KEY_STATUS_ERROR;
                break;
        case WIDGET_BUFFER_EVENT_KEY_FOCUS_OUT:
@@ -499,6 +522,10 @@ static int event_handler_cb(struct widget_buffer *handler, struct widget_buffer_
                        break;
                }
 
+               /**
+                * @TODO
+                * Fills me
+                */
                ret = WIDGET_KEY_STATUS_ERROR;
                break;
        default:
@@ -562,10 +589,28 @@ static void post_render_cb(void *data, Evas *e, void *event_info)
        if (info->type == VWIN_GEM) {
                widget_buffer_post_render(info->handle);
        } else if (info->type == VWIN_PIXMAP) {
-               /**
-                * TODO
-                */
-               ErrPrint("NOT SUPPORTED\n");
+               int idx;
+               unsigned int front_resource_id;
+
+               front_resource_id = ecore_evas_gl_x11_pixmap_get(info->ee);
+
+               for (idx = 0; idx < WIDGET_CONF_EXTRA_BUFFER_COUNT; idx++) {
+                       if (front_resource_id == info->resource_array[idx]) {
+                               /**
+                                */
+                               widget_send_updated_by_idx(info->handle, idx);
+                               break;
+                       }
+               }
+
+               if (idx == WIDGET_CONF_EXTRA_BUFFER_COUNT) {
+                       /* Send updated event for PRIMARY BUFFER */
+                       if (front_resource_id == widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER)) {
+                               widget_send_updated_by_idx(info->handle, WIDGET_PRIMARY_BUFFER);
+                       } else {
+                               DbgPrint("Unable to send updated: %u (%u)\n", front_resource_id, widget_viewer_get_resource_id(info->handle, WIDGET_PRIMARY_BUFFER));
+                       }
+               }
        } else if (info->type == VWIN_SW_BUF) {
                widget_viewer_sync_buffer(info->handle);
        }
@@ -600,7 +645,7 @@ static int pre_orientation_cb(const char *id, void *data)
        return WIDGET_ERROR_NONE;
 }
 
-static void pre_destroy_cb(const char *id, void *data)
+static int pre_destroy_cb(const char *id, void *data)
 {
        vwin_info_t info = data;
        const char *path = NULL;
@@ -633,7 +678,7 @@ static void ecore_evas_free_cb(Ecore_Evas *ee)
 {
        vwin_info_t info;
 
-       info = ecore_evas_data_get(ee, "dynamic,box,info");
+       info = ecore_evas_data_get(ee, WIN_INFO_TAG);
        if (!info) {
                DbgPrint("Info is not valid\n");
                return;
@@ -696,7 +741,7 @@ PUBLIC Evas *widget_get_evas(const char *id)
         * Acquire a buffer for canvas.
         */
        info->handle = widget_create_buffer(info->id, info->is_gbar,
-                       widget_conf_auto_align(),
+                       binder_widget_auto_align(),
                        event_handler_cb, info);
 
        if (!info->handle) {
@@ -723,7 +768,7 @@ PUBLIC Evas *widget_get_evas(const char *id)
                return NULL;
        }
 
-       ecore_evas_data_set(info->ee, "dynamic,box,info", info);
+       ecore_evas_data_set(info->ee, WIN_INFO_TAG, info);
 
        /**
         * @note