[gnome-shell] windowManager: Implement the resize popup here
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] windowManager: Implement the resize popup here
- Date: Tue, 30 Dec 2014 01:47:12 +0000 (UTC)
commit 329128195736cdf2b18c27851984380674cc794a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Dec 29 17:30:38 2014 -0800
windowManager: Implement the resize popup here
mutter recently removed its implementation, so add a simple one here.
data/theme/gnome-shell.css | 9 +++++++++
js/ui/windowManager.js | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index cb820c9..7beede3 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -2107,6 +2107,15 @@ StScrollBar StButton#vhandle:active {
font-size: 14pt;
}
+/* Resize popup */
+.resize-popup {
+ border-radius: 10px;
+ background-color: rgba(0.0, 0.0, 0.0, 0.9);
+ border: 2px solid #868686;
+ padding: 16px;
+ font-size: 14pt;
+}
+
/* ShellMountOperation Dialogs */
.shell-mount-operation-icon {
icon-size: 48px;
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index b8af0e0..56f33a5 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -580,6 +580,35 @@ const AppSwitchAction = new Lang.Class({
});
Signals.addSignalMethods(AppSwitchAction.prototype);
+const ResizePopup = new Lang.Class({
+ Name: 'ResizePopup',
+
+ _init: function() {
+ this._widget = new St.Widget({ layout_manager: new Clutter.BinLayout() });
+ this._label = new St.Label({ style_class: 'resize-popup',
+ x_align: Clutter.ActorAlign.CENTER,
+ y_align: Clutter.ActorAlign.CENTER,
+ x_expand: true, y_expand: true });
+ this._widget.add_child(this._label);
+ Main.uiGroup.add_actor(this._widget);
+ },
+
+ set: function(rect, displayW, displayH) {
+ /* Translators: This represents the size of a window. The first number is
+ * the width of the window and the second is the height. */
+ let text = _("%d x %d").format(displayW, displayH);
+ this._label.set_text(text);
+
+ this._widget.set_position(rect.x, rect.y);
+ this._widget.set_size(rect.width, rect.height);
+ },
+
+ destroy: function() {
+ this._widget.destroy();
+ this._widget = null;
+ },
+});
+
const WindowManager = new Lang.Class({
Name: 'WindowManager',
@@ -792,6 +821,8 @@ const WindowManager = new Lang.Class({
Shell.ActionMode.TOPBAR_POPUP,
Lang.bind(this, this._toggleAppMenu));
+ global.display.connect('show-resize-popup', Lang.bind(this, this._showResizePopup));
+
Main.overview.connect('showing', Lang.bind(this, function() {
for (let i = 0; i < this._dimmedWindows.length; i++)
this._undimWindow(this._dimmedWindows[i]);
@@ -1522,4 +1553,16 @@ const WindowManager = new Lang.Class({
let dialog = new DisplayChangeDialog(this._shellwm);
dialog.open();
},
+
+ _showResizePopup: function(display, show, rect, displayW, displayH) {
+ if (show) {
+ if (!this._resizePopup)
+ this._resizePopup = new ResizePopup();
+
+ this._resizePopup.set(rect, displayW, displayH);
+ } else {
+ if (this._resizePopup)
+ this._resizePopup.destroy();
+ }
+ },
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]