Prepare for 3.12 compatibility.

Works only on 3.11.5, to make it work on other 3.11 versions, metadata.json.in has to be fixed, because development versions must be secified exactly with major.minor.point .
master
Jens Lody 11 years ago
parent 9a01b0badf
commit 164d0082f8
  1. 2
      data/metadata.json.in
  2. 152
      src/extension.js

@ -2,7 +2,7 @@
"uuid": "@uuid@",
"name": "Panel OSD",
"description": "Place shell notifications under the panel instead of above the message-tray",
"shell-version": [ "3.6", "3.8", "3.10" ],
"shell-version": [ "3.6", "3.8", "3.10", "3.11.5" ],
"localedir": "@LOCALEDIR@",
"url": "@url@"
}

@ -70,18 +70,18 @@ let extensionShowNotification = function () {
this._notification = this._notificationQueue.shift();
this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
if (ExtensionUtils.versionCheck(['3.7', '3.8', '3.9', '3.10'], Config.PACKAGE_VERSION)) {
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME,
Lang.bind(this, this._onIdleMonitorWatch));
}
else
{
if (!this._userActiveWhileNotificationShown) {
// If the user isn't active, set up a watch to let us know
// when the user becomes active.
this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
}
}
else
{
this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME,
Lang.bind(this, this._onIdleMonitorWatch));
}
this._notificationClickedId = this._notification.connect('done-displaying',
Lang.bind(this, this._escapeTray));
@ -125,11 +125,7 @@ let extensionShowNotification = function () {
* entire screen.
*/
let extensionHideNotification = function(animate) {
if (ExtensionUtils.versionCheck(['3.9', '3.10'], Config.PACKAGE_VERSION)) {
this._notificationFocusGrabber.ungrabFocus();
}
else
{
if (ExtensionUtils.versionCheck(['3.6', '3.8'], Config.PACKAGE_VERSION)) {
// HACK!
// There seems to be a reentrancy issue in calling .ungrab() here,
// which causes _updateState to be called before _notificationState
@ -144,12 +140,42 @@ let extensionHideNotification = function(animate) {
this._grabHelper.ungrab({ actor: this._notification.actor });
}
else
{
this._notificationFocusGrabber.ungrabFocus();
}
if (this._notificationExpandedId) {
this._notification.disconnect(this._notificationExpandedId);
this._notificationExpandedId = 0;
}
if (ExtensionUtils.versionCheck(['3.7', '3.8', '3.9', '3.10'], Config.PACKAGE_VERSION)) {
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
if (this._notificationRemoved) {
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
this._notificationWidget.y = -global.screen_height;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
} else {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
{ y: -global.screen_height,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
}
}
else
{
if (this._notificationClickedId) {
this._notification.disconnect(this._notificationClickedId);
this._notificationClickedId = 0;
@ -159,39 +185,7 @@ let extensionHideNotification = function(animate) {
this._notificationUnfocusedId = 0;
}
if (ExtensionUtils.versionCheck(['3.9', '3.10'], Config.PACKAGE_VERSION)) {
if (this._notificationLeftTimeoutId) {
Mainloop.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
}
if (animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
{ y: -global.screen_height,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
} else {
Tweener.removeTweens(this._notificationWidget);
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
this._notificationWidget.y = -global.screen_height;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
}
}
else
{
if (ExtensionUtils.versionCheck(['3.8'], Config.PACKAGE_VERSION)) {
this._useLongerTrayLeftTimeout = false;
if (this._trayLeftTimeoutId) {
Mainloop.source_remove(this._trayLeftTimeoutId);
@ -224,31 +218,37 @@ let extensionHideNotification = function(animate) {
}
}
}
else
{
if (this._notificationRemoved) {
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
this._notificationWidget.y = -global.screen_height;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
} else {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
{ y: -global.screen_height,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
else
{
if (this._notificationLeftTimeoutId) {
Mainloop.source_remove(this._notificationLeftTimeoutId);
this._notificationLeftTimeoutId = 0;
this._notificationLeftMouseX = -1;
this._notificationLeftMouseY = -1;
}
if (animate) {
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
// JRL changes begin
//{ y: this.actor.height,
{ y: -global.screen_height,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
} else {
Tweener.removeTweens(this._notificationWidget);
// JRL changes begin
//this._notificationWidget.y = this.actor.height;
this._notificationWidget.y = -global.screen_height;
// JRL changes end
this._notificationWidget.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
}
}
}
}
@ -268,7 +268,13 @@ let extensionUpdateShowingNotification = function() {
this._notification._table.add_style_class_name('jrlnotification');
// JRL changes end
this._notification.acknowledged = true;
if (ExtensionUtils.versionCheck(['3.7', '3.8', '3.9', '3.10'], Config.PACKAGE_VERSION)) {
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
// We auto-expand notifications with CRITICAL urgency.
if (this._notification.urgency == Urgency.CRITICAL)
this._expandNotification(true);
}
else
{
this._notification.playSound();
// We auto-expand notifications with CRITICAL urgency, or for which the relevant setting
// is on in the control center.
@ -276,12 +282,6 @@ let extensionUpdateShowingNotification = function() {
this._notification.source.policy.forceExpanded)
this._expandNotification(true);
}
else
{
// We auto-expand notifications with CRITICAL urgency.
if (this._notification.urgency == Urgency.CRITICAL)
this._expandNotification(true);
}
// We tween all notifications to full opacity. This ensures that both new notifications and
// notifications that might have been in the process of hiding get full opacity.

Loading…
Cancel
Save