[gnome-shell/screenshot-ui-gsd-binds: 6/10] screenshot-ui: Add screencast area indicator
- From: Ivan Molodetskikh <imolodetskikh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/screenshot-ui-gsd-binds: 6/10] screenshot-ui: Add screencast area indicator
- Date: Fri, 28 Jan 2022 13:38:11 +0000 (UTC)
commit b0e0dd3d1267e554f977bc1db484fb2e5db0c42f
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Sat Nov 27 16:31:19 2021 +0300
screenshot-ui: Add screencast area indicator
It shows the screencast area during recording.
js/ui/screenshot.js | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 3d70216bdc..a3acb26a38 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -1027,6 +1027,17 @@ class ScreenshotUI extends St.Widget {
Main.layoutManager.screenshotUIGroup.add_child(
this._stageScreenshotContainer);
+ this._screencastAreaIndicator = new UIAreaIndicator({
+ style_class: 'screenshot-ui-screencast-area-indicator',
+ visible: false,
+ });
+ this._screencastAreaIndicator.add_constraint(new Clutter.BindConstraint({
+ source: global.stage,
+ coordinate: Clutter.BindCoordinate.ALL,
+ }));
+ // Add it directly to the stage so that it's above popup menus.
+ global.stage.add_child(this._screencastAreaIndicator);
+
Main.layoutManager.screenshotUIGroup.add_child(this);
this._stageScreenshot = new St.Widget({ style_class: 'screenshot-ui-screen-screenshot' });
@@ -1840,9 +1851,24 @@ class ScreenshotUI extends St.Widget {
const [x, y, w, h] = this._getSelectedGeometry(false);
const drawCursor = this._cursor.visible;
+ // Set up the screencast indicator rect.
+ if (this._selectionButton.checked) {
+ this._screencastAreaIndicator.setSelectionRect(
+ ...this._areaSelector.getGeometry());
+ } else if (this._screenButton.checked) {
+ const index =
+ this._screenSelectors.findIndex(screen => screen.checked);
+ const monitor = Main.layoutManager.monitors[index];
+
+ this._screencastAreaIndicator.setSelectionRect(
+ monitor.x, monitor.y, monitor.width, monitor.height);
+ }
+
// Close instantly so the fade-out doesn't get recorded.
this.close(true);
+ this._screencastAreaIndicator.show();
+
// This is a bit awkward because creating a proxy synchronously hangs Shell.
const doStartScreencast = () => {
let method =
@@ -1861,12 +1887,14 @@ class ScreenshotUI extends St.Widget {
{ 'draw-cursor': new GLib.Variant('b', drawCursor) },
([success, _filename], error) => {
if (error !== null) {
+ this._screencastAreaIndicator.hide();
this._screencastInProgress = false;
log('Error starting screencast: %s'.format(error.message));
return;
}
if (!success) {
+ this._screencastAreaIndicator.hide();
this._screencastInProgress = false;
log('Error starting screencast');
}
@@ -1902,6 +1930,8 @@ class ScreenshotUI extends St.Widget {
if (!this._screencastInProgress)
return;
+ this._screencastAreaIndicator.hide();
+
// Set this before calling the method as the screen recording indicator
// will check it before the success callback fires.
this._screencastInProgress = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]