~eliasnaur/gio-patches

Allow Mozilla browsers to read copied data. v1 PROPOSED

Daniel Wilkins: 1
 Allow Mozilla browsers to read copied data.

 1 files changed, 10 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/12157/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Allow Mozilla browsers to read copied data. Export this patch

---
 app/internal/window/os_x11.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/internal/window/os_x11.go b/app/internal/window/os_x11.go
index 69108c6..20b67be 100644
--- a/app/internal/window/os_x11.go
+++ b/app/internal/window/os_x11.go
@@ -53,6 +53,8 @@ type x11Window struct {
	atoms struct {
		// "UTF8_STRING".
		utf8string C.Atom
		// "text/plain;charset=utf-8".
		plaintext C.Atom
		// "TARGETS"
		targets C.Atom
		// "CLIPBOARD".
@@ -419,6 +421,9 @@ func (h *x11EventHandler) handleEvents() bool {
			case w.atoms.targets:
				// The requestor wants the supported clipboard
				// formats. First write the formats...
				// Note: Gecko ignores the targets anyway and
				// adding the full entry list causes X11 errors
				// So just advertise utf8string
				formats := []uint32{uint32(w.atoms.utf8string)}
				C.XChangeProperty(w.x, cevt.requestor, cevt.property, w.atoms.atom,
					32 /* bitwidth of formats */, C.PropModeReplace,
@@ -426,6 +431,10 @@ func (h *x11EventHandler) handleEvents() bool {
				)
				// ...then notify the requestor.
				notify()

			// Kludge to get Mozilla browsers working
			case w.atoms.plaintext:
				fallthrough
			case w.atoms.utf8string:
				content := w.clipboard.content
				var ptr *C.uchar
@@ -554,6 +563,7 @@ func newX11Window(gioWin Callbacks, opts *Options) error {
	C.XSetClassHint(dpy, win, &wmhints)

	w.atoms.utf8string = w.atom("UTF8_STRING", false)
	w.atoms.plaintext = w.atom("text/plain;charset=utf-8", false)
	w.atoms.evDelWindow = w.atom("WM_DELETE_WINDOW", false)
	w.atoms.clipboard = w.atom("CLIPBOARD", false)
	w.atoms.clipboardContent = w.atom("CLIPBOARD_CONTENT", false)
--
2.28.0