early-access version 2325

This commit is contained in:
pineappleEA
2021-12-18 11:14:57 +01:00
parent 66c22ff5a2
commit cdbc28f0d4
74 changed files with 7922 additions and 5076 deletions

View File

@@ -947,7 +947,7 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
}
*identical = 0;
}
map = (Uint8 *) SDL_malloc(src->ncolors);
map = (Uint8 *) SDL_calloc(256, sizeof(Uint8));
if (map == NULL) {
SDL_OutOfMemory();
return (NULL);
@@ -971,7 +971,7 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
SDL_Palette *pal = src->palette;
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
map = (Uint8 *) SDL_malloc(pal->ncolors * bpp);
map = (Uint8 *) SDL_calloc(256, bpp);
if (map == NULL) {
SDL_OutOfMemory();
return (NULL);

View File

@@ -473,15 +473,19 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
}
}
if (x > 0) {
x = SDL_ceil(x);
} else if (x < 0) {
x = SDL_floor(x);
}
if (y > 0) {
y = SDL_ceil(y);
} else if (y < 0) {
y = SDL_floor(y);
/* For discrete scroll events from conventional mice, always send a full tick.
For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
if (![event respondsToSelector:@selector(hasPreciseScrollingDeltas)] || ![event hasPreciseScrollingDeltas]) {
if (x > 0) {
x = SDL_ceil(x);
} else if (x < 0) {
x = SDL_floor(x);
}
if (y > 0) {
y = SDL_ceil(y);
} else if (y < 0) {
y = SDL_floor(y);
}
}
SDL_SendMouseWheel(window, mouseID, x, y, direction);

View File

@@ -109,7 +109,10 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
if (_this->egl_data == NULL) {
/* !!! FIXME: commenting out this assertion is (I think) incorrect; figure out why driver_loaded is wrong for ANGLE instead. --ryan. */
#if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 1, while the below lines function. */
SDL_assert(!_this->gl_config.driver_loaded);
#endif
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {
SDL_EGL_UnloadLibrary(_this);
return -1;

View File

@@ -73,6 +73,7 @@ KMSDRM_DestroyCursorBO (_THIS, SDL_VideoDisplay *display)
if (dispdata->cursor_bo) {
KMSDRM_gbm_bo_destroy(dispdata->cursor_bo);
dispdata->cursor_bo = NULL;
dispdata->cursor_bo_drm_fd = -1;
}
}
@@ -116,6 +117,8 @@ KMSDRM_CreateCursorBO (SDL_VideoDisplay *display) {
SDL_SetError("Could not create GBM cursor BO");
return;
}
dispdata->cursor_bo_drm_fd = viddata->drm_fd;
}
/* Remove a cursor buffer from a display's DRM cursor BO. */
@@ -384,11 +387,9 @@ KMSDRM_WarpMouseGlobal(int x, int y)
/* And now update the cursor graphic position on screen. */
if (dispdata->cursor_bo) {
int drm_fd;
int ret = 0;
drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, x, y);
ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, x, y);
if (ret) {
SDL_SetError("drmModeMoveCursor() failed.");
@@ -437,7 +438,6 @@ static void
KMSDRM_MoveCursor(SDL_Cursor * cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
int drm_fd;
int ret = 0;
/* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
@@ -452,9 +452,7 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
return;
}
drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(dispdata->cursor_bo));
ret = KMSDRM_drmModeMoveCursor(drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
if (ret) {
SDL_SetError("drmModeMoveCursor() failed.");

View File

@@ -95,7 +95,6 @@ SDL_KMSDRM_SYM(int,drmModeSetPlane,(int fd, uint32_t plane_id, uint32_t crtc_id,
/* Planes stuff ends. */
SDL_KMSDRM_MODULE(GBM)
SDL_KMSDRM_SYM(int,gbm_device_get_fd,(struct gbm_device *gbm))
SDL_KMSDRM_SYM(int,gbm_device_is_format_supported,(struct gbm_device *gbm,
uint32_t format, uint32_t usage))
SDL_KMSDRM_SYM(void,gbm_device_destroy,(struct gbm_device *gbm))

View File

@@ -555,6 +555,7 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) {
/* Initialize some of the members of the new display's driverdata
to sane values. */
dispdata->cursor_bo = NULL;
dispdata->cursor_bo_drm_fd = -1;
/* Since we create and show the default cursor on KMSDRM_InitMouse(),
and we call KMSDRM_InitMouse() when we create a window, we have to know

View File

@@ -77,6 +77,7 @@ typedef struct SDL_DisplayData
where we may not have an SDL_Cursor at all (so no SDL_Cursor driverdata).
There's only one cursor GBM BO because we only support one cursor. */
struct gbm_bo *cursor_bo;
int cursor_bo_drm_fd;
uint64_t cursor_w, cursor_h;
SDL_bool default_cursor_init;

View File

@@ -320,10 +320,15 @@ static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2)
}
if ((ulFlags & KC_CHAR) != 0) {
CHAR acUTF8[4];
LONG lRC = StrUTF8(1, acUTF8, sizeof(acUTF8), (PSZ)&ulCharCode, 1);
SDL_SendKeyboardText((lRC > 0)? acUTF8 : (PSZ)&ulCharCode);
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
char *utf8 = SDL_iconv_string("UTF-8", "", (char *)&ulCharCode, 1);
SDL_SendKeyboardText((utf8 && *utf8) ? utf8 : (char *)&ulCharCode);
SDL_free(utf8);
#else
char utf8[4];
int rc = StrUTF8(1, utf8, sizeof(utf8), (char *)&ulCharCode, 1);
SDL_SendKeyboardText((rc > 0) ? utf8 : (char *) &ulCharCode);
#endif
}
}
@@ -389,7 +394,7 @@ static MRESULT _wmDrop(WINDATA *pWinData, PDRAGINFO pDragInfo)
{
ULONG ulIdx;
PDRAGITEM pDragItem;
CHAR acFName[_MAX_PATH];
CHAR acFName[CCHMAXPATH];
PCHAR pcFName;
if (!DrgAccessDraginfo(pDragInfo))

View File

@@ -34,6 +34,7 @@
#include "SDL_keyboard.h"
#include "../../thread/SDL_systhread.h"
#include <psphprm.h>
#include <pspthreadman.h>
#ifdef PSPIRKEYB
#include <pspirkeyb.h>

View File

@@ -214,6 +214,7 @@ PSP_CreateWindow(_THIS, SDL_Window * window)
/* Setup driver data for this window */
window->driverdata = wdata;
SDL_SetKeyboardFocus(window);
/* Window has been successfully created */
return 0;

View File

@@ -95,6 +95,8 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned)
#define wl_proxy_set_tag (*WAYLAND_wl_proxy_set_tag)
#define wl_proxy_get_tag (*WAYLAND_wl_proxy_get_tag)
#define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags)
#define wl_proxy_marshal_array_flags (*WAYLAND_wl_proxy_marshal_array_flags)
#define wl_seat_interface (*WAYLAND_wl_seat_interface)
#define wl_surface_interface (*WAYLAND_wl_surface_interface)

View File

@@ -66,6 +66,25 @@
/* Weston uses a ratio of 10 units per scroll tick */
#define WAYLAND_WHEEL_AXIS_UNIT 10
static const struct {
xkb_keysym_t keysym;
SDL_KeyCode keycode;
} KeySymToSDLKeyCode[] = {
{ XKB_KEY_Shift_L, SDLK_LSHIFT },
{ XKB_KEY_Shift_R, SDLK_RSHIFT },
{ XKB_KEY_Control_L, SDLK_LCTRL },
{ XKB_KEY_Control_R, SDLK_RCTRL },
{ XKB_KEY_Caps_Lock, SDLK_CAPSLOCK },
{ XKB_KEY_Alt_L, SDLK_LALT },
{ XKB_KEY_Alt_R, SDLK_RALT },
{ XKB_KEY_Meta_L, SDLK_LGUI },
{ XKB_KEY_Meta_R, SDLK_RGUI },
{ XKB_KEY_Super_L, SDLK_LGUI },
{ XKB_KEY_Super_R, SDLK_RGUI },
{ XKB_KEY_Hyper_L, SDLK_LGUI },
{ XKB_KEY_Hyper_R, SDLK_RGUI },
};
struct SDL_WaylandTouchPoint {
SDL_TouchID id;
float x;
@@ -83,6 +102,19 @@ struct SDL_WaylandTouchPointList {
static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL};
static SDL_KeyCode
Wayland_KeySymToSDLKeyCode(xkb_keysym_t keysym)
{
int i;
for (i = 0; i < SDL_arraysize(KeySymToSDLKeyCode); ++i) {
if (keysym == KeySymToSDLKeyCode[i].keysym) {
return KeySymToSDLKeyCode[i].keycode;
}
}
return SDLK_UNKNOWN;
}
static void
touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface)
{
@@ -969,6 +1001,11 @@ Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) {
uint32_t keycode = SDL_KeySymToUcs4(syms[0]);
if (!keycode) {
keycode = Wayland_KeySymToSDLKeyCode(syms[0]);
}
if (keycode) {
sdlKeymap->keymap[scancode] = keycode;
} else {

View File

@@ -84,6 +84,10 @@ SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_18)
SDL_WAYLAND_SYM(void, wl_proxy_set_tag, (struct wl_proxy *, const char * const *))
SDL_WAYLAND_SYM(const char * const *, wl_proxy_get_tag, (struct wl_proxy *))
SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20)
SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...))
SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args))
SDL_WAYLAND_INTERFACE(wl_seat_interface)
SDL_WAYLAND_INTERFACE(wl_surface_interface)
SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)

View File

@@ -290,8 +290,10 @@ handle_configure_xdg_toplevel(void *data,
/* For fullscreen, foolishly do what the compositor says. If it's wrong,
* don't blame us, we were explicitly instructed to do this.
*/
window->w = width;
window->h = height;
if (width != 0 && height != 0) {
window->w = width;
window->h = height;
}
/* This part is good though. */
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {

View File

@@ -109,7 +109,7 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
if (_this->egl_data == NULL) {
/* !!! FIXME: commenting out this assertion is (I think) incorrect; figure out why driver_loaded is wrong for ANGLE instead. --ryan. */
#if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 0, while the below lines function. */
#if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 1, while the below lines function. */
SDL_assert(!_this->gl_config.driver_loaded);
#endif
if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) {

View File

@@ -115,6 +115,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
shmdt(shminfo->shmaddr);
} else {
/* Done! */
data->ximage->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? MSBFirst : LSBFirst;
data->use_mitshm = SDL_TRUE;
*pixels = shminfo->shmaddr;
return 0;
@@ -135,6 +136,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
SDL_free(*pixels);
return SDL_SetError("Couldn't create XImage");
}
data->ximage->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? MSBFirst : LSBFirst;
return 0;
}

View File

@@ -163,7 +163,7 @@ SDL_X11_SYM(Status,XmbTextListToTextProperty,(Display* a,char** b,int c,XICCEnco
SDL_X11_MODULE(XFIXES)
SDL_X11_SYM(PointerBarrier, XFixesCreatePointerBarrier, (Display* a, Window b, int c, int d, int e, int f, int g, int h, int *i),(a,b,c,d,e,f,g,h,i),return)
SDL_X11_SYM(void, XFixesDestroyPointerBarrier, (Display* a, PointerBarrier b), (a,b),)
SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, BarrierEventID d), (a,b,c,d), return)
SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, BarrierEventID d), (a,b,c,d), return) /* this is actually Xinput2 */
SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), return)
#endif

View File

@@ -91,7 +91,7 @@ static uint8_t clampU8(int32_t v)
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
};
return lut[(v+128*PRECISION_FACTOR)>>PRECISION];
return lut[((v+128*PRECISION_FACTOR)>>PRECISION)&511];
}