diff --git a/src/x11_init.c b/src/x11_init.c index cd3f5bfd..430a5174 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -35,6 +35,7 @@ #include #include #include +#include // Translate an X11 key code to a GLFW key code. @@ -397,7 +398,6 @@ static void detectEWMH(void) (unsigned char**) &supportedAtoms); // See which of the atoms we support that are supported by the WM - _glfw.x11.NET_WM_STATE = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE"); _glfw.x11.NET_WM_STATE_FULLSCREEN = @@ -543,18 +543,15 @@ static GLboolean initExtensions(void) // Find or create drag and drop atoms //Atoms for Xdnd - _glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", False); - _glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", False); - _glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", False); - _glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", False); - _glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", False); - _glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", False); - _glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", False); - _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False); - _glfw.x11.xdnd.string = NULL; - _glfw.x11.xdnd.type1 = NULL; - _glfw.x11.xdnd.type2 = NULL; - _glfw.x11.xdnd.type3 = NULL; + _glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", True); + _glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", True); + _glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", True); + _glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", True); + _glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", True); + _glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", True); + _glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", True); + _glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", True); + _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", True); diff --git a/src/x11_platform.h b/src/x11_platform.h index 70a9d5d1..1e4f66c9 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -124,6 +124,7 @@ typedef struct _GLFWlibraryX11 Atom MOTIF_WM_HINTS; // Atoms for Xdnd + Atom XdndAware; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; diff --git a/src/x11_window.c b/src/x11_window.c index a26834fd..9258ccb7 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -287,11 +287,11 @@ static GLboolean createWindow(_GLFWwindow* window, } // Enable Xdnd + if(_glfw.x11.XdndAware!=None) { //Announce XDND support - Atom XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", False); - Atom version=5; - XChangeProperty(_glfw.x11.display, window->x11.handle, XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1); + unsigned long version=5; + XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1); } _glfwPlatformSetWindowTitle(window, wndconfig->title); @@ -711,7 +711,6 @@ static void processEvent(XEvent *event) { // Xdnd Drop: The drag&drop event has finished dropping on // the window, ask to convert the selection - _glfw.x11.xdnd.sourceWindow = event->xclient.data.l[0]; XConvertSelection(_glfw.x11.display, _glfw.x11.XdndSelection, @@ -761,7 +760,6 @@ static void processEvent(XEvent *event) } case SelectionNotify: { - if(event->xselection.property != None) { // Xdnd: got a selection notification from the conversion @@ -816,7 +814,11 @@ static void processEvent(XEvent *event) XFree(data); - if(result) _glfwInputDrop(window,_glfw.x11.xdnd.string); + if(result) + { + _glfwInputDrop(window,_glfw.x11.xdnd.string); + + } } break; }