2 Simple DirectMedia Layer
3 Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
4 Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages
8 arising from the use of this software.
10 Permission is granted to anyone to use this software for any purpose,
11 including commercial applications, and to alter it and redistribute it
12 freely, subject to the following restrictions:
14 1. The origin of this software must not be misrepresented; you must not
15 claim that you wrote the original software. If you use this software
16 in a product, an acknowledgment in the product documentation would be
17 appreciated but is not required.
18 2. Altered source versions must be plainly marked as such, and must not be
19 misrepresented as being the original software.
20 3. This notice may not be removed or altered from any source distribution.
23 #include "../../SDL_internal.h"
25 #if SDL_VIDEO_DRIVER_TIZEN
27 #include "SDL_video.h"
28 #include "SDL_mouse.h"
29 #include "SDL_stdinc.h"
31 #include "../../events/SDL_events_c.h"
32 #include "../../core/tizen/SDL_tizen.h"
34 #include "SDL_tizenvideo.h"
35 #include "SDL_tizenwindow.h"
36 #include "SDL_tizenkeyboard.h"
37 #include "SDL_tizenvulkan.h"
38 #include "SDL_tizenopengles.h"
40 #include "SDL_tizenevents_c.h"
41 #include "SDL_tizenmouse.h"
44 #define TIZENVID_DRIVER_NAME "tizen"
47 _tizen_add_display(SDL_VideoData *d, uint32_t id)
49 SDL_VideoDisplay display;
51 static char *display_name = "tizen";
56 display.name = display_name;
58 ecore_wl_screen_size_get(&mode.w, &mode.h);
59 mode.refresh_rate = 60; //Hz
60 mode.format = SDL_PIXELFORMAT_ARGB8888;
62 SDL_AddDisplayMode(&display, &mode);
64 display.current_mode = mode;
65 display.desktop_mode = mode;
67 SDL_AddVideoDisplay(&display);
70 /* Wayland driver bootstrap functions */
78 Tizen_DeleteDevice(SDL_VideoDevice *device)
83 static SDL_VideoDevice *
84 Tizen_CreateDevice(int devindex)
86 SDL_VideoDevice *device;
88 /* Initialize all variables that we clean on shutdown */
89 device = SDL_calloc(1, sizeof(SDL_VideoDevice));
96 device->VideoInit = Tizen_VideoInit;
97 device->VideoQuit = Tizen_VideoQuit;
98 device->SetDisplayMode = Tizen_SetDisplayMode;
99 device->GetDisplayModes = Tizen_GetDisplayModes;
100 device->free = Tizen_DeleteDevice;
102 device->PumpEvents = Tizen_PumpEvents;
103 #if SDL_VIDEO_OPENGL_EGL
104 device->GL_SwapWindow = Tizen_GLES_SwapWindow;
105 device->GL_GetSwapInterval = Tizen_GLES_GetSwapInterval;
106 device->GL_SetSwapInterval = Tizen_GLES_SetSwapInterval;
107 device->GL_MakeCurrent = Tizen_GLES_MakeCurrent;
108 device->GL_CreateContext = Tizen_GLES_CreateContext;
109 device->GL_LoadLibrary = Tizen_GLES_LoadLibrary;
110 device->GL_UnloadLibrary = Tizen_GLES_UnloadLibrary;
111 device->GL_GetProcAddress = Tizen_GLES_GetProcAddress;
112 device->GL_DeleteContext = Tizen_GLES_DeleteContext;
113 // device->SetWindowBordered = Tizen_SetWindowBordered;
115 device->CreateWindow = Tizen_CreateWindow;
116 device->SetWindowTitle = Tizen_SetWindowTitle;
117 device->ShowWindow = Tizen_ShowWindow;
118 device->HideWindow = Tizen_HideWindow;
119 device->RaiseWindow = Tizen_RaiseWindow;
120 device->SetWindowFullscreen = Tizen_SetWindowFullscreen;
121 device->SetWindowSize = Tizen_SetWindowSize;
122 device->DestroyWindow = Tizen_DestroyWindow;
123 device->SetWindowHitTest = Tizen_SetWindowHitTest;
124 device->GetWindowWMInfo = Tizen_GetWindowWMInfo;
125 device->SetWindowPosition = Tizen_SetWindowPosition;
128 device->StartTextInput = Tizen_StartTextInput;
129 device->StopTextInput = Tizen_StopTextInput;
130 //device->SetTextInputRect = Tizen_SetTextInputRect;
132 /* Screen keyboard */
133 device->HasScreenKeyboardSupport = Tizen_HasScreenKeyboardSupport;
134 device->ShowScreenKeyboard = Tizen_ShowScreenKeyboard;
135 //device->HideScreenKeyboard = Tizen_HideScreenKeyboard;
136 device->IsScreenKeyboardShown = Tizen_IsScreenKeyboardShown;
139 device->vulkan_GetInstanceExtensions = Tizen_vulkan_GetInstanceExtensions;
140 device->vulkan_CreateSurface = Tizen_vulkan_CreateSurface;
141 device->vulkan_LoadLibrary = Tizen_vulkan_LoadLibrary;
143 device->GetWindowSize = Tizen_GetWindowSize;
148 VideoBootStrap TIZEN_bootstrap = {
149 TIZENVID_DRIVER_NAME, "SDL tizen video driver",
150 Tizen_Available, Tizen_CreateDevice
154 Tizen_VideoInit(_THIS)
156 SDL_VideoData *data = SDL_malloc(sizeof * data);
159 return SDL_OutOfMemory();
160 memset(data, 0, sizeof * data);
162 _this->driverdata = data;
165 _tizen_add_display(data, 0);
166 data->display = ecore_wl_display_get();
168 Tizen_InitWindow(_this);
174 Tizen_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
180 Tizen_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
182 return SDL_Unsupported();
186 Tizen_VideoQuit(_THIS)
188 SDL_VideoData *data = _this->driverdata;
190 Tizen_DeinitWindow(_this);
191 Tizen_FiniKeyboard();
194 _tizen_ecore_ipc_client_send(OP_TERMINATE, 0, 0, 0);
195 SDL_tizen_app_exit();
199 _this->driverdata = NULL;
203 #endif /* SDL_VIDEO_DRIVER_TIZEN */
205 /* vi: set ts=4 sw=4 expandtab: */