mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Adjust latest for larger scale factors
This commit is contained in:
19
appIcons.js
19
appIcons.js
@@ -168,7 +168,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
this._updateWindowTitle();
|
||||
this._updateWindowTitleStyle();
|
||||
|
||||
this._scaleFactorChangedId = St.ThemeContext.get_for_stage(global.stage).connect('changed', () => this._updateWindowTitleStyle());
|
||||
this._scaleFactorChangedId = Utils.getStageTheme().connect('changed', () => this._updateWindowTitleStyle());
|
||||
|
||||
box.add_child(this._dtpIconContainer);
|
||||
box.add_child(this._windowTitle);
|
||||
@@ -316,7 +316,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
global.window_manager.disconnect(this._switchWorkspaceId);
|
||||
|
||||
if(this._scaleFactorChangedId)
|
||||
St.ThemeContext.get_for_stage(global.stage).disconnect(this._scaleFactorChangedId);
|
||||
Utils.getStageTheme().disconnect(this._scaleFactorChangedId);
|
||||
|
||||
if (this._hoverChangeId) {
|
||||
this.actor.disconnect(this._hoverChangeId);
|
||||
@@ -474,16 +474,16 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
_updateWindowTitleStyle: function() {
|
||||
if (this._windowTitle) {
|
||||
let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width');
|
||||
let variableWidth = !useFixedWidth || this.dtpPanel.taskbar.fullScrollView;
|
||||
let variableWidth = !useFixedWidth || Panel.checkIfVertical() || this.dtpPanel.taskbar.fullScrollView;
|
||||
let fontWeight = Me.settings.get_string('group-apps-label-font-weight');
|
||||
let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') *
|
||||
St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let scaleFactor = Utils.getScaleFactor();
|
||||
let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * scaleFactor;
|
||||
|
||||
this._windowTitle[(maxLabelWidth > 0 ? 'show' : 'hide')]();
|
||||
|
||||
this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0;
|
||||
this._windowTitle.clutter_text.natural_width_set = useFixedWidth;
|
||||
this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + TITLE_RIGHT_PADDING);
|
||||
this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + TITLE_RIGHT_PADDING * scaleFactor);
|
||||
|
||||
this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' +
|
||||
'font-weight: ' + fontWeight + ';' +
|
||||
@@ -514,7 +514,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
let highlightMargin = isWide ? Me.settings.get_int('dot-size') : 0;
|
||||
|
||||
if(!this.window) {
|
||||
let containerWidth = this._dtpIconContainer.get_width() / St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let containerWidth = this._dtpIconContainer.get_width() / Utils.getScaleFactor();;
|
||||
let backgroundSize = containerWidth + "px " +
|
||||
(containerWidth - (pos == DOT_POSITION.BOTTOM ? highlightMargin : 0)) + "px;";
|
||||
|
||||
@@ -958,7 +958,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
},
|
||||
|
||||
_getRunningIndicatorSize: function() {
|
||||
return Me.settings.get_int('dot-size') * St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
return Me.settings.get_int('dot-size') * Utils.getScaleFactor();
|
||||
},
|
||||
|
||||
_getRunningIndicatorColor: function(isFocused) {
|
||||
@@ -1165,11 +1165,10 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
// We apply an overall scale factor that might come from a HiDPI monitor.
|
||||
// Clutter dimensions are in physical pixels, but CSS measures are in logical
|
||||
// pixels, so make sure to consider the scale.
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
// Set the font size to something smaller than the whole icon so it is
|
||||
// still visible. The border radius is large to make the shape circular
|
||||
let [minWidth, natWidth] = this._dtpIconContainer.get_preferred_width(-1);
|
||||
let font_size = Math.round(Math.max(12, 0.3 * natWidth) / scaleFactor);
|
||||
let font_size = Math.round(Math.max(12, 0.3 * natWidth) / Utils.getScaleFactor());
|
||||
let size = Math.round(font_size * 1.3);
|
||||
let label = bin.child;
|
||||
let style = 'font-size: ' + font_size + 'px;' +
|
||||
|
||||
@@ -74,7 +74,7 @@ function _enable() {
|
||||
// Disable Ubuntu Dock
|
||||
let extensionOrder = (extensionSystem.extensionOrder || extensionSystem._extensionOrder);
|
||||
|
||||
St.ThemeContext.get_for_stage(global.stage).get_theme().unload_stylesheet(ubuntuDock.stylesheet);
|
||||
Utils.getStageTheme().get_theme().unload_stylesheet(ubuntuDock.stylesheet);
|
||||
ubuntuDock.stateObj.disable();
|
||||
disabledUbuntuDock = true;
|
||||
ubuntuDock.state = 2; //ExtensionState.DISABLED
|
||||
|
||||
7
panel.js
7
panel.js
@@ -348,7 +348,7 @@ var dtpPanel = Utils.defineClass({
|
||||
this._signalsHandler.add(
|
||||
// this is to catch changes to the theme or window scale factor
|
||||
[
|
||||
St.ThemeContext.get_for_stage(global.stage),
|
||||
Utils.getStageTheme(),
|
||||
'changed',
|
||||
() => this._resetGeometry()
|
||||
],
|
||||
@@ -650,7 +650,8 @@ var dtpPanel = Utils.defineClass({
|
||||
//centered relatively to the monitor. This looks misaligned, adjust it here so it
|
||||
//is centered like the rest of the overview elements.
|
||||
let paddingSide = getPosition() == St.Side.LEFT ? 'left' : 'right';
|
||||
let style = offset ? 'padding-' + paddingSide + ':' + offset + 'px;' : null;
|
||||
let scaleFactor = Utils.getScaleFactor();
|
||||
let style = offset ? 'padding-' + paddingSide + ':' + (offset / scaleFactor) + 'px;' : null;
|
||||
let searchEntry = Main.overview._searchEntry || Main.overview._overview._searchEntry;
|
||||
|
||||
searchEntry.get_parent().set_style(style);
|
||||
@@ -692,7 +693,7 @@ var dtpPanel = Utils.defineClass({
|
||||
},
|
||||
|
||||
getGeometry: function() {
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor || 1;
|
||||
let scaleFactor = Utils.getScaleFactor();
|
||||
let panelBoxTheme = this.panelBox.get_theme_node();
|
||||
let lrPadding = panelBoxTheme.get_padding(St.Side.RIGHT) + panelBoxTheme.get_padding(St.Side.LEFT);
|
||||
let topPadding = panelBoxTheme.get_padding(St.Side.TOP);
|
||||
|
||||
@@ -419,7 +419,7 @@ var ProgressIndicator = Utils.defineClass({
|
||||
},
|
||||
|
||||
_drawProgressOverlay: function(area) {
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let scaleFactor = Utils.getScaleFactor();
|
||||
let [surfaceWidth, surfaceHeight] = area.get_surface_size();
|
||||
let cr = area.get_context();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ var DynamicTransparency = Utils.defineClass({
|
||||
_bindSignals: function() {
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
St.ThemeContext.get_for_stage(global.stage),
|
||||
Utils.getStageTheme(),
|
||||
'changed',
|
||||
() => this._updateAllAndSet()
|
||||
],
|
||||
|
||||
8
utils.js
8
utils.js
@@ -294,6 +294,14 @@ var getWorkspaceCount = function() {
|
||||
return DisplayWrapper.getWorkspaceManager().n_workspaces;
|
||||
};
|
||||
|
||||
var getStageTheme = function() {
|
||||
return St.ThemeContext.get_for_stage(global.stage);
|
||||
};
|
||||
|
||||
var getScaleFactor = function() {
|
||||
return getStageTheme().scale_factor || 1;
|
||||
};
|
||||
|
||||
var findIndex = function(array, predicate) {
|
||||
if (Array.prototype.findIndex) {
|
||||
return array.findIndex(predicate);
|
||||
|
||||
@@ -416,7 +416,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
isLeftButtons = Meta.prefs_get_button_layout().left_buttons.indexOf(Meta.ButtonFunction.CLOSE) >= 0;
|
||||
isTopHeader = Me.settings.get_string('window-preview-title-position') == 'TOP';
|
||||
isManualStyling = Me.settings.get_boolean('window-preview-manual-styling');
|
||||
scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
scaleFactor = Utils.getScaleFactor();
|
||||
headerHeight = Me.settings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0;
|
||||
animationTime = Me.settings.get_int('window-preview-animation-time') * .001;
|
||||
aspectRatio.x = {
|
||||
|
||||
Reference in New Issue
Block a user