fix Xdnd using Atom for passing version, was crashing on openbox

This commit is contained in:
arturo 2013-07-24 14:53:32 +02:00
parent ca54d3bdab
commit 4d3926baed
3 changed files with 19 additions and 19 deletions

View File

@ -35,6 +35,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
// 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);

View File

@ -124,6 +124,7 @@ typedef struct _GLFWlibraryX11
Atom MOTIF_WM_HINTS;
// Atoms for Xdnd
Atom XdndAware;
Atom XdndEnter;
Atom XdndPosition;
Atom XdndStatus;

View File

@ -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;
}