Fix #35 (make the extension work on gnome-shell 3.34).

master
Jens Lody 5 years ago
parent eb0d3c28e2
commit 28656ac8a6
  1. 2
      data/metadata.json.in
  2. 195
      src/extension.js

@ -2,7 +2,7 @@
"uuid": "@uuid@", "uuid": "@uuid@",
"name": "Panel OSD", "name": "Panel OSD",
"description": "Configuring where on the (main) screen notifications will appear, instead of just above the message tray", "description": "Configuring where on the (main) screen notifications will appear, instead of just above the message tray",
"shell-version": [ "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.24", "3.26", "3.28" ], "shell-version": [ "3.10", "3.12", "3.14", "3.16", "3.18", "3.20", "3.22", "3.24", "3.26", "3.28", "3.30", "3.32", "3.34" ],
"localedir": "@LOCALEDIR@", "localedir": "@LOCALEDIR@",
"url": "@url@", "url": "@url@",
"version": "@version@" "version": "@version@"

@ -47,6 +47,8 @@ const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience; const Convenience = Me.imports.convenience;
const St = imports.gi.St; const St = imports.gi.St;
const Meta = imports.gi.Meta; const Meta = imports.gi.Meta;
const Clutter = imports.gi.Clutter;
const Gettext = imports.gettext.domain('gnome-shell-extension-panel-osd'); const Gettext = imports.gettext.domain('gnome-shell-extension-panel-osd');
const _ = Gettext.gettext; const _ = Gettext.gettext;
@ -238,7 +240,9 @@ let extensionShowNotification = function() {
this._bannerBin.add_actor(this._banner.actor); this._bannerBin.add_actor(this._banner.actor);
this._bannerBin._opacity = 0; if (!versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
this._bannerBin._opacity = 0;
}
this._bannerBin.opacity = 0; this._bannerBin.opacity = 0;
if (getY_position() < 50) if (getY_position() < 50)
@ -269,6 +273,9 @@ let extensionShowNotification = function() {
this._notificationWidget.show(); this._notificationWidget.show();
} }
if (versionAtLeast('3.30', Config.PACKAGE_VERSION)) {
Meta.disable_unredirect_for_display(global.display);
}
this._updateShowingNotification(); this._updateShowingNotification();
let [x, y, mods] = global.get_pointer(); let [x, y, mods] = global.get_pointer();
@ -351,51 +358,85 @@ let extensionHideNotification = function(animate) {
} }
} }
// JRL changes begin if (versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
let theNotification; this._bannerBin.remove_all_transitions();
if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
theNotification = this._bannerBin; if (animate) {
}else this._notificationState = State.HIDING;
{ this._bannerBin.ease({
theNotification = this._notificationWidget; opacity: 0,
duration: ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_BACK
});
this._bannerBin.ease({
// JRL changes begin
y: yPos,
// JRL changes end
duration: ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_BACK,
onComplete: () => {
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
this._updateState();
}
});
} else {
// JRL changes begin
y: yPos,
// JRL changes end
this._bannerBin.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
}
} }
// JRL changes end else
{
// JRL changes begin
let theNotification;
if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
theNotification = this._bannerBin;
}else
{
theNotification = this._notificationWidget;
}
// JRL changes end
if (animate) { if (animate) {
if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) { if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
// JRL changes begin // JRL changes begin
this._tween(theNotification, '_notificationState', State.HIDDEN, this._tween(theNotification, '_notificationState', State.HIDDEN,
{ y: yPos, { y: yPos,
// JRL changes end // JRL changes end
_opacity: 0, _opacity: 0,
time: ANIMATION_TIME, time: ANIMATION_TIME,
transition: 'easeOutBack', transition: 'easeOutBack',
onUpdate: this._clampOpacity, onUpdate: this._clampOpacity,
onUpdateScope: this, onUpdateScope: this,
onComplete: this._hideNotificationCompleted, onComplete: this._hideNotificationCompleted,
onCompleteScope: this onCompleteScope: this
}); });
} else {
// JRL changes begin
this._tween(theNotification, '_notificationState', State.HIDDEN,
{ y: yPos,
// JRL changes end
opacity: 0,
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
}
} else { } else {
// JRL changes begin // JRL changes begin
this._tween(theNotification, '_notificationState', State.HIDDEN, Tweener.removeTweens(theNotification);
{ y: yPos, theNotification.y = yPos;
// JRL changes end theNotification.opacity = 0;
opacity: 0, // JRL changes end
time: ANIMATION_TIME, this._notificationState = State.HIDDEN;
transition: 'easeOutQuad', this._hideNotificationCompleted();
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
} }
} else {
// JRL changes begin
Tweener.removeTweens(theNotification);
theNotification.y = yPos;
theNotification.opacity = 0;
// JRL changes end
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
} }
}; };
@ -494,33 +535,57 @@ let extensionUpdateShowingNotification = function() {
// We use this._showNotificationCompleted() onComplete callback to extend the time the updated // We use this._showNotificationCompleted() onComplete callback to extend the time the updated
// notification is being shown. // notification is being shown.
let tweenParams; if (versionAtLeast('3.34', Config.PACKAGE_VERSION)) {
if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) { this._notificationState = State.SHOWING;
tweenParams = { _opacity: 255, this._bannerBin.remove_all_transitions();
// JRL changes begin this._bannerBin.ease({
y: yPos, opacity: 255,
// JRL changes end duration: ANIMATION_TIME,
time: ANIMATION_TIME, mode: Clutter.AnimationMode.LINEAR
transition: 'easeOutBack', });
onUpdate: this._clampOpacity, this._bannerBin.ease({
onUpdateScope: this, // JRL changes begin
onComplete: this._showNotificationCompleted, y: yPos,
onCompleteScope: this // JRL changes end
}; duration: ANIMATION_TIME,
}else mode: Clutter.AnimationMode.EASE_OUT_BACK,
{ onComplete: () => {
tweenParams = { opacity: 255, this._notificationState = State.SHOWN;
// JRL changes begin this._showNotificationCompleted();
y: yPos, this._updateState();
// JRL changes end }
time: ANIMATION_TIME, });
transition: 'easeOutQuad',
onComplete: this._showNotificationCompleted,
onCompleteScope: this
};
} }
else
{
let tweenParams;
if (versionAtLeast('3.16', Config.PACKAGE_VERSION)) {
tweenParams = { _opacity: 255,
// JRL changes begin
y: yPos,
// JRL changes end
time: ANIMATION_TIME,
transition: 'easeOutBack',
onUpdate: this._clampOpacity,
onUpdateScope: this,
onComplete: this._showNotificationCompleted,
onCompleteScope: this
};
}else
{
tweenParams = { opacity: 255,
// JRL changes begin
y: yPos,
// JRL changes end
time: ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._showNotificationCompleted,
onCompleteScope: this
};
}
this._tween(theNotification, '_notificationState', State.SHOWN, tweenParams); this._tween(theNotification, '_notificationState', State.SHOWN, tweenParams);
}
}; };
/* /*

Loading…
Cancel
Save