From ab0501b8ee38143012c3c4916bfa1cdb9f4e79eb Mon Sep 17 00:00:00 2001 From: Packit Service Date: Jan 15 2021 06:11:01 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml index ce69439..34a65af 100644 --- a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml +++ b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml @@ -189,19 +189,6 @@ --> - - - - - - - diff --git a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml index d71f241..9508681 100644 --- a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml +++ b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml @@ -57,19 +57,5 @@ - - - - - diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in index 9d7e011..24e2a75 100644 --- a/data/org.gnome.shell.gschema.xml.in +++ b/data/org.gnome.shell.gschema.xml.in @@ -39,7 +39,7 @@ - [ 'firefox.desktop', 'evolution.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'yelp.desktop', 'gnome-terminal.desktop' ] + [ 'epiphany.desktop', 'evolution.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop' ] List of desktop file IDs for favorite applications The applications corresponding to these identifiers diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss index 9e0751c..a6357ba 100644 --- a/data/theme/gnome-shell-sass/_common.scss +++ b/data/theme/gnome-shell-sass/_common.scss @@ -94,14 +94,6 @@ StEntry { } } -.caps-lock-warning-label { - padding-bottom: 8px; - padding-left: 6.2em; - @include fontsize($font-size - 1); - color: $warning_color; -} - - /* Scrollbars */ @@ -688,8 +680,7 @@ StScrollBar { spacing: 8px; } - .ws-switcher-active-up, .ws-switcher-active-down, - .ws-switcher-active-left, .ws-switcher-active-right { + .ws-switcher-active-up, .ws-switcher-active-down { height: 50px; background-color: $selected_bg_color; color: $selected_fg_color; @@ -778,11 +769,6 @@ StScrollBar { //dimensions of the icon are hardcoded } - .panel-logo-icon { - padding-right: .4em; - icon-size: 1em; - } - &:hover { color: lighten($fg_color, 10%); } @@ -1420,14 +1406,6 @@ StScrollBar { } - .app-well-hover-text { - text-align: center; - color: $osd_fg_color; - background-color: $osd_bg_color; - border-radius: 5px; - padding: 3px; - } - .app-well-app-running-dot { //running apps indicator width: 10px; height: 3px; background-color: $selected_bg_color; @@ -1823,12 +1801,7 @@ StScrollBar { .login-dialog-banner { color: darken($osd_fg_color,10%); } .login-dialog-button-box { spacing: 5px; } .login-dialog-message-warning { color: $warning_color; } - .login-dialog-message-hint, .login-dialog-message { - color: darken($osd_fg_color, 20%); - padding-top: 0; - padding-bottom: 20px; - min-height: 2.75em; - } + .login-dialog-message-hint { padding-top: 0; padding-bottom: 20px; } .login-dialog-user-selection-box { padding: 100px 0px; } .login-dialog-not-listed-label { padding-left: 2px; @@ -1883,10 +1856,6 @@ StScrollBar { padding-bottom: 12px; spacing: 8px; width: 23em; - .login-dialog-timed-login-indicator { - height: 2px; - background-color: darken($fg_color,40%); - } } .login-dialog-prompt-label { diff --git a/data/theme/meson.build b/data/theme/meson.build index d5acb8d..22bae3d 100644 --- a/data/theme/meson.build +++ b/data/theme/meson.build @@ -23,5 +23,3 @@ foreach style: styles ], depend_files: theme_sources) endforeach - -install_data('process-working.svg', install_dir: themedir) diff --git a/js/gdm/authList.js b/js/gdm/authList.js deleted file mode 100644 index 605a3d2..0000000 --- a/js/gdm/authList.js +++ /dev/null @@ -1,195 +0,0 @@ -// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -/* - * Copyright 2017 Red Hat, Inc - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -const Clutter = imports.gi.Clutter; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; -const Lang = imports.lang; -const Meta = imports.gi.Meta; -const Signals = imports.signals; -const St = imports.gi.St; - -const Tweener = imports.ui.tweener; - -const _SCROLL_ANIMATION_TIME = 0.5; - -const AuthListItem = new Lang.Class({ - Name: 'AuthListItem', - - _init(key, text) { - this.key = key; - let label = new St.Label({ style_class: 'auth-list-item-label', - y_align: Clutter.ActorAlign.CENTER }); - label.text = text; - - this.actor = new St.Button({ style_class: 'login-dialog-user-list-item', - button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, - can_focus: true, - child: label, - reactive: true, - x_align: St.Align.START, - x_fill: true }); - - this.actor.connect('key-focus-in', () => { - this._setSelected(true); - }); - this.actor.connect('key-focus-out', () => { - this._setSelected(false); - }); - this.actor.connect('notify::hover', () => { - this._setSelected(this.actor.hover); - }); - - this.actor.connect('clicked', this._onClicked.bind(this)); - }, - - _onClicked() { - this.emit('activate'); - }, - - _setSelected(selected) { - if (selected) { - this.actor.add_style_pseudo_class('selected'); - this.actor.grab_key_focus(); - } else { - this.actor.remove_style_pseudo_class('selected'); - } - } -}); -Signals.addSignalMethods(AuthListItem.prototype); - -var AuthList = new Lang.Class({ - Name: 'AuthList', - - _init() { - this.actor = new St.BoxLayout({ vertical: true, - style_class: 'login-dialog-auth-list-layout' }); - - this.label = new St.Label({ style_class: 'prompt-dialog-headline' }); - this.actor.add_actor(this.label); - - this._scrollView = new St.ScrollView({ style_class: 'login-dialog-user-list-view'}); - this._scrollView.set_policy(Gtk.PolicyType.NEVER, - Gtk.PolicyType.AUTOMATIC); - this.actor.add_actor(this._scrollView); - - this._box = new St.BoxLayout({ vertical: true, - style_class: 'login-dialog-user-list', - pseudo_class: 'expanded' }); - - this._scrollView.add_actor(this._box); - this._items = {}; - - this.actor.connect('key-focus-in', this._moveFocusToItems.bind(this)); - }, - - _moveFocusToItems() { - let hasItems = Object.keys(this._items).length > 0; - - if (!hasItems) - return; - - if (global.stage.get_key_focus() != this.actor) - return; - - let focusSet = this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false); - if (!focusSet) { - Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { - this._moveFocusToItems(); - return false; - }); - } - }, - - _onItemActivated(activatedItem) { - this.emit('activate', activatedItem.key); - }, - - scrollToItem(item) { - let box = item.actor.get_allocation_box(); - - let adjustment = this._scrollView.get_vscroll_bar().get_adjustment(); - - let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0); - Tweener.removeTweens(adjustment); - Tweener.addTween (adjustment, - { value: value, - time: _SCROLL_ANIMATION_TIME, - transition: 'easeOutQuad' }); - }, - - jumpToItem(item) { - let box = item.actor.get_allocation_box(); - - let adjustment = this._scrollView.get_vscroll_bar().get_adjustment(); - - let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0); - - adjustment.set_value(value); - }, - - getItem(key) { - let item = this._items[key]; - - if (!item) - return null; - - return item; - }, - - addItem(key, text) { - this.removeItem(key); - - let item = new AuthListItem(key, text); - this._box.add(item.actor, { x_fill: true }); - - this._items[key] = item; - - item.connect('activate', - this._onItemActivated.bind(this)); - - // Try to keep the focused item front-and-center - item.actor.connect('key-focus-in', - () => { this.scrollToItem(item); }); - - this._moveFocusToItems(); - - this.emit('item-added', item); - }, - - removeItem(key) { - let item = this._items[key]; - - if (!item) - return; - - item.actor.destroy(); - delete this._items[key]; - }, - - numItems() { - return Object.keys(this._items).length; - }, - - clear() { - this.label.text = ""; - this._box.destroy_all_children(); - this._items = {}; - } -}); -Signals.addSignalMethods(AuthList.prototype); diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 3ce9fd0..d7f53a9 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -1,13 +1,11 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter, GLib, Pango, Shell, St } = imports.gi; +const { Clutter, Pango, Shell, St } = imports.gi; const Signals = imports.signals; const Animation = imports.ui.animation; -const AuthList = imports.gdm.authList; const Batch = imports.gdm.batch; const GdmUtil = imports.gdm.util; -const Meta = imports.gi.Meta; const Params = imports.misc.params; const ShellEntry = imports.ui.shellEntry; const Tweener = imports.ui.tweener; @@ -43,8 +41,6 @@ var AuthPrompt = class { this._gdmClient = gdmClient; this._mode = mode; - this._idleMonitor = Meta.IdleMonitor.get_core(); - let reauthenticationOnly; if (this._mode == AuthPromptMode.UNLOCK_ONLY) reauthenticationOnly = true; @@ -55,7 +51,6 @@ var AuthPrompt = class { this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this)); this._userVerifier.connect('show-message', this._onShowMessage.bind(this)); - this._userVerifier.connect('show-choice-list', this._onShowChoiceList.bind(this)); this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this)); this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this)); this._userVerifier.connect('reset', this._onReset.bind(this)); @@ -65,16 +60,11 @@ var AuthPrompt = class { this.connect('next', () => { this.updateSensitivity(false); + this.startSpinning(); if (this._queryingService) { - this.startSpinning(); this._userVerifier.answerQuery(this._queryingService, this._entry.text); } else { this._preemptiveAnswer = this._entry.text; - - if (this._preemptiveAnswerWatchId) { - this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); - this._preemptiveAnswerWatchId = 0; - } } }); @@ -113,36 +103,6 @@ var AuthPrompt = class { this._entry.grab_key_focus(); - this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(); - this.actor.add_child(this._capsLockWarningLabel); - - this._timedLoginIndicator = new St.Bin({ style_class: 'login-dialog-timed-login-indicator', - scale_x: 0 }); - - this.actor.add(this._timedLoginIndicator); - - this._authList = new AuthList.AuthList(); - this._authList.connect('activate', (list, key) => { - this._authList.actor.reactive = false; - Tweener.addTween(this._authList.actor, - { opacity: 0, - time: MESSAGE_FADE_OUT_ANIMATION_TIME, - transition: 'easeOutQuad', - onComplete: () => { - this._authList.clear(); - this._authList.actor.hide(); - this._userVerifier.selectChoice(this._queryingService, key); - - } - }); - }); - this._authList.actor.hide(); - this.actor.add(this._authList.actor, - { expand: true, - x_fill: true, - y_fill: false, - x_align: St.Align.START }); - this._message = new St.Label({ opacity: 0, styleClass: 'login-dialog-message' }); this._message.clutter_text.line_wrap = true; @@ -167,46 +127,7 @@ var AuthPrompt = class { this._defaultButtonWell.add_child(this._spinner.actor); } - showTimedLoginIndicator(time) { - let hold = new Batch.Hold(); - - this.hideTimedLoginIndicator(); - - let startTime = GLib.get_monotonic_time(); - - this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 33, - () => { - let currentTime = GLib.get_monotonic_time(); - let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC; - this._timedLoginIndicator.scale_x = elapsedTime / time; - if (elapsedTime >= time) { - this._timedLoginTimeoutId = 0; - hold.release(); - return GLib.SOURCE_REMOVE; - } - - return GLib.SOURCE_CONTINUE; - }); - - GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId'); - - return hold; - } - - hideTimedLoginIndicator() { - if (this._timedLoginTimeoutId) { - GLib.source_remove(this._timedLoginTimeoutId); - this._timedLoginTimeoutId = 0; - } - this._timedLoginIndicator.scale_x = 0.; - } - _onDestroy() { - if (this._preemptiveAnswerWatchId) { - this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); - this._preemptiveAnswerWatchId = 0; - } - this._userVerifier.destroy(); this._userVerifier = null; } @@ -248,7 +169,7 @@ var AuthPrompt = class { this._updateNextButtonSensitivity(this._entry.text.length > 0); this._entry.clutter_text.connect('text-changed', () => { - if (!this._userVerifier.hasPendingMessages && this._queryingService && !this._preemptiveAnswer) + if (!this._userVerifier.hasPendingMessages) this._fadeOutMessage(); this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING); @@ -285,21 +206,6 @@ var AuthPrompt = class { this.emit('prompted'); } - _onShowChoiceList(userVerifier, serviceName, promptMessage, choiceList) { - if (this._queryingService) - this.clear(); - - this._queryingService = serviceName; - - if (this._preemptiveAnswer) - this._preemptiveAnswer = null; - - this.nextButton.label = _("Next"); - this.setChoiceList(promptMessage, choiceList); - this.updateSensitivity(true); - this.emit('prompted'); - } - _onOVirtUserAuthenticated() { if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED) this.reset(); @@ -428,60 +334,22 @@ var AuthPrompt = class { clear() { this._entry.text = ''; this.stopSpinning(); - this._authList.clear(); - this._authList.actor.hide(); } setPasswordChar(passwordChar) { this._entry.clutter_text.set_password_char(passwordChar); this._entry.menu.isPassword = passwordChar != ''; - this._capsLockWarningLabel.visible = passwordChar !== ''; } setQuestion(question) { - if (this._preemptiveAnswerWatchId) { - this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); - this._preemptiveAnswerWatchId = 0; - } - this._label.set_text(question); - this._authList.actor.hide(); this._label.show(); this._entry.show(); this._entry.grab_key_focus(); } - _fadeInChoiceList() { - this._authList.actor.opacity = 0; - this._authList.actor.show(); - this._authList.actor.reactive = false; - Tweener.addTween(this._authList.actor, - { opacity: 255, - time: MESSAGE_FADE_OUT_ANIMATION_TIME, - transition: 'easeOutQuad', - onComplete: () => { - this._authList.actor.reactive = true; - } - }); - } - - setChoiceList(promptMessage, choiceList) { - this._authList.clear(); - this._authList.label.text = promptMessage; - for (let key in choiceList) { - let text = choiceList[key]; - this._authList.addItem(key, text); - } - - this._label.hide(); - this._entry.hide(); - if (this._message.text == "") - this._message.hide(); - this._fadeInChoiceList(); - } - getAnswer() { let text; @@ -517,7 +385,6 @@ var AuthPrompt = class { else this._message.remove_style_class_name('login-dialog-message-hint'); - this._message.show(); if (message) { Tweener.removeTweens(this._message); this._message.text = message; @@ -533,7 +400,7 @@ var AuthPrompt = class { } updateSensitivity(sensitive) { - this._updateNextButtonSensitivity(sensitive && !this._authList.actor.visible && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING)); + this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING)); this._entry.reactive = sensitive; this._entry.clutter_text.editable = sensitive; } @@ -560,19 +427,6 @@ var AuthPrompt = class { } } - _onUserStoppedTypePreemptiveAnswer() { - if (!this._preemptiveAnswerWatchId || - this._preemptiveAnswer || - this._queryingService) - return; - - this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); - this._preemptiveAnswerWatchId = 0; - - this._entry.text = ''; - this.updateSensitivity(false); - } - reset() { let oldStatus = this.verificationStatus; this.verificationStatus = AuthPromptStatus.NOT_VERIFYING; @@ -580,12 +434,6 @@ var AuthPrompt = class { this.nextButton.label = _("Next"); this._preemptiveAnswer = null; - if (this._preemptiveAnswerWatchId) { - this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId); - } - this._preemptiveAnswerWatchId = this._idleMonitor.add_idle_watch (500, - this._onUserStoppedTypePreemptiveAnswer.bind(this)); - if (this._userVerifier) this._userVerifier.cancel(); diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 214c2f5..6c4d135 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -406,11 +406,6 @@ var LoginDialog = GObject.registerClass({ this._userManager = AccountsService.UserManager.get_default() this._gdmClient = new Gdm.Client(); - try { - this._gdmClient.set_enabled_extensions([Gdm.UserVerifierChoiceList.interface_info().name]); - } catch(e) { - } - this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA }); this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_KEY, @@ -739,9 +734,6 @@ var LoginDialog = GObject.registerClass({ if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING) this._authPrompt.reset(); - - if (this._disableUserList && this._timedLoginUserListHold) - this._timedLoginUserListHold.release(); } } @@ -1028,31 +1020,16 @@ var LoginDialog = GObject.registerClass({ let loginItem = null; let animationTime; - let tasks = [() => { - if (this._disableUserList) - return; - - this._timedLoginUserListHold = this._waitForItemForUser(userName); - - return this._timedLoginUserListHold; - }, + let tasks = [() => this._waitForItemForUser(userName), () => { - this._timedLoginUserListHold = null; - - - loginItem = this._disableUserList - ? this._authPrompt - : this._userList.getItemFromUserName(userName); + loginItem = this._userList.getItemFromUserName(userName); // If there is an animation running on the item, reset it. loginItem.hideTimedLoginIndicator(); }, () => { - if (this._disableUserList) - return; - // If we're just starting out, start on the right item. if (!this._userManager.is_loaded) { this._userList.jumpToItem(loginItem); @@ -1074,9 +1051,6 @@ var LoginDialog = GObject.registerClass({ }, () => { - if (this._disableUserList) - return; - // If idle timeout is done, make sure the timed login indicator is shown if (delay > _TIMED_LOGIN_IDLE_THRESHOLD && this._authPrompt.actor.visible) diff --git a/js/gdm/realmd.js b/js/gdm/realmd.js index 04cd997..50f3c58 100644 --- a/js/gdm/realmd.js +++ b/js/gdm/realmd.js @@ -21,7 +21,6 @@ var Manager = class { '/org/freedesktop/realmd', this._reloadRealms.bind(this)) this._realms = {}; - this._loginFormat = null; this._signalId = this._aggregateProvider.connect('g-properties-changed', (proxy, properties) => { @@ -87,7 +86,7 @@ var Manager = class { } get loginFormat() { - if (this._loginFormat) + if (this._loginFormat !== undefined) return this._loginFormat; this._updateLoginFormat(); diff --git a/js/gdm/util.js b/js/gdm/util.js index 9e24913..2e99352 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -126,6 +126,7 @@ var ShellUserVerifier = class { this._settings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA }); this._settings.connect('changed', this._updateDefaultService.bind(this)); + this._updateDefaultService(); this._fprintManager = Fprint.FprintManager(); this._smartcardManager = SmartcardManager.getSmartcardManager(); @@ -137,8 +138,6 @@ var ShellUserVerifier = class { this.smartcardDetected = false; this._checkForSmartcard(); - this._updateDefaultService(); - this._smartcardInsertedId = this._smartcardManager.connect('smartcard-inserted', this._checkForSmartcard.bind(this)); this._smartcardRemovedId = this._smartcardManager.connect('smartcard-removed', @@ -192,10 +191,6 @@ var ShellUserVerifier = class { if (this._userVerifier) { this._userVerifier.run_dispose(); this._userVerifier = null; - if (this._userVerifierChoiceList) { - this._userVerifierChoiceList.run_dispose(); - this._userVerifierChoiceList = null; - } } } @@ -223,10 +218,6 @@ var ShellUserVerifier = class { this._oVirtCredentialsManager = null; } - selectChoice(serviceName, key) { - this._userVerifierChoiceList.call_select_choice(serviceName, key, this._cancellable, null); - } - answerQuery(serviceName, answer) { if (!this.hasPendingMessages) { this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null); @@ -335,8 +326,6 @@ var ShellUserVerifier = class { else if (this._preemptingService == SMARTCARD_SERVICE_NAME) this._preemptingService = null; - this._updateDefaultService(); - this.emit('smartcard-status-changed'); } } @@ -370,11 +359,6 @@ var ShellUserVerifier = class { return; } - if (client.get_user_verifier_choice_list) - this._userVerifierChoiceList = client.get_user_verifier_choice_list(); - else - this._userVerifierChoiceList = null; - this.reauthenticating = true; this._connectSignals(); this._beginVerification(); @@ -392,11 +376,6 @@ var ShellUserVerifier = class { return; } - if (client.get_user_verifier_choice_list) - this._userVerifierChoiceList = client.get_user_verifier_choice_list(); - else - this._userVerifierChoiceList = null; - this._connectSignals(); this._beginVerification(); this._hold.release(); @@ -410,9 +389,6 @@ var ShellUserVerifier = class { this._userVerifier.connect('conversation-stopped', this._onConversationStopped.bind(this)); this._userVerifier.connect('reset', this._onReset.bind(this)); this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this)); - - if (this._userVerifierChoiceList) - this._userVerifierChoiceList.connect('choice-query', this._onChoiceListQuery.bind(this)); } _getForegroundService() { @@ -431,9 +407,7 @@ var ShellUserVerifier = class { } _updateDefaultService() { - if (this._smartcardManager.loggedInWithToken()) - this._defaultService = SMARTCARD_SERVICE_NAME; - else if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY)) + if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY)) this._defaultService = PASSWORD_SERVICE_NAME; else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY)) this._defaultService = SMARTCARD_SERVICE_NAME; @@ -489,13 +463,6 @@ var ShellUserVerifier = class { this._startService(FINGERPRINT_SERVICE_NAME); } - _onChoiceListQuery(client, serviceName, promptMessage, list) { - if (!this.serviceIsForeground(serviceName)) - return; - - this.emit('show-choice-list', serviceName, promptMessage, list.deep_unpack()); - } - _onInfo(client, serviceName, info) { if (this.serviceIsForeground(serviceName)) { this._queueMessage(info, MessageType.INFO); diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml index 002b202..836d1c6 100644 --- a/js/js-resources.gresource.xml +++ b/js/js-resources.gresource.xml @@ -1,7 +1,6 @@ - gdm/authList.js gdm/authPrompt.js gdm/batch.js gdm/fingerprint.js diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js index fb1e2b5..cf308b3 100644 --- a/js/misc/extensionUtils.js +++ b/js/misc/extensionUtils.js @@ -13,8 +13,7 @@ const FileUtils = imports.misc.fileUtils; var ExtensionType = { SYSTEM: 1, - PER_USER: 2, - SESSION_MODE: 3 + PER_USER: 2 }; // Maps uuid -> metadata object diff --git a/js/misc/introspect.js b/js/misc/introspect.js index 7c62113..f7a7f2f 100644 --- a/js/misc/introspect.js +++ b/js/misc/introspect.js @@ -1,11 +1,9 @@ -const { Gio, GLib, Meta, Shell, St } = imports.gi; +const { Gio, GLib, Meta, Shell } = imports.gi; const INTROSPECT_SCHEMA = 'org.gnome.shell'; const INTROSPECT_KEY = 'introspect'; const APP_WHITELIST = ['org.freedesktop.impl.portal.desktop.gtk']; -const INTROSPECT_DBUS_API_VERSION = 2; - const { loadInterfaceXML } = imports.misc.fileUtils; const IntrospectDBusIface = loadInterfaceXML('org.gnome.Shell.Introspect'); @@ -23,7 +21,6 @@ var IntrospectService = class { this._runningApplicationsDirty = true; this._activeApplication = null; this._activeApplicationDirty = true; - this._animationsEnabled = true; this._appSystem = Shell.AppSystem.get_default(); this._appSystem.connect('app-state-changed', @@ -32,9 +29,7 @@ var IntrospectService = class { this._syncRunningApplications(); }); - this._introspectSettings = new Gio.Settings({ - schema_id: INTROSPECT_SCHEMA, - }); + this._settings = new Gio.Settings({ schema_id: INTROSPECT_SCHEMA }); let tracker = Shell.WindowTracker.get_default(); tracker.connect('notify::focus-app', @@ -44,20 +39,6 @@ var IntrospectService = class { }); this._syncRunningApplications(); - - this._whitelistMap = new Map(); - APP_WHITELIST.forEach(appName => { - Gio.DBus.watch_name(Gio.BusType.SESSION, - appName, - Gio.BusNameWatcherFlags.NONE, - (conn, name, owner) => this._whitelistMap.set(name, owner), - (conn, name) => this._whitelistMap.delete(name)); - }); - - this._settings = St.Settings.get(); - this._settings.connect('notify::enable-animations', - this._syncAnimationsEnabled.bind(this)); - this._syncAnimationsEnabled(); } _isStandaloneApp(app) { @@ -67,16 +48,11 @@ var IntrospectService = class { } _isIntrospectEnabled() { - return this._introspectSettings.get_boolean(INTROSPECT_KEY); + return this._settings.get_boolean(INTROSPECT_KEY); } _isSenderWhitelisted(sender) { - return [...this._whitelistMap.values()].includes(sender); - } - - _getSandboxedAppId(app) { - let ids = app.get_windows().map(w => w.get_sandboxed_app_id()); - return ids.find(id => id != null); + return APP_WHITELIST.includes(sender); } _syncRunningApplications() { @@ -100,10 +76,6 @@ var IntrospectService = class { newActiveApplication = app.get_id(); } - let sandboxedAppId = this._getSandboxedAppId(app); - if (sandboxedAppId) - appInfo['sandboxed-app-id'] = new GLib.Variant('s', sandboxedAppId); - newRunningApplications[app.get_id()] = appInfo; } @@ -130,18 +102,9 @@ var IntrospectService = class { type == Meta.WindowType.UTILITY); } - _isInvocationAllowed(invocation) { - if (this._isIntrospectEnabled()) - return true; - - if (this._isSenderWhitelisted(invocation.get_sender())) - return true; - - return false; - } - GetRunningApplicationsAsync(params, invocation) { - if (!this._isInvocationAllowed(invocation)) { + if (!this._isIntrospectEnabled() && + !this._isSenderWhitelisted(invocation.get_sender())) { invocation.return_error_literal(Gio.DBusError, Gio.DBusError.ACCESS_DENIED, 'App introspection not allowed'); @@ -156,7 +119,7 @@ var IntrospectService = class { let apps = this._appSystem.get_running(); let windowsList = {}; - if (!this._isInvocationAllowed(invocation)) { + if (!this._isIntrospectEnabled()) { invocation.return_error_literal(Gio.DBusError, Gio.DBusError.ACCESS_DENIED, 'App introspection not allowed'); @@ -174,7 +137,6 @@ var IntrospectService = class { let frameRect = window.get_frame_rect(); let title = window.get_title(); let wmClass = window.get_wm_class(); - let sandboxedAppId = window.get_sandboxed_app_id(); windowsList[windowId] = { 'app-id': GLib.Variant.new('s', app.get_id()), @@ -191,29 +153,8 @@ var IntrospectService = class { if (wmClass != null) windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass); - - if (sandboxedAppId != null) - windowsList[windowId]['sandboxed-app-id'] = - GLib.Variant.new('s', sandboxedAppId); } } invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList])); } - - _syncAnimationsEnabled() { - let wasAnimationsEnabled = this._animationsEnabled; - this._animationsEnabled = this._settings.enable_animations; - if (wasAnimationsEnabled !== this._animationsEnabled) { - let variant = new GLib.Variant('b', this._animationsEnabled); - this._dbusImpl.emit_property_changed('AnimationsEnabled', variant); - } - } - - get AnimationsEnabled() { - return this._animationsEnabled; - } - - get version() { - return INTROSPECT_DBUS_API_VERSION; - } }; diff --git a/js/misc/smartcardManager.js b/js/misc/smartcardManager.js index bb43c96..fda782d 100644 --- a/js/misc/smartcardManager.js +++ b/js/misc/smartcardManager.js @@ -112,12 +112,5 @@ var SmartcardManager = class { return true; } - loggedInWithToken() { - if (this._loginToken) - return true; - - return false; - } - }; Signals.addSignalMethods(SmartcardManager.prototype); diff --git a/js/ui/animation.js b/js/ui/animation.js index 58d7f40..c21b225 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -162,7 +162,7 @@ var Spinner = class extends AnimatedIcon { time: SPINNER_ANIMATION_TIME, transition: 'linear', onComplete: () => { - super.stop(); + this.stop(false); } }); } else { diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index cb2be7d..adaefa7 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -78,9 +78,15 @@ function _getFolderName(folder) { let name = folder.get_string('name'); if (folder.get_boolean('translate')) { - let translated = Shell.util_get_translated_folder_name(name); - if (translated !== null) - return translated; + let keyfile = new GLib.KeyFile(); + let path = 'desktop-directories/' + name; + + try { + keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE); + name = keyfile.get_locale_string('Desktop Entry', 'Name', null); + } catch(e) { + return name; + } } return name; @@ -137,14 +143,10 @@ class BaseAppView { return this._allItems; } - hasItem(id) { - return this._items[id] !== undefined; - } - addItem(icon) { let id = icon.id; - if (this.hasItem(id)) - throw new Error(`icon with id ${id} already added to view`) + if (this._items[id] !== undefined) + return; this._allItems.push(icon); this._items[id] = icon; @@ -294,7 +296,6 @@ var AllView = class AllView extends BaseAppView { this._eventBlocker.add_action(this._clickAction); this._displayingPopup = false; - this._currentPopupDestroyId = 0; this._availWidth = 0; this._availHeight = 0; @@ -339,21 +340,6 @@ var AllView = class AllView extends BaseAppView { super.removeAll(); } - _redisplay() { - let openFolderId = null; - if (this._displayingPopup && this._currentPopup) - openFolderId = this._currentPopup._source.id; - - super._redisplay(); - - if (openFolderId) { - let [folderToReopen] = this.folderIcons.filter(folder => folder.id == openFolderId); - - if (folderToReopen) - folderToReopen.open(); - } - } - _itemNameChanged(item) { // If an item's name changed, we can pluck it out of where it's // supposed to be and reinsert it where it's sorted. @@ -400,8 +386,6 @@ var AllView = class AllView extends BaseAppView { let folders = this._folderSettings.get_strv('folder-children'); folders.forEach(id => { - if (this.hasItem(id)) - return; let path = this._folderSettings.path + 'folders/' + id + '/'; let icon = new FolderIcon(id, path, this); icon.connect('name-changed', this._itemNameChanged.bind(this)); @@ -599,22 +583,7 @@ var AllView = class AllView extends BaseAppView { this._stack.add_actor(popup.actor); popup.connect('open-state-changed', (popup, isOpen) => { this._eventBlocker.reactive = isOpen; - - if (this._currentPopup) { - this._currentPopup.actor.disconnect(this._currentPopupDestroyId); - this._currentPopupDestroyId = 0; - } - - this._currentPopup = null; - - if (isOpen) { - this._currentPopup = popup; - this._currentPopupDestroyId = popup.actor.connect('destroy', () => { - this._currentPopup = null; - this._currentPopupDestroyId = 0; - this._eventBlocker.reactive = false; - }); - } + this._currentPopup = isOpen ? popup : null; this._updateIconOpacities(isOpen); if(!isOpen) this._closeSpaceForPopup(); @@ -1001,8 +970,8 @@ var AppSearchProvider = class AppSearchProvider { let results = []; groups.forEach(group => { group = group.filter(appID => { - const app = this._appSys.lookup_app(appID); - return app && app.app_info.should_show(); + let app = Gio.DesktopAppInfo.new(appID); + return app && app.should_show(); }); results = results.concat(group.sort( (a, b) => usage.compare(a, b) @@ -1160,8 +1129,11 @@ var FolderIcon = class FolderIcon { this.view = new FolderView(); - this.actor.connect('clicked', this.open.bind(this)); - this.actor.connect('destroy', this.onDestroy.bind(this)); + this.actor.connect('clicked', () => { + this._ensurePopup(); + this.view.actor.vscroll.adjustment.value = 0; + this._openSpaceForPopup(); + }); this.actor.connect('notify::mapped', () => { if (!this.actor.mapped && this._popup) this._popup.popdown(); @@ -1171,24 +1143,6 @@ var FolderIcon = class FolderIcon { this._redisplay(); } - onDestroy() { - this.view.actor.destroy(); - - if (this._spaceReadySignalId) { - this._parentView.disconnect(this._spaceReadySignalId); - this._spaceReadySignalId = 0; - } - - if (this._popup) - this._popup.actor.destroy(); - } - - open() { - this._ensurePopup(); - this.view.actor.vscroll.adjustment.value = 0; - this._openSpaceForPopup(); - } - getAppIds() { return this.view.getAllItems().map(item => item.id); } @@ -1211,10 +1165,7 @@ var FolderIcon = class FolderIcon { let excludedApps = this._folder.get_strv('excluded-apps'); let appSys = Shell.AppSystem.get_default(); let addAppId = appId => { - if (this.view.hasItem(appId)) - return; - - if (excludedApps.includes(appId)) + if (excludedApps.indexOf(appId) >= 0) return; let app = appSys.lookup_app(appId); @@ -1256,9 +1207,8 @@ var FolderIcon = class FolderIcon { } _openSpaceForPopup() { - this._spaceReadySignalId = this._parentView.connect('space-ready', () => { - this._parentView.disconnect(this._spaceReadySignalId); - this._spaceReadySignalId = 0; + let id = this._parentView.connect('space-ready', () => { + this._parentView.disconnect(id); this._popup.popup(); this._updatePopupPosition(); }); @@ -1370,15 +1320,6 @@ var AppFolderPopup = class AppFolderPopup { }); this._grabHelper.addActor(Main.layoutManager.overviewGroup); this.actor.connect('key-press-event', this._onKeyPress.bind(this)); - this.actor.connect('destroy', this._onDestroy.bind(this)); - } - - _onDestroy() { - if (this._isOpen) { - this._isOpen = false; - this._grabHelper.ungrab({ actor: this.actor }); - this._grabHelper = null; - } } _onKeyPress(actor, event) { @@ -1537,20 +1478,6 @@ var AppIcon = class AppIcon { this.actor.connect('clicked', this._onClicked.bind(this)); this.actor.connect('popup-menu', this._onKeyboardPopupMenu.bind(this)); - this._hoverText = null; - this._hoverTimeoutId = 0; - - if (this.icon.label) { - this._hoverText = new St.Label({ style_class: 'app-well-hover-text', - text: this.icon.label.text, - visible: false }); - this._hoverText.clutter_text.line_wrap = true; - Main.layoutManager.addChrome(this._hoverText); - - this.actor.connect('notify::hover', this._syncHoverText.bind(this)); - this.connect('sync-tooltip', this._syncHoverText.bind(this)); - } - this._menu = null; this._menuManager = new PopupMenu.PopupMenuManager(this); @@ -1582,39 +1509,12 @@ var AppIcon = class AppIcon { this.app.disconnect(this._stateChangedId); this._stateChangedId = 0; this._removeMenuTimeout(); - this._removeHoverTimeout(); - if (this._hoverText) - this._hoverText.destroy(); - this._hoverText = null; } _createIcon(iconSize) { return this.app.create_icon_texture(iconSize); } - _syncHoverText() { - if (this.shouldShowTooltip()) { - if (this._hoverTimeoutId) - return; - - this._hoverTimeoutId = Mainloop.timeout_add(300, () => { - this._hoverText.style = `max-width: ${2 * this.icon.iconSize}px;`; - this._hoverText.ensure_style(); - - let [x, y] = this.icon.label.get_transformed_position(); - let offset = (this._hoverText.width - this.icon.label.width) / 2; - this._hoverText.set_position(Math.floor(x - offset), Math.floor(y)); - this._hoverText.show(); - - this._hoverTimeoutId = 0; - return GLib.SOURCE_REMOVE; - }); - } else { - this._removeHoverTimeout(); - this._hoverText.hide(); - } - } - _removeMenuTimeout() { if (this._menuTimeoutId > 0) { Mainloop.source_remove(this._menuTimeoutId); @@ -1622,13 +1522,6 @@ var AppIcon = class AppIcon { } } - _removeHoverTimeout() { - if (this._hoverTimeoutId > 0) { - Mainloop.source_remove(this._hoverTimeoutId); - this._hoverTimeoutId = 0; - } - } - _updateRunningStyle() { if (this.app.state != Shell.AppState.STOPPED) this._dot.show(); diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js index 1e44a16..657e159 100644 --- a/js/ui/appFavorites.js +++ b/js/ui/appFavorites.js @@ -49,7 +49,6 @@ const RENAMED_DESKTOP_IDS = { 'gnotski.desktop': 'org.gnome.Klotski.desktop', 'gtali.desktop': 'org.gnome.Tali.desktop', 'iagno.desktop': 'org.gnome.Reversi.desktop', - 'mozilla-firefox.desktop': 'firefox.desktop', 'nautilus.desktop': 'org.gnome.Nautilus.desktop', 'org.gnome.gnome-2048.desktop': 'org.gnome.TwentyFortyEight.desktop', 'org.gnome.taquin.desktop': 'org.gnome.Taquin.desktop', diff --git a/js/ui/background.js b/js/ui/background.js index 466cc4d..06e0388 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -254,7 +254,7 @@ var Background = class Background { (lm, aboutToSuspend) => { if (aboutToSuspend) return; - this.emit('changed'); + this._refreshAnimation(); }); this._settingsChangedSignalId = this._settings.connect('changed', () => { @@ -527,15 +527,10 @@ var BackgroundSource = class BackgroundSource { let monitorManager = Meta.MonitorManager.get(); this._monitorsChangedId = monitorManager.connect('monitors-changed', - this._refresh.bind(this)); - - global.display.connect('gl-video-memory-purged', () => { - Meta.Background.refresh_all(); - this._refresh(); - }); + this._onMonitorsChanged.bind(this)); } - _refresh() { + _onMonitorsChanged() { for (let monitorIndex in this._backgrounds) { let background = this._backgrounds[monitorIndex]; diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 3ae2e44..cd3e879 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -791,9 +791,8 @@ var EventsSection = class EventsSection extends MessageList.MessageListSection { this._title.connect('clicked', this._onTitleClicked.bind(this)); this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this)); - this._appSys = Shell.AppSystem.get_default(); - this._appSys.connect('installed-changed', - this._appInstalledChanged.bind(this)); + Shell.AppSystem.get_default().connect('installed-changed', + this._appInstalledChanged.bind(this)); this._appInstalledChanged(); } @@ -884,13 +883,10 @@ var EventsSection = class EventsSection extends MessageList.MessageListSection { Main.overview.hide(); Main.panel.closeCalendar(); - let appInfo = this._getCalendarApp(); - if (app.get_id() == 'evolution.desktop') { - let app = this._appSys.lookup_app('evolution-calendar.desktop'); - if (app) - appInfo = app.app_info; - } - appInfo.launch([], global.create_app_launch_context(0, -1)); + let app = this._getCalendarApp(); + if (app.get_id() == 'evolution.desktop') + app = Gio.DesktopAppInfo.new('evolution-calendar.desktop'); + app.launch([], global.create_app_launch_context(0, -1)); } setDate(date) { diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js index 3512fb6..0d9f1e4 100644 --- a/js/ui/components/keyring.js +++ b/js/ui/components/keyring.js @@ -128,12 +128,6 @@ var KeyringDialog = class extends ModalDialog.ModalDialog { this.prompt.set_password_actor(this._passwordEntry ? this._passwordEntry.clutter_text : null); this.prompt.set_confirm_actor(this._confirmEntry ? this._confirmEntry.clutter_text : null); - if (this._passwordEntry || this._confirmEntry) { - this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(); - layout.attach(this._capsLockWarningLabel, 1, row, 1, 1); - row++; - } - if (this.prompt.choice_visible) { let choice = new CheckBox.CheckBox(); this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text', GObject.BindingFlags.SYNC_CREATE); diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 32d40fb..f871c73 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -95,14 +95,6 @@ var NetworkSecretDialog = class extends ModalDialog.ModalDialog { secret.entry.clutter_text.set_password_char('\u25cf'); } - if (this._content.secrets.some(s => s.password)) { - this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(); - if (rtl) - layout.attach(this._capsLockWarningLabel, 0, pos, 1, 1); - else - layout.attach(this._capsLockWarningLabel, 1, pos, 1, 1); - } - contentBox.messageBox.add(secretTable); if (flags & NM.SecretAgentGetSecretsFlags.WPS_PBC_ACTIVE) { diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index 734a217..21feb40 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -108,8 +108,6 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog { this.setInitialKeyFocus(this._passwordEntry); this._passwordBox.hide(); - this._capsLockWarningLabel = new ShellEntry.CapsLockWarning({ style_class: 'prompt-dialog-caps-lock-warning' }); - content.messageBox.add(this._capsLockWarningLabel); this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' }); this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; diff --git a/js/ui/environment.js b/js/ui/environment.js index a9cc16d..e22ec74 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -11,9 +11,6 @@ imports.gi.versions.TelepathyLogger = '0.2'; const { Clutter, GLib, Shell, St } = imports.gi; const Gettext = imports.gettext; -const System = imports.system; - -let _localTimeZone = null; // We can't import shell JS modules yet, because they may have // variable initializations, etc, that depend on init() already having @@ -113,26 +110,9 @@ function init() { } }; - // Override to clear our own timezone cache as well - const origClearDateCaches = System.clearDateCaches; - System.clearDateCaches = function () { - _localTimeZone = null; - origClearDateCaches(); - }; - // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783 Date.prototype.toLocaleFormat = function(format) { - if (_localTimeZone === null) - _localTimeZone = GLib.TimeZone.new_local(); - - let dt = GLib.DateTime.new(_localTimeZone, - this.getFullYear(), - this.getMonth() + 1, - this.getDate(), - this.getHours(), - this.getMinutes(), - this.getSeconds()); - return dt ? dt.format(format) : ''; + return Shell.util_format_date(format, this.getTime()); }; let slowdownEnv = GLib.getenv('GNOME_SHELL_SLOWDOWN_FACTOR'); diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index eb820ba..6244c39 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -1,9 +1,8 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Gio, GLib, St } = imports.gi; +const { Gio, St } = imports.gi; const Signals = imports.signals; -const Config = imports.misc.config; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; @@ -313,36 +312,6 @@ function _onVersionValidationChanged() { } } -function _doUpdateCheck() { - let version = Config.PACKAGE_VERSION.split('.'); - if (parseInt(version[1]) % 2 == 0) - version.pop(); - - let pkgCacheDir = GLib.get_user_cache_dir() + '/gnome-shell/'; - let updateStamp = Gio.file_new_for_path(pkgCacheDir + - 'update-check-' + version.join('.')); - if (updateStamp.query_exists(null)) - return; - - GLib.mkdir_with_parents (pkgCacheDir, 0o755); - updateStamp.create(0, null).close(null); - - let nOutdated = enabledExtensions.reduce(function(n, uuid) { - let extension = ExtensionUtils.extensions[uuid]; - if (extension && extension.state == ExtensionState.OUT_OF_DATE) - n++; - return n; - }, 0); - - if (nOutdated == 0) - return; - - Main.notify(ngettext("%d extension is out of date", - "%d extensions are out of date", - nOutdated).format(nOutdated), - _("You can visit http://extensions.gnome.org for updates")); -} - function _loadExtensions() { global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged); global.settings.connect('changed::' + DISABLE_USER_EXTENSIONS_KEY, onEnabledExtensionsChanged); @@ -353,11 +322,8 @@ function _loadExtensions() { let finder = new ExtensionUtils.ExtensionFinder(); finder.connect('extension-found', (finder, extension) => { loadExtension(extension); - if (Main.sessionMode.enabledExtensions.indexOf(extension.uuid) != -1) - extension.type = ExtensionUtils.ExtensionType.SESSION_MODE; }); finder.scanExtensions(); - _doUpdateCheck(); } function enableAllExtensions() { diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 1f05e67..d51a443 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -210,8 +210,6 @@ var IconGrid = GObject.registerClass({ this.rightPadding = 0; this.leftPadding = 0; - this._updateIconSizesLaterId = 0; - this._items = []; this._clonesAnimating = []; // Pulled from CSS, but hardcode some defaults here @@ -229,14 +227,6 @@ var IconGrid = GObject.registerClass({ this.connect('actor-added', this._childAdded.bind(this)); this.connect('actor-removed', this._childRemoved.bind(this)); - this.connect('destroy', this._onDestroy.bind(this)); - } - - _onDestroy() { - if (this._updateIconSizesLaterId) { - Meta.later_remove (this._updateIconSizesLaterId); - this._updateIconSizesLaterId = 0; - } } _keyFocusIn(actor) { @@ -767,14 +757,12 @@ var IconGrid = GObject.registerClass({ this._updateSpacingForSize(availWidth, availHeight); } - if (!this._updateIconSizesLaterId) - this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, - this._updateIconSizes.bind(this)); + Meta.later_add(Meta.LaterType.BEFORE_REDRAW, + this._updateIconSizes.bind(this)); } // Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up _updateIconSizes() { - this._updateIconSizesLaterId = 0; let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize); let newIconSize = Math.floor(ICON_SIZE * scale); for (let i in this._items) { diff --git a/js/ui/layout.js b/js/ui/layout.js index beb4c0a..30e750d 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; +const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi; const Signals = imports.signals; const Background = imports.ui.background; @@ -267,13 +267,6 @@ var LayoutManager = GObject.registerClass({ this._backgroundGroup.lower_bottom(); this._bgManagers = []; - this._interfaceSettings = new Gio.Settings({ - schema_id: 'org.gnome.desktop.interface' - }); - - this._interfaceSettings.connect('changed::enable-hot-corners', - this._updateHotCorners.bind(this)); - // Need to update struts on new workspaces when they are added let workspaceManager = global.workspace_manager; workspaceManager.connect('notify::n-workspaces', @@ -289,6 +282,18 @@ var LayoutManager = GObject.registerClass({ monitorManager.connect('monitors-changed', this._monitorsChanged.bind(this)); this._monitorsChanged(); + + // NVIDIA drivers don't preserve FBO contents across + // suspend/resume, see + // https://bugzilla.gnome.org/show_bug.cgi?id=739178 + if (Shell.util_need_background_refresh()) { + LoginManager.getLoginManager().connect('prepare-for-sleep', + (lm, suspending) => { + if (suspending) + return; + Meta.Background.refresh_all(); + }); + } } // This is called by Main after everything else is constructed @@ -365,11 +370,6 @@ var LayoutManager = GObject.registerClass({ }); this.hotCorners = []; - if (!this._interfaceSettings.get_boolean('enable-hot-corners')) { - this.emit('hot-corners-changed'); - return; - } - let size = this.panelBox.height; // build new hot corners diff --git a/js/ui/main.js b/js/ui/main.js index 8dde95b..061303c 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -147,8 +147,6 @@ function _initializeUI() { _loadOskLayouts(); _loadDefaultStylesheet(); - new AnimationsSettings(); - // Setup the stage hierarchy early layoutManager = new Layout.LayoutManager(); @@ -202,11 +200,7 @@ function _initializeUI() { return true; }); - global.display.connect('gl-video-memory-purged', () => { - let cache = St.TextureCache.get_default(); - cache.clear(); - loadTheme(); - }); + global.display.connect('gl-video-memory-purged', loadTheme); // Provide the bus object for gnome-session to // initiate logouts. @@ -239,19 +233,6 @@ function _initializeUI() { ['MESSAGE_ID=' + GNOMESHELL_STARTED_MESSAGE_ID]); } - let credentials = new Gio.Credentials(); - if (credentials.get_unix_user() === 0) { - notify(_('Logged in as a privileged user'), - _('Running a session as a privileged user should be avoided for security reasons. If possible, you should log in as a normal user.')); - } - - if (sessionMode.currentMode !== 'gdm' && - sessionMode.currentMode !== 'initial-setup' && - screenShield === null) { - notify(_('Screen Lock disabled'), - _('Screen Locking requires the GNOME display manager.')); - } - let perfModuleName = GLib.getenv("SHELL_PERF_MODULE"); if (perfModuleName) { let perfOutput = GLib.getenv("SHELL_PERF_OUTPUT"); @@ -729,46 +710,3 @@ function showRestartMessage(message) { let restartMessage = new RestartMessage(message); restartMessage.open(); } - -var AnimationsSettings = class { - constructor() { - let backend = Meta.get_backend(); - if (!backend.is_rendering_hardware_accelerated()) { - St.Settings.get().inhibit_animations(); - return; - } - - let isXvnc = Shell.util_has_x11_display_extension( - global.display, 'VNC-EXTENSION'); - if (isXvnc) { - St.Settings.get().inhibit_animations(); - return; - } - - let remoteAccessController = backend.get_remote_access_controller(); - if (!remoteAccessController) - return; - - this._handles = new Set(); - remoteAccessController.connect('new-handle', - (_, handle) => this._onNewRemoteAccessHandle(handle)); - } - - _onRemoteAccessHandleStopped(handle) { - let settings = St.Settings.get(); - - settings.uninhibit_animations(); - this._handles.delete(handle); - } - - _onNewRemoteAccessHandle(handle) { - if (!handle.get_disable_animations()) - return; - - let settings = St.Settings.get(); - - settings.inhibit_animations(); - this._handles.add(handle); - handle.connect('stopped', this._onRemoteAccessHandleStopped.bind(this)); - } -}; diff --git a/js/ui/overview.js b/js/ui/overview.js index 5bad4cb..dc6ad18 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -80,7 +80,6 @@ var Overview = class { constructor() { this._overviewCreated = false; this._initCalled = false; - this._visible = false; Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index b4b3fe4..a4af472 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -555,14 +555,6 @@ var PadDiagram = GObject.registerClass({ this.add_actor(label); } - updateLabels(callback) { - for (let i = 0; i < this._labels.length; i++) { - let [label, action, idx, dir] = this._labels[i]; - let str = callback(action, idx, dir); - label.set_text(str); - } - } - _applyLabel(label, action, idx, dir, str) { if (str != null) { label.set_text(str); @@ -766,29 +758,17 @@ var PadOsd = class { global.display.request_pad_osd(pad, editionMode); } - _getActionText(type, number) { - let str = global.display.get_pad_action_label(this.padDevice, type, number); - return str ? str : _("None"); - } - _createLabel(type, number, dir) { - let label = new St.Label({ text: this._getActionText(type, number) }); + let str = global.display.get_pad_action_label(this.padDevice, type, number); + let label = new St.Label({ text: str ? str : _("None") }); this._padDiagram.addLabel(label, type, number, dir); } - _updateActionLabels() { - this._padDiagram.updateLabels(this._getActionText.bind(this)); - } - _onCapturedEvent(actor, event) { - let isModeSwitch = - (event.type() == Clutter.EventType.PAD_BUTTON_PRESS || - event.type() == Clutter.EventType.PAD_BUTTON_RELEASE) && - this.padDevice.get_mode_switch_button_group(event.get_button()) >= 0; - if (event.type() == Clutter.EventType.PAD_BUTTON_PRESS && event.get_source_device() == this.padDevice) { this._padDiagram.activateButton(event.get_button()); + let isModeSwitch = this.padDevice.get_mode_switch_button_group(event.get_button()) >= 0; /* Buttons that switch between modes cannot be edited */ if (this._editionMode && !isModeSwitch) @@ -797,11 +777,6 @@ var PadOsd = class { } else if (event.type() == Clutter.EventType.PAD_BUTTON_RELEASE && event.get_source_device() == this.padDevice) { this._padDiagram.deactivateButton(event.get_button()); - - if (isModeSwitch) { - this._endActionEdition(); - this._updateActionLabels(); - } return Clutter.EVENT_STOP; } else if (event.type() == Clutter.EventType.KEY_PRESS && (!this._editionMode || event.get_key_symbol() == Clutter.Escape)) { diff --git a/js/ui/panel.js b/js/ui/panel.js index ede1c2b..1648485 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -465,18 +465,11 @@ class ActivitiesButton extends PanelMenu.Button { this.actor.name = 'panelActivities'; - let box = new St.BoxLayout(); - this.actor.add_actor(box); - let iconFile = Gio.File.new_for_path('/usr/share/icons/hicolor/scalable/apps/start-here.svg'); - this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file: iconFile }), - style_class: 'panel-logo-icon' }); - box.add_actor(this._icon); - /* Translators: If there is no suitable word for "Activities" in your language, you can use the word for "Overview". */ this._label = new St.Label({ text: _("Activities"), y_align: Clutter.ActorAlign.CENTER }); - box.add_actor(this._label); + this.actor.add_actor(this._label); this.actor.label_actor = this._label; diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index d30c157..4481853 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -696,8 +696,7 @@ var PopupMenuBase = class { } _getMenuItems() { - const children = this.box.get_children().filter(a => a._delegate !== undefined); - return children.map(a => a._delegate).filter(item => { + return this.box.get_children().map(a => a._delegate).filter(item => { return item instanceof PopupBaseMenuItem || item instanceof PopupMenuSection; }); } @@ -801,10 +800,9 @@ var PopupMenu = class extends PopupMenuBase { let state = event.get_state(); - // if user has a modifier down (except capslock and numlock) + // if user has a modifier down (except capslock) // then don't handle the key press here state &= ~Clutter.ModifierType.LOCK_MASK; - state &= ~Clutter.ModifierType.MOD2_MASK; state &= Clutter.ModifierType.MODIFIER_MASK; if (state) diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 2d0a429..a005a20 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -513,10 +513,8 @@ var ScreenShield = class { this._smartcardManager = SmartcardManager.getSmartcardManager(); this._smartcardManager.connect('smartcard-inserted', (manager, token) => { - if (this._isLocked && token.UsedToLogin) { - this._wakeUpScreen(); + if (this._isLocked && token.UsedToLogin) this._liftShield(true, 0); - } }); this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager(); @@ -1200,8 +1198,6 @@ var ScreenShield = class { if (Main.sessionMode.currentMode == 'unlock-dialog') Main.sessionMode.popMode('unlock-dialog'); - this.emit('wake-up-screen'); - if (this._isGreeter) { // We don't want to "deactivate" any more than // this. In particular, we don't want to drop @@ -1223,9 +1219,6 @@ var ScreenShield = class { this._isModal = false; } - this._longLightbox.hide(); - this._shortLightbox.hide(); - Tweener.addTween(this._lockDialogGroup, { scale_x: 0, scale_y: 0, @@ -1242,6 +1235,8 @@ var ScreenShield = class { this._dialog = null; } + this._longLightbox.hide(); + this._shortLightbox.hide(); this.actor.hide(); if (this._becameActiveId != 0) { diff --git a/js/ui/screencast.js b/js/ui/screencast.js index 54f8fb5..0b0b14a 100644 --- a/js/ui/screencast.js +++ b/js/ui/screencast.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Gio, GLib, Meta, Shell } = imports.gi; +const { Gio, GLib, Shell } = imports.gi; const Signals = imports.signals; const Main = imports.ui.main; @@ -53,27 +53,16 @@ var ScreencastService = class { this._stopRecordingForSender(name); } - _stopRecordingForSender(sender, closeNow=false) { + _stopRecordingForSender(sender) { let recorder = this._recorders.get(sender); if (!recorder) return false; Gio.bus_unwatch_name(recorder._watchNameId); - if (closeNow) - recorder.close_now(); - else - recorder.close(); + recorder.close(); this._recorders.delete(sender); this.emit('updated'); - let connection = this._dbusImpl.get_connection(); - let info = this._dbusImpl.get_info(); - connection.emit_signal(sender, - this._dbusImpl.get_object_path(), - info ? info.name : null, - 'Stopped', - null); - return true; } @@ -89,53 +78,6 @@ var ScreencastService = class { recorder.set_draw_cursor(options['draw-cursor']); } - _ensureResourceScaleChangedHandler() { - if (this._resourceScaleChangedHandlerId) - return; - - this._resourceScaleChangedHandlerId = - global.stage.connect('notify::resource-scale', - () => { - for (let sender of this._recorders.keys()) { - let recorder = this._recorders.get(sender); - - if (!recorder.is_recording()) - continue; - - this._stopRecordingForSender(sender, true); - } - }); - } - - _ensureMonitorsChangedHandler() { - if (this._monitorsChangedHandlerId) - return; - - this._monitorsChangedHandlerId = Main.layoutManager.connect('monitors-changed', - () => { - for (let sender of this._recorders.keys()) { - let recorder = this._recorders.get(sender); - - if (!recorder.is_recording()) - continue; - - let geometry = recorder._geometry; - let screenWidth = global.screen_width; - let screenHeight = global.screen_height; - - if (recorder._isAreaScreecast) { - if (geometry.x + geometry.width > screenWidth || - geometry.y + geometry.height > screenHeight) - this._stopRecordingForSender(sender, true); - } else { - if (geometry.width != screenWidth || - geometry.height != screenHeight) - this._stopRecordingForSender(sender, true); - } - } - }); - } - ScreencastAsync(params, invocation) { let returnValue = [false, '']; if (!Main.sessionMode.allowScreencast || @@ -153,20 +95,8 @@ var ScreencastService = class { this._applyOptionalParameters(recorder, options); let [success, fileName] = recorder.record(); returnValue = [success, fileName ? fileName : '']; - if (success) { - recorder._isAreaScreecast = false; - recorder._geometry = - new Meta.Rectangle({ - x: 0, - y: 0, - width: global.screen_width, - height: global.screen_height - }); - this._ensureResourceScaleChangedHandler(); - this._ensureMonitorsChangedHandler(); - } else { + if (!success) this._stopRecordingForSender(sender); - } } invocation.return_value(GLib.Variant.new('(bs)', returnValue)); @@ -201,20 +131,8 @@ var ScreencastService = class { this._applyOptionalParameters(recorder, options); let [success, fileName] = recorder.record(); returnValue = [success, fileName ? fileName : '']; - if (success) { - recorder._isAreaScreecast = true; - recorder._geometry = - new Meta.Rectangle({ - x: x, - y: y, - width: width, - height: height - }); - this._ensureResourceScaleChangedHandler(); - this._ensureMonitorsChangedHandler(); - } else { + if (!success) this._stopRecordingForSender(sender); - } } invocation.return_value(GLib.Variant.new('(bs)', returnValue)); diff --git a/js/ui/scripting.js b/js/ui/scripting.js index eef8f38..d227b9e 100644 --- a/js/ui/scripting.js +++ b/js/ui/scripting.js @@ -3,10 +3,8 @@ const { Gio, GLib, Meta, Shell } = imports.gi; const Mainloop = imports.mainloop; -const Config = imports.misc.config; const Main = imports.ui.main; const Params = imports.misc.params; -const Util = imports.misc.util; const { loadInterfaceXML } = imports.misc.fileUtils; @@ -75,12 +73,6 @@ function _getPerfHelper() { return _perfHelper; } -function _spawnPerfHelper() { - let path = Config.LIBEXECDIR; - let command = `${path}/gnome-shell-perf-helper`; - Util.trySpawnCommandLine(command); -} - function _callRemote(obj, method, ...args) { return new Promise((resolve, reject) => { args.push((result, excp) => { @@ -278,25 +270,6 @@ function _collect(scriptModule, outputFile) { } } -async function _runPerfScript(scriptModule, outputFile) { - for (let step of scriptModule.run()) { - try { - await step; // eslint-disable-line no-await-in-loop - } catch (err) { - log(`Script failed: ${err}\n${err.stack}`); - Meta.exit(Meta.ExitCode.ERROR); - } - } - - try { - _collect(scriptModule, outputFile); - } catch (err) { - log(`Script failed: ${err}\n${err.stack}`); - Meta.exit(Meta.ExitCode.ERROR); - } - Meta.exit(Meta.ExitCode.SUCCESS); -} - /** * runPerfScript * @scriptModule: module object with run and finish functions @@ -337,13 +310,23 @@ async function _runPerfScript(scriptModule, outputFile) { * After running the script and collecting statistics from the * event log, GNOME Shell will exit. **/ -function runPerfScript(scriptModule, outputFile) { +async function runPerfScript(scriptModule, outputFile) { Shell.PerfLog.get_default().set_enabled(true); - _spawnPerfHelper(); - Gio.bus_watch_name(Gio.BusType.SESSION, - 'org.gnome.Shell.PerfHelper', - Gio.BusNameWatcherFlags.NONE, - () => _runPerfScript(scriptModule, outputFile), - null); + for (let step of scriptModule.run()) { + try { + await step; + } catch (err) { + log(`Script failed: ${err}\n${err.stack}`); + Meta.exit(Meta.ExitCode.ERROR); + } + } + + try { + _collect(scriptModule, outputFile); + } catch (err) { + log(`Script failed: ${err}\n${err.stack}`); + Meta.exit(Meta.ExitCode.ERROR); + } + Meta.exit(Meta.ExitCode.SUCCESS); } diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 112d60f..19d07ac 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -341,22 +341,6 @@ var GnomeShellExtensions = class { ExtensionDownloader.checkForUpdates(); } - LoadUserExtension(uuid) { - let extension = ExtensionUtils.extensions[uuid]; - if (extension) - return true; - - let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid])); - try { - extension = ExtensionUtils.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER); - ExtensionSystem.loadExtension(extension); - } catch (e) { - log('Could not load user extension from %s'.format(dir.get_path())); - return false; - } - return true; - } - get ShellVersion() { return Config.PACKAGE_VERSION; } diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index 4a30b22..79f1aad 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -1,12 +1,11 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter, GObject, Pango, Shell, St } = imports.gi; +const { Clutter, Shell, St } = imports.gi; const BoxPointer = imports.ui.boxpointer; const Main = imports.ui.main; const Params = imports.misc.params; const PopupMenu = imports.ui.popupMenu; -const Tweener = imports.ui.tweener; var EntryMenu = class extends PopupMenu.PopupMenu { constructor(entry) { @@ -171,58 +170,3 @@ function addContextMenu(entry, params) { entry._menuManager = null; }); } - -var CapsLockWarning = GObject.registerClass( -class CapsLockWarning extends St.Label { - _init(params) { - let defaultParams = { style_class: 'caps-lock-warning-label' }; - super._init(Object.assign(defaultParams, params)); - - this.text = _('Caps lock is on.'); - - this.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; - this.clutter_text.line_wrap = true; - - this._keymap = Clutter.get_default_backend().get_keymap(); - this._stateChangedId = 0; - - this.connect('notify::mapped', () => { - if (this.is_mapped()) { - this._stateChangedId = this._keymap.connect('state-changed', - () => this._sync(true)); - } else { - this._keymap.disconnect(this._stateChangedId); - this._stateChangedId = 0; - } - - this._sync(false); - }); - - this.connect('destroy', () => { - if (this._stateChangedId) - this._keymap.disconnect(this._stateChangedId); - }); - } - - _sync(animate) { - let capsLockOn = this._keymap.get_caps_lock_state(); - - Tweener.removeTweens(this); - - const naturalHeightSet = this.natural_height_set; - this.natural_height_set = false; - let [, height] = this.get_preferred_height(-1); - this.natural_height_set = naturalHeightSet; - - Tweener.addTween(this, { - height: capsLockOn ? height : 0, - opacity: capsLockOn ? 255 : 0, - time: animate ? 0.2 : 0, - transition: 'easeOutQuad', - onComplete: () => { - if (capsLockOn) - this.height = -1; - }, - }); - } -}); diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index 3a2377d..f976f40 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -305,9 +305,6 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog { this._passwordBox.add(this._passwordEntry, {expand: true }); this.setInitialKeyFocus(this._passwordEntry); - this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(); - content.messageBox.add(this._capsLockWarningLabel); - this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label', text: _("Sorry, that didn’t work. Please try again.") }); this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 90948d4..10223ec 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -154,14 +154,14 @@ class ATIndicator extends PanelMenu.Button { interfaceSettings.is_writable(KEY_ICON_THEME), enabled => { if (enabled) { - interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME); interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME); + interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME); } else if(!hasHC) { - interfaceSettings.set_string(KEY_ICON_THEME, iconTheme); interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme); + interfaceSettings.set_string(KEY_ICON_THEME, iconTheme); } else { - interfaceSettings.reset(KEY_ICON_THEME); interfaceSettings.reset(KEY_GTK_THEME); + interfaceSettings.reset(KEY_ICON_THEME); } }); return highContrast; diff --git a/js/ui/tweener.js b/js/ui/tweener.js index c04cede..bb9ea55 100644 --- a/js/ui/tweener.js +++ b/js/ui/tweener.js @@ -63,67 +63,30 @@ function _getTweenState(target) { return target.__ShellTweenerState; } -function _ensureHandlers(target) { - if (!target.__ShellTweenerHandlers) - target.__ShellTweenerHandlers = {}; - return target.__ShellTweenerHandlers; -} - function _resetTweenState(target) { let state = target.__ShellTweenerState; if (state) { - if (state.destroyedId) { + if (state.destroyedId) state.actor.disconnect(state.destroyedId); - delete state.destroyedId; - } } - _removeHandler(target, 'onComplete', _tweenCompleted); target.__ShellTweenerState = {}; } function _addHandler(target, params, name, handler) { - let wrapperNeeded = false; - let tweenerHandlers = _ensureHandlers(target); - - if (!(name in tweenerHandlers)) { - tweenerHandlers[name] = []; - wrapperNeeded = true; - } - - let handlers = tweenerHandlers[name]; - handlers.push(handler); - - if (wrapperNeeded) { - if (params[name]) { - let oldHandler = params[name]; - let oldScope = params[name + 'Scope']; - let oldParams = params[name + 'Params']; - let eventScope = oldScope ? oldScope : target; - - params[name] = () => { - oldHandler.apply(eventScope, oldParams); - handlers.forEach((h) => h(target)); - }; - } else { - params[name] = () => { handlers.forEach((h) => h(target)); }; - } - } -} - -function _removeHandler(target, name, handler) { - let tweenerHandlers = _ensureHandlers(target); - - if (name in tweenerHandlers) { - let handlers = tweenerHandlers[name]; - let handlerIndex = handlers.indexOf(handler); - - while (handlerIndex > -1) { - handlers.splice(handlerIndex, 1); - handlerIndex = handlers.indexOf(handler); - } - } + if (params[name]) { + let oldHandler = params[name]; + let oldScope = params[name + 'Scope']; + let oldParams = params[name + 'Params']; + let eventScope = oldScope ? oldScope : target; + + params[name] = () => { + oldHandler.apply(eventScope, oldParams); + handler(target); + }; + } else + params[name] = () => { handler(target); }; } function _actorDestroyed(target) { diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index 4b0470f..5c9d460 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -33,14 +33,7 @@ var UnlockDialog = class { y_expand: true }); this.actor.add_child(this._promptBox); - this._gdmClient = new Gdm.Client(); - - try { - this._gdmClient.set_enabled_extensions([Gdm.UserVerifierChoiceList.interface_info().name]); - } catch(e) { - } - - this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, AuthPrompt.AuthPromptMode.UNLOCK_ONLY); + this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY); this._authPrompt.connect('failed', this._fail.bind(this)); this._authPrompt.connect('cancelled', this._fail.bind(this)); this._authPrompt.connect('reset', this._onReset.bind(this)); diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 6529ac9..7714655 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -301,13 +301,11 @@ var ViewSelector = class { _addPage(actor, name, a11yIcon, params) { params = Params.parse(params, { a11yFocus: null }); - let page = new St.Bin({ - x_align: St.Align.START, - y_align: St.Align.START, - x_fill: true, - y_fill: true, - }); - page.set_child(actor); + let page = new St.Bin({ child: actor, + x_align: St.Align.START, + y_align: St.Align.START, + x_fill: true, + y_fill: true }); if (params.a11yFocus) Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon); else diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js index a9a7111..abdb8a4 100644 --- a/js/ui/windowAttentionHandler.js +++ b/js/ui/windowAttentionHandler.js @@ -69,6 +69,8 @@ var Source = class WindowAttentionSource extends MessageTray.Source { () => { this.destroy(); })); this.signalIDs.push(this._window.connect('unmanaged', () => { this.destroy(); })); + + this.connect('destroy', this._onDestroy.bind(this)); } _sync() { @@ -77,6 +79,13 @@ var Source = class WindowAttentionSource extends MessageTray.Source { this.destroy(); } + _onDestroy() { + for(let i = 0; i < this.signalIDs.length; i++) { + this._window.disconnect(this.signalIDs[i]); + } + this.signalIDs = []; + } + _createPolicy() { if (this._app && this._app.get_app_info()) { let id = this._app.get_id().replace(/\.desktop$/,''); @@ -90,14 +99,6 @@ var Source = class WindowAttentionSource extends MessageTray.Source { return this._app.create_icon_texture(size); } - destroy(params) { - for (let i = 0; i < this.signalIDs.length; i++) - this._window.disconnect(this.signalIDs[i]); - this.signalIDs = []; - - super.destroy(params); - } - open() { Main.activateWindow(this._window); } diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index b2e938c..b9f5fef 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1037,6 +1037,7 @@ var WindowManager = class { if (this._gsdWacomProxy) { this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels); + this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode); } }); @@ -2144,8 +2145,6 @@ var WindowManager = class { let [action,,,target] = binding.get_name().split('-'); let newWs; let direction; - let vertical = workspaceManager.layout_rows == -1; - let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; if (action == 'move') { // "Moving" a window to another workspace doesn't make sense when @@ -2158,12 +2157,7 @@ var WindowManager = class { } if (target == 'last') { - if (vertical) - direction = Meta.MotionDirection.DOWN; - else if (rtl) - direction = Meta.MotionDirection.LEFT; - else - direction = Meta.MotionDirection.RIGHT; + direction = Meta.MotionDirection.DOWN; newWs = workspaceManager.get_workspace_by_index(workspaceManager.n_workspaces - 1); } else if (isNaN(target)) { // Prepend a new workspace dynamically @@ -2179,33 +2173,16 @@ var WindowManager = class { target--; newWs = workspaceManager.get_workspace_by_index(target); - if (workspaceManager.get_active_workspace().index() > target) { - if (vertical) - direction = Meta.MotionDirection.UP; - else if (rtl) - direction = Meta.MotionDirection.RIGHT; - else - direction = Meta.MotionDirection.LEFT; - } else { - if (vertical) - direction = Meta.MotionDirection.DOWN; - else if (rtl) - direction = Meta.MotionDirection.LEFT; - else - direction = Meta.MotionDirection.RIGHT; - } + if (workspaceManager.get_active_workspace().index() > target) + direction = Meta.MotionDirection.UP; + else + direction = Meta.MotionDirection.DOWN; } - if (workspaceManager.layout_rows == -1 && - direction != Meta.MotionDirection.UP && + if (direction != Meta.MotionDirection.UP && direction != Meta.MotionDirection.DOWN) return; - if (workspaceManager.layout_columns == -1 && - direction != Meta.MotionDirection.LEFT && - direction != Meta.MotionDirection.RIGHT) - return; - if (action == 'switch') this.actionMoveWorkspace(newWs); else diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index f8eb439..628f145 100644 --- a/js/ui/windowMenu.js +++ b/js/ui/windowMenu.js @@ -115,23 +115,6 @@ var WindowMenu = class extends PopupMenu.PopupMenu { window.change_workspace(workspace.get_neighbor(dir)); }); } - - let { workspaceManager } = global; - let nWorkspaces = workspaceManager.n_workspaces; - if (nWorkspaces > 1 && !Meta.prefs_get_dynamic_workspaces()) { - item = new PopupMenu.PopupSubMenuMenuItem(_("Move to another workspace")); - this.addMenuItem(item); - - let currentIndex = workspaceManager.get_active_workspace_index(); - for (let i = 0; i < nWorkspaces; i++) { - let index = i; - let name = Meta.prefs_get_workspace_name(i); - let subitem = item.menu.addAction(name, () => { - window.change_workspace_by_index(index, false); - }); - subitem.setSensitive(currentIndex != i); - } - } } } diff --git a/js/ui/workspace.js b/js/ui/workspace.js index d3679b4..9c58861 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -383,7 +383,7 @@ var WindowClone = class { return; let [x, y] = action.get_coords(); action.release(); - this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence, event.get_device()); + this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence); }); } else { this.emit('show-chrome'); diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js index d21c5de..26404ea 100644 --- a/js/ui/workspaceSwitcherPopup.js +++ b/js/ui/workspaceSwitcherPopup.js @@ -17,75 +17,41 @@ class WorkspaceSwitcherPopupList extends St.Widget { this._itemSpacing = 0; this._childHeight = 0; this._childWidth = 0; - this._orientation = global.workspace_manager.layout_rows == -1 - ? Clutter.Orientation.VERTICAL - : Clutter.Orientation.HORIZONTAL; this.connect('style-changed', () => { this._itemSpacing = this.get_theme_node().get_length('spacing'); }); } - _getPreferredSizeForOrientation(forSize) { + vfunc_get_preferred_height(forWidth) { let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex); let themeNode = this.get_theme_node(); - let availSize; - if (this._orientation == Clutter.Orientation.HORIZONTAL) - availSize = workArea.width - themeNode.get_horizontal_padding(); - else - availSize = workArea.height - themeNode.get_vertical_padding(); + let availHeight = workArea.height; + availHeight -= themeNode.get_vertical_padding(); - let size = 0; + let height = 0; for (let child of this.get_children()) { let [childMinHeight, childNaturalHeight] = child.get_preferred_height(-1); - let height = childNaturalHeight * workArea.width / workArea.height; - - if (this._orientation == Clutter.Orientation.HORIZONTAL) { - size += height * workArea.width / workArea.height; - } else { - size += height; - } + let [childMinWidth, childNaturalWidth] = child.get_preferred_width(childNaturalHeight); + height += childNaturalHeight * workArea.width / workArea.height; } let workspaceManager = global.workspace_manager; let spacing = this._itemSpacing * (workspaceManager.n_workspaces - 1); - size += spacing; - size = Math.min(size, availSize); - - if (this._orientation == Clutter.Orientation.HORIZONTAL) { - this._childWidth = (size - spacing) / workspaceManager.n_workspaces; - return themeNode.adjust_preferred_width(size, size); - } else { - this._childHeight = (size - spacing) / workspaceManager.n_workspaces; - return themeNode.adjust_preferred_height(size, size); - } - } - - _getSizeForOppositeOrientation() { - let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex); + height += spacing; + height = Math.min(height, availHeight); - if (this._orientation == Clutter.Orientation.HORIZONTAL) { - this._childHeight = Math.round(this._childWidth * workArea.height / workArea.width); - return [this._childHeight, this._childHeight]; - } else { - this._childWidth = Math.round(this._childHeight * workArea.width / workArea.height); - return [this._childWidth, this._childWidth]; - } - } + this._childHeight = (height - spacing) / workspaceManager.n_workspaces; - vfunc_get_preferred_height(forWidth) { - if (this._orientation == Clutter.Orientation.HORIZONTAL) - return this._getSizeForOppositeOrientation(); - else - return this._getPreferredSizeForOrientation(forWidth); + return themeNode.adjust_preferred_height(height, height); } vfunc_get_preferred_width(forHeight) { - if (this._orientation == Clutter.Orientation.HORIZONTAL) - return this._getPreferredSizeForOrientation(forHeight); - else - return this._getSizeForOppositeOrientation(); + let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex); + this._childWidth = Math.round(this._childHeight * workArea.width / workArea.height); + + return [this._childWidth, this._childWidth]; } vfunc_allocate(box, flags) { @@ -96,23 +62,15 @@ class WorkspaceSwitcherPopupList extends St.Widget { let childBox = new Clutter.ActorBox(); - let rtl = this.text_direction == Clutter.TextDirection.RTL; - let x = rtl ? box.x2 - this._childWidth : box.x1; let y = box.y1; + let prevChildBoxY2 = box.y1 - this._itemSpacing; for (let child of this.get_children()) { - childBox.x1 = Math.round(x); - childBox.x2 = Math.round(x + this._childWidth); - childBox.y1 = Math.round(y); + childBox.x1 = box.x1; + childBox.x2 = box.x1 + this._childWidth; + childBox.y1 = prevChildBoxY2 + this._itemSpacing; childBox.y2 = Math.round(y + this._childHeight); - - if (this._orientation == Clutter.Orientation.HORIZONTAL) { - if (rtl) - x -= this._childWidth + this._itemSpacing; - else - x += this._childWidth + this._itemSpacing; - } else { - y += this._childHeight + this._itemSpacing; - } + y += this._childHeight + this._itemSpacing; + prevChildBoxY2 = childBox.y2; child.allocate(childBox, flags); } } @@ -165,10 +123,6 @@ class WorkspaceSwitcherPopup extends St.Widget { indicator = new St.Bin({ style_class: 'ws-switcher-active-up' }); else if(i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.DOWN) indicator = new St.Bin({ style_class: 'ws-switcher-active-down' }); - else if(i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.LEFT) - indicator = new St.Bin({ style_class: 'ws-switcher-active-left' }); - else if(i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.RIGHT) - indicator = new St.Bin({ style_class: 'ws-switcher-active-right' }); else indicator = new St.Bin({ style_class: 'ws-switcher-box' }); diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 8ec610a..fe06d9d 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -181,32 +181,26 @@ var WorkspacesView = class extends WorkspacesViewBase { Tweener.removeTweens(workspace.actor); - let params = {}; - if (workspaceManager.layout_rows == -1) - params.y = (w - active) * this._fullGeometry.height; - else if (this.actor.text_direction == Clutter.TextDirection.RTL) - params.x = (active - w) * this._fullGeometry.width; - else - params.x = (w - active) * this._fullGeometry.width; + let y = (w - active) * this._fullGeometry.height; if (showAnimation) { - let tweenParams = Object.assign(params, { - time: WORKSPACE_SWITCH_TIME, - transition: 'easeOutQuad' - }); + let params = { y: y, + time: WORKSPACE_SWITCH_TIME, + transition: 'easeOutQuad' + }; // we have to call _updateVisibility() once before the // animation and once afterwards - it does not really // matter which tween we use, so we pick the first one ... if (w == 0) { this._updateVisibility(); - tweenParams.onComplete = () => { + params.onComplete = () => { this._animating = false; this._updateVisibility(); }; } - Tweener.addTween(workspace.actor, tweenParams); + Tweener.addTween(workspace.actor, params); } else { - workspace.actor.set(params); + workspace.actor.set_position(0, y); if (w == 0) this._updateVisibility(); } @@ -344,39 +338,22 @@ var WorkspacesView = class extends WorkspacesViewBase { metaWorkspace.activate(global.get_current_time()); } - if (adj.upper == 1) - return; - let last = this._workspaces.length - 1; + let firstWorkspaceY = this._workspaces[0].actor.y; + let lastWorkspaceY = this._workspaces[last].actor.y; + let workspacesHeight = lastWorkspaceY - firstWorkspaceY; - if (workspaceManager.layout_rows == -1) { - let firstWorkspaceY = this._workspaces[0].actor.y; - let lastWorkspaceY = this._workspaces[last].actor.y; - let workspacesHeight = lastWorkspaceY - firstWorkspaceY; - - let currentY = firstWorkspaceY; - let newY = -adj.value / (adj.upper - 1) * workspacesHeight; - - let dy = newY - currentY; - - for (let i = 0; i < this._workspaces.length; i++) { - this._workspaces[i].actor.visible = Math.abs(i - adj.value) <= 1; - this._workspaces[i].actor.y += dy; - } - } else { - let firstWorkspaceX = this._workspaces[0].actor.x; - let lastWorkspaceX = this._workspaces[last].actor.x; - let workspacesWidth = lastWorkspaceX - firstWorkspaceX; + if (adj.upper == 1) + return; - let currentX = firstWorkspaceX; - let newX = -adj.value / (adj.upper - 1) * workspacesWidth; + let currentY = firstWorkspaceY; + let newY = - adj.value / (adj.upper - 1) * workspacesHeight; - let dx = newX - currentX; + let dy = newY - currentY; - for (let i = 0; i < this._workspaces.length; i++) { - this._workspaces[i].actor.visible = Math.abs(i - adj.value) <= 1; - this._workspaces[i].actor.x += dx; - } + for (let i = 0; i < this._workspaces.length; i++) { + this._workspaces[i].actor.visible = Math.abs(i - adj.value) <= 1; + this._workspaces[i].actor.y += dy; } } }; @@ -521,19 +498,13 @@ var WorkspacesDisplay = class { this._scrollEventId = 0; this._keyPressEventId = 0; - this._actualGeometry = null; this._fullGeometry = null; } _onPan(action) { let [dist, dx, dy] = action.get_motion_delta(0); let adjustment = this._scrollAdjustment; - if (global.workspace_manager.layout_rows == -1) - adjustment.value -= (dy / this.actor.height) * adjustment.page_size; - else if (this.actor.text_direction == Clutter.TextDirection.RTL) - adjustment.value += (dx / this.actor.width) * adjustment.page_size; - else - adjustment.value -= (dx / this.actor.width) * adjustment.page_size; + adjustment.value -= (dy / this.actor.height) * adjustment.page_size; return false; } @@ -565,12 +536,7 @@ var WorkspacesDisplay = class { let workspaceManager = global.workspace_manager; let active = workspaceManager.get_active_workspace_index(); let adjustment = this._scrollAdjustment; - if (workspaceManager.layout_rows == -1) - adjustment.value = (active - yRel / this.actor.height) * adjustment.page_size; - else if (this.actor.text_direction == Clutter.TextDirection.RTL) - adjustment.value = (active + xRel / this.actor.width) * adjustment.page_size; - else - adjustment.value = (active - xRel / this.actor.width) * adjustment.page_size; + adjustment.value = (active - yRel / this.actor.height) * adjustment.page_size; } _onSwitchWorkspaceActivated(action, direction) { @@ -589,16 +555,13 @@ var WorkspacesDisplay = class { show(fadeOnPrimary) { this._updateWorkspacesViews(); - - if (this._actualGeometry && this._fullGeometry) { - for (let i = 0; i < this._workspacesViews.length; i++) { - let animationType; - if (fadeOnPrimary && i == this._primaryIndex) - animationType = AnimationType.FADE; - else - animationType = AnimationType.ZOOM; - this._workspacesViews[i].animateToOverview(animationType); - } + for (let i = 0; i < this._workspacesViews.length; i++) { + let animationType; + if (fadeOnPrimary && i == this._primaryIndex) + animationType = AnimationType.FADE; + else + animationType = AnimationType.ZOOM; + this._workspacesViews[i].animateToOverview(animationType); } this._restackedNotifyId = @@ -670,19 +633,12 @@ var WorkspacesDisplay = class { this._scrollValueChanged.bind(this)); } - // HACK: Avoid spurious allocation changes while updating views - view.actor.hide(); - this._workspacesViews.push(view); Main.layoutManager.overviewGroup.add_actor(view.actor); } - this._workspacesViews.forEach(v => v.actor.show()); - - if (this._fullGeometry) - this._syncWorkspacesFullGeometry(); - if (this._actualGeometry) - this._syncWorkspacesActualGeometry(); + this._updateWorkspacesFullGeometry(); + this._updateWorkspacesActualGeometry(); } _scrollValueChanged() { @@ -721,9 +677,6 @@ var WorkspacesDisplay = class { oldParent.disconnect(this._notifyOpacityId); this._notifyOpacityId = 0; - if (!this.actor.get_parent()) - return; - Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { let newParent = this.actor.get_parent(); if (!newParent) @@ -748,10 +701,10 @@ var WorkspacesDisplay = class { // the sliding controls were never slid in at all. setWorkspacesFullGeometry(geom) { this._fullGeometry = geom; - this._syncWorkspacesFullGeometry(); + this._updateWorkspacesFullGeometry(); } - _syncWorkspacesFullGeometry() { + _updateWorkspacesFullGeometry() { if (!this._workspacesViews.length) return; @@ -763,21 +716,18 @@ var WorkspacesDisplay = class { } _updateWorkspacesActualGeometry() { - const [x, y] = this.actor.get_transformed_position(); - const width = this.actor.allocation.get_width(); - const height = this.actor.allocation.get_height(); - - this._actualGeometry = { x, y, width, height }; - this._syncWorkspacesActualGeometry(); - } - - _syncWorkspacesActualGeometry() { if (!this._workspacesViews.length) return; + let [x, y] = this.actor.get_transformed_position(); + 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; for (let i = 0; i < monitors.length; i++) { - let geometry = i === this._primaryIndex ? this._actualGeometry : monitors[i]; + let geometry = (i == this._primaryIndex) ? primaryGeometry : monitors[i]; this._workspacesViews[i].setActualGeometry(geometry); } } @@ -805,12 +755,6 @@ var WorkspacesDisplay = class { case Clutter.ScrollDirection.DOWN: ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN); break; - case Clutter.ScrollDirection.LEFT: - ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT); - break; - case Clutter.ScrollDirection.RIGHT: - ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT); - break; default: return Clutter.EVENT_PROPAGATE; } diff --git a/meson.build b/meson.build index 0acaba7..21a80bc 100644 --- a/meson.build +++ b/meson.build @@ -57,7 +57,6 @@ localedir = join_paths(datadir, 'locale') portaldir = join_paths(datadir, 'xdg-desktop-portal', 'portals') schemadir = join_paths(datadir, 'glib-2.0', 'schemas') servicedir = join_paths(datadir, 'dbus-1', 'services') -themedir = join_paths(pkgdatadir, 'theme') # XXX: Once https://github.com/systemd/systemd/issues/9595 is fixed and we can # depend on this version, replace with something like: diff --git a/src/gnome-shell-perf-tool.in b/src/gnome-shell-perf-tool.in index 04072c4..f4b48f7 100755 --- a/src/gnome-shell-perf-tool.in +++ b/src/gnome-shell-perf-tool.in @@ -24,6 +24,52 @@ def show_version(option, opt_str, value, parser): print("GNOME Shell Performance Test @VERSION@") sys.exit() +def wait_for_dbus_name(wait_name): + loop = GLib.MainLoop() + + def on_name_appeared(connection, name, new_owner, *args): + if not (name == wait_name and new_owner != ''): + return + loop.quit() + return + + watch_id = Gio.bus_watch_name(Gio.BusType.SESSION, + wait_name, + Gio.BusNameWatcherFlags.NONE, + on_name_appeared, + None) + + def on_timeout(): + print("\nFailed to start %s: timed out" % (wait_name,)) + sys.exit(1) + GLib.timeout_add_seconds(7, on_timeout) + + loop.run() + Gio.bus_unwatch_name(watch_id) + +PERF_HELPER_NAME = "org.gnome.Shell.PerfHelper" +PERF_HELPER_IFACE = "org.gnome.Shell.PerfHelper" +PERF_HELPER_PATH = "/org/gnome/Shell/PerfHelper" + +def start_perf_helper(): + self_dir = os.path.dirname(os.path.abspath(sys.argv[0])) + perf_helper_path = "@libexecdir@/gnome-shell-perf-helper" + + subprocess.Popen([perf_helper_path]) + wait_for_dbus_name (PERF_HELPER_NAME) + +def stop_perf_helper(): + bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) + + proxy = Gio.DBusProxy.new_sync(bus, + Gio.DBusProxyFlags.NONE, + None, + PERF_HELPER_NAME, + PERF_HELPER_PATH, + PERF_HELPER_IFACE, + None) + proxy.Exit() + def start_shell(perf_output=None): # Set up environment env = dict(os.environ) @@ -45,13 +91,6 @@ def start_shell(perf_output=None): if options.replace: args.append('--replace') - if options.wayland or options.nested: - args.append('--wayland') - if options.nested: - args.append('--nested') - else: - args.append('--display-server') - return subprocess.Popen(args, env=env) def run_shell(perf_output=None): @@ -165,6 +204,8 @@ def run_performance_test(): logs = [] metric_summaries = {} + start_perf_helper() + for i in range(0, iters): # We create an empty temporary file that the shell will overwrite # with the contents. @@ -176,12 +217,14 @@ def run_performance_test(): try: normal_exit = run_shell(perf_output=output_file) except: + stop_perf_helper() raise finally: if not normal_exit: os.remove(output_file) if not normal_exit: + stop_perf_helper() return False try: @@ -189,6 +232,7 @@ def run_performance_test(): output = json.load(f) f.close() except: + stop_perf_helper() raise finally: os.remove(output_file) @@ -216,6 +260,8 @@ def run_performance_test(): logs.append(output['log']) + stop_perf_helper() + if options.perf_output or options.perf_upload: # Write a complete report, formatted as JSON. The Javascript/C code that # generates the individual reports we are summarizing here is very careful @@ -291,10 +337,6 @@ parser.add_option("", "--version", action="callback", callback=show_version, parser.add_option("-r", "--replace", action="store_true", help="Replace the running window manager") -parser.add_option("-w", "--wayland", action="store_true", - help="Run as a Wayland compositor") -parser.add_option("-n", "--nested", action="store_true", - help="Run as a Wayland nested compositor") options, args = parser.parse_args() diff --git a/src/meson.build b/src/meson.build index 2b911d3..97a5a79 100644 --- a/src/meson.build +++ b/src/meson.build @@ -108,7 +108,6 @@ endif libshell_private_headers = [ 'shell-app-private.h', - 'shell-app-cache-private.h', 'shell-app-system-private.h', 'shell-global-private.h', 'shell-window-tracker-private.h', @@ -147,9 +146,7 @@ if have_networkmanager libshell_sources += 'shell-network-agent.c' endif -libshell_private_sources = [ - 'shell-app-cache.c', -] +libshell_private_sources = [] if enable_recorder libshell_sources += ['shell-recorder.c'] diff --git a/src/shell-app-cache-private.h b/src/shell-app-cache-private.h deleted file mode 100644 index b73094a..0000000 --- a/src/shell-app-cache-private.h +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -#ifndef __SHELL_APP_CACHE_PRIVATE_H__ -#define __SHELL_APP_CACHE_PRIVATE_H__ - -#include -#include - -#define SHELL_TYPE_APP_CACHE (shell_app_cache_get_type()) - -G_DECLARE_FINAL_TYPE (ShellAppCache, shell_app_cache, SHELL, APP_CACHE, GObject) - -ShellAppCache *shell_app_cache_get_default (void); -GList *shell_app_cache_get_all (ShellAppCache *cache); -GDesktopAppInfo *shell_app_cache_get_info (ShellAppCache *cache, - const char *id); -char *shell_app_cache_translate_folder (ShellAppCache *cache, - const char *name); - -#endif /* __SHELL_APP_CACHE_PRIVATE_H__ */ diff --git a/src/shell-app-cache.c b/src/shell-app-cache.c deleted file mode 100644 index 15d4734..0000000 --- a/src/shell-app-cache.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -#include "config.h" - -#include "shell-app-cache-private.h" - -/** - * SECTION:shell-app-cache - * @title: ShellAppCache - * @short_description: application information cache - * - * The #ShellAppCache is responsible for caching information about #GAppInfo - * to ensure that the compositor thread never needs to perform disk reads to - * access them. All of the work is done off-thread. When the new data has - * been loaded, a #ShellAppCache::changed signal is emitted. - * - * Additionally, the #ShellAppCache caches information about translations for - * directories. This allows translation provided in [Desktop Entry] GKeyFiles - * to be available when building StLabel and other elements without performing - * costly disk reads. - * - * Various monitors are used to keep this information up to date while the - * Shell is running. - */ - -#define DEFAULT_TIMEOUT_SECONDS 5 - -struct _ShellAppCache -{ - GObject parent_instance; - - GAppInfoMonitor *monitor; - GPtrArray *dir_monitors; - GHashTable *folders; - GCancellable *cancellable; - GList *app_infos; - - guint queued_update; -}; - -typedef struct -{ - GList *app_infos; - GHashTable *folders; -} CacheState; - -G_DEFINE_TYPE (ShellAppCache, shell_app_cache, G_TYPE_OBJECT) - -enum { - CHANGED, - N_SIGNALS -}; - -static guint signals [N_SIGNALS]; - -static void -cache_state_free (CacheState *state) -{ - g_clear_pointer (&state->folders, g_hash_table_unref); - g_list_free_full (state->app_infos, g_object_unref); - g_slice_free (CacheState, state); -} - -static CacheState * -cache_state_new (void) -{ - CacheState *state; - - state = g_slice_new0 (CacheState); - state->folders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - - return g_steal_pointer (&state); -} - -/** - * shell_app_cache_get_default: - * - * Gets the default #ShellAppCache. - * - * Returns: (transfer none): a #ShellAppCache - */ -ShellAppCache * -shell_app_cache_get_default (void) -{ - static ShellAppCache *instance; - - if (instance == NULL) - { - instance = g_object_new (SHELL_TYPE_APP_CACHE, NULL); - g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *)&instance); - } - - return instance; -} - -static void -load_folder (GHashTable *folders, - const char *path) -{ - g_autoptr(GDir) dir = NULL; - const char *name; - - g_assert (folders != NULL); - g_assert (path != NULL); - - dir = g_dir_open (path, 0, NULL); - if (dir == NULL) - return; - - while ((name = g_dir_read_name (dir))) - { - g_autofree gchar *filename = NULL; - g_autoptr(GKeyFile) keyfile = NULL; - - /* First added wins */ - if (g_hash_table_contains (folders, name)) - continue; - - filename = g_build_filename (path, name, NULL); - keyfile = g_key_file_new (); - - if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, NULL)) - { - gchar *translated; - - translated = g_key_file_get_locale_string (keyfile, - "Desktop Entry", "Name", - NULL, NULL); - - if (translated != NULL) - g_hash_table_insert (folders, g_strdup (name), translated); - } - } -} - -static void -load_folders (GHashTable *folders) -{ - const char * const *dirs; - g_autofree gchar *userdir = NULL; - guint i; - - g_assert (folders != NULL); - - userdir = g_build_filename (g_get_user_data_dir (), "desktop-directories", NULL); - load_folder (folders, userdir); - - dirs = g_get_system_data_dirs (); - for (i = 0; dirs[i] != NULL; i++) - { - g_autofree gchar *sysdir = g_build_filename (dirs[i], "desktop-directories", NULL); - load_folder (folders, sysdir); - } -} - -static void -shell_app_cache_worker (GTask *task, - gpointer source_object, - gpointer task_data, - GCancellable *cancellable) -{ - CacheState *state; - - g_assert (G_IS_TASK (task)); - g_assert (SHELL_IS_APP_CACHE (source_object)); - - state = cache_state_new (); - state->app_infos = g_app_info_get_all (); - load_folders (state->folders); - - g_task_return_pointer (task, state, (GDestroyNotify) cache_state_free); -} - -static void -apply_update_cb (GObject *object, - GAsyncResult *result, - gpointer user_data) -{ - ShellAppCache *cache = (ShellAppCache *)object; - g_autoptr(GError) error = NULL; - CacheState *state; - - g_assert (SHELL_IS_APP_CACHE (cache)); - g_assert (G_IS_TASK (result)); - g_assert (user_data == NULL); - - state = g_task_propagate_pointer (G_TASK (result), &error); - - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - g_list_free_full (cache->app_infos, g_object_unref); - cache->app_infos = g_steal_pointer (&state->app_infos); - - g_clear_pointer (&cache->folders, g_hash_table_unref); - cache->folders = g_steal_pointer (&state->folders); - - g_signal_emit (cache, signals[CHANGED], 0); - - cache_state_free (state); -} - -static gboolean -shell_app_cache_do_update (gpointer user_data) -{ - ShellAppCache *cache = user_data; - g_autoptr(GTask) task = NULL; - - cache->queued_update = 0; - - /* Reset the cancellable state so we don't race with - * two updates coming back overlapped and applying the - * information in the wrong order. - */ - g_cancellable_cancel (cache->cancellable); - g_clear_object (&cache->cancellable); - cache->cancellable = g_cancellable_new (); - - task = g_task_new (cache, cache->cancellable, apply_update_cb, NULL); - g_task_set_source_tag (task, shell_app_cache_do_update); - g_task_run_in_thread (task, shell_app_cache_worker); - - return G_SOURCE_REMOVE; -} - -static void -shell_app_cache_queue_update (ShellAppCache *self) -{ - g_assert (SHELL_IS_APP_CACHE (self)); - - if (self->queued_update != 0) - g_source_remove (self->queued_update); - - self->queued_update = g_timeout_add_seconds (DEFAULT_TIMEOUT_SECONDS, - shell_app_cache_do_update, - self); -} - -static void -monitor_desktop_directories_for_data_dir (ShellAppCache *self, - const gchar *directory) -{ - g_autofree gchar *subdir = NULL; - g_autoptr(GFile) file = NULL; - g_autoptr(GFileMonitor) monitor = NULL; - - g_assert (SHELL_IS_APP_CACHE (self)); - - if (directory == NULL) - return; - - subdir = g_build_filename (directory, "desktop-directories", NULL); - file = g_file_new_for_path (subdir); - monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL); - - if (monitor != NULL) - { - g_file_monitor_set_rate_limit (monitor, DEFAULT_TIMEOUT_SECONDS * 1000); - g_signal_connect_object (monitor, - "changed", - G_CALLBACK (shell_app_cache_queue_update), - self, - G_CONNECT_SWAPPED); - g_ptr_array_add (self->dir_monitors, g_steal_pointer (&monitor)); - } -} - -static void -shell_app_cache_finalize (GObject *object) -{ - ShellAppCache *self = (ShellAppCache *)object; - - g_clear_object (&self->monitor); - - if (self->queued_update) - { - g_source_remove (self->queued_update); - self->queued_update = 0; - } - - g_clear_pointer (&self->dir_monitors, g_ptr_array_unref); - g_clear_pointer (&self->folders, g_hash_table_unref); - g_list_free_full (self->app_infos, g_object_unref); - - G_OBJECT_CLASS (shell_app_cache_parent_class)->finalize (object); -} - -static void -shell_app_cache_class_init (ShellAppCacheClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = shell_app_cache_finalize; - - /** - * ShellAppCache::changed: - * - * The "changed" signal is emitted when the cache has updated - * information about installed applications. - */ - signals [CHANGED] = - g_signal_new ("changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 0); -} - -static void -shell_app_cache_init (ShellAppCache *self) -{ - const gchar * const *sysdirs; - guint i; - - /* Monitor directories for translation changes */ - self->dir_monitors = g_ptr_array_new_with_free_func (g_object_unref); - monitor_desktop_directories_for_data_dir (self, g_get_user_data_dir ()); - sysdirs = g_get_system_data_dirs (); - for (i = 0; sysdirs[i] != NULL; i++) - monitor_desktop_directories_for_data_dir (self, sysdirs[i]); - - /* Load translated directory names immediately */ - self->folders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - load_folders (self->folders); - - /* Setup AppMonitor to track changes */ - self->monitor = g_app_info_monitor_get (); - g_signal_connect_object (self->monitor, - "changed", - G_CALLBACK (shell_app_cache_queue_update), - self, - G_CONNECT_SWAPPED); - self->app_infos = g_app_info_get_all (); -} - -/** - * shell_app_cache_get_all: - * @cache: (nullable): a #ShellAppCache or %NULL - * - * Like g_app_info_get_all() but always returns a - * cached set of application info so the caller can be - * sure that I/O will not happen on the current thread. - * - * Returns: (transfer none) (element-type GAppInfo): - * a #GList of references to #GAppInfo. - */ -GList * -shell_app_cache_get_all (ShellAppCache *cache) -{ - g_return_val_if_fail (SHELL_IS_APP_CACHE (cache), NULL); - - return cache->app_infos; -} - -/** - * shell_app_cache_get_info: - * @cache: (nullable): a #ShellAppCache or %NULL - * @id: the application id - * - * A replacement for g_desktop_app_info_new() that will lookup the - * information from the cache instead of (re)loading from disk. - * - * Returns: (nullable) (transfer none): a #GDesktopAppInfo or %NULL - */ -GDesktopAppInfo * -shell_app_cache_get_info (ShellAppCache *cache, - const char *id) -{ - const GList *iter; - - g_return_val_if_fail (SHELL_IS_APP_CACHE (cache), NULL); - - for (iter = cache->app_infos; iter != NULL; iter = iter->next) - { - GAppInfo *info = iter->data; - - if (g_strcmp0 (id, g_app_info_get_id (info)) == 0) - return G_DESKTOP_APP_INFO (info); - } - - return NULL; -} - -/** - * shell_app_cache_translate_folder: - * @cache: (nullable): a #ShellAppCache or %NULL - * @name: the folder name - * - * Gets the translated folder name for @name if any exists. - * - * Returns: (nullable): the translated string or %NULL if there is no - * translation. - */ -char * -shell_app_cache_translate_folder (ShellAppCache *cache, - const char *name) -{ - g_return_val_if_fail (SHELL_IS_APP_CACHE (cache), NULL); - - if (name == NULL) - return NULL; - - return g_strdup (g_hash_table_lookup (cache->folders, name)); -} diff --git a/src/shell-app-system.c b/src/shell-app-system.c index 828fa72..f632cbe 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -9,20 +9,11 @@ #include #include -#include "shell-app-cache-private.h" #include "shell-app-private.h" #include "shell-window-tracker-private.h" #include "shell-app-system-private.h" #include "shell-global.h" #include "shell-util.h" -#include "st.h" - -/* Rescan for at most RESCAN_TIMEOUT_MS * MAX_RESCAN_RETRIES. That - * should be plenty of time for even a slow spinning drive to update - * the icon cache. - */ -#define RESCAN_TIMEOUT_MS 2500 -#define MAX_RESCAN_RETRIES 6 /* Vendor prefixes are something that can be preprended to a .desktop * file name. Undo this. @@ -60,9 +51,6 @@ struct _ShellAppSystemPrivate { GHashTable *id_to_app; GHashTable *startup_wm_class_to_id; GList *installed_apps; - - guint rescan_icons_timeout_id; - guint n_rescan_retries; }; static void shell_app_system_finalize (GObject *object); @@ -95,14 +83,14 @@ static void scan_startup_wm_class_to_id (ShellAppSystem *self) { ShellAppSystemPrivate *priv = self->priv; - const GList *l; - GList *all; + GList *l; g_hash_table_remove_all (priv->startup_wm_class_to_id); - all = shell_app_cache_get_all (shell_app_cache_get_default ()); + g_list_free_full (priv->installed_apps, g_object_unref); + priv->installed_apps = g_app_info_get_all (); - for (l = all; l != NULL; l = l->next) + for (l = priv->installed_apps; l != NULL; l = l->next) { GAppInfo *info = l->data; const char *startup_wm_class, *id, *old_id; @@ -132,8 +120,7 @@ app_is_stale (ShellApp *app) if (shell_app_is_window_backed (app)) return FALSE; - info = shell_app_cache_get_info (shell_app_cache_get_default (), - shell_app_get_id (app)); + info = g_desktop_app_info_new (shell_app_get_id (app)); if (!info) return TRUE; @@ -158,6 +145,7 @@ app_is_stale (ShellApp *app) g_icon_equal (g_app_info_get_icon (old_info), g_app_info_get_icon (new_info)); + g_object_unref (info); return !is_unchanged; } @@ -169,52 +157,12 @@ stale_app_remove_func (gpointer key, return app_is_stale (value); } -static gboolean -rescan_icon_theme_cb (gpointer user_data) -{ - ShellAppSystemPrivate *priv; - ShellAppSystem *self; - StTextureCache *texture_cache; - gboolean rescanned; - - self = (ShellAppSystem *) user_data; - priv = self->priv; - - texture_cache = st_texture_cache_get_default (); - rescanned = st_texture_cache_rescan_icon_theme (texture_cache); - - priv->n_rescan_retries++; - - if (rescanned || priv->n_rescan_retries >= MAX_RESCAN_RETRIES) - { - priv->n_rescan_retries = 0; - priv->rescan_icons_timeout_id = 0; - return G_SOURCE_REMOVE; - } - - return G_SOURCE_CONTINUE; -} - static void -rescan_icon_theme (ShellAppSystem *self) +installed_changed (GAppInfoMonitor *monitor, + gpointer user_data) { - ShellAppSystemPrivate *priv = self->priv; - - priv->n_rescan_retries = 0; - - if (priv->rescan_icons_timeout_id > 0) - return; + ShellAppSystem *self = user_data; - priv->rescan_icons_timeout_id = g_timeout_add (RESCAN_TIMEOUT_MS, - rescan_icon_theme_cb, - self); -} - -static void -installed_changed (ShellAppCache *cache, - ShellAppSystem *self) -{ - rescan_icon_theme (self); scan_startup_wm_class_to_id (self); g_hash_table_foreach_remove (self->priv->id_to_app, stale_app_remove_func, NULL); @@ -226,7 +174,7 @@ static void shell_app_system_init (ShellAppSystem *self) { ShellAppSystemPrivate *priv; - ShellAppCache *cache; + GAppInfoMonitor *monitor; self->priv = priv = shell_app_system_get_instance_private (self); @@ -237,9 +185,9 @@ shell_app_system_init (ShellAppSystem *self) priv->startup_wm_class_to_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - cache = shell_app_cache_get_default (); - g_signal_connect (cache, "changed", G_CALLBACK (installed_changed), self); - installed_changed (cache, self); + monitor = g_app_info_monitor_get (); + g_signal_connect (monitor, "changed", G_CALLBACK (installed_changed), self); + installed_changed (monitor, self); } static void @@ -252,7 +200,6 @@ shell_app_system_finalize (GObject *object) g_hash_table_destroy (priv->id_to_app); g_hash_table_destroy (priv->startup_wm_class_to_id); g_list_free_full (priv->installed_apps, g_object_unref); - g_clear_handle_id (&priv->rescan_icons_timeout_id, g_source_remove); G_OBJECT_CLASS (shell_app_system_parent_class)->finalize (object); } @@ -292,12 +239,13 @@ shell_app_system_lookup_app (ShellAppSystem *self, if (app) return app; - info = shell_app_cache_get_info (shell_app_cache_get_default (), id); + info = g_desktop_app_info_new (id); if (!info) return NULL; app = _shell_app_new (info); g_hash_table_insert (priv->id_to_app, (char *) shell_app_get_id (app), app); + g_object_unref (info); return app; } @@ -504,5 +452,7 @@ shell_app_system_search (const char *search_string) GList * shell_app_system_get_installed (ShellAppSystem *self) { - return shell_app_cache_get_all (shell_app_cache_get_default ()); + ShellAppSystemPrivate *priv = self->priv; + + return priv->installed_apps; } diff --git a/src/shell-app.c b/src/shell-app.c index f716bc5..10efa91 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -259,7 +259,7 @@ shell_app_get_name (ShellApp *app) const char *name = NULL; if (window) - name = meta_window_get_title (window); + name = meta_window_get_wm_class (window); if (!name) name = C_("program", "Unknown"); return name; @@ -1067,10 +1067,6 @@ _shell_app_add_window (ShellApp *app, if (!app->running_state) create_running_state (app); - if (app->started_on_workspace >= 0) - meta_window_change_workspace_by_index (window, app->started_on_workspace, FALSE); - app->started_on_workspace = -1; - app->running_state->window_sort_stale = TRUE; app->running_state->windows = g_slist_prepend (app->running_state->windows, g_object_ref (window)); g_signal_connect_object (window, "unmanaged", G_CALLBACK(shell_app_on_unmanaged), app, 0); @@ -1160,14 +1156,16 @@ _shell_app_handle_startup_sequence (ShellApp *app, shell_app_state_transition (app, SHELL_APP_STATE_STARTING); meta_x11_display_focus_the_no_focus_window (x11_display, meta_startup_sequence_get_timestamp (sequence)); + app->started_on_workspace = meta_startup_sequence_get_workspace (sequence); } - if (starting) - app->started_on_workspace = meta_startup_sequence_get_workspace (sequence); - else if (app->running_state && app->running_state->windows) - shell_app_state_transition (app, SHELL_APP_STATE_RUNNING); - else /* application have > 1 .desktop file */ - shell_app_state_transition (app, SHELL_APP_STATE_STOPPED); + if (!starting) + { + if (app->running_state && app->running_state->windows) + shell_app_state_transition (app, SHELL_APP_STATE_RUNNING); + else /* application have > 1 .desktop file */ + shell_app_state_transition (app, SHELL_APP_STATE_STOPPED); + } } /** @@ -1475,7 +1473,6 @@ static void shell_app_init (ShellApp *self) { self->state = SHELL_APP_STATE_STOPPED; - self->started_on_workspace = -1; } static void diff --git a/src/shell-global.c b/src/shell-global.c index 4b33778..df84b6b 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1573,55 +1573,6 @@ delete_variant_cb (GObject *object, } static void -replace_contents_worker (GTask *task, - gpointer source_object, - gpointer task_data, - GCancellable *cancellable) -{ - GFile *file = source_object; - GBytes *bytes = task_data; - GError *error = NULL; - const gchar *data; - gsize len; - - data = g_bytes_get_data (bytes, &len); - - if (!g_file_replace_contents (file, data, len, NULL, FALSE, - G_FILE_CREATE_REPLACE_DESTINATION, - NULL, cancellable, &error)) - g_task_return_error (task, g_steal_pointer (&error)); - else - g_task_return_boolean (task, TRUE); -} - -static void -replace_contents_async (GFile *path, - GBytes *bytes, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_autoptr(GTask) task = NULL; - - g_assert (G_IS_FILE (path)); - g_assert (bytes != NULL); - g_assert (!cancellable || G_IS_CANCELLABLE (cancellable)); - - task = g_task_new (path, cancellable, callback, user_data); - g_task_set_source_tag (task, replace_contents_async); - g_task_set_task_data (task, g_bytes_ref (bytes), (GDestroyNotify)g_bytes_unref); - g_task_run_in_thread (task, replace_contents_worker); -} - -static gboolean -replace_contents_finish (GFile *file, - GAsyncResult *result, - GError **error) -{ - return g_task_propagate_boolean (G_TASK (result), error); -} - -static void replace_variant_cb (GObject *object, GAsyncResult *result, gpointer user_data) @@ -1629,7 +1580,7 @@ replace_variant_cb (GObject *object, ShellGlobal *global = user_data; GError *error = NULL; - if (!replace_contents_finish (G_FILE (object), result, &error)) + if (!g_file_replace_contents_finish (G_FILE (object), result, NULL, &error)) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { @@ -1665,19 +1616,12 @@ save_variant (ShellGlobal *global, } else { - g_autoptr(GBytes) bytes = NULL; - - bytes = g_bytes_new_with_free_func (g_variant_get_data (variant), - g_variant_get_size (variant), - (GDestroyNotify)g_variant_unref, - g_variant_ref (variant)); - /* g_file_replace_contents_async() can potentially fsync() from the - * calling thread when completing the asynchronous task. Instead, we - * want to force that fsync() to a thread to avoid blocking the - * compository main loop. Using our own replace_contents_async() - * simply executes the operation synchronously from a thread. - */ - replace_contents_async (path, bytes, cancellable, replace_variant_cb, global); + g_file_replace_contents_async (path, + g_variant_get_data (variant), + g_variant_get_size (variant), + NULL, FALSE, + G_FILE_CREATE_REPLACE_DESTINATION, + cancellable, replace_variant_cb, global); } g_object_unref (path); diff --git a/src/shell-perf-helper.c b/src/shell-perf-helper.c index d3280de..e5eab20 100644 --- a/src/shell-perf-helper.c +++ b/src/shell-perf-helper.c @@ -12,6 +12,7 @@ #include #include +#include #define BUS_NAME "org.gnome.Shell.PerfHelper" @@ -59,6 +60,12 @@ static GOptionEntry opt_entries[] = { NULL } }; +static Display *xdisplay; +static Window xroot; +static Atom atom_wm_state; +static Atom atom__net_wm_name; +static Atom atom_utf8_string; + static guint timeout_id; static GList *our_windows; static GList *wait_windows_invocations; @@ -113,9 +120,9 @@ on_window_map_event (GtkWidget *window, } static gboolean -on_child_draw (GtkWidget *window, - cairo_t *cr, - WindowInfo *info) +on_window_draw (GtkWidget *window, + cairo_t *cr, + WindowInfo *info) { cairo_rectangle_int_t allocation; double x_offset, y_offset; @@ -197,7 +204,6 @@ create_window (int width, gboolean redraws) { WindowInfo *info; - GtkWidget *child; info = g_new0 (WindowInfo, 1); info->width = width; @@ -213,13 +219,10 @@ create_window (int width, info->pending = TRUE; info->start_time = -1; - child = g_object_new (GTK_TYPE_BOX, "visible", TRUE, "app-paintable", TRUE, NULL); - gtk_container_add (GTK_CONTAINER (info->window), child); - gtk_widget_set_size_request (info->window, width, height); gtk_widget_set_app_paintable (info->window, TRUE); g_signal_connect (info->window, "map-event", G_CALLBACK (on_window_map_event), info); - g_signal_connect (child, "draw", G_CALLBACK (on_child_draw), info); + g_signal_connect (info->window, "draw", G_CALLBACK (on_window_draw), info); gtk_widget_show (info->window); if (info->redraws) @@ -344,6 +347,8 @@ on_name_lost (GDBusConnection *connection, int main (int argc, char **argv) { + GdkDisplay *display; + GdkScreen *screen; GOptionContext *context; GError *error = NULL; @@ -359,6 +364,15 @@ main (int argc, char **argv) return 1; } + display = gdk_display_get_default (); + screen = gdk_screen_get_default (); + + xdisplay = gdk_x11_display_get_xdisplay (display); + xroot = gdk_x11_window_get_xid (gdk_screen_get_root_window (screen)); + atom_wm_state = gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE"); + atom__net_wm_name = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME"); + atom_utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"); + g_bus_own_name (G_BUS_TYPE_SESSION, BUS_NAME, G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | diff --git a/src/shell-recorder.c b/src/shell-recorder.c index e561a01..0203ecf 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -511,6 +511,21 @@ recorder_update_size (ShellRecorder *recorder) } } +static void +recorder_on_stage_notify_size (GObject *object, + GParamSpec *pspec, + ShellRecorder *recorder) +{ + recorder_update_size (recorder); + + /* This breaks the recording but tweaking the GStreamer pipeline a bit + * might make it work, at least if the codec can handle a stream where + * the frame size changes in the middle. + */ + if (recorder->current_pipeline) + recorder_pipeline_set_caps (recorder->current_pipeline); +} + static gboolean recorder_idle_redraw (gpointer data) { @@ -607,6 +622,12 @@ recorder_connect_stage_callbacks (ShellRecorder *recorder) G_CALLBACK (recorder_on_stage_destroy), recorder); g_signal_connect_after (recorder->stage, "paint", G_CALLBACK (recorder_on_stage_paint), recorder); + g_signal_connect (recorder->stage, "notify::width", + G_CALLBACK (recorder_on_stage_notify_size), recorder); + g_signal_connect (recorder->stage, "notify::height", + G_CALLBACK (recorder_on_stage_notify_size), recorder); + g_signal_connect (recorder->stage, "notify::resource-scale", + G_CALLBACK (recorder_on_stage_notify_size), recorder); } static void @@ -618,6 +639,9 @@ recorder_disconnect_stage_callbacks (ShellRecorder *recorder) g_signal_handlers_disconnect_by_func (recorder->stage, (void *)recorder_on_stage_paint, recorder); + g_signal_handlers_disconnect_by_func (recorder->stage, + (void *)recorder_on_stage_notify_size, + recorder); /* We don't don't deselect for cursor changes in case someone else just * happened to be selecting for cursor events on the same window; sending @@ -1555,32 +1579,6 @@ shell_recorder_record (ShellRecorder *recorder, } /** - * shell_recorder_close_now: - * @recorder: the #ShellRecorder - * - * Stops recording immediately. It's possible to call shell_recorder_record() - * again to reopen a new recording stream, but unless change the recording - * filename, this may result in the old recording being overwritten. - */ -void -shell_recorder_close_now (ShellRecorder *recorder) -{ - g_return_if_fail (SHELL_IS_RECORDER (recorder)); - g_return_if_fail (recorder->state != RECORDER_STATE_CLOSED); - - recorder_remove_update_pointer_timeout (recorder); - recorder_close_pipeline (recorder); - - recorder->state = RECORDER_STATE_CLOSED; - - /* Reenable after the recording */ - meta_enable_unredirect_for_display (shell_global_get_display (shell_global_get ())); - - /* Release the refcount we took when we started recording */ - g_object_unref (recorder); -} - -/** * shell_recorder_close: * @recorder: the #ShellRecorder * diff --git a/src/shell-recorder.h b/src/shell-recorder.h index 1c3e6aa..c1e0e63 100644 --- a/src/shell-recorder.h +++ b/src/shell-recorder.h @@ -37,7 +37,6 @@ void shell_recorder_set_area (ShellRecorder *recorder, gboolean shell_recorder_record (ShellRecorder *recorder, char **filename_used); void shell_recorder_close (ShellRecorder *recorder); -void shell_recorder_close_now (ShellRecorder *recorder); void shell_recorder_pause (ShellRecorder *recorder); gboolean shell_recorder_is_recording (ShellRecorder *recorder); diff --git a/src/shell-util.c b/src/shell-util.c index 5f9fb86..31bb18e 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -16,14 +16,11 @@ #include #include -#include "shell-app-cache-private.h" #include "shell-util.h" #include #include #include #include -#include -#include #include #ifdef HAVE__NL_TIME_FIRST_WEEKDAY @@ -377,6 +374,36 @@ shell_util_create_pixbuf_from_data (const guchar *data, (GdkPixbufDestroyNotify) g_free, NULL); } +typedef const gchar *(*ShellGLGetString) (GLenum); + +static const gchar * +get_gl_vendor (void) +{ + static const gchar *vendor = NULL; + + if (!vendor) + { + ShellGLGetString gl_get_string; + gl_get_string = (ShellGLGetString) cogl_get_proc_address ("glGetString"); + if (gl_get_string) + vendor = gl_get_string (GL_VENDOR); + } + + return vendor; +} + +gboolean +shell_util_need_background_refresh (void) +{ + if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11)) + return FALSE; + + if (g_strcmp0 (get_gl_vendor (), "NVIDIA Corporation") == 0) + return TRUE; + + return FALSE; +} + static gboolean canvas_draw_cb (ClutterContent *content, cairo_t *cr, @@ -586,42 +613,3 @@ shell_util_check_cloexec_fds (void) fdwalk (check_cloexec, NULL); g_info ("Open fd CLOEXEC check complete"); } - -/** - * shell_util_has_x11_display_extension: - * @display: A #MetaDisplay - * @extension: An X11 extension - * - * If the corresponding X11 display provides the passed extension, return %TRUE, - * otherwise %FALSE. If there is no X11 display, %FALSE is passed. - */ -gboolean -shell_util_has_x11_display_extension (MetaDisplay *display, - const char *extension) -{ - MetaX11Display *x11_display; - Display *xdisplay; - int op, event, error; - - x11_display = meta_display_get_x11_display (display); - if (!x11_display) - return FALSE; - - xdisplay = meta_x11_display_get_xdisplay (x11_display); - return XQueryExtension (xdisplay, extension, &op, &event, &error); -} - -/** - * shell_util_get_translated_folder_name: - * @name: the untranslated folder name - * - * Attempts to translate the folder @name using translations provided - * by .directory files. - * - * Returns: (nullable): a translated string or %NULL - */ -char * -shell_util_get_translated_folder_name (const char *name) -{ - return shell_app_cache_translate_folder (shell_app_cache_get_default (), name); -} diff --git a/src/shell-util.h b/src/shell-util.h index 9bb2425..6904f43 100644 --- a/src/shell-util.h +++ b/src/shell-util.h @@ -44,6 +44,8 @@ GdkPixbuf *shell_util_create_pixbuf_from_data (const guchar *data, int height, int rowstride); +gboolean shell_util_need_background_refresh (void); + ClutterContent * shell_util_get_content_for_window_actor (MetaWindowActor *window_actor, MetaRectangle *window_rect); @@ -57,11 +59,6 @@ cairo_surface_t * shell_util_composite_capture_images (ClutterCapture *captures void shell_util_check_cloexec_fds (void); -gboolean shell_util_has_x11_display_extension (MetaDisplay *display, - const char *extension); - -char *shell_util_get_translated_folder_name (const char *name); - G_END_DECLS #endif /* __SHELL_UTIL_H__ */ diff --git a/src/st/st-settings.c b/src/st/st-settings.c index ebfd284..17f2c46 100644 --- a/src/st/st-settings.c +++ b/src/st/st-settings.c @@ -54,7 +54,6 @@ struct _StSettings gchar *gtk_theme; gchar *gtk_icon_theme; - int inhibit_animations_count; gboolean enable_animations; gboolean primary_paste; gboolean magnifier_active; @@ -63,41 +62,6 @@ struct _StSettings G_DEFINE_TYPE (StSettings, st_settings, G_TYPE_OBJECT) -static gboolean -get_enable_animations (StSettings *settings) -{ - if (settings->inhibit_animations_count > 0) - return FALSE; - else - return settings->enable_animations; -} - -void -st_settings_inhibit_animations (StSettings *settings) -{ - gboolean enable_animations; - - enable_animations = get_enable_animations (settings); - settings->inhibit_animations_count++; - - if (enable_animations != get_enable_animations (settings)) - g_object_notify_by_pspec (G_OBJECT (settings), - props[PROP_ENABLE_ANIMATIONS]); -} - -void -st_settings_uninhibit_animations (StSettings *settings) -{ - gboolean enable_animations; - - enable_animations = get_enable_animations (settings); - settings->inhibit_animations_count--; - - if (enable_animations != get_enable_animations (settings)) - g_object_notify_by_pspec (G_OBJECT (settings), - props[PROP_ENABLE_ANIMATIONS]); -} - static void st_settings_finalize (GObject *object) { @@ -131,7 +95,7 @@ st_settings_get_property (GObject *object, switch (prop_id) { case PROP_ENABLE_ANIMATIONS: - g_value_set_boolean (value, get_enable_animations (settings)); + g_value_set_boolean (value, settings->enable_animations); break; case PROP_PRIMARY_PASTE: g_value_set_boolean (value, settings->primary_paste); diff --git a/src/st/st-settings.h b/src/st/st-settings.h index 8b25494..c2c4fa2 100644 --- a/src/st/st-settings.h +++ b/src/st/st-settings.h @@ -33,10 +33,6 @@ G_DECLARE_FINAL_TYPE (StSettings, st_settings, ST, SETTINGS, GObject) StSettings * st_settings_get (void); -void st_settings_inhibit_animations (StSettings *settings); - -void st_settings_uninhibit_animations (StSettings *settings); - G_END_DECLS #endif /* __ST_SETTINGS_H__ */ diff --git a/src/st/st-shadow.c b/src/st/st-shadow.c index 7665de7..f3a22f0 100644 --- a/src/st/st-shadow.c +++ b/src/st/st-shadow.c @@ -289,10 +289,9 @@ st_shadow_helper_paint (StShadowHelper *helper, ClutterActorBox *actor_box, guint8 paint_opacity) { - if (helper->pipeline != NULL) - _st_paint_shadow_with_opacity (helper->shadow, - framebuffer, - helper->pipeline, - actor_box, - paint_opacity); + _st_paint_shadow_with_opacity (helper->shadow, + framebuffer, + helper->pipeline, + actor_box, + paint_opacity); } diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 6dc3512..cbe3afa 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -48,8 +48,6 @@ struct _StTextureCachePrivate /* File monitors to evict cache data on changes */ GHashTable *file_monitors; /* char * -> GFileMonitor * */ - - GCancellable *cancellable; }; static void st_texture_cache_dispose (GObject *object); @@ -115,16 +113,6 @@ st_texture_cache_class_init (StTextureCacheClass *klass) G_TYPE_NONE, 1, G_TYPE_FILE); } -/* Evicts all cached textures */ -void -st_texture_cache_clear (StTextureCache *cache) -{ - g_return_if_fail (ST_IS_TEXTURE_CACHE (cache)); - - g_hash_table_remove_all (cache->priv->keyed_cache); - g_signal_emit (cache, signals[ICON_THEME_CHANGED], 0); -} - /* Evicts all cached textures for named icons */ static void st_texture_cache_evict_icons (StTextureCache *cache) @@ -154,9 +142,6 @@ on_icon_theme_changed (StSettings *settings, { g_autofree gchar *theme; - g_cancellable_cancel (cache->priv->cancellable); - g_cancellable_reset (cache->priv->cancellable); - st_texture_cache_evict_icons (cache); g_object_get (settings, "gtk-icon-theme", &theme, NULL); @@ -191,8 +176,6 @@ st_texture_cache_init (StTextureCache *self) self->priv->file_monitors = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, g_object_unref); - self->priv->cancellable = g_cancellable_new (); - on_icon_theme_changed (settings, NULL, self); } @@ -201,11 +184,8 @@ st_texture_cache_dispose (GObject *object) { StTextureCache *self = (StTextureCache*)object; - g_cancellable_cancel (self->priv->cancellable); - g_clear_object (&self->priv->settings); g_clear_object (&self->priv->icon_theme); - g_clear_object (&self->priv->cancellable); g_clear_pointer (&self->priv->keyed_cache, g_hash_table_destroy); g_clear_pointer (&self->priv->keyed_surface_cache, g_hash_table_destroy); @@ -685,14 +665,11 @@ load_texture_async (StTextureCache *cache, gtk_icon_info_load_symbolic_async (data->icon_info, &foreground_color, &success_color, &warning_color, &error_color, - cache->priv->cancellable, - on_symbolic_icon_loaded, data); + NULL, on_symbolic_icon_loaded, data); } else { - gtk_icon_info_load_icon_async (data->icon_info, - cache->priv->cancellable, - on_icon_loaded, data); + gtk_icon_info_load_icon_async (data->icon_info, NULL, on_icon_loaded, data); } } else @@ -1564,11 +1541,3 @@ st_texture_cache_get_default (void) instance = g_object_new (ST_TYPE_TEXTURE_CACHE, NULL); return instance; } - -gboolean -st_texture_cache_rescan_icon_theme (StTextureCache *cache) -{ - StTextureCachePrivate *priv = cache->priv; - - return gtk_icon_theme_rescan_if_needed (priv->icon_theme); -} diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h index 84742be..11d1c4e 100644 --- a/src/st/st-texture-cache.h +++ b/src/st/st-texture-cache.h @@ -53,7 +53,6 @@ typedef enum { } StTextureCachePolicy; StTextureCache* st_texture_cache_get_default (void); -void st_texture_cache_clear (StTextureCache *cache); ClutterActor * st_texture_cache_load_sliced_image (StTextureCache *cache, @@ -114,6 +113,4 @@ CoglTexture * st_texture_cache_load (StTextureCache *cache, void *data, GError **error); -gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache); - #endif /* __ST_TEXTURE_CACHE_H__ */