What is SDL_DROPTEXT and what does it require to work?


#1

The name suggests it represents an event for dropping a highlighted selection of text into a window, but [on Windows] this doesn’t seem to be right. The event is new enough that not much about it shows on Google besides the description text/plain drag-and-drop event. So what does it represent?


#2

Contrary to what the documentation says, drop events are disabled by default. You just need to enable them.

SDL_EventState(SDL_DROPTEXT, SDL_ENABLE);

#3

Thanks for the response :slightly_smiling_face:

I’ve tried manually enabling it via SDL_EventState(SDL_DROPTEXT, SDL_ENABLE), and SDL_GetEventState(SDL_DROPTEXT) indeed returns SDL_ENABLE before and after. However, text drag-and-drop still seems completely disabled (i.e. dragging highlighted text over an SDL window shows the “no symbol” cursor, and the event is never raised on release).

To be clear, on this Windows 10 machine, this procedure (highlight text, drag to another window, release) works as expected in other apps (Microsoft Word, Chrome, etc.)

And also to be clear, SDL_DROPFILE (as well as BEGIN and COMPLETE) work as expected in the same SDL program.


#4

I took a quick look at SDL source and it seems that SDL_DROPTEXT event is only implemented for X11 on Linux.


#5

Sorry, I should’ve done the same, my fault :sweat_smile:

Thank you for your time :slight_smile: