summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-11-22 23:49:55 +0100
committerMarcus Lundblad <ml@dfupdate.se>2022-11-23 22:04:40 +0100
commit1f6271805851f0a20763170556fe1f132eacc8f4 (patch)
tree413b27a6a0626e3d6db46a8955d82747b57c9b2d
parentc6be97003d57a7a28eb3a4bc3d212f8a3888a61b (diff)
downloadgnome-maps-wip/mlundblad/determine-adaptive-on-surface.tar.gz
mainWindow: Use notify::width on GdkSurface track adaptive changeswip/mlundblad/determine-adaptive-on-surface
Use the width of the backing GdkSurface to determine when the application is in adaptive mode.
-rw-r--r--src/mainWindow.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mainWindow.js b/src/mainWindow.js
index cf771082..494cacfb 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -330,17 +330,22 @@ export class MainWindow extends Gtk.ApplicationWindow {
this._actionBarRight = new HeaderBarRight({ mapView: this._mapView });
this._actionBar.pack_end(this._actionBarRight);
+ }
+
+ vfunc_realize() {
+ super.vfunc_realize();
+ this._surface = this.get_native().get_surface();
// update adaptive status based on initial geometry
this._updateAdaptiveMode();
- this.connect('notify::default-width', () => {
+ this._surface.connect('notify::width', () => {
this._updateAdaptiveMode();
});
}
_updateAdaptiveMode() {
- let width = this.default_width;
+ let width = this._surface.width;
if (width < _ADAPTIVE_VIEW_WIDTH) {
this.application.adaptive_mode = true;