-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the InputCapture portal #96
Conversation
31b8414
to
145192d
Compare
e0650f3
to
b4ab8ed
Compare
if anyone is following along: the most recent changes from today change the implementation so that we have an API that creates and takes This is basically a working implementation of #112 (while not touching the RD/SC API) and should eventually allow us to create an InputCapture session from an existing XdpSession object, see flatpak/xdg-desktop-portal#864. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some light review so far only, looks good to me so far.
struct _XdpInputCaptureSession | ||
{ | ||
GObject parent_instance; | ||
XdpSession *parent_session; /* strong ref */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this approach to session object management makes more sense to me.
6f3fa88
to
e0ed195
Compare
e0ed195
to
d4b2375
Compare
Just FTR, this now sits on top of #114 because I need both to work at the same time and juggling branches is annoying. |
66a219c
to
1f5a15e
Compare
4f748f8
to
3e9cf98
Compare
6943c9c
to
e1908e7
Compare
marking as ready, I stared at this for too long, I can no longer see any bugs... |
What's keeping this from landing at this point? It seems to have been sitting in a ready state for a month now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment. LGTM otherwise.
guint zone_set; | ||
}; | ||
|
||
G_DEFINE_TYPE (XdpInputCaptureSession, xdp_input_capture_session, G_TYPE_OBJECT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
G_DEFINE_TYPE (XdpInputCaptureSession, xdp_input_capture_session, G_TYPE_OBJECT) | |
G_DEFINE_FINAL_TYPE (XdpInputCaptureSession, xdp_input_capture_session, G_TYPE_OBJECT) |
This way, people will get a warning if they try subclassing the type by using the instance/class sizes known to the type system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undone, sorry, that breaks the build (CI) with Ubuntu 20.04.
gboolean is_valid; | ||
}; | ||
|
||
G_DEFINE_TYPE (XdpInputCaptureZone, xdp_input_capture_zone, G_TYPE_OBJECT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
G_DEFINE_TYPE (XdpInputCaptureZone, xdp_input_capture_zone, G_TYPE_OBJECT) | |
G_DEFINE_FINAL_TYPE (XdpInputCaptureZone, xdp_input_capture_zone, G_TYPE_OBJECT) |
This way, people using the type system to query the instance and class sizes in order to subclass this type will hit an assertion failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undone, sorry, that breaks the build (CI) with Ubuntu 20.04.
if (call->cancelled_id) | ||
{ | ||
g_signal_handler_disconnect (g_task_get_cancellable (call->task), call->cancelled_id); | ||
call->cancelled_id = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (call->cancelled_id) | |
{ | |
g_signal_handler_disconnect (g_task_get_cancellable (call->task), call->cancelled_id); | |
call->cancelled_id = 0; | |
} | |
g_clear_signal_handler (&call->cancelled_id, g_task_get_cancellable (call->task)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undone, sorry, that breaks the build (CI) with Ubuntu 20.04.
I had this on my list to look at today. Thanks for beating me to it, @ebassi |
The Session is no longer unique to RemoteDesktop/ScreenCast and shouldn't be treated as such. Let's split this out so we can use the same object across other interfaces. The session state is a bit more difficult since it is also related to RD/SC only but it's more spaghettied in.
Disentangle the generic Session is-closed state from the ScreenCast/RemoteDesktop-specific case. The more detailed SessionState is specific to SC/RD - INITIAL and CLOSED is generic enough that we can make it a generic API.
6ecf17f
to
ef99c44
Compare
libportal/session.c
Outdated
@@ -50,6 +50,7 @@ static void | |||
xdp_session_finalize (GObject *object) | |||
{ | |||
XdpSession *session = XDP_SESSION (object); | |||
g_warning ("session finalize"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
52933d3
to
7371f61
Compare
Many thanks for the review! I have applied the changes and forced push to @whot's branch now. Please also note that I had to drop a few suggested changes at it was breaking the build on Ubuntu 20.04 for the CI (I suspect the version of Glib is older on that target). |
b26f232
to
75e9aef
Compare
ftr, I fixed a buggy test case, but this branch should still be ready to go. |
This patch adds a new XdpSession type for the input capture protocol as well as as the methods provided by that portal to work on that session. Two helper objects are available now too: XdpInputCaptureZone and XdpInputCapturePointerBarrier
This also fixes the invocation of EmitSignalDetailed() which dated back to an earlier version of that dbusmock feature. Since we never used it, the wrong invocation got past the tests.
75e9aef
to
3e6c1bf
Compare
gentle ping for merging :) |
For the corresponding Portal PR, please see flatpak/xdg-desktop-portal#714
This is a draft PR to add support for the input capture portal. Most of it is straightforward portal implementation but this portal does have a larger surface and more state than most, which raises a few questions:
XdpSession
is re-used for input capture portals now too. This makes namespacing (or the lack thereof) slightly awkward, e.g. theactivated
signal on the session is insteadinputcapture-activated
to avoid future conflicts, which then requires the other signals to be namespaced too.ideally we'd have aedit: this was nacked in Subclass RemoteDesktop/ScreenCast sessions from XdpSession #102XdpInputCaptureSession
as subclass ofXdpSession
but the latter is declared final right now and I'm not 100% if that's an ABI break then.XdpInputCaptureSession
now contains anXdpSession
and the API is namespaced properly.enable
/disable
/release
methodsare paired with their respectiveUpdate June 06: these are method calls now_finish
, but tbh this is of questionable value. Even if the portal keeps these as requests, I'd argue hiding this away here would make for better API - we can use the session signals to notify the caller out-of-band.XdpSession
which doesn't have properties but setters/getters only.Disabled
signal is still missing here I just noticedthat won't run without patched dbus-python and dbusmockbut it makes testing so much easier. specifically, it allows to test libportal without an existing implementation of the actual portal. Merged to main in test: add a pytest/dbusmock-based test suite #99, this is just the inputcapture tests nowThe above are the larger topics, I'd appreciate a high-level review of the API and suggestions for where to go with this.
cc @jadahl