screenshot: Pass a Graphene.Point as PickPixel 'finished' signal

This will allow to pass the data as native object when porting this to Clutter
actor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:
Marco Trevisan (Treviño) 2019-09-03 01:51:00 +02:00 committed by Florian Müllner
parent 22fe4e92c7
commit f67b409fc1

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported ScreenshotService */
const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
const { Clutter, Graphene, Gio, GLib, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
const GrabHelper = imports.ui.grabHelper;
@ -198,7 +198,7 @@ var ScreenshotService = class {
let screenshot = this._createScreenshot(invocation, false);
if (!screenshot)
return;
screenshot.pick_color(...coords, (o, res) => {
screenshot.pick_color(coords.x, coords.y, (_o, res) => {
let [success_, color] = screenshot.pick_color_finish(res);
let { red, green, blue } = color;
let retval = GLib.Variant.new('(a{sv})', [{
@ -349,7 +349,8 @@ var PickPixel = class {
}
_onButtonRelease(actor, event) {
this._result = event.get_coords();
let [x, y] = event.get_coords();
this._result = new Graphene.Point({ x, y });
this._grabHelper.ungrab();
return Clutter.EVENT_PROPAGATE;
}