Commit eeb36ea5 authored by Javad Rahmatzadeh's avatar Javad Rahmatzadeh
Browse files

fix adw prefs window size for small displays

parent 3d1a61da
......@@ -6,6 +6,10 @@ We go to the next version after each release on [GNOME Shell Extensions website]
## [Unreleased]
### Fixed
- Prefs window size for small displays in GNOME Shell 42.
## [20.0.0 Hayez] - 2022-04-01
### Fixed
......
......@@ -121,7 +121,8 @@ var Prefs = class
this._onlyShowSupportedRows();
this._registerAllSignals(window);
window.set_size_request(this._windowWidthAwd, this._windowHeightAdw);
this._setWindowSize(window);
window.search_enabled = true;
}
......@@ -188,18 +189,7 @@ var Prefs = class
let window = (this._shellVersion < 40) ? obj.get_toplevel() : obj.get_root();
// default window size
let [pmWidth, pmHeight] = this._getPrimaryMonitorSize();
let sizeTolerance = 50;
if (pmWidth - sizeTolerance >= this._windowWidth &&
pmHeight - sizeTolerance >= this._windowHeight)
{
window.default_width = this._windowWidth;
window.set_size_request(this._windowWidth, this._windowHeight);
if (this._shellVersion < 40) {
window.resize(this._windowWidth, this._windowHeight);
}
}
this._setWindowSize(window);
// csd
let headerBar = this._builder.get_object('header_bar');
......@@ -217,6 +207,31 @@ var Prefs = class
return obj;
}
/**
* set window size
*
* @param {Gtk.Window|Adw.PreferencesWindow} window prefs window
*
* @returns {void}
*/
_setWindowSize(window)
{
let [pmWidth, pmHeight] = this._getPrimaryMonitorSize();
let sizeTolerance = 50;
let width = (this._shellVersion >= 42) ? this._windowWidthAdw : this._windowWidth;
let height = (this._shellVersion >= 42) ? this._windowHeightAdw : this._windowHeight;
if (pmWidth - sizeTolerance >= width && pmHeight - sizeTolerance >= height) {
if (this._shellVersion < 42) {
window.default_width = width;
}
window.set_size_request(width, height);
if (this._shellVersion < 40) {
window.resize(width, height);
}
}
}
/**
* set separators for all list boxes
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment