early-access version 1988
This commit is contained in:
80
externals/SDL/src/video/x11/SDL_x11clipboard.c
vendored
80
externals/SDL/src/video/x11/SDL_x11clipboard.c
vendored
@@ -27,14 +27,7 @@
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_x11video.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
|
||||
/* If you don't support UTF-8, you might use XA_STRING here */
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
#define TEXT_FORMAT X11_XInternAtom(display, "UTF8_STRING", False)
|
||||
#else
|
||||
#define TEXT_FORMAT XA_STRING
|
||||
#endif
|
||||
#include "SDL_x11clipboard.h"
|
||||
|
||||
/* Get any application owned window handle for clipboard association */
|
||||
static Window
|
||||
@@ -59,19 +52,77 @@ GetWindow(_THIS)
|
||||
return data->clipboard_window;
|
||||
}
|
||||
|
||||
|
||||
/* We use our own cut-buffer for intermediate storage instead of
|
||||
XA_CUT_BUFFER0 because their use isn't really defined for holding UTF8. */
|
||||
Atom
|
||||
X11_GetSDLCutBufferClipboardType(Display *display)
|
||||
X11_GetSDLCutBufferClipboardType(Display *display, enum ESDLX11ClipboardMimeType mime_type)
|
||||
{
|
||||
return X11_XInternAtom(display, "SDL_CUTBUFFER", False);
|
||||
switch (mime_type) {
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_STRING:
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN:
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN_UTF8:
|
||||
#endif
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT:
|
||||
return X11_XInternAtom(display, "SDL_CUTBUFFER", False);
|
||||
default:
|
||||
SDL_SetError("Can't find mime_type.");
|
||||
return XA_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
Atom
|
||||
X11_GetSDLCutBufferClipboardExternalFormat(Display *display, enum ESDLX11ClipboardMimeType mime_type)
|
||||
{
|
||||
switch (mime_type) {
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_STRING:
|
||||
/* If you don't support UTF-8, you might use XA_STRING here */
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
return X11_XInternAtom(display, "UTF8_STRING", False);
|
||||
#else
|
||||
return XA_STRING;
|
||||
#endif
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN:
|
||||
return X11_XInternAtom(display, "text/plain", False);
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN_UTF8:
|
||||
return X11_XInternAtom(display, "text/plain;charset=utf-8", False);
|
||||
#endif
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT:
|
||||
return X11_XInternAtom(display, "TEXT", False);
|
||||
default:
|
||||
SDL_SetError("Can't find mime_type.");
|
||||
return XA_STRING;
|
||||
}
|
||||
}
|
||||
Atom
|
||||
X11_GetSDLCutBufferClipboardInternalFormat(Display *display, enum ESDLX11ClipboardMimeType mime_type)
|
||||
{
|
||||
switch (mime_type) {
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_STRING:
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN:
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN_UTF8:
|
||||
#endif
|
||||
case SDL_X11_CLIPBOARD_MIME_TYPE_TEXT:
|
||||
/* If you don't support UTF-8, you might use XA_STRING here */
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
return X11_XInternAtom(display, "UTF8_STRING", False);
|
||||
#else
|
||||
return XA_STRING;
|
||||
#endif
|
||||
default:
|
||||
SDL_SetError("Can't find mime_type.");
|
||||
return XA_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
X11_SetClipboardText(_THIS, const char *text)
|
||||
{
|
||||
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
||||
Atom format;
|
||||
Window window;
|
||||
Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0);
|
||||
|
||||
@@ -82,9 +133,8 @@ X11_SetClipboardText(_THIS, const char *text)
|
||||
}
|
||||
|
||||
/* Save the selection on the root window */
|
||||
format = TEXT_FORMAT;
|
||||
X11_XChangeProperty(display, DefaultRootWindow(display),
|
||||
X11_GetSDLCutBufferClipboardType(display), format, 8, PropModeReplace,
|
||||
X11_GetSDLCutBufferClipboardType(display, SDL_X11_CLIPBOARD_MIME_TYPE_STRING), X11_GetSDLCutBufferClipboardInternalFormat(display, SDL_X11_CLIPBOARD_MIME_TYPE_STRING), 8, PropModeReplace,
|
||||
(const unsigned char *)text, SDL_strlen(text));
|
||||
|
||||
if (XA_CLIPBOARD != None &&
|
||||
@@ -125,7 +175,7 @@ X11_GetClipboardText(_THIS)
|
||||
|
||||
/* Get the window that holds the selection */
|
||||
window = GetWindow(_this);
|
||||
format = TEXT_FORMAT;
|
||||
format = X11_GetSDLCutBufferClipboardInternalFormat(display, SDL_X11_CLIPBOARD_MIME_TYPE_STRING);
|
||||
owner = X11_XGetSelectionOwner(display, XA_CLIPBOARD);
|
||||
if (owner == None) {
|
||||
/* Fall back to ancient X10 cut-buffers which do not support UTF8 strings*/
|
||||
@@ -134,7 +184,7 @@ X11_GetClipboardText(_THIS)
|
||||
format = XA_STRING;
|
||||
} else if (owner == window) {
|
||||
owner = DefaultRootWindow(display);
|
||||
selection = X11_GetSDLCutBufferClipboardType(display);
|
||||
selection = X11_GetSDLCutBufferClipboardType(display, SDL_X11_CLIPBOARD_MIME_TYPE_STRING);
|
||||
} else {
|
||||
/* Request that the selection owner copy the data to our window */
|
||||
owner = window;
|
||||
|
||||
14
externals/SDL/src/video/x11/SDL_x11clipboard.h
vendored
14
externals/SDL/src/video/x11/SDL_x11clipboard.h
vendored
@@ -23,10 +23,22 @@
|
||||
#ifndef SDL_x11clipboard_h_
|
||||
#define SDL_x11clipboard_h_
|
||||
|
||||
enum ESDLX11ClipboardMimeType {
|
||||
SDL_X11_CLIPBOARD_MIME_TYPE_STRING,
|
||||
SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN,
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
SDL_X11_CLIPBOARD_MIME_TYPE_TEXT_PLAIN_UTF8,
|
||||
#endif
|
||||
SDL_X11_CLIPBOARD_MIME_TYPE_TEXT,
|
||||
SDL_X11_CLIPBOARD_MIME_TYPE_MAX
|
||||
};
|
||||
|
||||
extern int X11_SetClipboardText(_THIS, const char *text);
|
||||
extern char *X11_GetClipboardText(_THIS);
|
||||
extern SDL_bool X11_HasClipboardText(_THIS);
|
||||
extern Atom X11_GetSDLCutBufferClipboardType(Display *display);
|
||||
extern Atom X11_GetSDLCutBufferClipboardType(Display *display, enum ESDLX11ClipboardMimeType mime_type);
|
||||
extern Atom X11_GetSDLCutBufferClipboardExternalFormat(Display *display, enum ESDLX11ClipboardMimeType mime_type);
|
||||
extern Atom X11_GetSDLCutBufferClipboardInternalFormat(Display *display, enum ESDLX11ClipboardMimeType mime_type);
|
||||
|
||||
#endif /* SDL_x11clipboard_h_ */
|
||||
|
||||
|
||||
71
externals/SDL/src/video/x11/SDL_x11events.c
vendored
71
externals/SDL/src/video/x11/SDL_x11events.c
vendored
@@ -404,6 +404,9 @@ X11_DispatchFocusIn(_THIS, SDL_WindowData *data)
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_SetFocus(SDL_TRUE);
|
||||
#endif
|
||||
if (data->flashing_window) {
|
||||
X11_FlashWindow(_this, data->window, SDL_FLASH_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -559,6 +562,7 @@ X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest)
|
||||
static void
|
||||
X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
|
||||
{
|
||||
int i;
|
||||
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
|
||||
Display *display = videodata->display;
|
||||
|
||||
@@ -570,10 +574,12 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
|
||||
case SelectionRequest: {
|
||||
const XSelectionRequestEvent *req = &xevent->xselectionrequest;
|
||||
XEvent sevent;
|
||||
int seln_format;
|
||||
int seln_format, mime_formats;
|
||||
unsigned long nbytes;
|
||||
unsigned long overflow;
|
||||
unsigned char *seln_data;
|
||||
unsigned char *seln_data;
|
||||
Atom supportedFormats[SDL_X11_CLIPBOARD_MIME_TYPE_MAX+1];
|
||||
Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0);
|
||||
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld)\n",
|
||||
@@ -591,27 +597,38 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
|
||||
/* !!! FIXME: We were probably storing this on the root window
|
||||
because an SDL window might go away...? but we don't have to do
|
||||
this now (or ever, really). */
|
||||
if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
|
||||
X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target,
|
||||
&sevent.xselection.target, &seln_format, &nbytes,
|
||||
&overflow, &seln_data) == Success) {
|
||||
/* !!! FIXME: cache atoms */
|
||||
Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0);
|
||||
if (sevent.xselection.target == req->target) {
|
||||
X11_XChangeProperty(display, req->requestor, req->property,
|
||||
sevent.xselection.target, seln_format, PropModeReplace,
|
||||
seln_data, nbytes);
|
||||
sevent.xselection.property = req->property;
|
||||
} else if (XA_TARGETS == req->target) {
|
||||
Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target };
|
||||
X11_XChangeProperty(display, req->requestor, req->property,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)SupportedFormats,
|
||||
SDL_arraysize(SupportedFormats));
|
||||
sevent.xselection.property = req->property;
|
||||
sevent.xselection.target = XA_TARGETS;
|
||||
|
||||
if (req->target == XA_TARGETS) {
|
||||
supportedFormats[0] = XA_TARGETS;
|
||||
mime_formats = 1;
|
||||
for (i = 0; i < SDL_X11_CLIPBOARD_MIME_TYPE_MAX; ++i)
|
||||
supportedFormats[mime_formats++] = X11_GetSDLCutBufferClipboardExternalFormat(display, i);
|
||||
X11_XChangeProperty(display, req->requestor, req->property,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)supportedFormats,
|
||||
mime_formats);
|
||||
sevent.xselection.property = req->property;
|
||||
sevent.xselection.target = XA_TARGETS;
|
||||
} else {
|
||||
for (i = 0; i < SDL_X11_CLIPBOARD_MIME_TYPE_MAX; ++i) {
|
||||
if (X11_GetSDLCutBufferClipboardExternalFormat(display, i) != req->target)
|
||||
continue;
|
||||
if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
|
||||
X11_GetSDLCutBufferClipboardType(display, i), 0, INT_MAX/4, False, X11_GetSDLCutBufferClipboardInternalFormat(display, i),
|
||||
&sevent.xselection.target, &seln_format, &nbytes,
|
||||
&overflow, &seln_data) == Success) {
|
||||
if (seln_format != None) {
|
||||
X11_XChangeProperty(display, req->requestor, req->property,
|
||||
sevent.xselection.target, seln_format, PropModeReplace,
|
||||
seln_data, nbytes);
|
||||
sevent.xselection.property = req->property;
|
||||
X11_XFree(seln_data);
|
||||
break;
|
||||
} else {
|
||||
X11_XFree(seln_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
X11_XFree(seln_data);
|
||||
}
|
||||
X11_XSendEvent(display, req->requestor, False, 0, &sevent);
|
||||
X11_XSync(display, False);
|
||||
@@ -1548,6 +1565,7 @@ X11_PumpEvents(_THIS)
|
||||
{
|
||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||
XEvent xevent;
|
||||
int i;
|
||||
|
||||
if (data->last_mode_change_deadline) {
|
||||
if (SDL_TICKS_PASSED(SDL_GetTicks(), data->last_mode_change_deadline)) {
|
||||
@@ -1586,6 +1604,15 @@ X11_PumpEvents(_THIS)
|
||||
|
||||
/* FIXME: Only need to do this when there are pending focus changes */
|
||||
X11_HandleFocusChanges(_this);
|
||||
|
||||
/* FIXME: Only need to do this when there are flashing windows */
|
||||
for (i = 0; i < data->numwindows; ++i) {
|
||||
if (data->windowlist[i] != NULL &&
|
||||
data->windowlist[i]->flash_cancel_time &&
|
||||
SDL_TICKS_PASSED(SDL_GetTicks(), data->windowlist[i]->flash_cancel_time)) {
|
||||
X11_FlashWindow(_this, data->windowlist[i]->window, SDL_FLASH_CANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
35
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
35
externals/SDL/src/video/x11/SDL_x11modes.c
vendored
@@ -995,6 +995,15 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||
}
|
||||
}
|
||||
|
||||
/* This catches an error from XRRSetScreenSize, as a workaround for now. */
|
||||
/* !!! FIXME: remove this later when we have a better solution. */
|
||||
static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL;
|
||||
static int
|
||||
SDL_XRRSetScreenSizeErrHandler(Display *d, XErrorEvent *e)
|
||||
{
|
||||
return (e->error_code == BadMatch) ? 0 : PreXRRSetScreenSizeErrorHandler(d, e);
|
||||
}
|
||||
|
||||
int
|
||||
X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode)
|
||||
{
|
||||
@@ -1002,6 +1011,7 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode
|
||||
Display *display = viddata->display;
|
||||
SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
|
||||
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
|
||||
int mm_width, mm_height;
|
||||
|
||||
viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2);
|
||||
|
||||
@@ -1030,10 +1040,35 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode
|
||||
return SDL_SetError("Couldn't get XRandR crtc info");
|
||||
}
|
||||
|
||||
X11_XGrabServer(display);
|
||||
status = X11_XRRSetCrtcConfig(display, res, output_info->crtc, CurrentTime,
|
||||
0, 0, None, crtc->rotation, NULL, 0);
|
||||
if (status != Success) {
|
||||
goto setCrtcError;
|
||||
}
|
||||
|
||||
mm_width = mode->w * DisplayWidthMM(display, data->screen) / DisplayWidth(display, data->screen);
|
||||
mm_height = mode->h * DisplayHeightMM(display, data->screen) / DisplayHeight(display, data->screen);
|
||||
|
||||
/* !!! FIXME: this can get into a problem scenario when a window is
|
||||
bigger than a physical monitor in a configuration where one screen
|
||||
spans multiple physical monitors. A detailed reproduction case is
|
||||
discussed at https://github.com/libsdl-org/SDL/issues/4561 ...
|
||||
for now we cheat and just catch the X11 error and carry on, which
|
||||
is likely to cause subtle issues but is better than outright
|
||||
crashing */
|
||||
X11_XSync(display, False);
|
||||
PreXRRSetScreenSizeErrorHandler = X11_XSetErrorHandler(SDL_XRRSetScreenSizeErrHandler);
|
||||
X11_XRRSetScreenSize(display, RootWindow(display, data->screen), mode->w, mode->h, mm_width, mm_height);
|
||||
X11_XSync(display, False);
|
||||
X11_XSetErrorHandler(PreXRRSetScreenSizeErrorHandler);
|
||||
|
||||
status = X11_XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime,
|
||||
crtc->x, crtc->y, modedata->xrandr_mode, crtc->rotation,
|
||||
&data->xrandr_output, 1);
|
||||
|
||||
setCrtcError:
|
||||
X11_XUngrabServer(display);
|
||||
X11_XRRFreeCrtcInfo(crtc);
|
||||
X11_XRRFreeOutputInfo(output_info);
|
||||
X11_XRRFreeScreenResources(res);
|
||||
|
||||
6
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
6
externals/SDL/src/video/x11/SDL_x11mouse.c
vendored
@@ -77,7 +77,7 @@ X11_CreateDefaultCursor()
|
||||
cursor = SDL_calloc(1, sizeof(*cursor));
|
||||
if (cursor) {
|
||||
/* None is used to indicate the default cursor */
|
||||
cursor->driverdata = (void*)None;
|
||||
cursor->driverdata = (void*)(uintptr_t)None;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
@@ -216,7 +216,7 @@ X11_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
||||
if (x11_cursor == None) {
|
||||
x11_cursor = X11_CreatePixmapCursor(surface, hot_x, hot_y);
|
||||
}
|
||||
cursor->driverdata = (void*)x11_cursor;
|
||||
cursor->driverdata = (void*)(uintptr_t)x11_cursor;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
@@ -257,7 +257,7 @@ X11_CreateSystemCursor(SDL_SystemCursor id)
|
||||
|
||||
x11_cursor = X11_XCreateFontCursor(GetDisplay(), shape);
|
||||
|
||||
cursor->driverdata = (void*)x11_cursor;
|
||||
cursor->driverdata = (void*)(uintptr_t)x11_cursor;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
35
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
35
externals/SDL/src/video/x11/SDL_x11opengl.c
vendored
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2021 NVIDIA Corporation
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -420,6 +421,9 @@ X11_GL_InitExtensions(_THIS)
|
||||
_this->gl_data->glXChooseFBConfig =
|
||||
(GLXFBConfig *(*)(Display *, int, const int *, int *))
|
||||
X11_GL_GetProcAddress(_this, "glXChooseFBConfig");
|
||||
_this->gl_data->glXGetVisualFromFBConfig =
|
||||
(XVisualInfo *(*)(Display *, GLXFBConfig))
|
||||
X11_GL_GetProcAddress(_this, "glXGetVisualFromFBConfig");
|
||||
}
|
||||
|
||||
/* Check for GLX_EXT_visual_rating */
|
||||
@@ -598,7 +602,7 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
|
||||
{
|
||||
/* 64 seems nice. */
|
||||
int attribs[64];
|
||||
XVisualInfo *vinfo;
|
||||
XVisualInfo *vinfo = NULL;
|
||||
int *pvistypeattr = NULL;
|
||||
|
||||
if (!_this->gl_data) {
|
||||
@@ -606,12 +610,33 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr);
|
||||
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
|
||||
if (_this->gl_data->glXChooseFBConfig &&
|
||||
_this->gl_data->glXGetVisualFromFBConfig) {
|
||||
GLXFBConfig *framebuffer_config = NULL;
|
||||
int fbcount = 0;
|
||||
|
||||
if (!vinfo && (pvistypeattr != NULL)) {
|
||||
*pvistypeattr = None;
|
||||
X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_TRUE, &pvistypeattr);
|
||||
framebuffer_config = _this->gl_data->glXChooseFBConfig(display, screen, attribs, &fbcount);
|
||||
if (!framebuffer_config && (pvistypeattr != NULL)) {
|
||||
*pvistypeattr = None;
|
||||
framebuffer_config = _this->gl_data->glXChooseFBConfig(display, screen, attribs, &fbcount);
|
||||
}
|
||||
|
||||
if (framebuffer_config) {
|
||||
vinfo = _this->gl_data->glXGetVisualFromFBConfig(display, framebuffer_config[0]);
|
||||
}
|
||||
|
||||
X11_XFree(framebuffer_config);
|
||||
}
|
||||
|
||||
if (!vinfo) {
|
||||
X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr);
|
||||
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
|
||||
|
||||
if (!vinfo && (pvistypeattr != NULL)) {
|
||||
*pvistypeattr = None;
|
||||
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
|
||||
}
|
||||
}
|
||||
|
||||
if (!vinfo) {
|
||||
|
||||
1
externals/SDL/src/video/x11/SDL_x11opengl.h
vendored
1
externals/SDL/src/video/x11/SDL_x11opengl.h
vendored
@@ -53,6 +53,7 @@ struct SDL_GLDriverData
|
||||
GLXContext (*glXCreateContext) (Display*,XVisualInfo*,GLXContext,Bool);
|
||||
GLXContext (*glXCreateContextAttribsARB) (Display*,GLXFBConfig,GLXContext,Bool,const int *);
|
||||
GLXFBConfig *(*glXChooseFBConfig) (Display*,int,const int *,int *);
|
||||
XVisualInfo *(*glXGetVisualFromFBConfig) (Display*,GLXFBConfig);
|
||||
void (*glXDestroyContext) (Display*, GLXContext);
|
||||
Bool(*glXMakeCurrent) (Display*,GLXDrawable,GLXContext);
|
||||
void (*glXSwapBuffers) (Display*, GLXDrawable);
|
||||
|
||||
3
externals/SDL/src/video/x11/SDL_x11sym.h
vendored
3
externals/SDL/src/video/x11/SDL_x11sym.h
vendored
@@ -119,8 +119,9 @@ SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d)
|
||||
SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
|
||||
SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
|
||||
SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
|
||||
SDL_X11_SYM(void,XSetWMProperties,(Display* a,Window b,XTextProperty* c,XTextProperty* d,char** e,int f,XSizeHints* g,XWMHints* h,XClassHint* i),(a,b,c,d,e,f,g,h,i),)
|
||||
SDL_X11_SYM(void,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),)
|
||||
SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
|
||||
SDL_X11_SYM(void,XSetWMProperties,(Display* a,Window b,XTextProperty* c,XTextProperty* d,char** e,int f,XSizeHints* g,XWMHints* h,XClassHint* i),(a,b,c,d,e,f,g,h,i),)
|
||||
SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
|
||||
SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
|
||||
SDL_X11_SYM(int,XStoreName,(Display* a,Window b,_Xconst char* c),(a,b,c),return)
|
||||
|
||||
4
externals/SDL/src/video/x11/SDL_x11video.c
vendored
4
externals/SDL/src/video/x11/SDL_x11video.c
vendored
@@ -453,10 +453,6 @@ X11_VideoInit(_THIS)
|
||||
|
||||
X11_InitTouch(_this);
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
SDL_DBus_Init();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
52
externals/SDL/src/video/x11/SDL_x11window.c
vendored
52
externals/SDL/src/video/x11/SDL_x11window.c
vendored
@@ -734,7 +734,7 @@ X11_SetWindowTitle(_THIS, SDL_Window * window)
|
||||
|
||||
status = X11_XChangeProperty(display, data->xwindow, _NET_WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, strlen(title));
|
||||
|
||||
if (status != Success) {
|
||||
if (status != 1) {
|
||||
char *x11_error = NULL;
|
||||
char x11_error_locale[256];
|
||||
if (X11_XGetErrorText(display, status, x11_error_locale, sizeof(x11_error_locale)) == Success)
|
||||
@@ -1749,26 +1749,48 @@ X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept)
|
||||
}
|
||||
|
||||
int
|
||||
X11_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count)
|
||||
X11_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||
Display *display = data->videodata->display;
|
||||
XWMHints *wmhints;
|
||||
|
||||
Atom demands_attention = X11_XInternAtom(display, "_NET_WM_STATE_DEMANDS_ATTENTION", 1);
|
||||
Atom wm_state = X11_XInternAtom(display, "_NET_WM_STATE", 1);
|
||||
wmhints = X11_XGetWMHints(display, data->xwindow);
|
||||
if (!wmhints) {
|
||||
return SDL_SetError("Couldn't get WM hints");
|
||||
}
|
||||
|
||||
XEvent snd_ntfy_ev = {ClientMessage};
|
||||
snd_ntfy_ev.xclient.window = data->xwindow;
|
||||
snd_ntfy_ev.xclient.message_type = wm_state;
|
||||
snd_ntfy_ev.xclient.format = 32;
|
||||
snd_ntfy_ev.xclient.data.l[0] = 1; /* _NET_WM_STATE_ADD */
|
||||
snd_ntfy_ev.xclient.data.l[1] = demands_attention;
|
||||
snd_ntfy_ev.xclient.data.l[2] = 0;
|
||||
snd_ntfy_ev.xclient.data.l[3] = 1; /* normal application */
|
||||
snd_ntfy_ev.xclient.data.l[4] = 0;
|
||||
X11_XSendEvent(display, RootWindow(display, displaydata->screen), False, SubstructureNotifyMask | SubstructureRedirectMask, &snd_ntfy_ev);
|
||||
wmhints->flags &= ~XUrgencyHint;
|
||||
data->flashing_window = SDL_FALSE;
|
||||
data->flash_cancel_time = 0;
|
||||
|
||||
switch (operation) {
|
||||
case SDL_FLASH_CANCEL:
|
||||
/* Taken care of above */
|
||||
break;
|
||||
case SDL_FLASH_BRIEFLY:
|
||||
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
wmhints->flags |= XUrgencyHint;
|
||||
data->flashing_window = SDL_TRUE;
|
||||
/* On Ubuntu 21.04 this causes a dialog to pop up, so leave it up for a full second so users can see it */
|
||||
data->flash_cancel_time = SDL_GetTicks() + 1000;
|
||||
if (!data->flash_cancel_time) {
|
||||
data->flash_cancel_time = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDL_FLASH_UNTIL_FOCUSED:
|
||||
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
wmhints->flags |= XUrgencyHint;
|
||||
data->flashing_window = SDL_TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
X11_XSetWMHints(display, data->xwindow, wmhints);
|
||||
X11_XFree(wmhints);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
4
externals/SDL/src/video/x11/SDL_x11window.h
vendored
4
externals/SDL/src/video/x11/SDL_x11window.h
vendored
@@ -68,6 +68,8 @@ typedef struct
|
||||
unsigned long user_time;
|
||||
Atom xdnd_req;
|
||||
Window xdnd_source;
|
||||
SDL_bool flashing_window;
|
||||
Uint32 flash_cancel_time;
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
EGLSurface egl_surface;
|
||||
#endif
|
||||
@@ -107,7 +109,7 @@ extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||
struct SDL_SysWMinfo *info);
|
||||
extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern void X11_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
||||
extern int X11_FlashWindow(_THIS, SDL_Window * window, Uint32 flash_count);
|
||||
extern int X11_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation);
|
||||
|
||||
#endif /* SDL_x11window_h_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user