~eliasnaur/gio

4 3

clipboard, dropfiles

ktye
Details
Message ID
<CAJnE92uoo=pjEf4_E2-+xpFFevdjBXwpX+cqeUWSQfXRmb8hyg@mail.gmail.com>
DKIM signature
missing
Download raw message
Are clipboard(copy, paste) and / or drop files into a window within
the scope of gio?

I could work on this for the win32 driver, if that's appreciated and
an interface is agreed on.
Details
Message ID
<BXD8KN6A5ATJ.4UZS95OKQOUF@toolbox>
In-Reply-To
<CAJnE92uoo=pjEf4_E2-+xpFFevdjBXwpX+cqeUWSQfXRmb8hyg@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Mon Sep 30, 2019 at 8:11 AM ktye wrote:
> Are clipboard(copy, paste) and / or drop files into a window within
> the scope of gio?
> 

It most definitely is.

> I could work on this for the win32 driver, if that's appreciated and
> an interface is agreed on.

Off the top of my head (modeled after package gioui.org/ui/system):

	// Package clipboard provides access to the system clipboard.
	package clipboard

	// InputOp registers a handler for receiving clipboard Events.
	type InputOp struct {
		Key ui.Key
		// Types is the list of acceptable MIME types.
		Types []string
	}

	// WriteOp replaces the clipboard content.
	type WriteOp struct {
		// Type is the MIME type of Data.
		Type string
		// Data replace the contents of the clipboard. It is
		// closed when the system is done with it.
		Data io.ReadCloser
	}

	// Event contain the type and content of the clipboard.
	// The reader is only valid until the next frame update.
	type Event struct{
		// Type is the MIME type of Data.
		Type string
		// Data is the clipboard content. Close Data after
		// use to free its underlying resources.
		Data io.ReadCloser
	}

Thanks for working on it.

-- elias
ktye
Details
Message ID
<CAJnE92u+QSd3LM506WVQHvobAH_jWxNpYvEzLiVtSpost8osmA@mail.gmail.com>
In-Reply-To
<BXD8KN6A5ATJ.4UZS95OKQOUF@toolbox> (view parent)
DKIM signature
missing
Download raw message
And what about dropfiles?

I see one issue about that:
In a desktop environment a drop file event has access to the complete path.
In a browser, only the filename (and content) is known.

We could restrict all to the common minimum and not reveal the full
path on desktop, or have device dependent options...
Do you have an opinion?
Details
Message ID
<BXDB0KTYJNRB.1RGK9TE25W38R@toolbox>
In-Reply-To
<CAJnE92u+QSd3LM506WVQHvobAH_jWxNpYvEzLiVtSpost8osmA@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Mon Sep 30, 2019 at 1:17 PM ktye wrote:
> And what about dropfiles?
> 

Drag and drop seems different from clipboard: DnD need a drop area similar to
pointer.Area, and is activated by the user (by releasing the mouse button on
top of the area). The clipboard is actively controlled by the program
(Ctrl-C/Ctrl-V).

In other words, I would expect dnd to have its own package.

> I see one issue about that:
> In a desktop environment a drop file event has access to the complete path.
> In a browser, only the filename (and content) is known.
> 
> We could restrict all to the common minimum and not reveal the full
> path on desktop, or have device dependent options...
> Do you have an opinion?

We could expose Path, which would be just the filename in browsers, and the
full path on desktops. The content would always be available as an
io.ReadCloser so the program don't need to and can't expect to be able to
actually access the path.

-- elias
Gregory Pomerantz
Details
Message ID
<0f825099-1304-f86c-8b02-998daf4c19f7@wow.st>
In-Reply-To
<BXD8KN6A5ATJ.4UZS95OKQOUF@toolbox> (view parent)
DKIM signature
missing
Download raw message
On Mon Sep 30, 2019 at 8:11 AM ktye wrote:
>> Are clipboard(copy, paste) and / or drop files into a window within
>> the scope of gio?
>>
> It most definitely is.

for MacOS, you can use git.wow.st/gmp/clip to access NSPasteboard 
directly (without going through the pbcopy and pbpaste command line 
utilities.
Reply to thread Export thread (mbox)