mirror of
https://github.com/glfw/glfw.git
synced 2025-06-15 20:22:15 +00:00
fix Xdnd using Atom for passing version, was crashing on openbox
This commit is contained in:
parent
ca54d3bdab
commit
4d3926baed
@ -35,6 +35,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
// Translate an X11 key code to a GLFW key code.
|
// Translate an X11 key code to a GLFW key code.
|
||||||
@ -397,7 +398,6 @@ static void detectEWMH(void)
|
|||||||
(unsigned char**) &supportedAtoms);
|
(unsigned char**) &supportedAtoms);
|
||||||
|
|
||||||
// See which of the atoms we support that are supported by the WM
|
// See which of the atoms we support that are supported by the WM
|
||||||
|
|
||||||
_glfw.x11.NET_WM_STATE =
|
_glfw.x11.NET_WM_STATE =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
||||||
@ -543,18 +543,15 @@ static GLboolean initExtensions(void)
|
|||||||
// Find or create drag and drop atoms
|
// Find or create drag and drop atoms
|
||||||
|
|
||||||
//Atoms for Xdnd
|
//Atoms for Xdnd
|
||||||
_glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", False);
|
_glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", True);
|
||||||
_glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", False);
|
_glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", True);
|
||||||
_glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", False);
|
_glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", True);
|
||||||
_glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", False);
|
_glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", True);
|
||||||
_glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", False);
|
_glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", True);
|
||||||
_glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", False);
|
_glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", True);
|
||||||
_glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", False);
|
_glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", True);
|
||||||
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False);
|
_glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", True);
|
||||||
_glfw.x11.xdnd.string = NULL;
|
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", True);
|
||||||
_glfw.x11.xdnd.type1 = NULL;
|
|
||||||
_glfw.x11.xdnd.type2 = NULL;
|
|
||||||
_glfw.x11.xdnd.type3 = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,6 +124,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom MOTIF_WM_HINTS;
|
Atom MOTIF_WM_HINTS;
|
||||||
|
|
||||||
// Atoms for Xdnd
|
// Atoms for Xdnd
|
||||||
|
Atom XdndAware;
|
||||||
Atom XdndEnter;
|
Atom XdndEnter;
|
||||||
Atom XdndPosition;
|
Atom XdndPosition;
|
||||||
Atom XdndStatus;
|
Atom XdndStatus;
|
||||||
|
@ -287,11 +287,11 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable Xdnd
|
// Enable Xdnd
|
||||||
|
if(_glfw.x11.XdndAware!=None)
|
||||||
{
|
{
|
||||||
//Announce XDND support
|
//Announce XDND support
|
||||||
Atom XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", False);
|
unsigned long version=5;
|
||||||
Atom version=5;
|
XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle, XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
||||||
@ -711,7 +711,6 @@ static void processEvent(XEvent *event)
|
|||||||
{
|
{
|
||||||
// Xdnd Drop: The drag&drop event has finished dropping on
|
// Xdnd Drop: The drag&drop event has finished dropping on
|
||||||
// the window, ask to convert the selection
|
// the window, ask to convert the selection
|
||||||
|
|
||||||
_glfw.x11.xdnd.sourceWindow = event->xclient.data.l[0];
|
_glfw.x11.xdnd.sourceWindow = event->xclient.data.l[0];
|
||||||
XConvertSelection(_glfw.x11.display,
|
XConvertSelection(_glfw.x11.display,
|
||||||
_glfw.x11.XdndSelection,
|
_glfw.x11.XdndSelection,
|
||||||
@ -761,7 +760,6 @@ static void processEvent(XEvent *event)
|
|||||||
}
|
}
|
||||||
case SelectionNotify:
|
case SelectionNotify:
|
||||||
{
|
{
|
||||||
|
|
||||||
if(event->xselection.property != None)
|
if(event->xselection.property != None)
|
||||||
{
|
{
|
||||||
// Xdnd: got a selection notification from the conversion
|
// Xdnd: got a selection notification from the conversion
|
||||||
@ -816,7 +814,11 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
XFree(data);
|
XFree(data);
|
||||||
|
|
||||||
if(result) _glfwInputDrop(window,_glfw.x11.xdnd.string);
|
if(result)
|
||||||
|
{
|
||||||
|
_glfwInputDrop(window,_glfw.x11.xdnd.string);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user