Revert "Posix: Remove X11 dependencies"

This reverts commit 48d0717f82.

It was causing crashes when running on Xorg…

Fixes #398.
This commit is contained in:
Emmanuel Gil Peyrot 2020-11-20 22:01:36 +01:00
parent 49fda66b3b
commit 91f6e4a9ef
4 changed files with 21 additions and 2 deletions

View File

@ -18,6 +18,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <X11/Xlib.h>
#include <SDL.h>
#include <SDL_thread.h>
#include <stdlib.h>
@ -627,6 +628,12 @@ int main(int argc, char ** argv) {
execute = true;
/* X11 multi-threading support */
if(!XInitThreads())
{
fprintf(stderr, "Warning: X11 not thread-safe\n");
}
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
{
fprintf(stderr, "Error trying to initialize SDL: %s\n",

View File

@ -1,3 +1,7 @@
dep_x11 = dependency('x11')
cli_dependencies = dependencies + [dep_x11]
cli_src = [
'main.cpp',
'../shared/sndsdl.cpp',
@ -13,7 +17,7 @@ includes = include_directories(
executable('desmume-cli',
cli_src,
dependencies: dependencies,
dependencies: cli_dependencies,
include_directories: includes,
link_with: libdesmume,
install: true,

View File

@ -29,6 +29,7 @@
#include <gio/gapplication.h>
#include <gdk/gdkkeysyms.h>
#include <SDL.h>
#include <X11/Xlib.h>
#include <vector>
#include "types.h"
@ -4590,6 +4591,12 @@ int main (int argc, char *argv[])
my_config.parse(argc, argv);
init_configured_features( &my_config);
/* X11 multi-threading support */
if(!XInitThreads())
{
fprintf(stderr, "Warning: X11 not thread-safe\n");
}
// TODO: pass G_APPLICATION_HANDLES_COMMAND_LINE instead.
GtkApplication *app = gtk_application_new("org.desmume.DeSmuME", G_APPLICATION_HANDLES_OPEN);
g_signal_connect (app, "activate", G_CALLBACK(common_gtk_main), &my_config);

View File

@ -1,6 +1,7 @@
dep_gtk3 = dependency('gtk+-3.0', version: '>=3.24')
dep_x11 = dependency('x11')
gtk_dependencies = dependencies + [dep_gtk3]
gtk_dependencies = dependencies + [dep_gtk3, dep_x11]
desmume_src = [
'avout_pipe_base.cpp',