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"
30 #include "../../events/SDL_events_c.h"
31 #include "../../core/tizen/SDL_tizen.h"
33 #include "SDL_tizenvideo.h"
34 #include "SDL_tizenevents_c.h"
35 #include "SDL_tizenwindow.h"
36 #include "SDL_tizenopengles.h"
37 #include "SDL_tizenmouse.h"
38 #include "SDL_tizentouch.h"
39 #include "SDL_tizenkeyboard.h"
40 #include "SDL_tizenvulkan.h"
43 #define TIZENVID_DRIVER_NAME "tizen"
45 /* Initialization/Query functions */
47 Tizen_VideoInit(_THIS);
50 Tizen_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display);
52 Tizen_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
55 Tizen_VideoQuit(_THIS);
58 _tizen_add_display(SDL_VideoData *d, uint32_t id)
60 SDL_VideoDisplay display;
62 static char *display_name = "tizen";
67 display.name = display_name;
69 ecore_wl_screen_size_get(&mode.w, &mode.h);
70 mode.refresh_rate = 60; //Hz
71 SDL_AddDisplayMode(&display, &mode);
73 display.current_mode = mode;
74 display.desktop_mode = mode;
76 SDL_AddVideoDisplay(&display);
79 /* Wayland driver bootstrap functions */
87 Tizen_DeleteDevice(SDL_VideoDevice *device)
92 static SDL_VideoDevice *
93 Tizen_CreateDevice(int devindex)
95 SDL_VideoDevice *device;
97 /* Initialize all variables that we clean on shutdown */
98 device = SDL_calloc(1, sizeof(SDL_VideoDevice));
105 device->VideoInit = Tizen_VideoInit;
106 device->VideoQuit = Tizen_VideoQuit;
107 device->SetDisplayMode = Tizen_SetDisplayMode;
108 device->GetDisplayModes = Tizen_GetDisplayModes;
109 device->free = Tizen_DeleteDevice;
111 device->PumpEvents = Tizen_PumpEvents;
112 #if SDL_VIDEO_OPENGL_EGL
113 device->GL_SwapWindow = Tizen_GLES_SwapWindow;
114 device->GL_GetSwapInterval = Tizen_GLES_GetSwapInterval;
115 device->GL_SetSwapInterval = Tizen_GLES_SetSwapInterval;
116 device->GL_MakeCurrent = Tizen_GLES_MakeCurrent;
117 device->GL_CreateContext = Tizen_GLES_CreateContext;
118 device->GL_LoadLibrary = Tizen_GLES_LoadLibrary;
119 device->GL_UnloadLibrary = Tizen_GLES_UnloadLibrary;
120 device->GL_GetProcAddress = Tizen_GLES_GetProcAddress;
121 device->GL_DeleteContext = Tizen_GLES_DeleteContext;
123 device->CreateWindow = Tizen_CreateWindow;
124 device->ShowWindow = Tizen_ShowWindow;
125 device->SetWindowFullscreen = Tizen_SetWindowFullscreen;
126 device->SetWindowSize = Tizen_SetWindowSize;
127 device->DestroyWindow = Tizen_DestroyWindow;
128 device->SetWindowHitTest = Tizen_SetWindowHitTest;
129 device->GetWindowWMInfo = Tizen_GetWindowWMInfo;
132 device->StartTextInput = Tizen_StartTextInput;
133 device->StopTextInput = Tizen_StopTextInput;
134 //device->SetTextInputRect = Tizen_SetTextInputRect;
136 /* Screen keyboard */
137 device->HasScreenKeyboardSupport = Tizen_HasScreenKeyboardSupport;
138 device->ShowScreenKeyboard = Tizen_ShowScreenKeyboard;
139 //device->HideScreenKeyboard = Tizen_HideScreenKeyboard;
140 device->IsScreenKeyboardShown = Tizen_IsScreenKeyboardShown;
143 device->vulkan_GetInstanceExtensions = Tizen_vulkan_GetInstanceExtensions;
144 device->vulkan_CreateSurface = Tizen_vulkan_CreateSurface;
150 VideoBootStrap TIZEN_bootstrap = {
151 TIZENVID_DRIVER_NAME, "SDL tizen video driver",
152 Tizen_Available, Tizen_CreateDevice
156 Tizen_VideoInit(_THIS)
158 SDL_VideoData *data = SDL_malloc(sizeof * data);
161 return SDL_OutOfMemory();
162 memset(data, 0, sizeof * data);
164 _this->driverdata = data;
167 _tizen_add_display(data, 0);
168 data->display = ecore_wl_display_get();
170 Tizen_InitWindow(_this);
176 Tizen_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
182 Tizen_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
184 return SDL_Unsupported();
188 Tizen_VideoQuit(_THIS)
190 SDL_VideoData *data = _this->driverdata;
192 Tizen_DeinitWindow(_this);
193 Tizen_FiniKeyboard();
195 SDL_tizen_app_exit();
199 _this->driverdata = NULL;
203 #endif /* SDL_VIDEO_DRIVER_TIZEN */
205 /* vi: set ts=4 sw=4 expandtab: */