Compare commits

...

28 Commits

Author SHA1 Message Date
38509081e7 windowManager: Switch the focused application on 3-finger hold + tap
The gesture action only cycles through the applications in the current
workspace.
2014-06-27 23:32:54 +02:00
f659b66a9d Add AppSwitchAction Clutter.GestureAction
This action implements 3-finger hold + 4th finger tap to switch
the focused application.
2014-06-27 23:32:54 +02:00
247a42ccc4 windowManager: switch workspaces on 4-finger drag
The workspace to switch is obtained from the direction received
by the WorkspaceSwitchAction gesture.
2014-06-27 23:32:54 +02:00
a50a463eb3 Add workspaceSwitchAction Clutter.GestureAction
This gesture implements 4-finger drag, that will be used for workspace
switching.
2014-06-27 23:32:54 +02:00
dc7cca7e6d viewSelector: Show the overview on 3-finger pinch gestures 2014-06-27 23:32:54 +02:00
38032bf820 Add showOverViewAction Clutter.GestureAction
This gesture implements 3-finger pinch, that will be used to show
the overview.
2014-06-27 23:32:54 +02:00
624314ee3e backgroundMenu: release the click gesture if a grab operation begun
If an active grab on pointer events happens during multi-touch operations,
all non-pointer-emulating touches will be muted. This may leave the
Clutter.ClickAction incomplete if triggered by one of those sequences,
just to have a gesture take over and trigger a compositor grab, which would
leave the capture-event handler stuck eating events.

So listen for grab-op-begin from the display, and ensure the action is
released if such grab begins.
and the capture event handler stuck.
2014-06-27 23:32:54 +02:00
ed6dc326d1 viewSelector: add left edge drag gesture to show the app picker 2014-06-27 23:32:54 +02:00
13b4290e55 messageTray: Add bottom drag gesture to popup the message tray 2014-06-27 23:32:54 +02:00
f4e0f6385c Add edgeDrag Clutter.GestureAction
This action is only triggered if started from the monitor edge specified
on construction.
2014-06-27 23:32:54 +02:00
41a3f10938 layout: Make the dummy cursor invisible
This means that moving it around won't attempt to cause a full redraw of
the stage. Yikes.
2014-06-27 11:59:10 -04:00
d850c8599e windowManager: Don't use ClutterActor.scale-gravity
It's deprecated as well.
2014-06-27 10:54:11 -04:00
ec288d0e68 layout: Use ClutterActor.background-color instead of ClutterStage.color
The latter is deprecated.
2014-06-27 10:54:10 -04:00
0b92cd0772 Updated POTFILES.in 2014-06-27 01:21:25 +02:00
c7f5f172dd Use the new RTL icons from adwaita
Use the suffix -rtl and -ltr.

https://bugzilla.gnome.org/show_bug.cgi?id=732301
2014-06-27 01:25:22 +03:00
84bc445593 st-icon: Undeprecate icon-name
Don't cause a bunch of warnings when the icon-name property is still a
really convenient internal shorthand.
2014-06-26 18:16:50 -04:00
365bfcae12 portalHelper: fix typo
Not even an hour, and already the first bug...
2014-06-26 20:10:18 +02:00
47c9243271 NetworkManager: show portal logins when required
Listen to changes in connectivity, and ask our helper to authenticate
when needed.
We don't have a URL to connect to yet (we will have when
the new NM API lands), so we use the default of trying
www.gnome.org (which is also more reliable because we can
recognize when the login is done)

https://bugzilla.gnome.org/show_bug.cgi?id=704416
2014-06-26 19:55:02 +02:00
8c67a70db0 Add a helper to handle captive portal logins
Add a small DBus-activated GtkApplication that embeds a WebKitWebView
and implements some minimal logic to see if the login succeeds.
It will try to connect to a custom NM-provided url (the portal login
page), if one exists, or to www.gnome.org in the normal case of
a portal doing redirect.

https://bugzilla.gnome.org/show_bug.cgi?id=704416
2014-06-26 19:54:58 +02:00
5f4591e24c NetworkMenu: make sure menu icons are updated at the end of connectivity checks
Icons inside the menu are updated only for device state change,
but for the main device they also depend on connectivity (which
is a global property).
Add a public method to force an update of the icon, and call it
when connectivity changes.

https://bugzilla.gnome.org/show_bug.cgi?id=726401
2014-06-26 19:23:57 +02:00
37ef0e4bed WorkspacesView: don't access the allocation 4 times
Access it once, and save 3 GObject property accesses and related
copies.

https://bugzilla.gnome.org/show_bug.cgi?id=729823
2014-06-26 19:20:17 +02:00
7d7b92419f Workspace: ignore actual geometry changes while unmapped
If unmapped, ignore geometry changes. This avoids doing useless
layout work on invisible workspaces during the slider control
animations.

https://bugzilla.gnome.org/show_bug.cgi?id=729823
2014-06-26 19:20:17 +02:00
309d40a92b WorkspacesView: separate setting the full and the actual geometry
They are different properties, they deserve different syncs.
Especially because a full allocation cycle sets both anyway, so
we should save some cycles this way.

https://bugzilla.gnome.org/show_bug.cgi?id=729823
2014-06-26 19:20:17 +02:00
02718357da workspace: avoid GObject overhead while computing the clone layout
We already have the width and height information cached in JS,
let's avoid going through gjs-gobject-clutter to retrieve them
again. As a plus, with normal properties the optimizer should
be able to generate better code.

https://bugzilla.gnome.org/show_bug.cgi?id=729823
2014-06-26 19:20:17 +02:00
cfef107114 background: fix early destroy of SystemBackground
If the SystemBackground is destroyed before loading, we call
removeImageContent() with null, which crashes.
2014-06-26 19:20:17 +02:00
b742b1eed2 background: fix typo updating images for animated background
We must remove the old image from the cache, not the new one.

This was causing a leak of old (and expensive) background
images, and was causing errors at the end of animations, trying
to destroy the animated background.
2014-06-26 19:20:17 +02:00
d58be565a1 Updated Russian translation 2014-06-25 22:59:18 +04:00
522ed3c21d theme: whitespace typo 2014-06-25 17:00:10 +02:00
24 changed files with 1239 additions and 283 deletions

View File

@ -1,6 +1,24 @@
CLEANFILES =
desktopdir=$(datadir)/applications
desktop_DATA = gnome-shell.desktop gnome-shell-wayland.desktop gnome-shell-extension-prefs.desktop
if HAVE_NETWORKMANAGER
desktop_DATA += org.gnome.Shell.PortalHelper.desktop
servicedir = $(datadir)/dbus-1/services
service_DATA = org.gnome.Shell.PortalHelper.service
CLEANFILES += \
org.gnome.Shell.PortalHelper.service \
org.gnome.Shell.PortalHelper.desktop
endif
%.service: %.service.in
$(AM_V_GEN) sed -e "s|@libexecdir[@]|$(libexecdir)|" \
$< > $@ || rm $@
# We substitute in bindir so it works as an autostart
# file when built in a non-system prefix
%.desktop.in:%.desktop.in.in
@ -88,9 +106,11 @@ EXTRA_DIST = \
$(menu_DATA) \
$(convert_DATA) \
$(keys_in_files) \
org.gnome.Shell.PortalHelper.desktop.in \
org.gnome.Shell.PortalHelper.service.in \
org.gnome.shell.gschema.xml.in.in
CLEANFILES = \
CLEANFILES += \
gnome-shell.desktop.in \
gnome-shell-wayland.desktop.in \
gnome-shell-extension-prefs.in \

View File

@ -0,0 +1,9 @@
[Desktop Entry]
_Name=Captive Portal
Type=Application
Exec=gapplication launch org.gnome.Shell.PortalHelper
DBusActivatable=true
NoDisplay=true
Icon=network-workgroup
StartupNotify=true
OnlyShowIn=GNOME;

View File

@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.gnome.Shell.PortalHelper
Exec=@libexecdir@/gnome-shell-portal-helper

View File

@ -45,7 +45,7 @@ stage {
/* small bold */
.dash-label,
.window-caption,
.switcher-list,
.switcher-list,
.app-well-app > .overview-icon,
.show-apps > .overview-icon,
.grid-search-result .overview-icon {

View File

@ -26,10 +26,13 @@
<file>perf/core.js</file>
<file>portalHelper/main.js</file>
<file>ui/altTab.js</file>
<file>ui/animation.js</file>
<file>ui/appDisplay.js</file>
<file>ui/appFavorites.js</file>
<file>ui/appSwitchAction.js</file>
<file>ui/backgroundMenu.js</file>
<file>ui/background.js</file>
<file>ui/boxpointer.js</file>
@ -39,6 +42,7 @@
<file>ui/dash.js</file>
<file>ui/dateMenu.js</file>
<file>ui/dnd.js</file>
<file>ui/edgeDragAction.js</file>
<file>ui/endSessionDialog.js</file>
<file>ui/environment.js</file>
<file>ui/extensionDownloader.js</file>
@ -77,6 +81,7 @@
<file>ui/shellDBus.js</file>
<file>ui/shellEntry.js</file>
<file>ui/shellMountOperation.js</file>
<file>ui/showOverviewAction.js</file>
<file>ui/slider.js</file>
<file>ui/switcherPopup.js</file>
<file>ui/tweener.js</file>
@ -87,6 +92,7 @@
<file>ui/windowMenu.js</file>
<file>ui/windowManager.js</file>
<file>ui/workspace.js</file>
<file>ui/workspaceSwitchAction.js</file>
<file>ui/workspaceSwitcherPopup.js</file>
<file>ui/workspaceThumbnail.js</file>
<file>ui/workspacesView.js</file>

248
js/portalHelper/main.js Normal file
View File

@ -0,0 +1,248 @@
const Format = imports.format;
const Gettext = imports.gettext;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Pango = imports.gi.Pango;
const Soup = imports.gi.Soup;
const WebKit = imports.gi.WebKit2;
const _ = Gettext.gettext;
const Config = imports.misc.config;
const PortalHelperResult = {
CANCELLED: 0,
COMPLETED: 1,
RECHECK: 2
};
const INACTIVITY_TIMEOUT = 30000; //ms
const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;
const HelperDBusInterface = '<node> \
<interface name="org.gnome.Shell.PortalHelper"> \
<method name="Authenticate"> \
<arg type="o" direction="in" name="connection" /> \
<arg type="s" direction="in" name="url" /> \
<arg type="u" direction="in" name="timestamp" /> \
</method> \
<method name="Close"> \
<arg type="o" direction="in" name="connection" /> \
</method> \
<method name="Refresh"> \
<arg type="o" direction="in" name="connection" /> \
</method> \
<signal name="Done"> \
<arg type="o" name="connection" /> \
<arg type="u" name="result" /> \
</signal> \
</interface> \
</node>';
const PortalWindow = new Lang.Class({
Name: 'PortalWindow',
Extends: Gtk.ApplicationWindow,
_init: function(application, url, timestamp, doneCallback) {
this.parent({ application: application });
if (url) {
this._uri = new Soup.URI(uri);
} else {
url = 'http://www.gnome.org';
this._uri = null;
this._everSeenRedirect = false;
}
this._originalUrl = url;
this._doneCallback = doneCallback;
this._lastRecheck = 0;
this._recheckAtExit = false;
this._webView = new WebKit.WebView();
this._webView.connect('decide-policy', Lang.bind(this, this._onDecidePolicy));
this._webView.load_uri(url);
this._webView.connect('notify::title', Lang.bind(this, this._syncTitle));
this._syncTitle();
this.add(this._webView);
this._webView.show();
this.maximize();
this.present_with_time(timestamp);
},
_syncTitle: function() {
let title = this._webView.title;
if (title) {
this.title = title;
} else {
// TRANSLATORS: this is the title of the wifi captive portal login
// window, until we know the title of the actual login page
this.title = _("Web Authentication Redirect");
}
},
refresh: function() {
this._everSeenRedirect = false;
this._webView.load_uri(this._originalUrl);
},
vfunc_delete_event: function(event) {
if (this._recheckAtExit)
this._doneCallback(PortalHelperResult.RECHECK);
else
this._doneCallback(PortalHelperResult.CANCELLED);
return false;
},
_onDecidePolicy: function(view, decision, type) {
if (type == WebKit.PolicyDecisionType.NEW_WINDOW_ACTION) {
decision.ignore();
return true;
}
if (type != WebKit.PolicyDecisionType.NAVIGATION_ACTION)
return false;
let request = decision.get_request();
let uri = new Soup.URI(request.get_uri());
if (this._uri != null) {
if (!uri.host_equal(uri, this._uri)) {
// We *may* have finished here, but we don't know for
// sure. Tell gnome-shell to run another connectivity check
// (but ratelimit the checks, we don't want to spam
// gnome.org for portals that have 10 or more internal
// redirects - and unfortunately they exist)
// If we hit the rate limit, we also queue a recheck
// when the window is closed, just in case we miss the
// final check and don't realize we're connected
// This should not be a problem in the cancelled logic,
// because if the user doesn't want to start the login,
// we should not see any redirect at all, outside this._uri
let now = GLib.get_monotonic_time();
let shouldRecheck = (now - this._lastRecheck) >
CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT;
if (shouldRecheck) {
this._lastRecheck = now;
this._recheckAtExit = false;
this._doneCallback(PortalHelperResult.RECHECK);
} else {
this._recheckAtExit = true;
}
}
// Update the URI, in case of chained redirects, so we still
// think we're doing the login until gnome-shell kills us
this._uri = uri;
} else {
if (uri.get_host() == 'www.gnome.org' && this._everSeenRedirect) {
// Yay, we got to gnome!
decision.ignore();
this._doneCallback(PortalHelperResult.COMPLETED);
return true;
} else if (uri.get_host() != 'www.gnome.org') {
this._everSeenRedirect = true;
}
}
decision.use();
return true;
},
});
const WebPortalHelper = new Lang.Class({
Name: 'WebPortalHelper',
Extends: Gtk.Application,
_init: function() {
this.parent({ application_id: 'org.gnome.Shell.PortalHelper',
flags: Gio.ApplicationFlags.IS_SERVICE,
inactivity_timeout: 30000 });
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(HelperDBusInterface, this);
this._queue = [];
},
vfunc_dbus_register: function(connection, path) {
this._dbusImpl.export(connection, path);
this.parent(connection, path);
return true;
},
vfunc_dbus_unregister: function(connection, path) {
this._dbusImpl.unexport_from_connection(connection);
this.parent(connection, path);
},
vfunc_activate: function() {
// If launched manually (for example for testing), force a dummy authentication
// session with the default url
this.Authenticate('/org/gnome/dummy', '', 0);
},
Authenticate: function(connection, url, timestamp) {
this._queue.push({ connection: connection, url: url, timestamp: timestamp });
this._processQueue();
},
Close: function(connection) {
for (let i = 0; i < this._queue.length; i++) {
let obj = this._queue[i];
if (obj.connection == connection) {
if (obj.window)
obj.window.destroy();
this._queue.splice(i, 1);
break;
}
}
this._processQueue();
},
Refresh: function(connection) {
for (let i = 0; i < this._queue.length; i++) {
let obj = this._queue[i];
if (obj.connection == connection) {
if (obj.window)
obj.window.refresh();
break;
}
}
},
_processQueue: function() {
if (this._queue.length == 0)
return;
let top = this._queue[0];
if (top.window != null)
return;
top.window = new PortalWindow(this, top.uri, top.timestamp, Lang.bind(this, function(result) {
this._dbusImpl.emit_signal('Done', new GLib.Variant('(ou)', [top.connection, result]));
}));
},
});
function initEnvironment() {
String.prototype.format = Format.format;
}
function main(argv) {
initEnvironment();
Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
Gettext.textdomain(Config.GETTEXT_PACKAGE);
let app = new WebPortalHelper();
return app.run(argv);
}

64
js/ui/appSwitchAction.js Normal file
View File

@ -0,0 +1,64 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Signals = imports.signals;
const Clutter = imports.gi.Clutter;
//in milliseconds
let LONG_PRESS_TIMEOUT = 250;
let MOTION_THRESHOLD = 30;
const AppSwitchAction = new Lang.Class({
Name: 'AppSwitchAction',
Extends: Clutter.GestureAction,
_init : function() {
this.parent();
this.set_n_touch_points (3);
global.display.connect('grab-op-begin', Lang.bind(this, this.cancel));
global.display.connect('grab-op-end', Lang.bind(this, this.cancel));
},
vfunc_gesture_prepare : function(action, actor) {
return this.get_n_current_points() <= 4;
},
vfunc_gesture_begin : function(action, actor) {
let nPoints = this.get_n_current_points();
let event = this.get_last_event (nPoints - 1);
if (nPoints == 3)
this._longPressStartTime = event.get_time();
else if (nPoints == 4) {
// Check whether the 4th finger press happens after a 3-finger long press,
// this only needs to be checked on the first 4th finger press
if (this._longPressStartTime != null &&
event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT)
this.cancel();
else {
this._longPressStartTime = null;
this.emit('activated');
}
}
return this.get_n_current_points() <= 4;
},
vfunc_gesture_progress : function(action, actor) {
if (this.get_n_current_points() == 3) {
for (let i = 0; i < this.get_n_current_points(); i++) {
[startX, startY] = this.get_press_coords(i);
[x, y] = this.get_motion_coords(i);
if (Math.abs(x - startX) > MOTION_THRESHOLD ||
Math.abs(y - startY) > MOTION_THRESHOLD)
return false;
}
}
return true;
}
});
Signals.addSignalMethods(AppSwitchAction.prototype);

View File

@ -448,7 +448,7 @@ const Background = new Lang.Class({
let image = this._images[index];
if (image.content)
this._cache.removeImageContent(content);
this._cache.removeImageContent(image.content);
image.content = content;
this._watchCacheFile(filename);
},
@ -659,7 +659,10 @@ const SystemBackground = new Lang.Class({
},
_onDestroy: function() {
this._cache.removeImageContent(this.actor.content);
let content = this.actor.content;
if (content)
this._cache.removeImageContent(content);
},
});
Signals.addSignalMethods(SystemBackground.prototype);

View File

@ -55,6 +55,10 @@ function addBackgroundMenu(actor, layoutManager) {
});
actor.add_action(clickAction);
global.display.connect('grab-op-begin', function () {
clickAction.release();
});
actor.connect('destroy', function() {
actor._backgroundMenu.destroy();
actor._backgroundMenu = null;

76
js/ui/edgeDragAction.js Normal file
View File

@ -0,0 +1,76 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Signals = imports.signals;
const Meta = imports.gi.Meta;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
let EDGE_THRESHOLD = 20;
let DRAG_DISTANCE = 80;
const EdgeDragAction = new Lang.Class({
Name: 'EdgeDragAction',
Extends: Clutter.GestureAction,
_init : function(side) {
this.parent();
this._side = side;
this.set_n_touch_points (1);
global.display.connect('grab-op-begin', Lang.bind(this, this.cancel));
global.display.connect('grab-op-end', Lang.bind(this, this.cancel));
},
_getMonitorRect : function (x, y) {
let rect = new Meta.Rectangle({ x: x - 1, y: y - 1, width: 1, height: 1 });
let monitorIndex = global.screen.get_monitor_index_for_rect(rect);
return global.screen.get_monitor_geometry(monitorIndex);
},
vfunc_gesture_prepare : function(action, actor) {
if (this.get_n_current_points() == 0)
return false;
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
return ((this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
},
vfunc_gesture_progress : function (action, actor) {
let [startX, startY] = this.get_press_coords(0);
let [x, y] = this.get_motion_coords(0);
let offsetX = Math.abs (x - startX);
let offsetY = Math.abs (y - startY);
if (offsetX < EDGE_THRESHOLD && offsetY < EDGE_THRESHOLD)
return true;
if ((offsetX > offsetY &&
(this._side == St.Side.TOP || this._side == St.Side.BOTTOM)) ||
(offsetY > offsetX &&
(this._side == St.Side.LEFT || this._side == St.Side.RIGHT))) {
this.cancel();
return false;
}
return true;
},
vfunc_gesture_end : function (action, actor) {
let [startX, startY] = this.get_press_coords(0);
let [x, y] = this.get_motion_coords(0);
let monitorRect = this._getMonitorRect(startX, startY);
if ((this._side == St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
(this._side == St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
(this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
(this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
this.emit('activated');
}
});
Signals.addSignalMethods(EdgeDragAction.prototype);

View File

@ -163,7 +163,7 @@ const LayoutManager = new Lang.Class({
// Normally, the stage is always covered so Clutter doesn't need to clear
// it; however it becomes visible during the startup animation
// See the comment below for a longer explanation
global.stage.color = DEFAULT_BACKGROUND_COLOR;
global.stage.background_color = DEFAULT_BACKGROUND_COLOR;
// Set up stage hierarchy to group all UI actors under one container.
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
@ -224,7 +224,7 @@ const LayoutManager = new Lang.Class({
// A dummy actor that tracks the mouse or text cursor, based on the
// position and size set in setDummyCursorGeometry.
this.dummyCursor = new St.Widget({ width: 0, height: 0 });
this.dummyCursor = new St.Widget({ width: 0, height: 0, visible: false });
this.uiGroup.add_actor(this.dummyCursor);
global.stage.remove_actor(global.top_window_group);

View File

@ -15,6 +15,7 @@ const Signals = imports.signals;
const St = imports.gi.St;
const Tp = imports.gi.TelepathyGLib;
const EdgeDragAction = imports.ui.edgeDragAction;
const BoxPointer = imports.ui.boxpointer;
const CtrlAltTab = imports.ui.ctrlAltTab;
const GnomeSession = imports.misc.gnomeSession;
@ -1933,6 +1934,10 @@ const MessageTray = new Lang.Class({
this._messageTrayMenuButton = new MessageTrayMenuButton(this);
this.actor.add_actor(this._messageTrayMenuButton.actor);
let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM);
gesture.connect('activated', Lang.bind(this, this.toggle));
global.stage.add_action(gesture);
},
close: function() {

View File

@ -0,0 +1,66 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Signals = imports.signals;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Clutter = imports.gi.Clutter;
const ShowOverviewAction = new Lang.Class({
Name: 'ShowOverviewAction',
Extends: Clutter.GestureAction,
_init : function() {
this.parent();
this.set_n_touch_points (3);
global.display.connect('grab-op-begin', Lang.bind(this, this.cancel));
global.display.connect('grab-op-end', Lang.bind(this, this.cancel));
},
vfunc_gesture_prepare : function(action, actor) {
return this.get_n_current_points() == this.get_n_touch_points();
},
_getBoundingRect : function(motion) {
let minX, minY, maxX, maxY;
for (let i = 0; i < this.get_n_current_points(); i++) {
let x, y;
if (motion == true) {
[x, y] = this.get_motion_coords(i);
} else {
[x, y] = this.get_press_coords(i);
}
if (i == 0) {
minX = maxX = x;
minY = maxY = y;
} else {
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
}
return new Meta.Rectangle({ x: minX,
y: minY,
width: maxX - minX,
height: maxY - minY });
},
vfunc_gesture_begin : function(action, actor) {
this._initialRect = this._getBoundingRect(false);
return true;
},
vfunc_gesture_end : function(action, actor) {
let rect = this._getBoundingRect(true);
let oldArea = this._initialRect.width * this._initialRect.height;
let newArea = rect.width * rect.height;
let areaDiff = newArea / oldArea;
this.emit('activated', areaDiff);
}
});
Signals.addSignalMethods(ShowOverviewAction.prototype);

View File

@ -44,6 +44,33 @@ const NM80211Mode = NetworkManager['80211Mode'];
const NM80211ApFlags = NetworkManager['80211ApFlags'];
const NM80211ApSecurityFlags = NetworkManager['80211ApSecurityFlags'];
const PortalHelperResult = {
CANCELLED: 0,
COMPLETED: 1,
RECHECK: 2
};
const PortalHelperIface = '<node> \
<interface name="org.gnome.Shell.PortalHelper"> \
<method name="Authenticate"> \
<arg type="o" direction="in" name="connection" /> \
<arg type="s" direction="in" name="url" /> \
<arg type="u" direction="in" name="timestamp" /> \
</method> \
<method name="Close"> \
<arg type="o" direction="in" name="connection" /> \
</method> \
<method name="Refresh"> \
<arg type="o" direction="in" name="connection" /> \
</method> \
<signal name="Done"> \
<arg type="o" name="connection" /> \
<arg type="u" name="result" /> \
</signal> \
</interface> \
</node>';
const PortalHelperProxy = Gio.DBusProxy.makeProxyWrapper(PortalHelperIface);
function ssidCompare(one, two) {
if (!one || !two)
return false;
@ -207,13 +234,23 @@ const NMConnectionSection = new Lang.Class({
this.item.menu.addMenuItem(this._labelSection);
this.item.menu.addMenuItem(this._radioSection);
this.connect('icon-changed', Lang.bind(this, this._sync));
this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged));
},
destroy: function() {
if (this._notifyConnectivityId != 0) {
this._client.disconnect(this._notifyConnectivityId);
this._notifyConnectivityId = 0;
}
this.item.destroy();
},
_iconChanged: function() {
this._sync();
this.emit('icon-changed');
},
_sync: function() {
let nItems = this._connectionItems.size;
@ -278,7 +315,7 @@ const NMConnectionSection = new Lang.Class({
return;
item.connect('icon-changed', Lang.bind(this, function() {
this.emit('icon-changed');
this._iconChanged();
}));
item.connect('activation-failed', Lang.bind(this, function(item, reason) {
this.emit('activation-failed', reason);
@ -523,7 +560,7 @@ const NMDeviceModem = new Lang.Class({
if (this._mobileDevice) {
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
this.emit('icon-changed');
this._iconChanged();
}));
}
},
@ -1145,10 +1182,16 @@ const NMDeviceWireless = new Lang.Class({
this._wirelessHwEnabledChangedId = this._client.connect('notify::wireless-hardware-enabled', Lang.bind(this, this._sync));
this._activeApChangedId = this._device.connect('notify::active-access-point', Lang.bind(this, this._activeApChanged));
this._stateChangedId = this._device.connect('state-changed', Lang.bind(this, this._deviceStateChanged));
this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged));
this._sync();
},
_iconChanged: function() {
this._sync();
this.emit('icon-changed');
},
destroy: function() {
if (this._activeApChangedId) {
GObject.Object.prototype.disconnect.call(this._device, this._activeApChangedId);
@ -1174,6 +1217,10 @@ const NMDeviceWireless = new Lang.Class({
this._dialog.destroy();
this._dialog = null;
}
if (this._notifyConnectivityId) {
this._client.disconnect(this._notifyConnectivityId);
this._notifyConnectivityId = 0;
}
this.item.destroy();
},
@ -1211,7 +1258,7 @@ const NMDeviceWireless = new Lang.Class({
},
_strengthChanged: function() {
this.emit('icon-changed');
this._iconChanged();
},
_activeApChanged: function() {
@ -1561,6 +1608,7 @@ const NMApplet = new Lang.Class({
this._activeConnections = [ ];
this._connections = [ ];
this._connectivityQueue = [ ];
this._mainConnection = null;
this._mainConnectionIconChangedId = 0;
@ -1589,6 +1637,7 @@ const NMApplet = new Lang.Class({
this._client.connect('notify::primary-connection', Lang.bind(this, this._syncMainConnection));
this._client.connect('notify::activating-connection', Lang.bind(this, this._syncMainConnection));
this._client.connect('notify::active-connections', Lang.bind(this, this._syncVPNConnections));
this._client.connect('notify::connectivity', Lang.bind(this, this._syncConnectivity));
this._client.connect('device-added', Lang.bind(this, this._deviceAdded));
this._client.connect('device-removed', Lang.bind(this, this._deviceRemoved));
this._settings.connect('new-connection', Lang.bind(this, this._newConnection));
@ -1757,6 +1806,7 @@ const NMApplet = new Lang.Class({
}
this._updateIcon();
this._syncConnectivity();
},
_syncVPNConnections: function() {
@ -1862,6 +1912,97 @@ const NMApplet = new Lang.Class({
_syncNMState: function() {
this.indicators.visible = this._client.manager_running;
this.menu.actor.visible = this._client.networking_enabled;
this._syncConnectivity();
},
_flushConnectivityQueue: function() {
if (this._portalHelperProxy) {
for (let item of this._connectivityQueue)
this._portalHelperProxy.CloseRemote(item);
}
this._connectivityQueue = [];
},
_closeConnectivityCheck: function(path) {
let index = this._connectivityQueue.indexOf(path);
if (index >= 0) {
if (this._portalHelperProxy)
this._portalHelperProxy.CloseRemote(path);
this._connectivityQueue.splice(index, 1);
}
},
_portalHelperDone: function(proxy, emitter, parameters) {
let [path, result] = parameters;
if (result == PortalHelperResult.CANCELLED) {
// Keep the connection in the queue, so the user is not
// spammed with more logins until we next flush the queue,
// which will happen once he chooses a better connection
// or we get to full connectivity through other means
} else if (result == PortalHelperResult.COMPLETED) {
this._closeConnectivityCheck(path);
return;
} else if (result == PortalHelperResult.RECHECK) {
this._client.check_connectivity_async(null, Lang.bind(this, function(client, result) {
try {
let state = client.check_connectivity_finish(result);
if (state >= NetworkManager.ConnectivityState.FULL)
this._closeConnectivityCheck(path);
} catch(e) { }
}));
} else {
log('Invalid result from portal helper: ' + result);
}
},
_syncConnectivity: function() {
if (this._mainConnection == null ||
this._mainConnection.state != NetworkManager.ActiveConnectionState.ACTIVATED) {
this._flushConnectivityQueue();
return;
}
let isPortal = this._client.connectivity == NetworkManager.ConnectivityState.PORTAL;
// For testing, allow interpreting any value != FULL as PORTAL, because
// LIMITED (no upstream route after the default gateway) is easy to obtain
// with a tethered phone
// NONE is also possible, with a connection configured to force no default route
// (but in general we should only prompt a portal if we know there is a portal)
if (GLib.getenv('GNOME_SHELL_CONNECTIVITY_TEST') != null)
isPortal = isPortal || this._client.connectivity < NetworkManager.ConnectivityState.FULL;
if (!isPortal)
return;
let path = this._mainConnection.get_path();
for (let item of this._connectivityQueue) {
if (item == path)
return;
}
let timestamp = global.get_current_time();
if (this._portalHelperProxy) {
this._portalHelperProxy.AuthenticateRemote(path, '', timestamp);
} else {
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
'/org/gnome/Shell/PortalHelper', Lang.bind(this, function (proxy, error) {
if (error) {
log('Error launching the portal helper: ' + error);
return;
}
this._portalHelperProxy = proxy;
proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone));
proxy.AuthenticateRemote(path, '', timestamp);
}));
}
this._connectivityQueue.push(path);
},
_updateIcon: function() {

View File

@ -11,6 +11,8 @@ const Lang = imports.lang;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const EdgeDragAction = imports.ui.edgeDragAction;
const ShowOverviewAction = imports.ui.showOverviewAction;
const AppDisplay = imports.ui.appDisplay;
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
@ -83,10 +85,10 @@ const ViewSelector = new Lang.Class({
icon_name: 'edit-find-symbolic' }));
if (this._entry.get_text_direction() == Clutter.TextDirection.RTL)
this._clearIcon = new St.Icon({ style_class: 'search-entry-icon',
icon_name: 'edit-clear-rtl-symbolic' });
icon_name: 'edit-clear-symbolic-rtl' });
else
this._clearIcon = new St.Icon({ style_class: 'search-entry-icon',
icon_name: 'edit-clear-symbolic' });
icon_name: 'edit-clear-symbolic-ltr' });
this._iconClickedId = 0;
this._capturedEventId = 0;
@ -145,6 +147,21 @@ const ViewSelector = new Lang.Class({
Shell.KeyBindingMode.OVERVIEW,
Lang.bind(Main.overview, Main.overview.toggle));
let gesture = new EdgeDragAction.EdgeDragAction(St.Side.RIGHT);
gesture.connect('activated', Lang.bind(this, function() {
if (Main.overview.visible)
Main.overview.hide();
else
this.showApps();
}));
global.stage.add_action(gesture);
gesture = new ShowOverviewAction.ShowOverviewAction();
gesture.connect('activated', Lang.bind(this, function(action, areaDiff) {
if (areaDiff < 0.7)
Main.overview.show();
}));
global.stage.add_action(gesture);
},
_toggleAppsPage: function() {

View File

@ -11,6 +11,8 @@ const St = imports.gi.St;
const Shell = imports.gi.Shell;
const AltTab = imports.ui.altTab;
const WorkspaceSwitchAction = imports.ui.workspaceSwitchAction;
const AppSwitchAction = imports.ui.appSwitchAction;
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
const Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog;
@ -683,6 +685,53 @@ const WindowManager = new Lang.Class({
global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
false, -1, 1);
let gesture = new WorkspaceSwitchAction.WorkspaceSwitchAction();
gesture.connect('activated', Lang.bind(this, function(action, direction) {
let newWs = global.screen.get_active_workspace().get_neighbor(direction);
this.actionMoveWorkspace(newWs);
}));
global.stage.add_action(gesture);
gesture = new AppSwitchAction.AppSwitchAction();
gesture.connect('activated', Lang.bind(this, this._switchApp));
global.stage.add_action(gesture);
},
_lookupIndex: function (windows, metaWindow) {
for (let i = 0; i < windows.length; i++) {
if (windows[i].metaWindow == metaWindow) {
return i;
}
}
return -1;
},
_switchApp : function () {
let windows = global.get_window_actors().filter(Lang.bind(this, function(actor) {
let win = actor.metaWindow;
return (!win.is_override_redirect() &&
win.located_on_workspace(global.screen.get_active_workspace()));
}));
if (windows.length == 0)
return;
let focusWindow = global.display.focus_window;
let nextWindow;
if (focusWindow == null)
nextWindow = windows[0].metaWindow;
else {
let index = this._lookupIndex (windows, focusWindow) + 1;
if (index >= windows.length)
index = 0;
nextWindow = windows[index].metaWindow;
}
Main.activateWindow(nextWindow);
},
keepWorkspaceAlive: function(workspace, duration) {
@ -903,7 +952,7 @@ const WindowManager = new Lang.Class({
/* Scale the window from the center of the parent */
this._checkDimming(actor.get_meta_window().get_transient_for());
actor.set_scale(1.0, 0.0);
actor.scale_gravity = Clutter.Gravity.CENTER;
actor.set_pivot_point(0.5, 0.5);
actor.show();
this._mapping.push(actor);
@ -977,7 +1026,7 @@ const WindowManager = new Lang.Class({
this._checkDimming(parent, window);
actor.set_scale(1.0, 1.0);
actor.scale_gravity = Clutter.Gravity.CENTER;
actor.set_pivot_point(0.5, 0.5);
actor.show();
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {

View File

@ -239,6 +239,14 @@ const WindowClone = new Lang.Class({
return this._boundingBox;
},
get width() {
return this._boundingBox.width;
},
get height() {
return this._boundingBox.height;
},
getOriginalPosition: function() {
return [this._boundingBox.x, this._boundingBox.y];
},
@ -257,7 +265,8 @@ const WindowClone = new Lang.Class({
rect = rect.union(metaWindow.get_outer_rect());
}, this);
this._boundingBox = rect;
// Convert from a MetaRectangle to a native JS object
this._boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
this.actor.layout_manager.boundingBox = rect;
},
@ -832,7 +841,7 @@ const LayoutStrategy = new Lang.Class({
// thumbnails is much more important to preserve than the width of
// them, so two windows with equal height, but maybe differering
// widths line up.
let ratio = window.actor.height / this._monitor.height;
let ratio = window.height / this._monitor.height;
// The purpose of this manipulation here is to prevent windows
// from getting too small. For something like a calculator window,
@ -934,11 +943,11 @@ const LayoutStrategy = new Lang.Class({
let window = row.windows[j];
let s = scale * this._computeWindowScale(window) * row.additionalScale;
let cellWidth = window.actor.width * s;
let cellHeight = window.actor.height * s;
let cellWidth = window.width * s;
let cellHeight = window.height * s;
s = Math.min(s, WINDOW_CLONE_MAXIMUM_SCALE);
let cloneWidth = window.actor.width * s;
let cloneWidth = window.width * s;
let cloneX = x + (cellWidth - cloneWidth) / 2;
let cloneY = row.y + row.height - cellHeight;
@ -992,7 +1001,7 @@ const UnalignedLayoutStrategy = new Lang.Class({
for (let i = 0; i < windows.length; i++) {
let window = windows[i];
let s = this._computeWindowScale(window);
totalWidth += window.actor.width * s;
totalWidth += window.width * s;
}
let idealRowWidth = totalWidth / numRows;
@ -1005,8 +1014,8 @@ const UnalignedLayoutStrategy = new Lang.Class({
for (; windowIdx < windows.length; windowIdx++) {
let window = windows[windowIdx];
let s = this._computeWindowScale(window);
let width = window.actor.width * s;
let height = window.actor.height * s;
let width = window.width * s;
let height = window.height * s;
row.fullHeight = Math.max(row.fullHeight, height);
// either new width is < idealWidth or new width is nearer from idealWidth then oldWidth
@ -1131,6 +1140,11 @@ const Workspace = new Lang.Class({
this._positionWindowsFlags = 0;
this._positionWindowsId = 0;
this.actor.connect('notify::mapped', Lang.bind(this, function() {
if (this.actor.mapped)
this._syncActualGeometry();
}));
},
setFullGeometry: function(geom) {
@ -1138,7 +1152,9 @@ const Workspace = new Lang.Class({
return;
this._fullGeometry = geom;
this._recalculateWindowPositions(WindowPositionFlags.NONE);
if (this.actor.mapped)
this._recalculateWindowPositions(WindowPositionFlags.NONE);
},
setActualGeometry: function(geom) {
@ -1146,18 +1162,29 @@ const Workspace = new Lang.Class({
return;
this._actualGeometry = geom;
this._actualGeometryDirty = true;
if (this._actualGeometryLater)
if (this.actor.mapped)
this._syncActualGeometry();
},
_syncActualGeometry: function() {
if (this._actualGeometryLater || !this._actualGeometryDirty)
return;
if (!this._actualGeometry)
return;
this._actualGeometryLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
this._actualGeometryLater = 0;
if (!this.actor.mapped)
return false;
let geom = this._actualGeometry;
this._dropRect.set_position(geom.x, geom.y);
this._dropRect.set_size(geom.width, geom.height);
this._updateWindowPositions(Main.overview.animationInProgress ? WindowPositionFlags.ANIMATE : WindowPositionFlags.NONE);
this._actualGeometryLater = 0;
return false;
}));
},

View File

@ -0,0 +1,52 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Signals = imports.signals;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Clutter = imports.gi.Clutter;
let MOTION_THRESHOLD = 50;
const WorkspaceSwitchAction = new Lang.Class({
Name: 'WorkspaceSwitchAction',
Extends: Clutter.GestureAction,
_init : function() {
this.parent();
this.set_n_touch_points (4);
global.display.connect('grab-op-begin', Lang.bind(this, this.cancel));
global.display.connect('grab-op-end', Lang.bind(this, this.cancel));
},
vfunc_gesture_prepare : function(action, actor) {
return this.get_n_current_points() == this.get_n_touch_points();
},
vfunc_gesture_end : function(action, actor) {
// Just check one touchpoint here
let [startX, startY] = this.get_press_coords(0);
let [x, y] = this.get_motion_coords(0);
let offsetX = x - startX;
let offsetY = y - startY;
let direction;
if (Math.abs(offsetX) < MOTION_THRESHOLD &&
Math.abs(offsetY) < MOTION_THRESHOLD)
return;
if (Math.abs(offsetY) > Math.abs(offsetX)) {
if (offsetY > 0)
direction = Meta.MotionDirection.UP;
else
direction = Meta.MotionDirection.DOWN;
} else {
if (offsetX > 0)
direction = Meta.MotionDirection.LEFT;
else
direction = Meta.MotionDirection.RIGHT;
}
this.emit('activated', direction);
}
});
Signals.addSignalMethods(WorkspaceSwitchAction.prototype);

View File

@ -74,12 +74,12 @@ const WorkspacesViewBase = new Lang.Class({
setFullGeometry: function(geom) {
this._fullGeometry = geom;
this._syncGeometry();
this._syncFullGeometry();
},
setActualGeometry: function(geom) {
this._actualGeometry = geom;
this._syncGeometry();
this._syncActualGeometry();
},
});
@ -127,9 +127,12 @@ const WorkspacesView = new Lang.Class({
this._workspaces[i].setReservedSlot(clone);
},
_syncGeometry: function() {
_syncFullGeometry: function() {
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setFullGeometry(this._fullGeometry);
},
_syncActualGeometry: function() {
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].setActualGeometry(this._actualGeometry);
},
@ -260,10 +263,12 @@ const WorkspacesView = new Lang.Class({
}
}
if (this._fullGeometry)
if (this._fullGeometry) {
this._updateWorkspaceActors(false);
this._syncGeometry();
this._syncFullGeometry();
}
if (this._actualGeometry)
this._syncActualGeometry();
},
_activeWorkspaceChanged: function(wm, from, to, direction) {
@ -352,8 +357,11 @@ const ExtraWorkspaceView = new Lang.Class({
this._workspace.setReservedSlot(clone);
},
_syncGeometry: function() {
_syncFullGeometry: function() {
this._workspace.setFullGeometry(this._fullGeometry);
},
_syncActualGeometry: function() {
this._workspace.setActualGeometry(this._actualGeometry);
},
@ -598,8 +606,9 @@ const WorkspacesDisplay = new Lang.Class({
return;
let [x, y] = this.actor.get_transformed_position();
let width = this.actor.allocation.x2 - this.actor.allocation.x1;
let height = this.actor.allocation.y2 - this.actor.allocation.y1;
let allocation = this.actor.allocation;
let width = allocation.x2 - allocation.x1;
let height = allocation.y2 - allocation.y1;
let primaryGeometry = { x: x, y: y, width: width, height: height };
let monitors = Main.layoutManager.monitors;

View File

@ -6,11 +6,13 @@ data/gnome-shell.desktop.in.in
data/gnome-shell-extension-prefs.desktop.in.in
data/gnome-shell-wayland.desktop.in.in
data/org.gnome.shell.gschema.xml.in.in
data/org.gnome.Shell.PortalHelper.desktop.in
js/extensionPrefs/main.js
js/gdm/authPrompt.js
js/gdm/loginDialog.js
js/gdm/util.js
js/misc/util.js
js/portalHelper/main.js
js/ui/appDisplay.js
js/ui/appFavorites.js
js/ui/backgroundMenu.js

584
po/ru.po

File diff suppressed because it is too large Load Diff

View File

@ -199,6 +199,21 @@ nodist_gnome_shell_extension_prefs_SOURCES = \
gnome_shell_extension_prefs_CPPFLAGS = $(gnome_shell_cflags)
gnome_shell_extension_prefs_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
if HAVE_NETWORKMANAGER
libexec_PROGRAMS += gnome-shell-portal-helper
gnome_shell_portal_helper_SOURCES = \
gnome-shell-portal-helper.c \
$(NULL)
nodist_gnome_shell_portal_helper_SOURCES = \
$(top_builddir)/js/js-resources.c \
$(top_builddir)/js/js-resources.h \
$(NULL)
gnome_shell_portal_helper_CPPFLAGS = $(gnome_shell_cflags)
gnome_shell_portal_helper_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
endif
########################################
libgnome_shell_js_la_SOURCES = \

View File

@ -0,0 +1,52 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include "config.h"
#include <girepository.h>
#include <gjs/gjs.h>
#include <glib/gi18n.h>
int
main (int argc, char *argv[])
{
const char *search_path[] = { "resource:///org/gnome/shell", NULL };
GError *error = NULL;
GjsContext *context;
int status;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
g_irepository_prepend_search_path (GNOME_SHELL_PKGLIBDIR);
context = g_object_new (GJS_TYPE_CONTEXT,
"search-path", search_path,
NULL);
if (!gjs_context_define_string_array(context, "ARGV",
argc, (const char**)argv,
&error))
{
g_message("Failed to define ARGV: %s", error->message);
g_error_free (error);
return 1;
}
if (!gjs_context_eval (context,
"const Main = imports.portalHelper.main; Main.main(ARGV);",
-1,
"<main>",
&status,
&error))
{
g_message ("Execution of main.js threw exception: %s", error->message);
g_error_free (error);
return status;
}
return 0;
}

View File

@ -252,7 +252,7 @@ st_icon_class_init (StIconClass *klass)
pspec = g_param_spec_string ("icon-name",
"Icon name",
"An icon name",
NULL, ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
NULL, ST_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_ICON_NAME, pspec);
pspec = g_param_spec_int ("icon-size",