Hello!
I have been trying to implement the ability to drop files onto a SDL window and receive the event… I have found some information on the internet on how to enable DND X11 messages.
This is accomplished with the following code
Code:
bool InitWindowManager() {
D(debug("InitWindowManager()\n"));
SDL_SysWMinfo info;
printf("Init window manager!\n");
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info) == 1) {
if (info.subsystem == SDL_SYSWM_X11) {
D(debug("Found X11 system!\n"));
D(debug("Display = 0x%08x\n", info.info.x11.gfxdisplay));
D(debug("Windows = 0x%08x\n", info.info.x11.fswindow));
display = info.info.x11.gfxdisplay;
window = info.info.x11.wmwindow;
printf("display = %08x window = %08x\n", (unsigned int)display, (unsigned int)window);
}
// InitAtoms(display);
AnnounceDND(display, window);
// XFlush(display);
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
return true;
}
return false;
}
void AnnounceDND(Display* disp, Window w) {
//Announce XDND support
Atom XdndAware = XInternAtom(disp, "XdndAware", False);
Atom version=5;
XChangeProperty(disp, w, XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
}
void probePaneManager::Run() {
.
.
.
while (SDL_PollEvent(&event)) {
// check for messages
switch (event.type)
{
#ifdef _ENABLE_DND
case SDL_SYSWMEVENT:
printf("---- GOT EVENT %d----\n", event.syswm.msg->event.xevent.type);
break;
#endif
case SDL_USEREVENT:
HandleUserEvent(event);;
break;
case SDL_VIDEOEXPOSE:
HandleExposeEvent();
break;
.
.
.
}
As you can see I call SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE) in order to enable reception of Window Manager messages in my event handling loop. I also set the Atom XdndAware. When I use xprop on the resulting window I see that XdndAware is set…
I currently see messages with the type of 28 and 33 yet I can’t , for the life of me , figure out what these messages mean.
I would appreciate {to the point of begging} any help in implementing this. I am overall happy with SDL for my needs… We are using SDL, SDLNet, SDLgfx, and SDLttf for this project. If I could only get this feature to work I would be indebted to whomever leads me on the right path.
Thank you for your time!