Fixed Android compilation

This commit is contained in:
Sergii Pylypenko
2019-09-09 18:22:20 +03:00
parent 346f8d1223
commit adeeb0ea78
7 changed files with 64 additions and 11 deletions

View File

@@ -28,16 +28,8 @@ int dix_main(int argc, char *argv[], char *envp[]);
/*
A default implementation of main, which can be overridden by the DDX
*/
#if defined(__ANDROID__)
int
android_main(int argc, char *argv[], char *envp[])
{
return dix_main(argc, argv, envp);
}
#else
int
main(int argc, char *argv[], char *envp[])
{
return dix_main(argc, argv, envp);
}
#endif

View File

@@ -5,7 +5,7 @@ INCLUDES = \
bin_PROGRAMS = Xsdl
Xsdl_SOURCES = sdl.c android_main.c sdl_send_text.c sdl_send_text.h sdl_kdrive.h sdl_clipboard.c
Xsdl_SOURCES = sdl.c sdl_send_text.c sdl_send_text.h sdl_kdrive.h sdl_clipboard.c sdl_android_main.c stub_main.c
Xsdl_LDADD = \
@KDRIVE_LIBS@ \

View File

@@ -48,7 +48,6 @@
#include <android/log.h>
// DEBUG
//#define printf(...)
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "XSDL", __VA_ARGS__)
#endif

View File

@@ -0,0 +1,12 @@
#include <stdlib.h>
#include <xorg-config.h>
#include "kdrive.h"
#include "dix.h"
extern int android_main( int argc, char *argv[], char *envp[] );
int android_main( int argc, char *argv[], char *envp[] )
{
return dix_main(argc, argv, envp);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright © 2004 PillowElephantBadgerBankPond
* Copyright © 2014-2019 Sergii Pylypenko
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of PillowElephantBadgerBankPond not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. PillowElephantBadgerBankPond makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* PillowElephantBadgerBankPond DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL PillowElephantBadgerBankPond BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* It's really not my fault - see it was the elephants!!
* - jaymz
*
*/
// This file is needed because SDL_syswm.h conflicts with KDrive headers
#include "sdl_send_text.h"
#include <SDL/SDL.h>
#include <SDL/SDL_syswm.h>
#ifdef __ANDROID__
#include <SDL/SDL_screenkeyboard.h>
#include <android/log.h>
// DEBUG
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "XSDL", __VA_ARGS__)
#endif
void process_clipboard_event(SDL_SysWMEvent *event)
{
#ifdef __ANDROID__
if (event->msg != NULL && event->msg->type == SDL_SYSWM_ANDROID_CLIPBOARD_CHANGED)
set_clipboard_text(SDL_GetClipboardText());
#endif
}

View File

@@ -42,7 +42,6 @@
#include <android/log.h>
// DEBUG
//#define printf(...)
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "XSDL", __VA_ARGS__)
#endif

View File

@@ -3,6 +3,7 @@
#include "kdrive.h"
#include "dix.h"
int main(int argc, char* argv[])
{
char * envp[] = { NULL };