From 08e0485213c597ed9ca9ac6a26684e4b74b2b7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 2 Mar 2011 00:19:18 +0100 Subject: [PATCH 01/17] search-display: Remove search result count Currently the total number of matches for a particular section is displayed on the left of the section's header. While it made sense in the old layout where it was close to the section's title, it is now rather disconnected, and has been removed in current mockups. https://bugzilla.gnome.org/show_bug.cgi?id=643632 --- js/ui/searchDisplay.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index 7e9ba7a7d..ae7bce6a8 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -249,12 +249,7 @@ SearchResults.prototype = { y_fill: true }); titleButton.connect('clicked', Lang.bind(this, function () { this._onHeaderClicked(provider); })); providerBox.add(titleButton); - let titleBox = new St.BoxLayout(); - titleButton.set_child(titleBox); - let title = new St.Label({ text: provider.title }); - let count = new St.Label(); - titleBox.add(title, { expand: true }); - titleBox.add(count); + titleButton.set_child(new St.Label({ text: provider.title })); let resultDisplayBin = new St.Bin({ style_class: 'search-section-results', x_fill: true, @@ -267,8 +262,7 @@ SearchResults.prototype = { resultDisplayBin.set_child(resultDisplay.actor); this._providerMeta.push({ actor: providerBox, - resultDisplay: resultDisplay, - count: count }); + resultDisplay: resultDisplay }); this._content.add(providerBox); }, @@ -322,7 +316,6 @@ SearchResults.prototype = { let meta = this._metaForProvider(provider); meta.actor.show(); meta.resultDisplay.renderResults(providerResults, terms); - meta.count.set_text('' + providerResults.length); } if (this._selectedOpenSearchButton == -1) From 7f5135016ed7476bc3457668d853bc114feea9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 2 Mar 2011 00:15:17 +0100 Subject: [PATCH 02/17] search: Don't expand search when clicking section headers Currently section headers in the search view are reactive and run the corresponding provider's expandSearch() function when clicked, which should launch an external program displaying all search results for the section. Unfortunately it is only implemented for the "Settings" provider, and does not work properly (as it ignores the search and just launches System Settings). Also current mockups deemphasize the section header, making the feature pretty much indiscoverable (except by accident when interfering with swipe-scrolling). In conclusion, the feature does not make much sense in its current form, so remove it. https://bugzilla.gnome.org/show_bug.cgi?id=643632 --- js/ui/appDisplay.js | 10 ---------- js/ui/docDisplay.js | 4 ---- js/ui/search.js | 11 ----------- js/ui/searchDisplay.js | 14 +++----------- 4 files changed, 3 insertions(+), 36 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index cd5983bf6..364b637db 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -294,10 +294,6 @@ AppSearchProvider.prototype = { let app = this._appSys.get_app(resultMeta['id']); let icon = new AppWellIcon(app); return icon.actor; - }, - - expandSearch: function(terms) { - log('TODO expand search'); } }; @@ -318,12 +314,6 @@ PrefsSearchProvider.prototype = { getSubsearchResultSet: function(previousResults, terms) { return this._appSys.subsearch(true, previousResults, terms); - }, - - expandSearch: function(terms) { - let controlCenter = this._appSys.load_from_desktop_file('gnomecc.desktop'); - controlCenter.launch(); - Main.overview.hide(); } }; diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js index 2e77f8c77..85bbdf978 100644 --- a/js/ui/docDisplay.js +++ b/js/ui/docDisplay.js @@ -43,9 +43,5 @@ DocSearchProvider.prototype = { getSubsearchResultSet: function(previousResults, terms) { return this._docManager.subsearch(previousResults, terms); - }, - - expandSearch: function(terms) { - log('TODO expand docs search'); } }; diff --git a/js/ui/search.js b/js/ui/search.js index ca35341e9..fce586624 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -209,17 +209,6 @@ SearchProvider.prototype = { */ activateResult: function(id) { throw new Error('Not implemented'); - }, - - /** - * expandSearch: - * - * Called when the user clicks on the header for this - * search section. Should typically launch an external program - * displaying search results for that item type. - */ - expandSearch: function(terms) { - throw new Error('Not implemented'); } }; Signals.addSignalMethods(SearchProvider.prototype); diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index ae7bce6a8..552737ec5 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -243,13 +243,9 @@ SearchResults.prototype = { createProviderMeta: function(provider) { let providerBox = new St.BoxLayout({ style_class: 'search-section', vertical: true }); - let titleButton = new St.Button({ style_class: 'search-section-header', - reactive: true, - x_fill: true, - y_fill: true }); - titleButton.connect('clicked', Lang.bind(this, function () { this._onHeaderClicked(provider); })); - providerBox.add(titleButton); - titleButton.set_child(new St.Label({ text: provider.title })); + let title = new St.Label({ style_class: 'search-section-header', + text: provider.title }); + providerBox.add(title); let resultDisplayBin = new St.Bin({ style_class: 'search-section-results', x_fill: true, @@ -324,10 +320,6 @@ SearchResults.prototype = { return true; }, - _onHeaderClicked: function(provider) { - provider.expandSearch(this._searchSystem.getTerms()); - }, - _modifyActorSelection: function(resultDisplay, up) { let success; let index = resultDisplay.getSelectionIndex(); From 7723e59a724cdb391f9b70e6b4c5e0683908510e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 28 Feb 2011 20:36:52 +0100 Subject: [PATCH 03/17] search: Replace 'icon' property in metaInfo with a function Search results' meta info currently is expected to have an 'icon' property holding a Clutter.Texture of a fixed icon size. This property is used to implement the createIcon() function of BaseIcon, which is used to actually display the result, ignoring the size parameter due to the fixed icon size. Given that all available search providers create this property for the desired icon size using a function with the same signature, it appears logical to replace the fixed-sized 'icon' property with such a function, so that the icon size will be defined by the display actor rather than the search system. https://bugzilla.gnome.org/show_bug.cgi?id=643632 --- js/ui/appDisplay.js | 5 ++++- js/ui/docDisplay.js | 5 ++++- js/ui/placeDisplay.js | 5 ++++- js/ui/search.js | 7 +++---- js/ui/searchDisplay.js | 4 +--- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 364b637db..b9f4b1fb4 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -251,7 +251,10 @@ BaseAppSearchProvider.prototype = { return null; return { 'id': resultId, 'name': app.get_name(), - 'icon': app.create_icon_texture(Search.RESULT_ICON_SIZE)}; + 'createIcon': function(size) { + return app.create_icon_texture(size); + } + }; }, activateResult: function(id, params) { diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js index 85bbdf978..26871728a 100644 --- a/js/ui/docDisplay.js +++ b/js/ui/docDisplay.js @@ -26,7 +26,10 @@ DocSearchProvider.prototype = { return null; return { 'id': resultId, 'name': docInfo.name, - 'icon': docInfo.createIcon(Search.RESULT_ICON_SIZE)}; + 'createIcon': function(size) { + return docInfo.createIcon(size); + } + }; }, activateResult: function(id, params) { diff --git a/js/ui/placeDisplay.js b/js/ui/placeDisplay.js index a44506e70..450a7ba2b 100644 --- a/js/ui/placeDisplay.js +++ b/js/ui/placeDisplay.js @@ -415,7 +415,10 @@ PlaceSearchProvider.prototype = { return null; return { 'id': resultId, 'name': placeInfo.name, - 'icon': placeInfo.iconFactory(Search.RESULT_ICON_SIZE) }; + 'createIcon': function(size) { + return placeInfo.iconFactory(size); + } + }; }, activateResult: function(id, params) { diff --git a/js/ui/search.js b/js/ui/search.js index fce586624..7e30fc000 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -15,8 +15,6 @@ const Main = imports.ui.main; const DISABLED_OPEN_SEARCH_PROVIDERS_KEY = 'disabled-open-search-providers'; -const RESULT_ICON_SIZE = 48; - // Not currently referenced by the search API, but // this enumeration can be useful for provider // implementations. @@ -165,8 +163,9 @@ SearchProvider.prototype = { * getResultInfo: * @id: Result identifier string * - * Return an object with 'id', 'name', (both strings) and 'icon' (Clutter.Texture) - * properties which describe the given search result. + * Return an object with 'id', 'name', (both strings) and 'createIcon' + * (function(size) returning a Clutter.Texture) properties which describe + * the given search result. */ getResultMeta: function(id) { throw new Error('Not implemented'); diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index 552737ec5..485620c82 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -36,9 +36,7 @@ SearchResult.prototype = { reactive: true, track_hover: true }); let icon = new IconGrid.BaseIcon(this.metaInfo['name'], - { createIcon: Lang.bind(this, function(size) { - return this.metaInfo['icon']; - })}); + { createIcon: this.metaInfo['createIcon'] }); content.set_child(icon.actor); } this._content = content; From 34ce17c4b372ba0149a79bbbd6d2d58bf16825ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 25 Feb 2011 22:53:53 +0100 Subject: [PATCH 04/17] search-result: Use a larger icon size Increase the icon size of search results for consistency with the application view. To account for the larger icons, only display a single row of results per section. https://bugzilla.gnome.org/show_bug.cgi?id=643632 --- data/theme/gnome-shell.css | 15 +++++---------- js/ui/searchDisplay.js | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index c7d875a13..65312383f 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -534,7 +534,11 @@ StTooltip StLabel { .icon-grid { spacing: 36px; - -shell-grid-item-size: 70px; + -shell-grid-item-size: 118px; +} + +.icon-grid .overview-icon { + icon-size: 96px; } .all-app { @@ -542,15 +546,6 @@ StTooltip StLabel { spacing: 20px; } -.all-app .icon-grid { - -shell-grid-item-size: 118px; -} - -.all-app .overview-icon { - icon-size: 96px; -} - - .app-filter { font-size: 14px; font-weight: bold; diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index 485620c82..0527d8f83 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -13,7 +13,7 @@ const Main = imports.ui.main; const Overview = imports.ui.overview; const Search = imports.ui.search; -const MAX_SEARCH_RESULTS_ROWS = 2; +const MAX_SEARCH_RESULTS_ROWS = 1; function SearchResult(provider, metaInfo, terms) { From 84889d6deaba4329751c0299554b4963cd1d9928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 26 Feb 2011 00:00:53 +0100 Subject: [PATCH 05/17] search-display: Minor style updates Adjust the style of the search display to match current mockups: - add a border to search buttons - increase padding and spacing - remove section background and border - decrease font size in section headers https://bugzilla.gnome.org/show_bug.cgi?id=643632 --- data/theme/gnome-shell.css | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 65312383f..da21721e7 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -469,11 +469,12 @@ StTooltip StLabel { #searchResults { padding: 20px 10px 10px 10px; + spacing: 18px; } #searchResultsContent { - padding: 0 10px; - spacing: 8px; + padding: 0 20px 0 0; + spacing: 36px; } .search-statustext, @@ -481,18 +482,11 @@ StTooltip StLabel { padding: 4px 12px; spacing: 4px; color: #6f6f6f; -} - -.search-section { - background-color: rgba(128, 128, 128, .1); - border: 1px solid rgba(50, 50, 50, .4); - border-radius: 10px; + font-size: .8em; } .search-section-results { color: #ffffff; - border-radius: 10px; - border: 1px solid rgba(50, 50, 50, .4); padding: 6px; } @@ -505,17 +499,18 @@ StTooltip StLabel { } .search-providers-box { - spacing: 4px; + spacing: 12px; } .dash-search-button { background-gradient-direction: vertical; background-gradient-start: rgba(255, 255, 255, 0.2); background-gradient-end: rgba(255, 255, 255, 0); -/* border: 1px solid #808080;*/ - border-radius: 10px; + border: 1px solid #808080; + border-radius: 16px; height: 32px; width: 300px; + font-weight: bold; } .dash-search-button:selected, From 3a6b4f3eb57ea188871e2d47324db4f4a6d28df7 Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Fri, 25 Feb 2011 01:29:20 +0300 Subject: [PATCH 06/17] main: correct pushModal/popModal mechanism 1. disconnect destroy signals in popModal (actors can have great lifetime and then pushed again) 2. incorrect pushModal/popModal pair in overview https://bugzilla.gnome.org/show_bug.cgi?id=64078 --- js/ui/main.js | 59 +++++++++++++++++++++++++++++------------------ js/ui/overview.js | 6 ++--- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/js/ui/main.js b/js/ui/main.js index 2a7e225b3..a79841454 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -539,10 +539,8 @@ function _globalKeyPressHandler(actor, event) { function _findModal(actor) { for (let i = 0; i < modalActorFocusStack.length; i++) { - let [stackActor, stackFocus] = modalActorFocusStack[i]; - if (stackActor == actor) { + if (modalActorFocusStack[i].actor == actor) return i; - } } return -1; } @@ -568,7 +566,6 @@ function _findModal(actor) { * Returns: true iff we successfully acquired a grab or already had one */ function pushModal(actor, timestamp) { - if (timestamp == undefined) timestamp = global.get_current_time(); @@ -582,20 +579,24 @@ function pushModal(actor, timestamp) { global.set_stage_input_mode(Shell.StageInputMode.FULLSCREEN); modalCount += 1; - actor.connect('destroy', function() { + let actorDestroyId = actor.connect('destroy', function() { let index = _findModal(actor); if (index >= 0) modalActorFocusStack.splice(index, 1); }); let curFocus = global.stage.get_key_focus(); + let curFocusDestroyId; if (curFocus != null) { - curFocus.connect('destroy', function() { + curFocusDestroyId = curFocus.connect('destroy', function() { let index = _findModal(actor); if (index >= 0) - modalActorFocusStack[index][1] = null; + modalActorFocusStack[index].actor = null; }); } - modalActorFocusStack.push([actor, curFocus]); + modalActorFocusStack.push({ actor: actor, + focus: curFocus, + destroyId: actorDestroyId, + focusDestroyId: curFocusDestroyId }); global.stage.set_key_focus(actor); return true; @@ -615,28 +616,42 @@ function pushModal(actor, timestamp) { * global.get_current_time() is assumed. */ function popModal(actor, timestamp) { - if (timestamp == undefined) timestamp = global.get_current_time(); - modalCount -= 1; let focusIndex = _findModal(actor); - if (focusIndex >= 0) { - if (focusIndex == modalActorFocusStack.length - 1) { - let [stackActor, stackFocus] = modalActorFocusStack[focusIndex]; - global.stage.set_key_focus(stackFocus); - } else { - // Remove from the middle, shift the focus chain up - for (let i = focusIndex; i < modalActorFocusStack.length - 1; i++) { - modalActorFocusStack[i + 1][1] = modalActorFocusStack[i][1]; - } - } - modalActorFocusStack.splice(focusIndex, 1); + if (focusIndex < 0) { + global.stage.set_key_focus(null); + global.end_modal(timestamp); + global.set_stage_input_mode(Shell.StageInputMode.NORMAL); + + throw new Error('incorrect pop'); } + + modalCount -= 1; + + let record = modalActorFocusStack[focusIndex]; + record.actor.disconnect(record.destroyId); + + if (focusIndex == modalActorFocusStack.length - 1) { + if (record.focus) + record.focus.disconnect(record.focusDestroyId); + global.stage.set_key_focus(record.focus); + } else { + let t = modalActorFocusStack[modalActorFocusStack.length - 1]; + if (t.focus) + t.focus.disconnect(t.focusDestroyId); + // Remove from the middle, shift the focus chain up + for (let i = modalActorFocusStack.length - 1; i > focusIndex; i--) { + modalActorFocusStack[i].focus = modalActorFocusStack[i - 1].focus; + modalActorFocusStack[i].focusDestroyId = modalActorFocusStack[i - 1].focusDestroyId; + } + } + modalActorFocusStack.splice(focusIndex, 1); + if (modalCount > 0) return; - global.stage.set_key_focus(null); global.end_modal(timestamp); global.set_stage_input_mode(Shell.StageInputMode.NORMAL); } diff --git a/js/ui/overview.js b/js/ui/overview.js index 1aeb83b93..177295c43 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -655,20 +655,20 @@ Overview.prototype = { if (this._shown) { if (!this._modal) { - if (Main.pushModal(this.dash.actor)) + if (Main.pushModal(this._group)) this._modal = true; else this.hide(); } } else if (this._shownTemporarily) { if (this._modal) { - Main.popModal(this.dash.actor); + Main.popModal(this._group); this._modal = false; } global.stage_input_mode = Shell.StageInputMode.FULLSCREEN; } else { if (this._modal) { - Main.popModal(this.dash.actor); + Main.popModal(this._group); this._modal = false; } else if (global.stage_input_mode == Shell.StageInputMode.FULLSCREEN) From 29e5768f9b7650b820130039696869375fa1829e Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Thu, 3 Mar 2011 03:47:58 +0300 Subject: [PATCH 07/17] messageTray: don't leak Notifications https://bugzilla.gnome.org/show_bug.cgi?id=640781 --- js/ui/messageTray.js | 45 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index fe220744e..5c4445810 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -421,6 +421,7 @@ Notification.prototype = { !this._actionArea.contains(event.get_source())) this._onClicked(); })); + this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this._buttonFocusManager = St.FocusManager.get_for_stage(global.stage); @@ -763,6 +764,8 @@ Notification.prototype = { }, collapseCompleted: function() { + if (this._destroyed) + return; this.expanded = false; // Make sure we don't line wrap the title, and ellipsize it instead. this._titleLabel.clutter_text.line_wrap = false; @@ -794,13 +797,18 @@ Notification.prototype = { this.destroy(); }, - destroy: function(reason) { + _onDestroy: function() { if (this._destroyed) return; this._destroyed = true; - if (!reason) - reason = NotificationDestroyedReason.DISMISSED; - this.emit('destroy', reason); + if (!this._destroyedReason) + this._destroyedReason = NotificationDestroyedReason.DISMISSED; + this.emit('destroy', this._destroyedReason); + }, + + destroy: function(reason) { + this._destroyedReason = reason; + this.actor.destroy(); } }; Signals.addSignalMethods(Notification.prototype); @@ -1135,10 +1143,7 @@ MessageTray.prototype = { this._onSummaryItemClicked(summaryItem); })); - source.connect('destroy', Lang.bind(this, - function () { - this.removeSource(source); - })); + source.connect('destroy', Lang.bind(this, this._onSourceDestroy)); // We need to display the newly-added summary item, but if the // caller is about to post a notification, we want to show that @@ -1147,20 +1152,12 @@ MessageTray.prototype = { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._updateState(); return false; })); }, - removeSource: function(source) { + _onSourceDestroy: function(source) { let index = this._getIndexOfSummaryItemForSource(source); if (index == -1) return; - // remove all notifications with this source from the queue - let newNotificationQueue = []; - for (let i = 0; i < this._notificationQueue.length; i++) { - if (this._notificationQueue[i].source != source) - newNotificationQueue.push(this._notificationQueue[i]); - } - this._notificationQueue = newNotificationQueue; - - this._summary.remove_actor(this._summaryItems[index].actor); + this._summaryItems[index].actor.destroy(); let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]); if (newSummaryItemsIndex != -1) @@ -1202,9 +1199,16 @@ MessageTray.prototype = { if (needUpdate); this._updateState(); + + // remove all notifications with this source from the queue + let newNotificationQueue = []; + for (let i = this._notificationQueue.length - 1; i >= 0; i--) { + if (this._notificationQueue[i].source == source) + this._notificationQueue[i].destroy(); + } }, - removeNotification: function(notification) { + _onNotificationDestroy: function(notification) { if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) { this._updateNotificationTimeout(0); this._notificationRemoved = true; @@ -1213,6 +1217,7 @@ MessageTray.prototype = { } let index = this._notificationQueue.indexOf(notification); + notification.destroy(); if (index != -1) this._notificationQueue.splice(index, 1); }, @@ -1248,7 +1253,7 @@ MessageTray.prototype = { this._updateShowingNotification(); } else if (this._notificationQueue.indexOf(notification) < 0) { notification.connect('destroy', - Lang.bind(this, this.removeNotification)); + Lang.bind(this, this._onNotificationDestroy)); this._notificationQueue.push(notification); this._notificationQueue.sort(function(notification1, notification2) { return (notification2.urgency - notification1.urgency); From b1654af406327290ed3b9ef9fce39b51230e4e16 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 24 Feb 2011 11:21:30 +0100 Subject: [PATCH 08/17] Fix positioning of panel on startup We need to do the initial relayout before we start up the startup animation, and the startup animation can't hardcode the position of the panel to zero. https://bugzilla.gnome.org/show_bug.cgi?id=642881 --- js/ui/main.js | 6 +++--- js/ui/panel.js | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/js/ui/main.js b/js/ui/main.js index a79841454..3d3d87c14 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -196,6 +196,9 @@ function start() { ExtensionSystem.init(); ExtensionSystem.loadExtensions(); + // Perform initial relayout here + _relayout(); + panel.startStatusArea(); panel.startupAnimation(); @@ -204,9 +207,6 @@ function start() { global.stage.connect('captured-event', _globalKeyPressHandler); - // Perform initial relayout here - _relayout(); - _log('info', 'loaded at ' + _startDate); log('GNOME Shell started at ' + _startDate); diff --git a/js/ui/panel.js b/js/ui/panel.js index 92272df98..1d1e10d60 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -1042,9 +1042,10 @@ Panel.prototype = { }, startupAnimation: function() { - this.actor.y = -this.actor.height; + let oldY = this.actor.y; + this.actor.y = oldY - this.actor.height; Tweener.addTween(this.actor, - { y: 0, + { y: oldY, time: 0.2, transition: 'easeOutQuad' }); From d235c205d6248a014450ff299c085bc7bafd30a9 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 21 Feb 2011 16:14:54 +0100 Subject: [PATCH 09/17] Consider struts top/botton or left/right based on primary monitor size Right now we require a strut to be as wide as the full screen to create a TOP strut. This means that in a multi-monitor scenario (at least if the primary monitor is leftmost) we will make the panel strut be Meta.Side.LEFT due to the random side picking for corner objects. This changes the width/height comparison to the primary monitor rather than the screen to get this right. Also adds some docs about how struts work in a multi-monitor situation. https://bugzilla.gnome.org/show_bug.cgi?id=642881 --- js/ui/chrome.js | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/js/ui/chrome.js b/js/ui/chrome.js index f5e82920e..4bad7c038 100644 --- a/js/ui/chrome.js +++ b/js/ui/chrome.js @@ -363,41 +363,58 @@ Chrome.prototype = { if (!actorData.affectsStruts) continue; + // Limit struts to the size of the screen + let x1 = Math.max(x, 0); + let x2 = Math.min(x + w, global.screen_width); + let y1 = Math.max(y, 0); + let y2 = Math.min(y + h, global.screen_height); + + // NetWM struts are not really powerful enought to handle + // a multi-monitor scenario, they only describe what happens + // around the outer sides of the full display region. However + // it can describe a partial region along each side, so + // we can support having the struts only affect the + // primary monitor. This should be enough as we only have + // chrome affecting the struts on the primary monitor so + // far. + // // Metacity wants to know what side of the screen the // strut is considered to be attached to. If the actor is // only touching one edge, or is touching the entire - // width/height of one edge, then it's obvious which side - // to call it. If it's in a corner, we pick a side + // border of the primary monitor, then it's obvious which + // side to call it. If it's in a corner, we pick a side // arbitrarily. If it doesn't touch any edges, or it spans // the width/height across the middle of the screen, then // we don't create a strut for it at all. let side; - if (w >= global.screen_width) { - if (y <= 0) + let primary = this._primaryMonitor; + if (x1 <= primary.x && x2 >= primary.x + primary.width) { + if (y1 <= primary.y) side = Meta.Side.TOP; - else if (y + h >= global.screen_height) + else if (y2 >= primary.y + primary.height) side = Meta.Side.BOTTOM; else continue; - } else if (h >= global.screen_height) { - if (x <= 0) + } else if (y1 <= primary.y && y2 >= primary.y + primary.height) { + if (x1 <= 0) side = Meta.Side.LEFT; - else if (x + w >= global.screen_width) + else if (x2 >= global.screen_width) side = Meta.Side.RIGHT; else continue; - } else if (x <= 0) + } else if (x1 <= 0) side = Meta.Side.LEFT; - else if (y <= 0) + else if (y1 <= 0) side = Meta.Side.TOP; - else if (x + w >= global.screen_width) + else if (x2 >= global.screen_width) side = Meta.Side.RIGHT; - else if (y + h >= global.screen_height) + else if (y2 >= global.screen_height) side = Meta.Side.BOTTOM; else continue; - let strut = new Meta.Strut({ rect: rect, side: side }); + let strutRect = new Meta.Rectangle({ x: x1, y: y1, width: x2 - x1, height: y2 - y1}); + let strut = new Meta.Strut({ rect: strutRect, side: side }); struts.push(strut); } From d964d2baaebf3d8f6de639beeae2e6a573d5990b Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 24 Feb 2011 12:06:25 +0100 Subject: [PATCH 10/17] Ensure that all struts we set extends to their boundary Mutter really expects this, as this is how app-specified struts happen. For instance, if the primary display is beside a taller screen and is not positioned at the top, then we extend the struts for the panel with the size of the unused area above the primary monitor. https://bugzilla.gnome.org/show_bug.cgi?id=642881 --- js/ui/chrome.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js/ui/chrome.js b/js/ui/chrome.js index 4bad7c038..addc9ac7d 100644 --- a/js/ui/chrome.js +++ b/js/ui/chrome.js @@ -413,6 +413,23 @@ Chrome.prototype = { else continue; + // Ensure that the strut rects goes all the way to the screen edge, + // as this really what mutter expects. + switch (side) { + case Meta.Side.TOP: + y1 = 0; + break; + case Meta.Side.BOTTOM: + y2 = global.screen_height; + break; + case Meta.Side.LEFT: + x1 = 0; + break; + case Meta.Side.RIGHT: + x2 = global.screen_width; + break; + } + let strutRect = new Meta.Rectangle({ x: x1, y: y1, width: x2 - x1, height: y2 - y1}); let strut = new Meta.Strut({ rect: strutRect, side: side }); struts.push(strut); From 602fa1c657eecabbc24e93649e86d7d4735a6194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Mar 2011 17:01:19 +0100 Subject: [PATCH 11/17] universal-access: Use "text-scaling-factor" instead of "dpi" The latter has been removed from the schema, so adjust to that change. --- js/ui/status/accessibility.js | 48 ++++++++--------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 035e96e16..5d77a5c1c 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -25,16 +25,12 @@ const KEY_MOUSE_KEYS_ENABLED = 'mousekeys-enable'; const APPLICATIONS_SCHEMA = 'org.gnome.desktop.a11y.applications'; -const XSETTINGS_SCHEMA = 'org.gnome.settings-daemon.plugins.xsettings'; -const KEY_DPI = 'dpi'; - const DPI_LOW_REASONABLE_VALUE = 50; const DPI_HIGH_REASONABLE_VALUE = 500; const DPI_FACTOR_LARGE = 1.25; const DPI_FACTOR_LARGER = 1.5; const DPI_FACTOR_LARGEST = 2.0; -const DPI_DEFAULT = 96; const KEY_META_DIR = '/apps/metacity/general'; const KEY_VISUAL_BELL = KEY_META_DIR + '/visual_bell'; @@ -42,25 +38,10 @@ const KEY_VISUAL_BELL = KEY_META_DIR + '/visual_bell'; const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface'; const KEY_GTK_THEME = 'gtk-theme'; const KEY_ICON_THEME = 'icon-theme'; +const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor'; const HIGH_CONTRAST_THEME = 'HighContrast'; -function getDPIFromX() { - let screen = global.get_gdk_screen(); - if (screen) { - let width_dpi = (screen.get_width() / (screen.get_width_mm() / 25.4)); - let height_dpi = (screen.get_height() / (screen.get_height_mm() / 25.4)); - if (width_dpi < DPI_LOW_REASONABLE_VALUE - || width_dpi > DPI_HIGH_REASONABLE_VALUE - || height_dpi < DPI_LOW_REASONABLE_VALUE - || height_dpi > DPI_HIGH_REASONABLE_VALUE) - return DPI_DEFAULT; - else - return (width_dpi + height_dpi) / 2; - } - return DPI_DEFAULT; -} - function ATIndicator() { this._init.apply(this, arguments); } @@ -194,30 +175,23 @@ ATIndicator.prototype = { }, _buildFontItem: function() { - let settings = new Gio.Settings({ schema: XSETTINGS_SCHEMA }); + let settings = new Gio.Settings({ schema: DESKTOP_INTERFACE_SCHEMA }); - // we assume this never changes (which is not true if resolution - // is changed, but we would need XRandR events for that) - let x_value = getDPIFromX(); - let user_value; - function on_get() { - user_value = settings.get_double(KEY_DPI); - return (user_value - (DPI_FACTOR_LARGE * x_value) > -1); - } - let initial_setting = on_get(); - let default_value = (initial_setting || user_value == 0) ? x_value : user_value; + let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); + let initial_setting = (factor > 1.0); let widget = this._buildItemExtended(_("Large Text"), initial_setting, - settings.is_writable(KEY_DPI), + settings.is_writable(KEY_TEXT_SCALING_FACTOR), function (enabled) { if (enabled) - settings.set_double(KEY_DPI, DPI_FACTOR_LARGE * default_value); + settings.set_double(KEY_TEXT_SCALING_FACTOR, + DPI_FACTOR_LARGE); else - settings.set_double(KEY_DPI, default_value); + settings.reset(KEY_TEXT_SCALING_FACTOR); }); - settings.connect('changed::' + KEY_DPI, function() { - let active = on_get(); - default_value = (active || user_value == 0) ? x_value : user_value; + settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, function() { + let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); + let active = (factor > 1.0); widget.setToggleState(active); }); return widget; From 1c759384fac3113036011d03668a47b1b72c52ef Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 2 Mar 2011 00:17:33 -0500 Subject: [PATCH 12/17] jhbuild: Install evolution-data-server for Ubuntu Ubuntu's libecal is too old, so add evolution-data-server to the modules file and have gnome-shell depend on that. Also add libsoup, libgweather and glib-networking as indirect dependencies. Remove evolution-data-server-dev from the list of packages to install and add libproxy-dev and libdb-dev. --- tools/build/gnome-shell-build-setup.sh | 7 ++--- tools/build/gnome-shell.modules | 38 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/tools/build/gnome-shell-build-setup.sh b/tools/build/gnome-shell-build-setup.sh index 99e741799..7a864ed9a 100755 --- a/tools/build/gnome-shell-build-setup.sh +++ b/tools/build/gnome-shell-build-setup.sh @@ -63,7 +63,7 @@ fi # spidermonkey ({mozilla,firefox,xulrunner}-js), startup-notification, # xdamage, icon-naming-utils, upower, libtool-ltdl, libvorbis, # libgcrypt, libtasn1, libgnome-keyring, libgtop, cups, -# evolution-data-server libusb +# libusb, libproxy, libdb # # Non-devel packages needed by gnome-shell and its deps: # glxinfo, gstreamer-plugins-base, gstreamer-plugins-good, @@ -82,8 +82,7 @@ if test "x$system" = xUbuntu -o "x$system" = xDebian -o "x$system" = xLinuxMint xulrunner-dev libcroco3-dev libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer0.10-plugins-good libltdl-dev libvorbis-dev iso-codes libgnome-keyring-dev libusb-1.0-0-dev - libupower-glib-dev libcups2-dev evolution-data-server-dev - libecal1.2-dev libedataserverui1.2-dev + libupower-glib-dev libcups2-dev libproxy-dev libdb-dev " if apt-cache show autopoint > /dev/null 2> /dev/null; then @@ -121,7 +120,7 @@ if test "x$system" = xFedora ; then startup-notification-devel zenity icon-naming-utils upower-devel libtool-ltdl-devel libvorbis-devel iso-codes-devel libgcrypt-devel libtasn1-devel libtasn1-tools libusb1-devel - libgnome-keyring-devel libgtop2-devel cups-devel evolution-data-server-devel + libgnome-keyring-devel libgtop2-devel cups-devel db4-devel libproxy-devel " if expr $version \>= 14 > /dev/null ; then diff --git a/tools/build/gnome-shell.modules b/tools/build/gnome-shell.modules index b32104ef5..e9f1407a8 100644 --- a/tools/build/gnome-shell.modules +++ b/tools/build/gnome-shell.modules @@ -200,6 +200,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -223,6 +260,7 @@ + From 440b2226642bdc7e67cd40a264c8ec9b0846e3e8 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Tue, 1 Mar 2011 20:03:25 -0500 Subject: [PATCH 13/17] Do not launch power statistics app from battery items https://bugzilla.gnome.org/show_bug.cgi?id=640768 --- js/ui/status/power.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/js/ui/status/power.js b/js/ui/status/power.js index f3625cc2d..fabb18187 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -72,7 +72,7 @@ Indicator.prototype = { this._hasPrimary = false; this._primaryDeviceId = null; - this._batteryItem = new PopupMenu.PopupMenuItem(''); + this._batteryItem = new PopupMenu.PopupMenuItem('', { reactive: false }); this._primaryPercentage = new St.Label(); this._batteryItem.addActor(this._primaryPercentage, { align: St.Align.END }); this.menu.addMenuItem(this._batteryItem); @@ -136,17 +136,6 @@ Indicator.prototype = { } this._primaryDeviceId = device_id; - if (this._primaryDeviceId) { - this._batteryItem.actor.reactive = true; - this._batteryItem.actor.can_focus = true; - this._batteryItem.connect('activate', function(item) { - Util.spawn(['gnome-power-statistics', '--device', device_id]); - }); - } else { - // virtual device - this._batteryItem.actor.reactive = false; - this._batteryItem.actor.can_focus = false; - } })); }, @@ -168,9 +157,6 @@ Indicator.prototype = { continue; let item = new DeviceItem (devices[i]); - item.connect('activate', function() { - Util.spawn(['gnome-power-statistics', '--device', device_id]); - }); this._deviceItems.push(item); this.menu.addMenuItem(item, this._otherDevicePosition + position); position++; @@ -216,7 +202,7 @@ DeviceItem.prototype = { __proto__: PopupMenu.PopupBaseMenuItem.prototype, _init: function(device) { - PopupMenu.PopupBaseMenuItem.prototype._init.call(this); + PopupMenu.PopupBaseMenuItem.prototype._init.call(this, { reactive: false }); let [device_id, device_type, icon, percentage, state, time] = device; From c64242c2764effd64450cd02878636cfdce0a1e9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 3 Mar 2011 16:21:53 -0500 Subject: [PATCH 14/17] gnome-shell-build-setup: Install sqlite, libproxy for Ubuntu Both of these are required by libsoup. Also add sqlite-devel for Fedora. --- tools/build/gnome-shell-build-setup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/build/gnome-shell-build-setup.sh b/tools/build/gnome-shell-build-setup.sh index 7a864ed9a..f568fc27b 100755 --- a/tools/build/gnome-shell-build-setup.sh +++ b/tools/build/gnome-shell-build-setup.sh @@ -63,7 +63,7 @@ fi # spidermonkey ({mozilla,firefox,xulrunner}-js), startup-notification, # xdamage, icon-naming-utils, upower, libtool-ltdl, libvorbis, # libgcrypt, libtasn1, libgnome-keyring, libgtop, cups, -# libusb, libproxy, libdb +# libusb, libproxy, libdb, libproxy, sqlite # # Non-devel packages needed by gnome-shell and its deps: # glxinfo, gstreamer-plugins-base, gstreamer-plugins-good, @@ -82,7 +82,8 @@ if test "x$system" = xUbuntu -o "x$system" = xDebian -o "x$system" = xLinuxMint xulrunner-dev libcroco3-dev libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer0.10-plugins-good libltdl-dev libvorbis-dev iso-codes libgnome-keyring-dev libusb-1.0-0-dev - libupower-glib-dev libcups2-dev libproxy-dev libdb-dev + libupower-glib-dev libcups2-dev libproxy-dev libdb-dev libproxy-dev + libsqlite3-dev " if apt-cache show autopoint > /dev/null 2> /dev/null; then @@ -121,6 +122,7 @@ if test "x$system" = xFedora ; then icon-naming-utils upower-devel libtool-ltdl-devel libvorbis-devel iso-codes-devel libgcrypt-devel libtasn1-devel libtasn1-tools libusb1-devel libgnome-keyring-devel libgtop2-devel cups-devel db4-devel libproxy-devel + sqlite-devel " if expr $version \>= 14 > /dev/null ; then From 6fbf8fa9e428a9d4965333e31dd3c0546f619796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Mar 2011 17:34:14 +0100 Subject: [PATCH 15/17] panel: Use a constant for the panel startup animation time https://bugzilla.gnome.org/show_bug.cgi?id=643804 --- js/ui/panel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index 1d1e10d60..37a720e1f 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -25,6 +25,8 @@ const PANEL_HEIGHT = 26; const PANEL_ICON_SIZE = 24; +const STARTUP_ANIMATION_TIME = 0.2; + const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5; const BUTTON_DND_ACTIVATION_TIMEOUT = 250; @@ -1046,7 +1048,7 @@ Panel.prototype = { this.actor.y = oldY - this.actor.height; Tweener.addTween(this.actor, { y: oldY, - time: 0.2, + time: STARTUP_ANIMATION_TIME, transition: 'easeOutQuad' }); }, From d6e29be980c1ef7ac577775f5162f103b167814a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Mar 2011 17:25:30 +0100 Subject: [PATCH 16/17] panel: Include panel corners in startup animation Commit b1654af4063 moved the panel positioning (and thus that of its corners) before the panel startup animation. As the panel corners now are mapped while the panel animation is active, the initial style-changed signal which triggers another repositioning is received after the initial layout and the corners end up at wrong positions. To fix, animate the corner positions as well during the startup animation - if anyone could actually see the animation, the corners should animate with the panel anyway ... https://bugzilla.gnome.org/show_bug.cgi?id=643804 --- js/ui/panel.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/ui/panel.js b/js/ui/panel.js index 37a720e1f..95dc2bcac 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -1051,6 +1051,20 @@ Panel.prototype = { time: STARTUP_ANIMATION_TIME, transition: 'easeOutQuad' }); + + let oldCornerY = this._leftCorner.actor.y; + this._leftCorner.actor.y = oldCornerY - this.actor.height; + this._rightCorner.actor.y = oldCornerY - this.actor.height; + Tweener.addTween(this._leftCorner.actor, + { y: oldCornerY, + time: STARTUP_ANIMATION_TIME, + transition: 'easeOutQuad' + }); + Tweener.addTween(this._rightCorner.actor, + { y: oldCornerY, + time: STARTUP_ANIMATION_TIME, + transition: 'easeOutQuad' + }); }, relayout: function() { From e01971eac7769abb67fe31d3e15b69abac2f3144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Mar 2011 00:25:23 +0100 Subject: [PATCH 17/17] base-icon: Always recreate icon texture on style changes Currently the icon texture is only updated on style changes when the icon size is set from CSS and differs from the previously used icon size. As the style change may have been triggered by an icon theme change, textures that are created for themed icons should always be recreated; given that this is the case for most uses (with the exception of file thumbnails), recreate the icon texture unconditionally to avoid complexity. https://bugzilla.gnome.org/show_bug.cgi?id=643738 --- js/ui/iconGrid.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index f2d046cb2..24556e233 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -52,8 +52,7 @@ BaseIcon.prototype = { this.createIcon = params.createIcon; this._setSizeManually = params.setSizeManually; - this.icon = this.createIcon(this.iconSize); - this._iconBin.set_child(this.icon); + this.icon = null; }, _allocate: function(actor, box, flags) { @@ -116,14 +115,15 @@ BaseIcon.prototype = { if (!this._setSizeManually) throw new Error('setSizeManually has to be set to use setIconsize'); - this._setIconSize(size); - }, - - _setIconSize: function(size) { if (size == this.iconSize) return; - this.icon.destroy(); + this._createIconTexture(size); + }, + + _createIconTexture: function(size) { + if (this.icon) + this.icon.destroy(); this.iconSize = size; this.icon = this.createIcon(this.iconSize); @@ -139,12 +139,15 @@ BaseIcon.prototype = { let node = this.actor.get_theme_node(); this._spacing = node.get_length('spacing'); - if (this._setSizeManually) - return; + let size; + if (this._setSizeManually) { + size = this.iconSize; + } else { + let [found, len] = node.lookup_length('icon-size', false); + size = found ? len : ICON_SIZE; + } - let len = node.get_length('icon-size'); - if (len > 0) - this._setIconSize(len); + this._createIconTexture(size); } };