Use the border-radius of the actual theme for our notification, not always 10 pixel.

master
Jens Lody 11 years ago
parent 0ee29c5466
commit a2488f0e43
  1. 41
      src/extension.js

@ -21,6 +21,7 @@ const Lang = imports.lang;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const Me = ExtensionUtils.getCurrentExtension(); const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience; const Convenience = Me.imports.convenience;
const St = imports.gi.St;
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;
@ -342,17 +343,26 @@ let extensionHideNotification = function(animate) {
*/ */
let extensionUpdateShowingNotification = function() { let extensionUpdateShowingNotification = function() {
// JRL changes begin // JRL changes begin
// add own class-name to change border-radius, otherwise the changed value remains after switching off the extension // first reset the border-radius to the default
this._notification._table.remove_style_class_name('jrlnotification'); this._notification._table.set_style('border-radius:;');
this._notification._table.remove_style_class_name('jrlnotification_top'); if (getY_position() > 0.1)
this._notification._table.remove_style_class_name('jrlnotification_bottom'); {
if (getY_position() <= 0.1) // fix the border-radiuses, depending on the position
this._notification._table.add_style_class_name('jrlnotification_bottom'); let tl, tr;
else if (getY_position() >= 99.9) let bl = this._notification._table.get_theme_node().get_border_radius(St.Corner.TOPLEFT);
this._notification._table.add_style_class_name('jrlnotification_top'); let br = this._notification._table.get_theme_node().get_border_radius(St.Corner.TOPRIGHT);
else if (getY_position() >= 99.9)
this._notification._table.add_style_class_name('jrlnotification'); {
tl = this._notification._table.get_theme_node().get_border_radius(St.Corner.BOTTOMLEFT);
tr = this._notification._table.get_theme_node().get_border_radius(St.Corner.BOTTOMRIGHT);
}
else
{
tl = bl;
tr = br;
}
this._notification._table.set_style(_('border-radius: %dpx %dpx %dpx %dpx;').format(tl, tr, bl, br));
}
// JRL changes end // JRL changes end
this._notification.acknowledged = true; this._notification.acknowledged = true;
if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) { if (ExtensionUtils.versionCheck(['3.6'], Config.PACKAGE_VERSION)) {
@ -481,12 +491,9 @@ function disable() {
if (showTestNotificationTimeout !== undefined) if (showTestNotificationTimeout !== undefined)
Mainloop.source_remove(showTestNotificationTimeout); Mainloop.source_remove(showTestNotificationTimeout);
// remove our style, in case we just show a notification, otherwise the radius is drawn incorrect // remove our (inline-)style, in case we just show a notification, otherwise the radius is drawn incorrect
if (Main.messageTray._notification) { if (Main.messageTray._notification)
Main.messageTray._notification._table.remove_style_class_name('jrlnotification'); Main.messageTray._notification.set_style('border-radius:;');
Main.messageTray._notification._table.remove_style_class_name('jrlnotification_top');
Main.messageTray._notification._table.remove_style_class_name('jrlnotification_bottom');
}
// reset x-position // reset x-position
notificationWidget.x = originalNotificationWidgetX; notificationWidget.x = originalNotificationWidgetX;
Main.messageTray._showNotification = originalShowNotification; Main.messageTray._showNotification = originalShowNotification;

Loading…
Cancel
Save