Add clipboard API and new input capture session construction API#208
Add clipboard API and new input capture session construction API#208jadahl wants to merge 11 commits intoflatpak:mainfrom
Conversation
This makes the label not "fly away" when some other widget makes its column wider.
Only starts the session and reports the shared devices and streams.
This will be necessary when handling signals, which needs to fetch the session from a handle.
This adds API to interact with the clipboard portal associated with a remote desktop session.
This allows copying to, and pasting from, the clipboard portal.
This makes it easier to construct a session from somewhere else, which will be needed with CreateSession2().
It's its own thing, that also controls the lifetime of the actual session, so need some special casing.
Rather useless, since we're not adding any barriers, but more complete none the less.
In API version 2, the CreateSession() was replaced by CreateSession2()/Start(); add API that corresponds to this. Unfortunately applications will need to check whether this is supported by manually checking the exposed API version, to use the new construction method.
This will allow enabling clipboard integration later.
bfc4532 to
efa8c1a
Compare
whot
left a comment
There was a problem hiding this comment.
Note that one of the commit messages has a portal--test/ prefix
| } | ||
|
|
||
| /** | ||
| * xdp_session_is_clipboard_enabed: |
There was a problem hiding this comment.
| * xdp_session_is_clipboard_enabed: | |
| * xdp_session_is_clipboard_enabled: |
| { | ||
| XdpPortal *portal = data; | ||
| XdpSession *session; | ||
| g_autoptr(GVariant) variant = NULL; |
There was a problem hiding this comment.
| g_autoptr(GVariant) variant = NULL; |
unused
| mime_type, serial); | ||
| } | ||
|
|
||
| void |
There was a problem hiding this comment.
| void | |
| static void |
| &error); | ||
| if (!ret) | ||
| { | ||
| g_warning ("Failed to write selection: %s", error->message); |
There was a problem hiding this comment.
| g_warning ("Failed to write selection: %s", error->message); | |
| g_warning ("Failed to read selection: %s", error->message); |
| PORTAL_BUS_NAME, | ||
| PORTAL_OBJECT_PATH, | ||
| "org.freedesktop.portal.Clipboard", | ||
| "SetSelection", |
There was a problem hiding this comment.
| "SetSelection", | |
| "SelectionWriteDone", |
| if (!call->session_path) | ||
| { | ||
| g_task_return_new_error (call->task, G_IO_ERROR, G_IO_ERROR_FAILED, | ||
| "Missing session handel"); |
There was a problem hiding this comment.
| "Missing session handel"); | |
| "Missing session handle"); |
whot
left a comment
There was a problem hiding this comment.
A few nitpicks after a manual review, but overall this LGTM
| g_autoptr(GString) devices_s = NULL; | ||
|
|
||
| if (s->len > 0) | ||
| g_string_append (s, "\n"); | ||
|
|
||
| devices_s = g_string_new (NULL); | ||
| g_string_append (s, "Devices: "); | ||
|
|
||
| if (device_types & XDP_DEVICE_KEYBOARD) | ||
| g_string_append (devices_s, "keyboard"); | ||
|
|
||
| if (device_types & XDP_DEVICE_POINTER) | ||
| { | ||
| if (devices_s->len > 0) | ||
| g_string_append (devices_s, ", "); | ||
| g_string_append (devices_s, "pointer"); | ||
| } | ||
|
|
||
| if (device_types & XDP_DEVICE_TOUCHSCREEN) | ||
| { | ||
| if (devices_s->len > 0) | ||
| g_string_append (devices_s, ", "); | ||
| g_string_append (devices_s, "touchscreen"); | ||
| } |
There was a problem hiding this comment.
I reckon this would be easier to read with a GStrv and a g_strjoin() or whatever it's called.
| gpointer data); | ||
|
|
||
| XDP_PUBLIC | ||
| XdpInputCaptureSession * xdp_portal_create_input_capture_session2_finish (XdpPortal *portal, |
There was a problem hiding this comment.
just ftr, it'd be nice to also have this as _sync, feel free to steal that from #214
| /* background */ | ||
| guint background_interface_version; | ||
|
|
||
| /* clipbord */ |
There was a problem hiding this comment.
| /* clipbord */ | |
| /* clipboard */ |
| "width", &w, | ||
| "height", &h, | ||
| "x", &x, | ||
| "y", &y, | ||
| NULL); |
There was a problem hiding this comment.
this looks like wrong indentation here
| win); | ||
| if (xdp_portal_get_input_capture_version_sync (win->portal, NULL, NULL) > 1) | ||
| { | ||
| g_print ("Using new input capture session construction API\n"); |
| } | ||
| else | ||
| { | ||
| g_print ("Using legacy input capture session construction API\n"); |
|
yikes, another issue: the first two commits for Anyway, I've squashed all the above comments into my branch in #214 so might be easiest to get that one merged. |
This adds clipboard API usable with the existing remote desktop portal, and implements the new split session construction input capture API, as well as input capture clipboard support. See flatpak/xdg-desktop-portal#1803.