1 /*  RetroArch - A frontend for libretro.
2  *  Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  *  Copyright (C) 2011-2017 - Daniel De Matteis
4  *  Copyright (C) 2016-2019 - Brad Parker
5  *
6  *  RetroArch is free software: you can redistribute it and/or modify it under the terms
7  *  of the GNU General Public License as published by the Free Software Found-
8  *  ation, either version 3 of the License, or (at your option) any later version.
9  *
10  *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  *  PURPOSE.  See the GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along with RetroArch.
15  *  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <stddef.h>
19 #include "../video_display_server.h"
20 #include "../../frontend/drivers/platform_unix.h"
21 
android_display_server_init(void)22 static void* android_display_server_init(void) { return NULL; }
android_display_server_destroy(void * data)23 static void android_display_server_destroy(void *data) { }
android_display_server_set_window_opacity(void * data,unsigned opacity)24 static bool android_display_server_set_window_opacity(void *data, unsigned opacity) { return true; }
android_display_server_set_window_progress(void * data,int progress,bool finished)25 static bool android_display_server_set_window_progress(void *data, int progress, bool finished) { return true; }
android_display_server_get_flags(void * data)26 static uint32_t android_display_server_get_flags(void *data) { return 0; }
27 
android_display_server_set_screen_orientation(void * data,enum rotation rotation)28 static void android_display_server_set_screen_orientation(void *data,
29       enum rotation rotation)
30 {
31    JNIEnv *env = jni_thread_getenv();
32 
33    if (!env || !g_android)
34       return;
35 
36    if (g_android->setScreenOrientation)
37       CALL_VOID_METHOD_PARAM(env, g_android->activity->clazz,
38             g_android->setScreenOrientation, rotation);
39 }
40 
41 const video_display_server_t dispserv_android = {
42    android_display_server_init,
43    android_display_server_destroy,
44    android_display_server_set_window_opacity,
45    android_display_server_set_window_progress,
46    NULL, /* set_window_decorations */
47    NULL, /* set_resolution */
48    NULL, /* get_resolution_list */
49    NULL, /* get_output_options */
50    android_display_server_set_screen_orientation,
51    NULL, /* get_screen_orientation */
52    android_display_server_get_flags,
53    "android"
54 };
55