X11: Allow drag and drop of text/plain in addition to text/uri-list

Fixes #2441
This commit is contained in:
Kovid Goyal 2020-03-18 22:37:23 +05:30
parent 342f0981d8
commit e827e6fa21
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 11 additions and 0 deletions

View File

@ -77,6 +77,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Workaround for bug in less that causes colors to reset at wrapped lines - Workaround for bug in less that causes colors to reset at wrapped lines
(:iss:`2381`) (:iss:`2381`)
- X11: Allow drag and drop of text/plain in addition to text/uri-list
(:iss:`2441`)
- Dont strip :code:`&` and :code:`-` from the end of URLs (:iss:`2436`) - Dont strip :code:`&` and :code:`-` from the end of URLs (:iss:`2436`)
- Fix ``@selection`` placeholder not working with launch command (:iss:`2417`) - Fix ``@selection`` placeholder not working with launch command (:iss:`2417`)

2
glfw/x11_init.c vendored
View File

@ -385,6 +385,8 @@ static bool initExtensions(void)
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False); _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False);
_glfw.x11.XdndTypeList = XInternAtom(_glfw.x11.display, "XdndTypeList", False); _glfw.x11.XdndTypeList = XInternAtom(_glfw.x11.display, "XdndTypeList", False);
_glfw.x11.text_uri_list = XInternAtom(_glfw.x11.display, "text/uri-list", False); _glfw.x11.text_uri_list = XInternAtom(_glfw.x11.display, "text/uri-list", False);
_glfw.x11.text_plain = XInternAtom(_glfw.x11.display, "text/plain", False);
_glfw.x11.text_plain_utf8 = XInternAtom(_glfw.x11.display, "text/plain;charset=utf-8", False);
// ICCCM, EWMH and Motif window property atoms // ICCCM, EWMH and Motif window property atoms
// These can be set safely even without WM support // These can be set safely even without WM support

2
glfw/x11_platform.h vendored
View File

@ -267,6 +267,8 @@ typedef struct _GLFWlibraryX11
Atom XdndSelection; Atom XdndSelection;
Atom XdndTypeList; Atom XdndTypeList;
Atom text_uri_list; Atom text_uri_list;
Atom text_plain;
Atom text_plain_utf8;
// Selection (clipboard) atoms // Selection (clipboard) atoms
Atom TARGETS; Atom TARGETS;

4
glfw/x11_window.c vendored
View File

@ -1478,6 +1478,10 @@ static void processEvent(XEvent *event)
{ {
_glfw.x11.xdnd.format = _glfw.x11.text_uri_list; _glfw.x11.xdnd.format = _glfw.x11.text_uri_list;
break; break;
} else if (formats[i] == _glfw.x11.text_plain_utf8 && (_glfw.x11.xdnd.format == None || _glfw.x11.xdnd.format == _glfw.x11.text_plain)) {
_glfw.x11.xdnd.format = _glfw.x11.text_plain_utf8;
} else if (formats[i] == _glfw.x11.text_plain && _glfw.x11.xdnd.format == None) {
_glfw.x11.xdnd.format = _glfw.x11.text_plain;
} }
} }