update sdl Merge commit '644725478f4de0f074a6834e8423ac36dce3974f'

This commit is contained in:
2023-09-23 18:53:11 +02:00
172 changed files with 7495 additions and 4062 deletions

View File

@ -92,9 +92,7 @@ static int SetSelectionData(SDL_VideoDevice *_this, Atom selection, SDL_Clipboar
clipboard->mime_count = mime_count;
clipboard->sequence = sequence;
if (!clipboard_owner) {
X11_XSetSelectionOwner(display, selection, window, CurrentTime);
}
X11_XSetSelectionOwner(display, selection, window, CurrentTime);
return 0;
}

View File

@ -1579,12 +1579,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
}
}
if (changed & SDL_WINDOW_MAXIMIZED) {
if (flags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
if ((changed & SDL_WINDOW_MAXIMIZED) && ((flags & SDL_WINDOW_MAXIMIZED) && !(flags & SDL_WINDOW_MINIMIZED))) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
}
if ((changed & SDL_WINDOW_MINIMIZED) && (flags & SDL_WINDOW_MINIMIZED)) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
}
if (((changed & SDL_WINDOW_MAXIMIZED) || (changed & SDL_WINDOW_MINIMIZED)) &&
(!(flags & SDL_WINDOW_MAXIMIZED) && !(flags & SDL_WINDOW_MINIMIZED))) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
}
if (changed & SDL_WINDOW_OCCLUDED) {
SDL_SendWindowEvent(data->window, (flags & SDL_WINDOW_OCCLUDED) ? SDL_EVENT_WINDOW_OCCLUDED : SDL_EVENT_WINDOW_EXPOSED, 0, 0);
}
} else if (xevent->xproperty.atom == videodata->XKLAVIER_STATE) {
/* Hack for Ubuntu 12.04 (etc) that doesn't send MappingNotify

View File

@ -39,8 +39,6 @@
#include "SDL_x11opengles.h"
#endif
#include "SDL_x11vulkan.h"
/* Initialization/Query functions */
static int X11_VideoInit(SDL_VideoDevice *_this);
static void X11_VideoQuit(SDL_VideoDevice *_this);
@ -214,6 +212,7 @@ static SDL_VideoDevice *X11_CreateDevice(void)
device->AcceptDragAndDrop = X11_AcceptDragAndDrop;
device->FlashWindow = X11_FlashWindow;
device->ShowWindowSystemMenu = X11_ShowWindowSystemMenu;
device->SetWindowFocusable = X11_SetWindowFocusable;
#ifdef SDL_VIDEO_DRIVER_X11_XFIXES
device->SetWindowMouseRect = X11_SetWindowMouseRect;

View File

@ -25,30 +25,6 @@
#include "../SDL_sysvideo.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XDBE
#include <X11/extensions/Xdbe.h>
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
#include <X11/extensions/XInput2.h>
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
#include <X11/extensions/scrnsaver.h>
#endif
#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
#include <X11/extensions/shape.h>
#endif
#include "../../core/linux/SDL_dbus.h"
#include "../../core/linux/SDL_ime.h"

View File

@ -22,6 +22,8 @@
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)
#include "../SDL_vulkan_internal.h"
#include "SDL_x11video.h"
#include "SDL_x11vulkan.h"

View File

@ -23,11 +23,11 @@
#ifndef SDL_x11vulkan_h_
#define SDL_x11vulkan_h_
#include "../SDL_vulkan_internal.h"
#include <SDL3/SDL_vulkan.h>
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)
/*typedef struct xcb_connection_t xcb_connection_t;*/
typedef struct xcb_connection_t xcb_connection_t;
typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy);
int X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);

View File

@ -238,7 +238,7 @@ Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwin
for (i = 0; i < numItems; ++i) {
if (atoms[i] == _NET_WM_STATE_HIDDEN) {
flags |= SDL_WINDOW_HIDDEN;
flags |= SDL_WINDOW_MINIMIZED | SDL_WINDOW_OCCLUDED;
} else if (atoms[i] == _NET_WM_STATE_FOCUSED) {
flags |= SDL_WINDOW_INPUT_FOCUS;
} else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
@ -604,8 +604,14 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
return SDL_SetError("Couldn't create window");
}
SetWindowBordered(display, screen, w,
!(window->flags & SDL_WINDOW_BORDERLESS));
/* Do not set borderless window if in desktop fullscreen, this causes
flickering in multi-monitor setups */
if (!((window->pending_flags & SDL_WINDOW_FULLSCREEN) &&
(window->flags & SDL_WINDOW_BORDERLESS) &&
!window->fullscreen_exclusive)) {
SetWindowBordered(display, screen, w,
!(window->flags & SDL_WINDOW_BORDERLESS));
}
sizehints = X11_XAllocSizeHints();
/* Setup the normal size hints */
@ -623,7 +629,7 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
/* Setup the input hints so we get keyboard input */
wmhints = X11_XAllocWMHints();
wmhints->input = True;
wmhints->input = !(window->flags & SDL_WINDOW_NOT_FOCUSABLE) ? True : False;
wmhints->window_group = data->window_group;
wmhints->flags = InputHint | WindowGroupHint;
@ -1982,4 +1988,24 @@ void X11_ShowWindowSystemMenu(SDL_Window *window, int x, int y)
X11_XFlush(display);
}
int X11_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable)
{
SDL_WindowData *data = window->driverdata;
Display *display = data->videodata->display;
XWMHints *wmhints;
wmhints = X11_XGetWMHints(display, data->xwindow);
if (wmhints == NULL) {
return SDL_SetError("Couldn't get WM hints");
}
wmhints->input = focusable ? True : False;
wmhints->flags |= InputHint;
X11_XSetWMHints(display, data->xwindow, wmhints);
X11_XFree(wmhints);
return 0;
}
#endif /* SDL_VIDEO_DRIVER_X11 */

View File

@ -116,6 +116,7 @@ extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern void X11_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
extern int X11_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
extern void X11_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
extern int X11_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool focusable);
int SDL_X11_SetWindowTitle(Display *display, Window xwindow, char *title);
void X11_UpdateWindowPosition(SDL_Window *window);