Skip to content

Commit e827e6f

Browse files
committed
X11: Allow drag and drop of text/plain in addition to text/uri-list
Fixes #2441
1 parent 342f098 commit e827e6f

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
7777
- Workaround for bug in less that causes colors to reset at wrapped lines
7878
(:iss:`2381`)
7979

80+
- X11: Allow drag and drop of text/plain in addition to text/uri-list
81+
(:iss:`2441`)
82+
8083
- Dont strip :code:`&` and :code:`-` from the end of URLs (:iss:`2436`)
8184

8285
- Fix ``@selection`` placeholder not working with launch command (:iss:`2417`)

glfw/x11_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ static bool initExtensions(void)
385385
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False);
386386
_glfw.x11.XdndTypeList = XInternAtom(_glfw.x11.display, "XdndTypeList", False);
387387
_glfw.x11.text_uri_list = XInternAtom(_glfw.x11.display, "text/uri-list", False);
388+
_glfw.x11.text_plain = XInternAtom(_glfw.x11.display, "text/plain", False);
389+
_glfw.x11.text_plain_utf8 = XInternAtom(_glfw.x11.display, "text/plain;charset=utf-8", False);
388390

389391
// ICCCM, EWMH and Motif window property atoms
390392
// These can be set safely even without WM support

glfw/x11_platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ typedef struct _GLFWlibraryX11
267267
Atom XdndSelection;
268268
Atom XdndTypeList;
269269
Atom text_uri_list;
270+
Atom text_plain;
271+
Atom text_plain_utf8;
270272

271273
// Selection (clipboard) atoms
272274
Atom TARGETS;

glfw/x11_window.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,10 @@ static void processEvent(XEvent *event)
14781478
{
14791479
_glfw.x11.xdnd.format = _glfw.x11.text_uri_list;
14801480
break;
1481+
} else if (formats[i] == _glfw.x11.text_plain_utf8 && (_glfw.x11.xdnd.format == None || _glfw.x11.xdnd.format == _glfw.x11.text_plain)) {
1482+
_glfw.x11.xdnd.format = _glfw.x11.text_plain_utf8;
1483+
} else if (formats[i] == _glfw.x11.text_plain && _glfw.x11.xdnd.format == None) {
1484+
_glfw.x11.xdnd.format = _glfw.x11.text_plain;
14811485
}
14821486
}
14831487

0 commit comments

Comments
 (0)