From c980ce2120199ef2fc06a10c30bd26d04dd4a460 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Jul 2023 12:03:35 -0700 Subject: [PATCH] Removed SDL_EVENT_CLIPBOARD_CANCELLED in favor of the cleanup callback --- include/SDL3/SDL_events.h | 9 ++------- src/events/SDL_clipboardevents.c | 17 ----------------- src/events/SDL_clipboardevents_c.h | 1 - src/events/SDL_events.c | 2 -- src/test/SDL_test_common.c | 3 --- src/video/SDL_clipboard.c | 2 -- 6 files changed, 2 insertions(+), 32 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 55ce261da..19ec7e2ae 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -175,7 +175,6 @@ typedef enum /* Clipboard events */ SDL_EVENT_CLIPBOARD_UPDATE = 0x900, /**< The clipboard or primary selection changed */ - SDL_EVENT_CLIPBOARD_CANCELLED, /**< The clipboard or primary selection cancelled */ /* Drag and drop events */ SDL_EVENT_DROP_FILE = 0x1000, /**< The system requests a file open */ @@ -535,16 +534,12 @@ typedef struct SDL_DropEvent } SDL_DropEvent; /** - * \brief An event triggered when the applications active clipboard content is cancelled by new clipboard content - * \note Primary use for this event is to free any userdata you may have provided when setting the clipboard data. - * - * \sa SDL_SetClipboardData + * \brief An event triggered when the clipboard contents have changed (event.clipboard.*) */ typedef struct SDL_ClipboardEvent { - Uint32 type; /**< ::SDL_EVENT_CLIPBOARD_UPDATE or ::SDL_EVENT_CLIPBOARD_CANCELLED */ + Uint32 type; /**< ::SDL_EVENT_CLIPBOARD_UPDATE */ Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ - void *userdata; /**< User data if any has been set. NULL for ::SDL_EVENT_CLIPBOARD_UPDATE */ } SDL_ClipboardEvent; /** diff --git a/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c index ae6519d16..bc9b07e6e 100644 --- a/src/events/SDL_clipboardevents.c +++ b/src/events/SDL_clipboardevents.c @@ -35,23 +35,6 @@ int SDL_SendClipboardUpdate(void) SDL_Event event; event.type = SDL_EVENT_CLIPBOARD_UPDATE; event.clipboard.timestamp = 0; - event.clipboard.userdata = NULL; - posted = (SDL_PushEvent(&event) > 0); - } - return posted; -} - -int SDL_SendClipboardCancelled(void *userdata) -{ - int posted; - - /* Post the event, if desired */ - posted = 0; - if (SDL_EventEnabled(SDL_EVENT_CLIPBOARD_CANCELLED)) { - SDL_Event event; - event.type = SDL_EVENT_CLIPBOARD_CANCELLED; - event.clipboard.timestamp = 0; - event.clipboard.userdata = userdata; posted = (SDL_PushEvent(&event) > 0); } return posted; diff --git a/src/events/SDL_clipboardevents_c.h b/src/events/SDL_clipboardevents_c.h index c07804213..ce74e3cbd 100644 --- a/src/events/SDL_clipboardevents_c.h +++ b/src/events/SDL_clipboardevents_c.h @@ -24,6 +24,5 @@ #define SDL_clipboardevents_c_h_ extern int SDL_SendClipboardUpdate(void); -extern int SDL_SendClipboardCancelled(void *userdata); #endif /* SDL_clipboardevents_c_h_ */ diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index b228738f4..865a9b063 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -210,8 +210,6 @@ static void SDL_LogEvent(const SDL_Event *event) break; SDL_EVENT_CASE(SDL_EVENT_CLIPBOARD_UPDATE) break; - SDL_EVENT_CASE(SDL_EVENT_CLIPBOARD_CANCELLED) - break; SDL_EVENT_CASE(SDL_EVENT_RENDER_TARGETS_RESET) break; SDL_EVENT_CASE(SDL_EVENT_RENDER_DEVICE_RESET) diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index ffb721009..31a29243a 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1757,9 +1757,6 @@ static void SDLTest_PrintEvent(SDL_Event *event) case SDL_EVENT_CLIPBOARD_UPDATE: SDL_Log("SDL EVENT: Clipboard updated"); break; - case SDL_EVENT_CLIPBOARD_CANCELLED: - SDL_Log("SDL EVENT: Clipboard ownership canceled"); - break; case SDL_EVENT_FINGER_MOTION: SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index 8858f4b45..b6cbcb3fb 100644 --- a/src/video/SDL_clipboard.c +++ b/src/video/SDL_clipboard.c @@ -35,8 +35,6 @@ void SDL_CancelClipboardData(Uint32 sequence) return; } - SDL_SendClipboardCancelled(_this->clipboard_userdata); - if (_this->clipboard_cleanup) { _this->clipboard_cleanup(_this->clipboard_userdata); }