if test x$PKG_CONFIG != xno && \
test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then
- if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm; then
- TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul`
- TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul`
+ if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
+ TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+ TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
video_tizen=yes
fi
fi
if test x$PKG_CONFIG != xno && \
test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then
- if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm; then
- TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul`
- TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul`
+ if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
+ TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+ TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
video_tizen=yes
fi
fi
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libdrm)
+BuildRequires: pkgconfig(ecore-ipc)
BuildRequires: binutils-devel
BuildRequires: which
BuildRequires: autoconf
return -1;
}
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_GestureProcessEvent(event);
-
+ if(event->type == SDL_ROTATEEVENT && SDL_GetHint(SDL_HINT_ORIENTATIONS))
+ {
+ if(*(SDL_GetHint(SDL_HINT_ORIENTATIONS)) != '\0')
+ {
+ SDL_IndicatorProcessEvent(event, _this->current_glwin);
+ }
+ }
return 1;
}
--- /dev/null
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+SDL_PROC(void, glActiveTexture, (GLenum))
+SDL_PROC(void, glAttachShader, (GLuint, GLuint))
+SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *))
+SDL_PROC(void, glBindTexture, (GLenum, GLuint))
+SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum))
+SDL_PROC(void, glClear, (GLbitfield))
+SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
+SDL_PROC(void, glCompileShader, (GLuint))
+SDL_PROC(GLuint, glCreateProgram, (void))
+SDL_PROC(GLuint, glCreateShader, (GLenum))
+SDL_PROC(void, glDeleteProgram, (GLuint))
+SDL_PROC(void, glDeleteShader, (GLuint))
+SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *))
+SDL_PROC(void, glDisable, (GLenum))
+SDL_PROC(void, glDisableVertexAttribArray, (GLuint))
+SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei))
+SDL_PROC(void, glEnable, (GLenum))
+SDL_PROC(void, glEnableVertexAttribArray, (GLuint))
+SDL_PROC(void, glFinish, (void))
+SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glGenTextures, (GLsizei, GLuint *))
+SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *))
+SDL_PROC(const GLubyte *, glGetString, (GLenum))
+SDL_PROC(GLenum, glGetError, (void))
+SDL_PROC(void, glGetIntegerv, (GLenum, GLint *))
+SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *))
+SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *))
+SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *))
+SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *))
+SDL_PROC(void, glLinkProgram, (GLuint))
+SDL_PROC(void, glPixelStorei, (GLenum, GLint))
+SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
+SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
+SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *))
+SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
+SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
+SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
+SDL_PROC(void, glUniform1i, (GLint, GLint))
+SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *))
+SDL_PROC(void, glUseProgram, (GLuint))
+SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))
+SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint))
+SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint))
+SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum))
+SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))
+SDL_PROC(GLint, glGetAttribLocation, (GLuint, const GLchar *))
+SDL_PROC(void, glGetProgramInfoLog, (GLuint, GLsizei, GLsizei*, GLchar*))
+SDL_PROC(void, glGenBuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glBindBuffer, (GLenum, GLuint))
+SDL_PROC(void, glBufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum))
+SDL_PROC(void, glBufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *))
SDL_Window *prev;
SDL_Window *next;
+
+ SDL_bool indicator_show;
+ Uint32 last_indicator_showtime;
+ int indicator_type;
};
#define FULLSCREEN_VISIBLE(W) \
(((W)->flags & SDL_WINDOW_FULLSCREEN) && \
window->next = _this->windows;
window->is_destroying = SDL_FALSE;
+ window->indicator_type = 0;
+
if (_this->windows) {
_this->windows->prev = window;
}
--- /dev/null
+#include "SDL_ecore_ipc.h"
+
+#include <sys/mman.h>
+#include <fcntl.h>
+
+#include "SDL_tizenopengles.h"
+
+SharedFile* CreateSharedFile(char* SharedFileName, int size)
+{
+ SharedFile* sharedFile = (SharedFile*)malloc(sizeof(SharedFile));
+ if(sharedFile == NULL)
+ {
+ return NULL;
+ }
+
+ mode_t mode;
+ mode = S_IRUSR | S_IWUSR;
+ mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+
+ sharedFile->fileDescriptor= shm_open( SharedFileName, O_RDONLY, mode );
+ SDL_Log("sharedFile->fileDescriptor == %d", sharedFile->fileDescriptor);
+ if(sharedFile->fileDescriptor >= 0)
+ {
+ sharedFile->fileName = SharedFileName;
+ sharedFile->size = size;
+ sharedFile->address = mmap( NULL, size, PROT_READ, MAP_SHARED, sharedFile->fileDescriptor, 0 );
+ if(sharedFile->address != MAP_FAILED)
+ {
+ return sharedFile;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ return sharedFile;
+}
+
+LockFile* CreateLockeFile(char* LockFileName)
+{
+ LockFile* lockFile = (LockFile*)malloc(sizeof(LockFile));
+ if(lockFile == NULL)
+ {
+ return NULL;
+ }
+
+ lockFile->fileDescriptor = open(LockFileName, O_RDWR);
+ if(lockFile->fileDescriptor == -1)
+ {
+ SDL_Log("Fail to open lock file!");
+ return NULL;
+
+ }
+ lockFile->fileName = LockFileName;
+
+ return lockFile;
+
+}
+
+
+void SetSharedImageInfo(Ecore_Ipc_Event_Server_Data* epcEvent, SharedFileInfo* fileInfo)
+{
+ if ( (epcEvent->data) && (epcEvent->size > 0) && (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
+ {
+ int n = epcEvent->response;
+ if(n == 0 /*&& n < SHARED_FILE_NUMBER*/)
+ {
+ fileInfo->SharedFileName = (char*)epcEvent->data;
+ fileInfo->SharedFileID = epcEvent->ref;
+ fileInfo->SharedFileNumber = epcEvent->ref_to;
+ SDL_Log("SetSharedImageInfo: shared file name: %s, shared file id: %d, shared file number: %d", fileInfo->SharedFileName, fileInfo->SharedFileID, fileInfo->SharedFileNumber);
+ SDL_Log("epcEvent->response: %d", n);
+ }
+ }
+}
+
+void SetLockFileInfo(Ecore_Ipc_Event_Server_Data* epcEvent, SharedFileInfo *fileInfo)
+{
+ if((epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) && (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0))
+ {
+ int n = epcEvent->response;
+ if(n == 0/* && n < SHARED_FILE_NUMBER*/)
+ {
+ fileInfo->ImageWidth = epcEvent->ref;
+ fileInfo->ImageHeight = epcEvent->ref_to;
+ fileInfo->LockFileName = epcEvent->data;
+ SDL_Log("SetLockFileInfo: width %d, height %d, filename %s", fileInfo->ImageWidth, fileInfo->ImageHeight, fileInfo->LockFileName);
+ SDL_Log("epcEvent->response: %d", n);
+ }
+ }
+}
+
+unsigned char* CopyBuffer(SharedFileInfo* fileInfo)
+{
+ return (unsigned char*)fileInfo->sharedFile->address;
+}
+
+void LoadSharedImage(Ecore_Ipc_Event_Server_Data* epcEvent, SharedFileInfo *fileInfo)
+{
+ char sharedFilename[256];
+ int n = epcEvent->response;
+ if(n == 0 /*&& n < SHARED_FILE_NUMBER*/)
+ {
+ snprintf(sharedFilename, 256, "/%s-%d.%d", fileInfo->SharedFileName, fileInfo->SharedFileID, fileInfo->SharedFileNumber);
+ SDL_Log("The shared file name is %s", sharedFilename);
+ fileInfo->sharedFile = CreateSharedFile(sharedFilename, fileInfo->ImageWidth * fileInfo->ImageHeight * 4);
+ if(fileInfo->sharedFile != NULL)
+ {
+ fileInfo->lockFile = CreateLockeFile(fileInfo->LockFileName);
+ }
+ else
+ {
+ SDL_Log("fileInfo->sharedFile == NULL");
+ }
+ }
+}
+
+
+void DataReceived(void* event, SharedFileInfo* fileInfo)
+{
+ Ecore_Ipc_Event_Server_Data* epcEvent = (Ecore_Ipc_Event_Server_Data*)event;
+ switch(epcEvent->minor)
+ {
+ case OP_SHM_REF0:
+ {
+ SDL_Log("Indicator client received: OP_SHM_REF0\n");
+ SetSharedImageInfo(epcEvent, fileInfo);
+ break;
+ }
+ case OP_SHM_REF1:
+ {
+ SDL_Log("Indicator client received: OP_SHM_REF1\n");
+ SetLockFileInfo(epcEvent, fileInfo);
+ break;
+ }
+ case OP_SHM_REF2:
+ {
+ SDL_Log("Indicator client received: OP_SHM_REF2\n");
+ LoadSharedImage(epcEvent, fileInfo);
+ break;
+ }
+ case OP_PIXMAP_REF:
+ {
+ SDL_Log("Indicator client received: OP_PIXMAP_REF!\n");
+ break;
+ }
+ case OP_UPDATE:
+ {
+// Tizen_glTexImage2d();
+ SDL_Log("Indicator client received: OP_UPDATE\n");
+ break;
+ }
+ }
+}
+
+int handler_server_add(void *data, int ev_type, void *ev)
+{
+ Ecore_Ipc_Event_Server_Add *e = (Ecore_Ipc_Event_Server_Add *)ev;
+ SDL_Log("Got a server add %p", e->server);
+ return 1;
+}
+
+int handler_server_del(void *data, int ev_type, void *ev)
+{
+ Ecore_Ipc_Event_Server_Del *e = (Ecore_Ipc_Event_Server_Del *)ev;
+ SDL_Log("Got a server del %p", e->server);
+ return 1;
+}
+
+int handler_server_data(void *data, int ev_type, void *ev)
+{
+ Ecore_Ipc_Event_Server_Data *e = (Ecore_Ipc_Event_Server_Data *)ev;
+ SharedFileInfo* fileInfo = (SharedFileInfo*)data;
+ DataReceived(ev, fileInfo);
+ return 1;
+}
+
+Ecore_Ipc_Server* serverConnection(const char* serviceName, SharedFileInfo* fileInfo)
+{
+ Ecore_Ipc_Server* IpcServer;
+ Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER;
+
+ if(!ecore_ipc_init())
+ {
+ SDL_Log("cannot init ecore_con!");
+ ecore_shutdown();
+ return NULL;
+ }
+
+ IpcServer = ecore_ipc_server_connect(ipctype, (char*)serviceName, 0, NULL);
+
+ if(IpcServer)
+ {
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, handler_server_add, NULL);
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, handler_server_del, NULL);
+ ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, handler_server_data, fileInfo);
+ }
+ else
+ {
+ ecore_shutdown();
+ ecore_ipc_shutdown();
+ }
+
+ return IpcServer;
+}
+
+
--- /dev/null
+#ifndef _ECORE_IPC_H_
+#define _ECORE_IPC_H_
+
+#include <Ecore.h>
+#include <Ecore_Ipc.h>
+
+#define MAJOR 0x2011
+#define SHARED_FILE_NUMBER 2
+
+typedef struct
+{
+ char* fileName;
+ int fileDescriptor;
+}LockFile;
+
+typedef struct
+{
+ char* fileName;
+ int fileDescriptor;
+ void* address;
+ int size;
+}SharedFile;
+
+typedef struct
+{
+ int ImageWidth;
+ int ImageHeight;
+
+ char* LockFileName;
+ char* SharedFileName;
+ int SharedFileID;
+ int SharedFileNumber;
+
+ SharedFile* sharedFile;
+ LockFile* lockFile;
+
+}SharedFileInfo;
+
+enum // opcodes
+{
+ OP_RESIZE,
+ OP_SHOW,
+ OP_HIDE,
+ OP_FOCUS,
+ OP_UNFOCUS,
+ OP_UPDATE,
+ OP_UPDATE_DONE,
+ OP_SHM_REF0,
+ OP_SHM_REF1,
+ OP_SHM_REF2,
+ OP_PROFILE_CHANGE_REQUEST,
+ OP_PROFILE_CHANGE_DONE,
+ OP_EV_MOUSE_IN,
+ OP_EV_MOUSE_OUT,
+ OP_EV_MOUSE_UP,
+ OP_EV_MOUSE_DOWN,
+ OP_EV_MOUSE_MOVE,
+ OP_EV_MOUSE_WHEEL,
+ OP_EV_MULTI_UP,
+ OP_EV_MULTI_DOWN,
+ OP_EV_MULTI_MOVE,
+ OP_EV_KEY_UP,
+ OP_EV_KEY_DOWN,
+ OP_EV_HOLD,
+ OP_MSG_PARENT,
+ OP_MSG,
+ OP_PIXMAP_REF,
+};
+
+
+unsigned char* CopyBuffer(SharedFileInfo* fileInfo);
+Ecore_Ipc_Server* serverConnection(const char* serviceName, SharedFileInfo* fileInfo);
+
+#endif
Ecore_Event_Mouse_Button *e = event;
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)",e->x,e->y);
+ if(_this->current_glwin->indicator_type == 0)
+ {
+ if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + _this->current_glwin->w &&
+ e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + 52)
+ {
+ _this->current_glwin->indicator_show = SDL_TRUE;
+ _this->current_glwin->last_indicator_showtime = SDL_GetTicks();
+ }
+ }
+ else if(_this->current_glwin->indicator_type == 1)
+ {
+ if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + 52 &&
+ e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + _this->current_glwin->h)
+ {
+ _this->current_glwin->indicator_show = SDL_TRUE;
+ _this->current_glwin->last_indicator_showtime = SDL_GetTicks();
+ }
+ }
+ else if(_this->current_glwin->indicator_type == 2)
+ {
+ if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + _this->current_glwin->w &&
+ e->y > _this->current_glwin->y + _this->current_glwin->h -52 && e->y < _this->current_glwin->y + _this->current_glwin->h)
+ {
+ _this->current_glwin->indicator_show = SDL_TRUE;
+ _this->current_glwin->last_indicator_showtime = SDL_GetTicks();
+ }
+ }
+ else if(_this->current_glwin->indicator_type == 3)
+ {
+ if(e->x > _this->current_glwin->x + _this->current_glwin->w -52 && e->x < _this->current_glwin->x + _this->current_glwin->w &&
+ e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + _this->current_glwin->h)
+ {
+ _this->current_glwin->indicator_show = SDL_TRUE;
+ _this->current_glwin->last_indicator_showtime = SDL_GetTicks();
+ }
+ }
+
SDL_SendMouseMotion(_this->current_glwin, 0, 0, e->x, e->y);
SDL_SendMouseButton(_this->current_glwin, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
#include "SDL_tizenwindow.h"
#include "SDL_tizenevents_c.h"
+#include "SDL_ecore_ipc.h"
+
+
+#if SDL_VIDEO_OPENGL
+#include "SDL_opengl.h"
+#endif /* SDL_VIDEO_OPENGL */
+
+#if SDL_VIDEO_OPENGL_ES
+#include "SDL_opengles.h"
+#endif /* SDL_VIDEO_OPENGL_ES */
+
+/* GL and GLES2 headers conflict on Linux 32 bits */
+#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL
+#include "SDL_opengles2.h"
+#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
+
+
+GLfloat vVertices[18]={
+ 1.0f, 1.0f, 0.0f,
+ -1.0f, 0.92f, 0.0f,
+ 1.0f, 0.92f, 0.0f,
+ 1.0f, 1.0f, 0.0f,
+ -1.0f, 1.0f, 0.0f,
+ -1.0f, 0.92f, 0.0f
+ };
+
+GLfloat vCoord[12] = {
+ 1.0f, 0.0f,
+ 0.0f, 1.0f,
+ 1.0f, 1.0f,
+ 1.0f, 0.0f,
+ 0.0f, 0.0f,
+ 0.0f, 1.0f};
+
+
/* EGL implementation of SDL OpenGL ES support */
+typedef struct GLES2_Context
+{
+ #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+ #include "../../render/opengles2/SDL_gles2funcs.h"
+ #undef SDL_PROC
+} GLES2_Context;
+
+GLuint programObject;
int
Tizen_GLES_LoadLibrary(_THIS, const char *path)
return ret;
}
+static int LoadContext(GLES2_Context * data)
+{
+ #define SDL_PROC(ret,func,params) \
+ do { \
+ data->func = SDL_GL_GetProcAddress(#func); \
+ if ( ! data->func ) { \
+ return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
+ } \
+ } while ( 0 );
+
+ #include "../../render/opengles2/SDL_gles2funcs.h"
+ #undef SDL_PROC
+
+ return 0;
+}
+
+static GLuint LoadShader(GLES2_Context* Mainctx, const char *shaderSrc, GLenum type)
+{
+ GLuint shader;
+ GLint compiled;
+
+ shader = Mainctx->glCreateShader(type);
+ SDL_Log("shader == %d", shader);
+ if(shader == 0)
+ return 0;
+ Mainctx->glShaderSource(shader, 1, &shaderSrc, NULL);
+ Mainctx->glCompileShader(shader);
+ Mainctx->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+ if(!compiled)
+ {
+ GLint infoLen = 0;
+ Mainctx->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if(infoLen > 1)
+ {
+ char* infoLog = (char*)(malloc(sizeof(char) * infoLen));
+ Mainctx->glGetShaderInfoLog(shader, infoLen, NULL, infoLog);
+ SDL_Log("Error compiling shader: %s", infoLog );
+ free(infoLog);
+ }
+ Mainctx->glDeleteShader(shader);
+ return 0;
+ }
+ return shader;
+
+}
+
+SharedFileInfo fileInfo;
+
+unsigned int textureID;
+unsigned int indicator_vbo[4], indicator_ibo[4];
+unsigned short indicator_index;
+
+
+void Tizen_glTexImage2d()
+{
+
+ GLES2_Context Mainctx;
+ LoadContext(&Mainctx);
+
+ Mainctx.glBindTexture(GL_TEXTURE_2D, textureID);
+ Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
+}
+
+static int Indicator_GLES_Init(SDL_Window* window)
+{
+ SDL_WindowData *wind = window->driverdata;
+ ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN);
+ ecore_wl_window_indicator_opacity_set(wind->window, ECORE_WL_INDICATOR_OPAQUE);
+ ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_ON);
+
+ Ecore_Ipc_Server* IpcServer = serverConnection("elm_indicator", &fileInfo);
+ if(!IpcServer)
+ {
+ SDL_Log("Fail to connect elm_indicator!\n");
+ return 0;
+ }
+
+ GLchar vShaderStr[] =
+ "attribute vec4 vVertices;\n"
+ "attribute vec2 vCoord;\n"
+ "varying vec2 Coord;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = vVertices;\n"
+ " Coord = vCoord;\n"
+ "}\n";
+
+ GLchar fShaderStr[] =
+ "precision mediump float;\n"
+ "varying vec2 Coord;\n"
+ "uniform sampler2D s_texture;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = texture2D(s_texture,Coord);\n"
+ "}\n";
+
+ ecore_main_loop_iterate();
+
+ GLuint vertexShader;
+ GLuint fragmentShader;
+
+ GLint linked;
+
+ GLES2_Context Mainctx;
+ LoadContext(&Mainctx);
+
+ vertexShader = LoadShader(&Mainctx, vShaderStr, GL_VERTEX_SHADER);
+ fragmentShader = LoadShader(&Mainctx, fShaderStr, GL_FRAGMENT_SHADER);
+ SDL_Log("The vertex shader is %d", vertexShader);
+ SDL_Log("The fragment shader is %d", fragmentShader);
+
+ programObject = Mainctx.glCreateProgram();
+ if(programObject == 0)
+ return 0;
+
+ Mainctx.glAttachShader(programObject, vertexShader);
+ Mainctx.glAttachShader(programObject, fragmentShader);
+
+ Mainctx.glBindAttribLocation(programObject, 0, "vVertices");
+ Mainctx.glBindAttribLocation(programObject, 1, "vCoord");
+
+ Mainctx.glLinkProgram(programObject);
+ Mainctx.glGetProgramiv(programObject, GL_LINK_STATUS, &linked);
+
+ if(!linked)
+ {
+ GLint infoLen = 0;
+ Mainctx.glGetProgramiv(programObject, GL_INFO_LOG_LENGTH, &infoLen);
+ if(infoLen > 1)
+ {
+ char* infoLog = (char*)(malloc(sizeof(char) * infoLen));
+ Mainctx.glGetProgramInfoLog(programObject, infoLen, NULL, infoLog);
+ SDL_Log("Error linking program: %s", infoLog);
+ free(infoLog);
+ }
+ Mainctx.glDeleteProgram(programObject);
+ return 0;
+ }
+
+
+ Mainctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ Mainctx.glEnable(GL_DEPTH_TEST);
+
+ /* Generate buffer object names */
+ Mainctx.glGenBuffers(4, indicator_vbo);
+ /* Bind a named buffer object */
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_vbo[0]);
+ /* Ceates and initializes a buffer object's data store */
+ Mainctx.glBufferData(GL_ARRAY_BUFFER, 18 * 4, vVertices, GL_STATIC_DRAW);
+
+ /* Generate buffer object names */
+ Mainctx.glGenBuffers(4, indicator_ibo);
+ /* Bind a named buffer object */
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_ibo[0]);
+ /* Ceates and initializes a buffer object's data store */
+ Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vCoord, GL_STATIC_DRAW);
+
+
+
+ Mainctx.glGenTextures(1, &textureID);
+ Mainctx.glBindTexture(GL_TEXTURE_2D, textureID);
+
+ Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
+ Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
+
+ window->indicator_show = SDL_TRUE;
+ window->last_indicator_showtime = SDL_GetTicks();
+ return 1;
+}
SDL_GLContext
Tizen_GLES_CreateContext(_THIS, SDL_Window *window)
SDL_GLContext context;
context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+
+ if(!(window->flags & SDL_WINDOW_FULLSCREEN) && !(window->flags & SDL_WINDOW_BORDERLESS))
+ {
+ if(!Indicator_GLES_Init(window))
+ {
+ SDL_Log("Indicator GLES init error!");
+ }
+ }
+
return context;
}
wdata->received_rotation = 0;
}
+ if(window->last_indicator_showtime + 3000 < SDL_GetTicks())
+ {
+ window->indicator_show = SDL_FALSE;
+ }
+
+ if(!(window->flags & SDL_WINDOW_FULLSCREEN) && !(window->flags & SDL_WINDOW_BORDERLESS) && window->indicator_show)
+ {
+ GLES2_Context Mainctx;
+ LoadContext(&Mainctx);
+ Mainctx.glUseProgram(programObject);
+
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_vbo[window->indicator_type]);
+ Mainctx.glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
+
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_ibo[window->indicator_type]);
+ Mainctx.glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
+
+ Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
+ Mainctx.glEnableVertexAttribArray(0);
+ Mainctx.glEnableVertexAttribArray(1);
+ Mainctx.glDrawArrays(GL_TRIANGLES, 0, 6);
+ }
+
SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
}
SDL_EGL_DeleteContext(_this, context);
}
+void
+SDL_IndicatorProcessEvent(SDL_Event * event, SDL_Window *window)
+{
+ GLES2_Context Mainctx;
+ LoadContext(&Mainctx);
+
+ if(event->type == SDL_ROTATEEVENT)
+ {
+ window->indicator_type = ((int)event->user.data1) / 90;
+ if( window->indicator_type == 0)
+ {
+ SDL_Log("===rotate 0 degree!\n");
+ vVertices[0] = 1.0f;
+ vVertices[1] = 1.0f;
+ vVertices[3] = -1.0f;
+ vVertices[4] = 0.92f;
+ vVertices[6] = 1.0f;
+ vVertices[7] = 0.92f;
+ vVertices[9] = 1.0f;
+ vVertices[10] = 1.0f;
+ vVertices[12] = -1.0f;
+ vVertices[13] = 1.0f;
+ vVertices[15] = -1.0f;
+ vVertices[16] = 0.92f;
+
+ vCoord[0] = 1.0f;
+ vCoord[1] = 0.0f;
+ vCoord[2] = 0.0f;
+ vCoord[3] = 1.0f;
+ vCoord[4] = 1.0f;
+ vCoord[5] = 1.0f;
+ vCoord[6] = 1.0f;
+ vCoord[7] = 0.0f;
+ vCoord[8] = 0.0f;
+ vCoord[9] = 0.0f;
+ vCoord[10] = 0.0f;
+ vCoord[11] = 1.0f;
+
+ }
+ else if(window->indicator_type == 1)
+ {
+ SDL_Log("===rotate 90 degree!\n");
+ vVertices[0] = -0.86f;
+ vVertices[1] = 1.0f;
+ vVertices[3] = -0.86f;
+ vVertices[4] = -1.0f;
+ vVertices[6] = -1.0f;
+ vVertices[7] = 1.0f;
+ vVertices[9] = -1.0f;
+ vVertices[10] = -1.0f;
+ vVertices[12] = -0.86f;
+ vVertices[13] = -1.0f;
+ vVertices[15] = -1.0f;
+ vVertices[16] = 1.0f;
+
+ vCoord[0] = 1.0f;
+ vCoord[1] = 1.0f;
+ vCoord[2] = 0.0f;
+ vCoord[3] = 1.0f;
+ vCoord[4] = 1.0f;
+ vCoord[5] = 0.0f;
+ vCoord[6] = 0.0f;
+ vCoord[7] = 0.0f;
+ vCoord[8] = 0.0f;
+ vCoord[9] = 1.0f;
+ vCoord[10] = 1.0f;
+ vCoord[11] = 0.0f;
+ }
+ else if(window->indicator_type == 2)
+ {
+ SDL_Log("===rotate 180 degree!\n");
+ vVertices[0] = -1.0f;
+ vVertices[1] = -1.0f;
+ vVertices[3] = -1.0f;
+ vVertices[4] = -0.92f;
+ vVertices[6] = 1.0f;
+ vVertices[7] = -1.0f;
+ vVertices[9] = 1.0f;
+ vVertices[10] = -0.92f;
+ vVertices[12] = -1.0f;
+ vVertices[13] = -0.92f;
+ vVertices[15] = 1.0f;
+ vVertices[16] = -1.0f;
+
+ vCoord[0] = 1.0f;
+ vCoord[1] = 0.0f;
+ vCoord[2] = 1.0f;
+ vCoord[3] = 1.0f;
+ vCoord[4] = 0.0f;
+ vCoord[5] = 0.0f;
+ vCoord[6] = 0.0f;
+ vCoord[7] = 1.0f;
+ vCoord[8] = 1.0f;
+ vCoord[9] = 1.0f;
+ vCoord[10] = 0.0f;
+ vCoord[11] = 0.0f;
+ }
+ else if(window->indicator_type == 3)
+ {
+ SDL_Log("===rotate 270 degree!\n");
+ vVertices[0] = 1.0f;
+ vVertices[1] = 1.0f;
+ vVertices[3] = 0.86f;
+ vVertices[4] = 1.0f;
+ vVertices[6] = 1.0f;
+ vVertices[7] = -1.0f;
+ vVertices[9] = 0.86f;
+ vVertices[10] = -1.0f;
+ vVertices[12] = 0.86f;
+ vVertices[13] = 1.0f;
+ vVertices[15] = 1.0f;
+ vVertices[16] = -1.0f;
+
+ vCoord[0] = 0.0f;
+ vCoord[1] = 0.0f;
+ vCoord[2] = 0.0f;
+ vCoord[3] = 1.0f;
+ vCoord[4] = 1.0f;
+ vCoord[5] = 0.0f;
+ vCoord[6] = 1.0f;
+ vCoord[7] = 1.0f;
+ vCoord[8] = 0.0f;
+ vCoord[9] = 1.0f;
+ vCoord[10] = 1.0f;
+ vCoord[11] = 0.0f;
+ }
+
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_vbo[window->indicator_type]);
+ Mainctx.glBufferData(GL_ARRAY_BUFFER, 18 * 4, vVertices, GL_STATIC_DRAW);
+ Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_ibo[window->indicator_type]);
+ Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vCoord, GL_STATIC_DRAW);
+
+ Mainctx.glBindTexture(GL_TEXTURE_2D, textureID);
+
+ Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
+ window->indicator_show = SDL_TRUE;
+ window->last_indicator_showtime = SDL_GetTicks();
+ }
+}
+
#endif /* SDL_VIDEO_DRIVER_TIZEN && SDL_VIDEO_OPENGL_EGL */
/* vi: set ts=4 sw=4 expandtab: */
#include "../SDL_sysvideo.h"
#include "../SDL_egl_c.h"
+#include "SDL_events.h"
#if SDL_VIDEO_OPENGL_EGL
#define Tizen_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
#define Tizen_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+extern void Tizen_glTexImage2d();
+extern void SDL_IndicatorProcessEvent(SDL_Event * event, SDL_Window* window);
+
extern int Tizen_GLES_LoadLibrary(_THIS, const char *path);
extern SDL_GLContext Tizen_GLES_CreateContext(_THIS, SDL_Window *window);
extern void Tizen_GLES_SwapWindow(_THIS, SDL_Window *window);