early-access version 1617
This commit is contained in:
80
externals/SDL/src/video/x11/SDL_x11events.c
vendored
80
externals/SDL/src/video/x11/SDL_x11events.c
vendored
@@ -39,7 +39,6 @@
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -433,8 +432,12 @@ X11_DispatchFocusOut(_THIS, SDL_WindowData *data)
|
||||
static void
|
||||
X11_DispatchMapNotify(SDL_WindowData *data)
|
||||
{
|
||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
||||
SDL_Window *window = data->window;
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
||||
if (!(window->flags & SDL_WINDOW_HIDDEN) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
SDL_UpdateWindowGrab(window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -642,6 +645,29 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
isMapNotify(Display *display, XEvent *ev, XPointer arg)
|
||||
{
|
||||
XUnmapEvent *unmap;
|
||||
|
||||
unmap = (XUnmapEvent*) arg;
|
||||
|
||||
return ev->type == MapNotify &&
|
||||
ev->xmap.window == unmap->window &&
|
||||
ev->xmap.serial == unmap->serial;
|
||||
}
|
||||
|
||||
static Bool
|
||||
isReparentNotify(Display *display, XEvent *ev, XPointer arg)
|
||||
{
|
||||
XUnmapEvent *unmap;
|
||||
|
||||
unmap = (XUnmapEvent*) arg;
|
||||
|
||||
return ev->type == ReparentNotify &&
|
||||
ev->xreparent.window == unmap->window &&
|
||||
ev->xreparent.serial == unmap->serial;
|
||||
}
|
||||
|
||||
static void
|
||||
X11_DispatchEvent(_THIS)
|
||||
@@ -683,7 +709,7 @@ X11_DispatchEvent(_THIS)
|
||||
/* But only if we're using one of the DBus IMEs, otherwise
|
||||
some XIM IMEs will generate duplicate events */
|
||||
if (orig_keycode) {
|
||||
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
|
||||
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX)
|
||||
SDL_Scancode scancode = videodata->key_layout[orig_keycode];
|
||||
videodata->filter_code = orig_keycode;
|
||||
videodata->filter_time = xevent.xkey.time;
|
||||
@@ -818,9 +844,9 @@ X11_DispatchEvent(_THIS)
|
||||
break;
|
||||
}
|
||||
|
||||
if (xevent.xfocus.detail == NotifyInferior) {
|
||||
if (xevent.xfocus.detail == NotifyInferior || xevent.xfocus.detail == NotifyPointer) {
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window %p: FocusIn (NotifierInferior, ignoring)\n", data);
|
||||
printf("window %p: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", data);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -851,10 +877,12 @@ X11_DispatchEvent(_THIS)
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (xevent.xfocus.detail == NotifyInferior) {
|
||||
/* We still have focus if a child gets focus */
|
||||
if (xevent.xfocus.detail == NotifyInferior || xevent.xfocus.detail == NotifyPointer) {
|
||||
/* We still have focus if a child gets focus. We also don't
|
||||
care about the position of the pointer when the keyboard
|
||||
focus changed. */
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window %p: FocusOut (NotifierInferior, ignoring)\n", data);
|
||||
printf("window %p: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", data);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -946,10 +974,17 @@ X11_DispatchEvent(_THIS)
|
||||
|
||||
/* Have we been iconified? */
|
||||
case UnmapNotify:{
|
||||
XEvent ev;
|
||||
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window %p: UnmapNotify!\n", data);
|
||||
#endif
|
||||
X11_DispatchUnmapNotify(data);
|
||||
|
||||
if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent.xunmap)) {
|
||||
X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&xevent.xunmap);
|
||||
} else {
|
||||
X11_DispatchUnmapNotify(data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1346,19 +1381,22 @@ X11_DispatchEvent(_THIS)
|
||||
X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY);
|
||||
|
||||
if (p.format == 8) {
|
||||
char* saveptr = NULL;
|
||||
char* name = X11_XGetAtomName(display, target);
|
||||
char *token = SDL_strtokr((char *) p.data, "\r\n", &saveptr);
|
||||
while (token != NULL) {
|
||||
if (SDL_strcmp("text/plain", name)==0) {
|
||||
SDL_SendDropText(data->window, token);
|
||||
} else if (SDL_strcmp("text/uri-list", name)==0) {
|
||||
char *fn = X11_URIToLocal(token);
|
||||
if (fn) {
|
||||
SDL_SendDropFile(data->window, fn);
|
||||
char *saveptr = NULL;
|
||||
char *name = X11_XGetAtomName(display, target);
|
||||
if (name) {
|
||||
char *token = SDL_strtokr((char *) p.data, "\r\n", &saveptr);
|
||||
while (token != NULL) {
|
||||
if (SDL_strcmp("text/plain", name) == 0) {
|
||||
SDL_SendDropText(data->window, token);
|
||||
} else if (SDL_strcmp("text/uri-list", name) == 0) {
|
||||
char *fn = X11_URIToLocal(token);
|
||||
if (fn) {
|
||||
SDL_SendDropFile(data->window, fn);
|
||||
}
|
||||
}
|
||||
token = SDL_strtokr(NULL, "\r\n", &saveptr);
|
||||
}
|
||||
token = SDL_strtokr(NULL, "\r\n", &saveptr);
|
||||
X11_XFree(name);
|
||||
}
|
||||
SDL_SendDropComplete(data->window);
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "SDL.h"
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_x11dyn.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_x11messagebox.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
@@ -246,7 +245,7 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data )
|
||||
const SDL_MessageBoxData *messageboxdata = data->messageboxdata;
|
||||
|
||||
/* Go over text and break linefeeds into separate lines. */
|
||||
if ( messageboxdata->message && messageboxdata->message[ 0 ] ) {
|
||||
if ( messageboxdata->message[0] ) {
|
||||
const char *text = messageboxdata->message;
|
||||
const int linecount = CountLinesOfText(text);
|
||||
TextLineData *plinedata = (TextLineData *) SDL_malloc(sizeof (TextLineData) * linecount);
|
||||
|
4
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
4
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
@@ -487,7 +487,7 @@ X11_InitModes_XRandR(_THIS)
|
||||
display.desktop_mode = mode;
|
||||
display.current_mode = mode;
|
||||
display.driverdata = displaydata;
|
||||
SDL_AddVideoDisplay(&display);
|
||||
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||
}
|
||||
|
||||
X11_XRRFreeScreenResources(res);
|
||||
@@ -807,7 +807,7 @@ X11_InitModes(_THIS)
|
||||
display.desktop_mode = mode;
|
||||
display.current_mode = mode;
|
||||
display.driverdata = displaydata;
|
||||
SDL_AddVideoDisplay(&display);
|
||||
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||
|
1
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
1
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
@@ -23,7 +23,6 @@
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_x11mouse.h"
|
||||
#include "SDL_x11xinput2.h"
|
||||
|
9
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
9
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
@@ -23,7 +23,6 @@
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
|
||||
/* GLX implementation of SDL OpenGL support */
|
||||
@@ -32,8 +31,12 @@
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_x11opengles.h"
|
||||
|
||||
#if defined(__IRIX__)
|
||||
/* IRIX doesn't have a GL library versioning system */
|
||||
#if defined(__IRIX__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/*
|
||||
* IRIX doesn't have a GL library versioning system.
|
||||
* NetBSD and OpenBSD have different GL library versions depending on how
|
||||
* the library was installed.
|
||||
*/
|
||||
#define DEFAULT_OPENGL "libGL.so"
|
||||
#elif defined(__MACOSX__)
|
||||
#define DEFAULT_OPENGL "/opt/X11/lib/libGL.1.dylib"
|
||||
|
1
externals/SDL/src/video/x11/SDL_x11shape.c
vendored
1
externals/SDL/src/video/x11/SDL_x11shape.c
vendored
@@ -22,7 +22,6 @@
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_x11shape.h"
|
||||
#include "SDL_x11window.h"
|
||||
|
56
externals/SDL/src/video/x11/SDL_x11video.c
vendored
56
externals/SDL/src/video/x11/SDL_x11video.c
vendored
@@ -92,19 +92,7 @@ get_classname()
|
||||
|
||||
/* X11 driver bootstrap functions */
|
||||
|
||||
static int
|
||||
X11_Available(void)
|
||||
{
|
||||
Display *display = NULL;
|
||||
if (SDL_X11_LoadSymbols()) {
|
||||
display = X11_XOpenDisplay(NULL);
|
||||
if (display != NULL) {
|
||||
X11_XCloseDisplay(display);
|
||||
}
|
||||
SDL_X11_UnloadSymbols();
|
||||
}
|
||||
return (display != NULL);
|
||||
}
|
||||
static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
|
||||
|
||||
static void
|
||||
X11_DeleteDevice(SDL_VideoDevice * device)
|
||||
@@ -114,6 +102,7 @@ X11_DeleteDevice(SDL_VideoDevice * device)
|
||||
device->Vulkan_UnloadLibrary(device);
|
||||
}
|
||||
if (data->display) {
|
||||
X11_XSetErrorHandler(orig_x11_errhandler);
|
||||
X11_XCloseDisplay(data->display);
|
||||
}
|
||||
SDL_free(data->windowlist);
|
||||
@@ -125,7 +114,6 @@ X11_DeleteDevice(SDL_VideoDevice * device)
|
||||
|
||||
/* An error handler to reset the vidmode and then call the default handler. */
|
||||
static SDL_bool safety_net_triggered = SDL_FALSE;
|
||||
static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
|
||||
static int
|
||||
X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
|
||||
{
|
||||
@@ -159,6 +147,7 @@ X11_CreateDevice(int devindex)
|
||||
SDL_VideoDevice *device;
|
||||
SDL_VideoData *data;
|
||||
const char *display = NULL; /* Use the DISPLAY environment variable */
|
||||
Display *x11_display = NULL;
|
||||
|
||||
if (!SDL_X11_LoadSymbols()) {
|
||||
return NULL;
|
||||
@@ -168,6 +157,14 @@ X11_CreateDevice(int devindex)
|
||||
nVidia driver to be threaded. */
|
||||
X11_XInitThreads();
|
||||
|
||||
/* Open the display first to be sure that X11 is available */
|
||||
x11_display = X11_XOpenDisplay(display);
|
||||
|
||||
if (!x11_display) {
|
||||
SDL_X11_UnloadSymbols();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
if (!device) {
|
||||
@@ -184,34 +181,7 @@ X11_CreateDevice(int devindex)
|
||||
|
||||
data->global_mouse_changed = SDL_TRUE;
|
||||
|
||||
/* FIXME: Do we need this?
|
||||
if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) ||
|
||||
(SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) {
|
||||
local_X11 = 1;
|
||||
} else {
|
||||
local_X11 = 0;
|
||||
}
|
||||
*/
|
||||
data->display = X11_XOpenDisplay(display);
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||
/* On some systems if linking without -lX11, it fails and you get following message.
|
||||
* Xlib: connection to ":0.0" refused by server
|
||||
* Xlib: XDM authorization key matches an existing client!
|
||||
*
|
||||
* It succeeds if retrying 1 second later
|
||||
* or if running xhost +localhost on shell.
|
||||
*/
|
||||
if (data->display == NULL) {
|
||||
SDL_Delay(1000);
|
||||
data->display = X11_XOpenDisplay(display);
|
||||
}
|
||||
#endif
|
||||
if (data->display == NULL) {
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
SDL_SetError("Couldn't open X11 display");
|
||||
return NULL;
|
||||
}
|
||||
data->display = x11_display;
|
||||
#ifdef X11_DEBUG
|
||||
X11_XSynchronize(data->display, True);
|
||||
#endif
|
||||
@@ -317,7 +287,7 @@ X11_CreateDevice(int devindex)
|
||||
|
||||
VideoBootStrap X11_bootstrap = {
|
||||
"x11", "SDL X11 video driver",
|
||||
X11_Available, X11_CreateDevice
|
||||
X11_CreateDevice
|
||||
};
|
||||
|
||||
static int (*handler) (Display *, XErrorEvent *) = NULL;
|
||||
|
10
externals/SDL/src/video/x11/SDL_x11vulkan.c
vendored
10
externals/SDL/src/video/x11/SDL_x11vulkan.c
vendored
@@ -23,13 +23,19 @@
|
||||
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_x11vulkan.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
/*#include <xcb/xcb.h>*/
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#define DEFAULT_VULKAN "libvulkan.so"
|
||||
#else
|
||||
#define DEFAULT_VULKAN "libvulkan.so.1"
|
||||
#endif
|
||||
|
||||
/*
|
||||
typedef uint32_t xcb_window_t;
|
||||
typedef uint32_t xcb_visualid_t;
|
||||
@@ -52,7 +58,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path)
|
||||
if(!path)
|
||||
path = SDL_getenv("SDL_VULKAN_LIBRARY");
|
||||
if(!path)
|
||||
path = "libvulkan.so.1";
|
||||
path = DEFAULT_VULKAN;
|
||||
_this->vulkan_config.loader_handle = SDL_LoadObject(path);
|
||||
if(!_this->vulkan_config.loader_handle)
|
||||
return -1;
|
||||
|
19
externals/SDL/src/video/x11/SDL_x11window.c
vendored
19
externals/SDL/src/video/x11/SDL_x11window.c
vendored
@@ -22,7 +22,6 @@
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
@@ -40,7 +39,6 @@
|
||||
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_log.h"
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0l
|
||||
#define _NET_WM_STATE_ADD 1l
|
||||
@@ -1577,6 +1575,13 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||
oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(_this, window);
|
||||
|
||||
if (oldstyle_fullscreen || grabbed) {
|
||||
/* If the window is unmapped, XGrab calls return GrabNotViewable,
|
||||
so when we get a MapNotify later, we'll try to update the grab as
|
||||
appropriate. */
|
||||
if (window->flags & SDL_WINDOW_HIDDEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try to grab the mouse */
|
||||
if (!data->videodata->broken_pointer_grab) {
|
||||
const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
|
||||
@@ -1662,7 +1667,15 @@ SDL_bool
|
||||
X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
Display *display;
|
||||
|
||||
if (!data) {
|
||||
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
|
||||
SDL_SetError("Window not initialized");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
display = data->videodata->display;
|
||||
|
||||
if (info->version.major == SDL_MAJOR_VERSION &&
|
||||
info->version.minor == SDL_MINOR_VERSION) {
|
||||
|
Reference in New Issue
Block a user