GNOME Bugzilla – Bug 738972
wayland: port area selection to gnome-shell api
Last modified: 2014-10-23 17:51:44 UTC
The area selection code does not work under Wayland. Instead, we should just call into gnome-shell, using org.gnome.Shell.Screenshot. SelectArea(out i x, out i y, out i width, out i height); Which works fine when I tried it out using gdbus under wayland.
Created attachment 289213 [details] [review] Port screenshot area selection to GNOME Shell's DBus API ... to make screenshot selection work under Wayland. In order to keep gnome-screenshot working with other window managers, this keeps the old, X11 based area selection code around as a fallback when the DBus interface is unavailable.
Review of attachment 289213 [details] [review]: ::: src/screenshot-area-selection.c @@ +306,3 @@ + + ret = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object), res, &error); + if (error != NULL) what happens when the user cancels the operation? do we get an error or a [0,0,0,0] area?
even if we get a [0,0,0,0] area from the shell, then we should set .aborted = true, so that the screenshot app can eventually show the interactive dialog again if needed.
Just tested it and we get an error when the user cancels it -- I'll amend the patch to handle that case, thanks Emmanuele!
Created attachment 289215 [details] [review] Port screenshot area selection to GNOME Shell's DBus API ... to make screenshot selection work under Wayland. In order to keep gnome-screenshot working with other window managers, this keeps the old, X11 based area selection code around as a fallback when the DBus interface is unavailable.
Review of attachment 289215 [details] [review]: looks good to me; if Cosimo does not object, I think this is good to be merged.
Review of attachment 289215 [details] [review]: Looks good with one minor comment. ::: src/screenshot-area-selection.c @@ +354,3 @@ + NULL, + G_DBUS_CALL_FLAGS_NONE, + g_variant_get (ret, "(iiii)", You probably want no timeout here instead of the default - selecting the area could take a while.
(In reply to comment #7) > You probably want no timeout here instead of the default - selecting the area > could take a while. hopefully, not more than 25 seconds — but nice catch.
Thanks for the quick review, guys! Pushed with the timeout change. Attachment 289215 [details] pushed as 5606572 - Port screenshot area selection to GNOME Shell's DBus API