From 16f26d3207ac589f54946dc36a9a51e83eb392f1 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Sun, 27 Dec 2020 17:33:01 +0100 Subject: [PATCH] Move window to top when new file is opened --- clapper_src/app.js | 6 +++--- clapper_src/appBase.js | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/clapper_src/app.js b/clapper_src/app.js index c084c616..bfc4c196 100644 --- a/clapper_src/app.js +++ b/clapper_src/app.js @@ -44,10 +44,10 @@ class ClapperApp extends AppBase this.playlist = files; - if(!this.doneFirstActivate) - this._handleAppStart(); - else + if(this.doneFirstActivate) this.setWindowPlaylist(this.active_window); + + this.activate(); } _onWindowShow(window) diff --git a/clapper_src/appBase.js b/clapper_src/appBase.js index cc2842af..db2a423e 100644 --- a/clapper_src/appBase.js +++ b/clapper_src/appBase.js @@ -1,4 +1,4 @@ -const { Gio, GObject, Gtk } = imports.gi; +const { Gio, GLib, GObject, Gtk } = imports.gi; const Debug = imports.clapper_src.debug; const Menu = imports.clapper_src.menu; const Misc = imports.clapper_src.misc; @@ -51,7 +51,12 @@ class ClapperAppBase extends Gtk.Application { super.vfunc_activate(); - this._handleAppStart(); + if(!this.doneFirstActivate) + this._onFirstActivate(); + + this.active_window.present_with_time( + Math.floor(GLib.get_monotonic_time() / 1000) + ); } run(arr) @@ -59,15 +64,6 @@ class ClapperAppBase extends Gtk.Application super.run(arr || []); } - _handleAppStart() - { - if(this.doneFirstActivate) - return; - - this._onFirstActivate(); - this.active_window.present(); - } - _onFirstActivate() { let gtkSettings = Gtk.Settings.get_default();