messageTray: Clean up _updateState for the summary box pointer
This code still isn't great, but it's an improvement over what we had before.
This commit is contained in:
parent
b6499e5248
commit
e818ddf152
@ -2273,30 +2273,30 @@ const MessageTray = new Lang.Class({
|
|||||||
|
|
||||||
// Summary notification
|
// Summary notification
|
||||||
let haveClickedSummaryItem = this._clickedSummaryItem != null;
|
let haveClickedSummaryItem = this._clickedSummaryItem != null;
|
||||||
// We only have sources with empty notification stacks for legacy tray icons. Currently, we never attempt
|
|
||||||
// to show notifications for legacy tray icons, but this would be necessary if we did.
|
|
||||||
let requestedNotificationStackIsEmpty = (haveClickedSummaryItem &&
|
let requestedNotificationStackIsEmpty = (haveClickedSummaryItem &&
|
||||||
this._clickedSummaryItemMouseButton == 1 &&
|
this._clickedSummaryItemMouseButton == 1 &&
|
||||||
this._clickedSummaryItem.source.notifications.length == 0);
|
this._clickedSummaryItem.source.notifications.length == 0);
|
||||||
let wrongSummaryNotificationStack = (haveClickedSummaryItem &&
|
|
||||||
this._clickedSummaryItemMouseButton == 1 &&
|
|
||||||
this._summaryBoxPointer.bin.child != this._clickedSummaryItem.notificationStackWidget);
|
|
||||||
let wrongSummaryRightClickMenu = (haveClickedSummaryItem &&
|
|
||||||
this._clickedSummaryItemMouseButton == 3 &&
|
|
||||||
this._clickedSummaryItem.rightClickMenu != null &&
|
|
||||||
this._summaryBoxPointer.bin.child != this._clickedSummaryItem.rightClickMenu);
|
|
||||||
let wrongSummaryBoxPointer = (haveClickedSummaryItem &&
|
|
||||||
(wrongSummaryNotificationStack || wrongSummaryRightClickMenu));
|
|
||||||
|
|
||||||
if (this._summaryBoxPointerState == State.HIDDEN) {
|
if (this._summaryBoxPointerState == State.HIDDEN) {
|
||||||
if (haveClickedSummaryItem && !requestedNotificationStackIsEmpty)
|
if (haveClickedSummaryItem && !requestedNotificationStackIsEmpty)
|
||||||
this._showSummaryBoxPointer();
|
this._showSummaryBoxPointer();
|
||||||
} else if (this._summaryBoxPointerState == State.SHOWN) {
|
} else if (this._summaryBoxPointerState == State.SHOWN) {
|
||||||
if (!haveClickedSummaryItem || wrongSummaryBoxPointer || !hasNotifications) {
|
if (haveClickedSummaryItem && hasNotifications) {
|
||||||
|
let wrongSummaryNotificationStack = (this._clickedSummaryItemMouseButton == 1 &&
|
||||||
|
this._summaryBoxPointer.bin.child != this._clickedSummaryItem.notificationStackWidget &&
|
||||||
|
requestedNotificationStackIsEmpty);
|
||||||
|
let wrongSummaryRightClickMenu = (this._clickedSummaryItemMouseButton == 3 &&
|
||||||
|
this._clickedSummaryItem.rightClickMenu != null &&
|
||||||
|
this._summaryBoxPointer.bin.child != this._clickedSummaryItem.rightClickMenu);
|
||||||
|
let wrongSummaryBoxPointer = (wrongSummaryNotificationStack || wrongSummaryRightClickMenu);
|
||||||
|
|
||||||
|
if (wrongSummaryBoxPointer) {
|
||||||
this._hideSummaryBoxPointer();
|
this._hideSummaryBoxPointer();
|
||||||
if (wrongSummaryBoxPointer)
|
|
||||||
this._showSummaryBoxPointer();
|
this._showSummaryBoxPointer();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this._hideSummaryBoxPointer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tray itself
|
// Tray itself
|
||||||
|
Loading…
Reference in New Issue
Block a user