Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/sdl/patches/0001-remove-unnecessary-subsystems.patch
9898 views
1
diff --git a/thirdparty/sdl/SDL.c b/thirdparty/sdl/SDL.c
2
index 502f6617a4..dd0b823634 100644
3
--- a/thirdparty/sdl/SDL.c
4
+++ b/thirdparty/sdl/SDL.c
5
@@ -40,23 +40,14 @@
6
#include "SDL_hints_c.h"
7
#include "SDL_log_c.h"
8
#include "SDL_properties_c.h"
9
-#include "audio/SDL_sysaudio.h"
10
-#include "camera/SDL_camera_c.h"
11
-#include "cpuinfo/SDL_cpuinfo_c.h"
12
+//#include "audio/SDL_sysaudio.h"
13
#include "events/SDL_events_c.h"
14
#include "haptic/SDL_haptic_c.h"
15
#include "joystick/SDL_gamepad_c.h"
16
#include "joystick/SDL_joystick_c.h"
17
-#include "render/SDL_sysrender.h"
18
#include "sensor/SDL_sensor_c.h"
19
#include "stdlib/SDL_getenv_c.h"
20
#include "thread/SDL_thread_c.h"
21
-#include "tray/SDL_tray_utils.h"
22
-#include "video/SDL_pixels_c.h"
23
-#include "video/SDL_surface_c.h"
24
-#include "video/SDL_video_c.h"
25
-#include "filesystem/SDL_filesystem_c.h"
26
-#include "io/SDL_asyncio_c.h"
27
#ifdef SDL_PLATFORM_ANDROID
28
#include "core/android/SDL_android.h"
29
#endif
30
@@ -278,7 +269,7 @@ void SDL_InitMainThread(void)
31
SDL_InitTLSData();
32
SDL_InitEnvironment();
33
SDL_InitTicks();
34
- SDL_InitFilesystem();
35
+ //SDL_InitFilesystem();
36
37
if (!done_info) {
38
const char *value;
39
@@ -297,7 +288,7 @@ void SDL_InitMainThread(void)
40
41
static void SDL_QuitMainThread(void)
42
{
43
- SDL_QuitFilesystem();
44
+ //SDL_QuitFilesystem();
45
SDL_QuitTicks();
46
SDL_QuitEnvironment();
47
SDL_QuitTLSData();
48
@@ -657,21 +648,21 @@ void SDL_Quit(void)
49
SDL_HelperWindowDestroy();
50
#endif
51
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
52
- SDL_CleanupTrays();
53
+ //SDL_CleanupTrays();
54
55
#ifdef SDL_USE_LIBDBUS
56
SDL_DBus_Quit();
57
#endif
58
59
SDL_QuitTimers();
60
- SDL_QuitAsyncIO();
61
+ //SDL_QuitAsyncIO();
62
63
SDL_SetObjectsInvalid();
64
SDL_AssertionsQuit();
65
66
- SDL_QuitPixelFormatDetails();
67
+ //SDL_QuitPixelFormatDetails();
68
69
- SDL_QuitCPUInfo();
70
+ //SDL_QuitCPUInfo();
71
72
/* Now that every subsystem has been quit, we reset the subsystem refcount
73
* and the list of initialized subsystems.
74
diff --git a/thirdparty/sdl/SDL_assert.c b/thirdparty/sdl/SDL_assert.c
75
index 2440d04b1e..af904039a4 100644
76
--- a/thirdparty/sdl/SDL_assert.c
77
+++ b/thirdparty/sdl/SDL_assert.c
78
@@ -25,7 +25,7 @@
79
#endif
80
81
#include "SDL_assert_c.h"
82
-#include "video/SDL_sysvideo.h"
83
+//#include "video/SDL_sysvideo.h"
84
85
#if defined(SDL_PLATFORM_WINDOWS)
86
#ifndef WS_OVERLAPPEDWINDOW
87
@@ -209,18 +209,6 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
88
}
89
}
90
91
- // Leave fullscreen mode, if possible (scary!)
92
- window = SDL_GetToplevelForKeyboardFocus();
93
- if (window) {
94
- if (window->fullscreen_exclusive) {
95
- SDL_MinimizeWindow(window);
96
- } else {
97
- // !!! FIXME: ungrab the input if we're not fullscreen?
98
- // No need to mess with the window
99
- window = NULL;
100
- }
101
- }
102
-
103
// Show a messagebox if we can, otherwise fall back to stdio
104
SDL_zero(messagebox);
105
messagebox.flags = SDL_MESSAGEBOX_WARNING;
106
@@ -230,7 +218,8 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
107
messagebox.numbuttons = SDL_arraysize(buttons);
108
messagebox.buttons = buttons;
109
110
- if (SDL_ShowMessageBox(&messagebox, &selected)) {
111
+ //if (SDL_ShowMessageBox(&messagebox, &selected)) {
112
+ if (false) {
113
if (selected == -1) {
114
state = SDL_ASSERTION_IGNORE;
115
} else {
116
@@ -311,13 +300,13 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
117
}
118
}
119
#else
120
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Assertion Failed", message, window);
121
+ //SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Assertion Failed", message, window);
122
#endif // HAVE_STDIO_H
123
}
124
125
// Re-enter fullscreen mode
126
if (window) {
127
- SDL_RestoreWindow(window);
128
+ //SDL_RestoreWindow(window);
129
}
130
131
if (message != stack_buf) {
132
diff --git a/thirdparty/sdl/SDL_internal.h b/thirdparty/sdl/SDL_internal.h
133
index 8fcd96a7fa..20ec0fcb91 100644
134
--- a/thirdparty/sdl/SDL_internal.h
135
+++ b/thirdparty/sdl/SDL_internal.h
136
@@ -62,7 +62,7 @@
137
138
#include "SDL_build_config.h"
139
140
-#include "dynapi/SDL_dynapi.h"
141
+//#include "dynapi/SDL_dynapi.h"
142
143
#if SDL_DYNAMIC_API
144
#include "dynapi/SDL_dynapi_overrides.h"
145
diff --git a/thirdparty/sdl/SDL_properties.c b/thirdparty/sdl/SDL_properties.c
146
index 166ea0f918..42d4845458 100644
147
--- a/thirdparty/sdl/SDL_properties.c
148
+++ b/thirdparty/sdl/SDL_properties.c
149
@@ -409,7 +409,7 @@ static void SDLCALL CleanupSurface(void *userdata, void *value)
150
{
151
SDL_Surface *surface = (SDL_Surface *)value;
152
153
- SDL_DestroySurface(surface);
154
+ //SDL_DestroySurface(surface);
155
}
156
157
bool SDL_SetSurfaceProperty(SDL_PropertiesID props, const char *name, SDL_Surface *surface)
158
diff --git a/thirdparty/sdl/core/linux/SDL_evdev.c b/thirdparty/sdl/core/linux/SDL_evdev.c
159
index 5746e2ef98..04e3e9d6b6 100644
160
--- a/thirdparty/sdl/core/linux/SDL_evdev.c
161
+++ b/thirdparty/sdl/core/linux/SDL_evdev.c
162
@@ -39,7 +39,6 @@
163
#include <linux/input.h>
164
165
#include "../../events/SDL_events_c.h"
166
-#include "../../events/SDL_scancode_tables_c.h"
167
#include "../../core/linux/SDL_evdev_capabilities.h"
168
#include "../../core/linux/SDL_udev.h"
169
170
@@ -221,7 +220,7 @@ bool SDL_EVDEV_Init(void)
171
SDL_EVDEV_UpdateKeyboardMute();
172
}
173
174
- SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode;
175
+ //SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode;
176
177
_this->ref_count += 1;
178
179
@@ -328,7 +327,7 @@ void SDL_EVDEV_Poll(void)
180
181
SDL_EVDEV_kbd_update(_this->kbd);
182
183
- mouse = SDL_GetMouse();
184
+ mouse = NULL; //SDL_GetMouse();
185
186
for (item = _this->first; item; item = item->next) {
187
while ((len = read(item->fd, events, sizeof(events))) > 0) {
188
@@ -345,10 +344,11 @@ void SDL_EVDEV_Poll(void)
189
190
switch (event->type) {
191
case EV_KEY:
192
+ break;
193
if (event->code >= BTN_MOUSE && event->code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) {
194
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
195
mouse_button = event->code - BTN_MOUSE;
196
- SDL_SendMouseButton(timestamp, mouse->focus, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0));
197
+ //SDL_SendMouseButton(timestamp, mouse->focus, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0));
198
break;
199
}
200
201
@@ -371,11 +371,11 @@ void SDL_EVDEV_Poll(void)
202
{
203
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
204
scancode = SDL_EVDEV_translate_keycode(event->code);
205
- if (event->value == 0) {
206
- SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, false);
207
- } else if (event->value == 1 || event->value == 2 /* key repeated */) {
208
- SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, true);
209
- }
210
+ // if (event->value == 0) {
211
+ // SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, false);
212
+ // } else if (event->value == 1 || event->value == 2 /* key repeated */) {
213
+ // SDL_SendKeyboardKey(timestamp, (SDL_KeyboardID)item->fd, event->code, scancode, true);
214
+ // }
215
SDL_EVDEV_kbd_keycode(_this->kbd, event->code, event->value);
216
}
217
break;
218
@@ -490,36 +490,30 @@ void SDL_EVDEV_Poll(void)
219
if (item->relative_mouse) {
220
if (item->mouse_x != 0 || item->mouse_y != 0) {
221
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
222
- SDL_SendMouseMotion(timestamp, mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, (float)item->mouse_x, (float)item->mouse_y);
223
+ //SDL_SendMouseMotion(timestamp, mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, (float)item->mouse_x, (float)item->mouse_y);
224
item->mouse_x = item->mouse_y = 0;
225
}
226
} else if (item->range_x > 0 && item->range_y > 0) {
227
int screen_w = 0, screen_h = 0;
228
const SDL_DisplayMode *mode = NULL;
229
230
- if (mouse->focus) {
231
- mode = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(mouse->focus));
232
- }
233
- if (!mode) {
234
- mode = SDL_GetCurrentDisplayMode(SDL_GetPrimaryDisplay());
235
- }
236
if (mode) {
237
screen_w = mode->w;
238
screen_h = mode->h;
239
}
240
- SDL_SendMouseMotion(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse,
241
- (float)(item->mouse_x - item->min_x) * screen_w / item->range_x,
242
- (float)(item->mouse_y - item->min_y) * screen_h / item->range_y);
243
+ //SDL_SendMouseMotion(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse,
244
+ // (float)(item->mouse_x - item->min_x) * screen_w / item->range_x,
245
+ // (float)(item->mouse_y - item->min_y) * screen_h / item->range_y);
246
}
247
248
if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) {
249
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
250
const float denom = (item->high_res_hwheel ? 120.0f : 1.0f);
251
- SDL_SendMouseWheel(timestamp,
252
- mouse->focus, (SDL_MouseID)item->fd,
253
- item->mouse_hwheel / denom,
254
- item->mouse_wheel / denom,
255
- SDL_MOUSEWHEEL_NORMAL);
256
+ //SDL_SendMouseWheel(timestamp,
257
+ // mouse->focus, (SDL_MouseID)item->fd,
258
+ // item->mouse_hwheel / denom,
259
+ // item->mouse_wheel / denom,
260
+ // SDL_MOUSEWHEEL_NORMAL);
261
item->mouse_wheel = item->mouse_hwheel = 0;
262
}
263
264
@@ -546,16 +540,16 @@ void SDL_EVDEV_Poll(void)
265
* be window-relative in that case. */
266
switch (item->touchscreen_data->slots[j].delta) {
267
case EVDEV_TOUCH_SLOTDELTA_DOWN:
268
- SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_DOWN, norm_x, norm_y, norm_pressure);
269
+ //SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_DOWN, norm_x, norm_y, norm_pressure);
270
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
271
break;
272
case EVDEV_TOUCH_SLOTDELTA_UP:
273
- SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_UP, norm_x, norm_y, norm_pressure);
274
+ //SDL_SendTouch(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_EVENT_FINGER_UP, norm_x, norm_y, norm_pressure);
275
item->touchscreen_data->slots[j].tracking_id = 0;
276
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
277
break;
278
case EVDEV_TOUCH_SLOTDELTA_MOVE:
279
- SDL_SendTouchMotion(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure);
280
+ //SDL_SendTouchMotion(SDL_EVDEV_GetEventTimestamp(event), item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure);
281
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
282
break;
283
default:
284
@@ -585,7 +579,7 @@ void SDL_EVDEV_Poll(void)
285
286
static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode)
287
{
288
- SDL_Scancode scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, keycode);
289
+ //SDL_Scancode scancode = SDL_GetScancodeFromTable(SDL_SCANCODE_TABLE_LINUX, keycode);
290
291
#ifdef DEBUG_SCANCODES
292
if (scancode == SDL_SCANCODE_UNKNOWN) {
293
@@ -602,7 +596,7 @@ static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode)
294
}
295
#endif // DEBUG_SCANCODES
296
297
- return scancode;
298
+ return 0; //scancode;
299
}
300
301
static bool SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class)
302
@@ -612,14 +606,14 @@ static bool SDL_EVDEV_init_keyboard(SDL_evdevlist_item *item, int udev_class)
303
name[0] = '\0';
304
ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
305
306
- SDL_AddKeyboard((SDL_KeyboardID)item->fd, name, true);
307
+ //SDL_AddKeyboard((SDL_KeyboardID)item->fd, name, true);
308
309
return true;
310
}
311
312
static void SDL_EVDEV_destroy_keyboard(SDL_evdevlist_item *item)
313
{
314
- SDL_RemoveKeyboard((SDL_KeyboardID)item->fd, true);
315
+ //SDL_RemoveKeyboard((SDL_KeyboardID)item->fd, true);
316
}
317
318
static bool SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
319
@@ -631,7 +625,7 @@ static bool SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
320
name[0] = '\0';
321
ioctl(item->fd, EVIOCGNAME(sizeof(name)), name);
322
323
- SDL_AddMouse((SDL_MouseID)item->fd, name, true);
324
+ //SDL_AddMouse((SDL_MouseID)item->fd, name, true);
325
326
ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info);
327
if (ret < 0) {
328
@@ -656,7 +650,7 @@ static bool SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class)
329
330
static void SDL_EVDEV_destroy_mouse(SDL_evdevlist_item *item)
331
{
332
- SDL_RemoveMouse((SDL_MouseID)item->fd, true);
333
+ //SDL_RemoveMouse((SDL_MouseID)item->fd, true);
334
}
335
336
static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
337
@@ -743,9 +737,10 @@ static bool SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class)
338
return false;
339
}
340
341
- ret = SDL_AddTouch(item->fd, // I guess our fd is unique enough
342
- (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) ? SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE : SDL_TOUCH_DEVICE_DIRECT,
343
- item->touchscreen_data->name);
344
+ //ret = SDL_AddTouch(item->fd, // I guess our fd is unique enough
345
+ // (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) ? SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE : SDL_TOUCH_DEVICE_DIRECT,
346
+ // item->touchscreen_data->name);
347
+ ret = -1;
348
if (ret < 0) {
349
SDL_free(item->touchscreen_data->slots);
350
SDL_free(item->touchscreen_data->name);
351
@@ -762,7 +757,7 @@ static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item *item)
352
return;
353
}
354
355
- SDL_DelTouch(item->fd);
356
+ //SDL_DelTouch(item->fd);
357
SDL_free(item->touchscreen_data->slots);
358
SDL_free(item->touchscreen_data->name);
359
SDL_free(item->touchscreen_data);
360
diff --git a/thirdparty/sdl/core/linux/SDL_fcitx.c b/thirdparty/sdl/core/linux/SDL_fcitx.c
361
index d7a9ed6656..c6bce5f796 100644
362
--- a/thirdparty/sdl/core/linux/SDL_fcitx.c
363
+++ b/thirdparty/sdl/core/linux/SDL_fcitx.c
364
@@ -23,8 +23,7 @@
365
#include <unistd.h>
366
367
#include "SDL_fcitx.h"
368
-#include "../../video/SDL_sysvideo.h"
369
-#include "../../events/SDL_keyboard_c.h"
370
+//#include "../../video/SDL_sysvideo.h"
371
#include "SDL_dbus.h"
372
373
#ifdef SDL_VIDEO_DRIVER_X11
374
@@ -192,7 +191,7 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
375
dbus->message_iter_init(msg, &iter);
376
dbus->message_iter_get_basic(&iter, &text);
377
378
- SDL_SendKeyboardText(text);
379
+ //SDL_SendKeyboardText(text);
380
381
return DBUS_HANDLER_RESULT_HANDLED;
382
}
383
@@ -206,13 +205,13 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
384
Sint32 byte_pos = Fcitx_GetPreeditCursorByte(dbus, msg);
385
start_pos = byte_pos >= 0 ? SDL_utf8strnlen(text, byte_pos) : -1;
386
}
387
- SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1);
388
+ //SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1);
389
SDL_free(text);
390
} else {
391
- SDL_SendEditingText("", 0, 0);
392
+ //SDL_SendEditingText("", 0, 0);
393
}
394
395
- SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus());
396
+ //SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus());
397
return DBUS_HANDLER_RESULT_HANDLED;
398
}
399
400
@@ -394,7 +393,7 @@ bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down)
401
DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mod_state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID,
402
DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) {
403
if (handled) {
404
- SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus());
405
+ //SDL_Fcitx_UpdateTextInputArea(SDL_GetKeyboardFocus());
406
return true;
407
}
408
}
409
@@ -402,51 +401,6 @@ bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down)
410
return false;
411
}
412
413
-void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window)
414
-{
415
- int x = 0, y = 0;
416
- SDL_Rect *cursor = &fcitx_client.cursor_rect;
417
-
418
- if (!window) {
419
- return;
420
- }
421
-
422
- // We'll use a square at the text input cursor location for the cursor_rect
423
- cursor->x = window->text_input_rect.x + window->text_input_cursor;
424
- cursor->y = window->text_input_rect.y;
425
- cursor->w = window->text_input_rect.h;
426
- cursor->h = window->text_input_rect.h;
427
-
428
- SDL_GetWindowPosition(window, &x, &y);
429
-
430
-#ifdef SDL_VIDEO_DRIVER_X11
431
- {
432
- SDL_PropertiesID props = SDL_GetWindowProperties(window);
433
- Display *x_disp = (Display *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL);
434
- int x_screen = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_SCREEN_NUMBER, 0);
435
- Window x_win = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
436
- Window unused;
437
- if (x_disp && x_win) {
438
- X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
439
- }
440
- }
441
-#endif
442
-
443
- if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
444
- // move to bottom left
445
- int w = 0, h = 0;
446
- SDL_GetWindowSize(window, &w, &h);
447
- cursor->x = 0;
448
- cursor->y = h;
449
- }
450
-
451
- x += cursor->x;
452
- y += cursor->y;
453
-
454
- SDL_DBus_CallVoidMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "SetCursorRect",
455
- DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID);
456
-}
457
-
458
void SDL_Fcitx_PumpEvents(void)
459
{
460
SDL_DBusContext *dbus = fcitx_client.dbus;
461
diff --git a/thirdparty/sdl/core/linux/SDL_ibus.c b/thirdparty/sdl/core/linux/SDL_ibus.c
462
index ea58ed5778..3d4bb83694 100644
463
--- a/thirdparty/sdl/core/linux/SDL_ibus.c
464
+++ b/thirdparty/sdl/core/linux/SDL_ibus.c
465
@@ -26,7 +26,7 @@
466
467
#ifdef SDL_USE_LIBDBUS
468
469
-#include "../../video/SDL_sysvideo.h"
470
+//#include "../../video/SDL_sysvideo.h"
471
#include "../../events/SDL_keyboard_c.h"
472
473
#ifdef SDL_VIDEO_DRIVER_X11
474
@@ -261,7 +261,7 @@ static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *
475
}
476
}
477
478
- SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus());
479
+ //SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus());
480
481
return DBUS_HANDLER_RESULT_HANDLED;
482
}
483
@@ -484,13 +484,6 @@ static bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr)
484
dbus->connection_flush(ibus_conn);
485
}
486
487
- SDL_Window *window = SDL_GetKeyboardFocus();
488
- if (SDL_TextInputActive(window)) {
489
- SDL_IBus_SetFocus(true);
490
- SDL_IBus_UpdateTextInputArea(window);
491
- } else {
492
- SDL_IBus_SetFocus(false);
493
- }
494
return result;
495
}
496
497
@@ -678,53 +671,11 @@ bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down)
498
}
499
}
500
501
- SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus());
502
+ //SDL_IBus_UpdateTextInputArea(SDL_GetKeyboardFocus());
503
504
return (result != 0);
505
}
506
507
-void SDL_IBus_UpdateTextInputArea(SDL_Window *window)
508
-{
509
- int x = 0, y = 0;
510
- SDL_DBusContext *dbus;
511
-
512
- if (!window) {
513
- return;
514
- }
515
-
516
- // We'll use a square at the text input cursor location for the ibus_cursor
517
- ibus_cursor_rect.x = window->text_input_rect.x + window->text_input_cursor;
518
- ibus_cursor_rect.y = window->text_input_rect.y;
519
- ibus_cursor_rect.w = window->text_input_rect.h;
520
- ibus_cursor_rect.h = window->text_input_rect.h;
521
-
522
- SDL_GetWindowPosition(window, &x, &y);
523
-
524
-#ifdef SDL_VIDEO_DRIVER_X11
525
- {
526
- SDL_PropertiesID props = SDL_GetWindowProperties(window);
527
- Display *x_disp = (Display *)SDL_GetPointerProperty(props, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL);
528
- int x_screen = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_SCREEN_NUMBER, 0);
529
- Window x_win = SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
530
- Window unused;
531
-
532
- if (x_disp && x_win) {
533
- X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
534
- }
535
- }
536
-#endif
537
-
538
- x += ibus_cursor_rect.x;
539
- y += ibus_cursor_rect.y;
540
-
541
- dbus = SDL_DBus_GetContext();
542
-
543
- if (IBus_CheckConnection(dbus)) {
544
- SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "SetCursorLocation",
545
- DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID);
546
- }
547
-}
548
-
549
void SDL_IBus_PumpEvents(void)
550
{
551
SDL_DBusContext *dbus = SDL_DBus_GetContext();
552
diff --git a/thirdparty/sdl/core/linux/SDL_system_theme.c b/thirdparty/sdl/core/linux/SDL_system_theme.c
553
index 6d6087db5a..f5ef92dd05 100644
554
--- a/thirdparty/sdl/core/linux/SDL_system_theme.c
555
+++ b/thirdparty/sdl/core/linux/SDL_system_theme.c
556
@@ -22,7 +22,7 @@
557
558
#include "SDL_dbus.h"
559
#include "SDL_system_theme.h"
560
-#include "../../video/SDL_sysvideo.h"
561
+//#include "../../video/SDL_sysvideo.h"
562
563
#include <unistd.h>
564
565
@@ -99,7 +99,7 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
566
if (!DBus_ExtractThemeVariant(&signal_iter, &system_theme_data.theme))
567
goto not_our_signal;
568
569
- SDL_SetSystemTheme(system_theme_data.theme);
570
+ //SDL_SetSystemTheme(system_theme_data.theme);
571
return DBUS_HANDLER_RESULT_HANDLED;
572
}
573
not_our_signal:
574
diff --git a/thirdparty/sdl/events/SDL_events.c b/thirdparty/sdl/events/SDL_events.c
575
index a151740524..24c2c4270f 100644
576
--- a/thirdparty/sdl/events/SDL_events.c
577
+++ b/thirdparty/sdl/events/SDL_events.c
578
@@ -24,10 +24,7 @@
579
580
#include "SDL_events_c.h"
581
#include "SDL_eventwatch_c.h"
582
-#include "SDL_windowevents_c.h"
583
#include "../SDL_hints_c.h"
584
-#include "../audio/SDL_audio_c.h"
585
-#include "../camera/SDL_camera_c.h"
586
#include "../timer/SDL_timer_c.h"
587
#ifndef SDL_JOYSTICK_DISABLED
588
#include "../joystick/SDL_joystick_c.h"
589
@@ -35,7 +32,7 @@
590
#ifndef SDL_SENSOR_DISABLED
591
#include "../sensor/SDL_sensor_c.h"
592
#endif
593
-#include "../video/SDL_sysvideo.h"
594
+//#include "../video/SDL_sysvideo.h"
595
596
#ifdef SDL_PLATFORM_ANDROID
597
#include "../core/android/SDL_android.h"
598
@@ -930,7 +927,7 @@ void SDL_StopEventLoop(void)
599
}
600
601
SDL_QuitEventWatchList(&SDL_event_watchers);
602
- SDL_QuitWindowEventWatch();
603
+ //SDL_QuitWindowEventWatch();
604
605
SDL_Mutex *lock = NULL;
606
if (SDL_EventQ.lock) {
607
@@ -970,7 +967,7 @@ bool SDL_StartEventLoop(void)
608
}
609
#endif // !SDL_THREADS_DISABLED
610
611
- SDL_InitWindowEventWatch();
612
+ //SDL_InitWindowEventWatch();
613
614
SDL_EventQ.active = true;
615
616
@@ -1071,17 +1068,6 @@ static void SDL_SendWakeupEvent(void)
617
{
618
#ifdef SDL_PLATFORM_ANDROID
619
Android_SendLifecycleEvent(SDL_ANDROID_LIFECYCLE_WAKE);
620
-#else
621
- SDL_VideoDevice *_this = SDL_GetVideoDevice();
622
- if (_this == NULL || !_this->SendWakeupEvent) {
623
- return;
624
- }
625
-
626
- // We only want to do this once while waiting for an event, so set it to NULL atomically here
627
- SDL_Window *wakeup_window = (SDL_Window *)SDL_SetAtomicPointer(&_this->wakeup_window, NULL);
628
- if (wakeup_window) {
629
- _this->SendWakeupEvent(_this, wakeup_window);
630
- }
631
#endif
632
}
633
634
@@ -1420,9 +1406,9 @@ void SDL_PumpEventMaintenance(void)
635
}
636
#endif
637
638
- SDL_UpdateTrays();
639
+ //SDL_UpdateTrays();
640
641
- SDL_SendPendingSignalEvents(); // in case we had a signal handler fire, etc.
642
+ //SDL_SendPendingSignalEvents(); // in case we had a signal handler fire, etc.
643
}
644
645
// Run the system dependent event loops
646
@@ -1432,7 +1418,7 @@ static void SDL_PumpEventsInternal(bool push_sentinel)
647
SDL_FreeTemporaryMemory();
648
649
// Release any keys held down from last frame
650
- SDL_ReleaseAutoReleaseKeys();
651
+ //SDL_ReleaseAutoReleaseKeys();
652
653
// Run any pending main thread callbacks
654
SDL_RunMainThreadCallbacks();
655
@@ -1440,12 +1426,6 @@ static void SDL_PumpEventsInternal(bool push_sentinel)
656
#ifdef SDL_PLATFORM_ANDROID
657
// Android event processing is independent of the video subsystem
658
Android_PumpEvents(0);
659
-#else
660
- // Get events from the video subsystem
661
- SDL_VideoDevice *_this = SDL_GetVideoDevice();
662
- if (_this) {
663
- _this->PumpEvents(_this);
664
- }
665
#endif
666
667
SDL_PumpEventMaintenance();
668
@@ -1476,103 +1456,6 @@ bool SDL_PollEvent(SDL_Event *event)
669
return SDL_WaitEventTimeoutNS(event, 0);
670
}
671
672
-#ifndef SDL_PLATFORM_ANDROID
673
-
674
-static Sint64 SDL_events_get_polling_interval(void)
675
-{
676
- Sint64 poll_intervalNS = SDL_MAX_SINT64;
677
-
678
-#ifndef SDL_JOYSTICK_DISABLED
679
- if (SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks) {
680
- if (SDL_JoysticksOpened()) {
681
- // If we have joysticks open, we need to poll rapidly for events
682
- poll_intervalNS = SDL_min(poll_intervalNS, EVENT_POLL_INTERVAL_NS);
683
- } else {
684
- // If not, just poll every few seconds to enumerate new joysticks
685
- poll_intervalNS = SDL_min(poll_intervalNS, ENUMERATION_POLL_INTERVAL_NS);
686
- }
687
- }
688
-#endif
689
-
690
-#ifndef SDL_SENSOR_DISABLED
691
- if (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && SDL_SensorsOpened()) {
692
- // If we have sensors open, we need to poll rapidly for events
693
- poll_intervalNS = SDL_min(poll_intervalNS, EVENT_POLL_INTERVAL_NS);
694
- }
695
-#endif
696
-
697
- return poll_intervalNS;
698
-}
699
-
700
-static int SDL_WaitEventTimeout_Device(SDL_VideoDevice *_this, SDL_Window *wakeup_window, SDL_Event *event, Uint64 start, Sint64 timeoutNS)
701
-{
702
- Sint64 loop_timeoutNS = timeoutNS;
703
- Sint64 poll_intervalNS = SDL_events_get_polling_interval();
704
-
705
- for (;;) {
706
- int status;
707
- /* Pump events on entry and each time we wake to ensure:
708
- a) All pending events are batch processed after waking up from a wait
709
- b) Waiting can be completely skipped if events are already available to be pumped
710
- c) Periodic processing that takes place in some platform PumpEvents() functions happens
711
- d) Signals received in WaitEventTimeout() are turned into SDL events
712
- */
713
- SDL_PumpEventsInternal(true);
714
-
715
- status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_EVENT_FIRST, SDL_EVENT_LAST);
716
- if (status < 0) {
717
- // Got an error: return
718
- break;
719
- }
720
- if (status > 0) {
721
- // There is an event, we can return.
722
- return 1;
723
- }
724
- // No events found in the queue, call WaitEventTimeout to wait for an event.
725
- if (timeoutNS > 0) {
726
- Sint64 elapsed = SDL_GetTicksNS() - start;
727
- if (elapsed >= timeoutNS) {
728
- return 0;
729
- }
730
- loop_timeoutNS = (timeoutNS - elapsed);
731
- }
732
- // Adjust the timeout for any polling requirements we currently have.
733
- if (poll_intervalNS != SDL_MAX_SINT64) {
734
- if (loop_timeoutNS >= 0) {
735
- loop_timeoutNS = SDL_min(loop_timeoutNS, poll_intervalNS);
736
- } else {
737
- loop_timeoutNS = poll_intervalNS;
738
- }
739
- }
740
- SDL_SetAtomicPointer(&_this->wakeup_window, wakeup_window);
741
- status = _this->WaitEventTimeout(_this, loop_timeoutNS);
742
- SDL_SetAtomicPointer(&_this->wakeup_window, NULL);
743
- if (status == 0 && poll_intervalNS != SDL_MAX_SINT64 && loop_timeoutNS == poll_intervalNS) {
744
- // We may have woken up to poll. Try again
745
- continue;
746
- } else if (status <= 0) {
747
- // There is either an error or the timeout is elapsed: return
748
- return status;
749
- }
750
- /* An event was found and pumped into the SDL events queue. Continue the loop
751
- to let SDL_PeepEvents pick it up .*/
752
- }
753
- return 0;
754
-}
755
-
756
-static SDL_Window *SDL_find_active_window(SDL_VideoDevice *_this)
757
-{
758
- SDL_Window *window;
759
- for (window = _this->windows; window; window = window->next) {
760
- if (!window->is_destroying) {
761
- return window;
762
- }
763
- }
764
- return NULL;
765
-}
766
-
767
-#endif // !SDL_PLATFORM_ANDROID
768
-
769
bool SDL_WaitEvent(SDL_Event *event)
770
{
771
return SDL_WaitEventTimeoutNS(event, -1);
772
@@ -1662,24 +1545,6 @@ bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS)
773
Android_PumpEvents(delay);
774
}
775
#else
776
- SDL_VideoDevice *_this = SDL_GetVideoDevice();
777
- if (_this && _this->WaitEventTimeout && _this->SendWakeupEvent) {
778
- // Look if a shown window is available to send the wakeup event.
779
- SDL_Window *wakeup_window = SDL_find_active_window(_this);
780
- if (wakeup_window) {
781
- result = SDL_WaitEventTimeout_Device(_this, wakeup_window, event, start, timeoutNS);
782
- if (result > 0) {
783
- return true;
784
- } else if (result == 0) {
785
- return false;
786
- } else {
787
- /* There may be implementation-defined conditions where the backend cannot
788
- * reliably wait for the next event. If that happens, fall back to polling.
789
- */
790
- }
791
- }
792
- }
793
-
794
for (;;) {
795
SDL_PumpEventsInternal(true);
796
797
@@ -1852,7 +1717,7 @@ void SDL_SetEventEnabled(Uint32 type, bool enabled)
798
/* turn off drag'n'drop support if we've disabled the events.
799
This might change some UI details at the OS level. */
800
if (type == SDL_EVENT_DROP_FILE || type == SDL_EVENT_DROP_TEXT) {
801
- SDL_ToggleDragAndDropSupport();
802
+ //SDL_ToggleDragAndDropSupport();
803
}
804
}
805
}
806
@@ -1944,14 +1809,14 @@ bool SDL_InitEvents(void)
807
return false;
808
}
809
810
- SDL_InitQuit();
811
+ //SDL_InitQuit();
812
813
return true;
814
}
815
816
void SDL_QuitEvents(void)
817
{
818
- SDL_QuitQuit();
819
+ //SDL_QuitQuit();
820
SDL_StopEventLoop();
821
SDL_QuitMainThreadCallbacks();
822
SDL_RemoveHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, NULL);
823
diff --git a/thirdparty/sdl/events/SDL_events_c.h b/thirdparty/sdl/events/SDL_events_c.h
824
index e56ac475e5..f3a0744d1c 100644
825
--- a/thirdparty/sdl/events/SDL_events_c.h
826
+++ b/thirdparty/sdl/events/SDL_events_c.h
827
@@ -25,16 +25,9 @@
828
#include "SDL_internal.h"
829
830
// Useful functions and variables from SDL_events.c
831
-#include "../video/SDL_sysvideo.h"
832
+//#include "../video/SDL_sysvideo.h"
833
834
-#include "SDL_clipboardevents_c.h"
835
-#include "SDL_displayevents_c.h"
836
-#include "SDL_dropevents_c.h"
837
-#include "SDL_keyboard_c.h"
838
#include "SDL_mouse_c.h"
839
-#include "SDL_touch_c.h"
840
-#include "SDL_pen_c.h"
841
-#include "SDL_windowevents_c.h"
842
843
// Start and stop the event processing loop
844
extern bool SDL_StartEventLoop(void);
845
diff --git a/thirdparty/sdl/include/SDL3/SDL.h b/thirdparty/sdl/include/SDL3/SDL.h
846
index ed1b32483a..f0671c95c3 100644
847
--- a/thirdparty/sdl/include/SDL3/SDL.h
848
+++ b/thirdparty/sdl/include/SDL3/SDL.h
849
@@ -47,7 +47,7 @@
850
#include <SDL3/SDL_events.h>
851
#include <SDL3/SDL_filesystem.h>
852
#include <SDL3/SDL_gamepad.h>
853
-#include <SDL3/SDL_gpu.h>
854
+//#include <SDL3/SDL_gpu.h>
855
#include <SDL3/SDL_guid.h>
856
#include <SDL3/SDL_haptic.h>
857
#include <SDL3/SDL_hidapi.h>
858
@@ -85,6 +85,6 @@
859
#include <SDL3/SDL_touch.h>
860
#include <SDL3/SDL_version.h>
861
#include <SDL3/SDL_video.h>
862
-#include <SDL3/SDL_oldnames.h>
863
+//#include <SDL3/SDL_oldnames.h>
864
865
#endif /* SDL_h_ */
866
diff --git a/thirdparty/sdl/joystick/SDL_joystick.c b/thirdparty/sdl/joystick/SDL_joystick.c
867
index 921576854e..f36ca95baa 100644
868
--- a/thirdparty/sdl/joystick/SDL_joystick.c
869
+++ b/thirdparty/sdl/joystick/SDL_joystick.c
870
@@ -29,7 +29,7 @@
871
#include "SDL_steam_virtual_gamepad.h"
872
873
#include "../events/SDL_events_c.h"
874
-#include "../video/SDL_sysvideo.h"
875
+//#include "../video/SDL_sysvideo.h"
876
#include "../sensor/SDL_sensor_c.h"
877
#include "hidapi/SDL_hidapijoystick_c.h"
878
879
@@ -1011,7 +1011,8 @@ static void AttemptSensorFusion(SDL_Joystick *joystick, bool invert_sensors)
880
When a phone is being used as a gamepad, its orientation changes,
881
so adjust sensor axes to match.
882
*/
883
- if (SDL_GetNaturalDisplayOrientation(SDL_GetPrimaryDisplay()) == SDL_ORIENTATION_LANDSCAPE) {
884
+ //if (SDL_GetNaturalDisplayOrientation(SDL_GetPrimaryDisplay()) == SDL_ORIENTATION_LANDSCAPE) {
885
+ if (true) {
886
/* When a device in landscape orientation is laid flat, the axes change
887
orientation as follows:
888
-X to +X becomes -X to +X
889
@@ -2068,11 +2069,6 @@ static bool SDL_PrivateJoystickShouldIgnoreEvent(void)
890
if (SDL_joystick_allows_background_events) {
891
return false;
892
}
893
-
894
- if (SDL_HasWindows() && SDL_GetKeyboardFocus() == NULL) {
895
- // We have windows but we don't have focus, ignore the event.
896
- return true;
897
- }
898
return false;
899
}
900
901
diff --git a/thirdparty/sdl/joystick/windows/SDL_dinputjoystick.c b/thirdparty/sdl/joystick/windows/SDL_dinputjoystick.c
902
index b00218d969..377992ed9e 100644
903
--- a/thirdparty/sdl/joystick/windows/SDL_dinputjoystick.c
904
+++ b/thirdparty/sdl/joystick/windows/SDL_dinputjoystick.c
905
@@ -40,11 +40,8 @@
906
#define CONVERT_MAGNITUDE(x) (((x)*10000) / 0x7FFF)
907
908
// external variables referenced.
909
-#ifdef SDL_VIDEO_DRIVER_WINDOWS
910
extern HWND SDL_HelperWindow;
911
-#else
912
-static const HWND SDL_HelperWindow = NULL;
913
-#endif
914
+
915
916
// local variables
917
static bool coinitialized = false;
918
919