Move window to top when new file is opened

This commit is contained in:
Rafostar
2020-12-27 17:33:01 +01:00
parent 92cf34c682
commit 16f26d3207
2 changed files with 10 additions and 14 deletions

View File

@@ -44,10 +44,10 @@ class ClapperApp extends AppBase
this.playlist = files; this.playlist = files;
if(!this.doneFirstActivate) if(this.doneFirstActivate)
this._handleAppStart();
else
this.setWindowPlaylist(this.active_window); this.setWindowPlaylist(this.active_window);
this.activate();
} }
_onWindowShow(window) _onWindowShow(window)

View File

@@ -1,4 +1,4 @@
const { Gio, GObject, Gtk } = imports.gi; const { Gio, GLib, GObject, Gtk } = imports.gi;
const Debug = imports.clapper_src.debug; const Debug = imports.clapper_src.debug;
const Menu = imports.clapper_src.menu; const Menu = imports.clapper_src.menu;
const Misc = imports.clapper_src.misc; const Misc = imports.clapper_src.misc;
@@ -51,7 +51,12 @@ class ClapperAppBase extends Gtk.Application
{ {
super.vfunc_activate(); 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) run(arr)
@@ -59,15 +64,6 @@ class ClapperAppBase extends Gtk.Application
super.run(arr || []); super.run(arr || []);
} }
_handleAppStart()
{
if(this.doneFirstActivate)
return;
this._onFirstActivate();
this.active_window.present();
}
_onFirstActivate() _onFirstActivate()
{ {
let gtkSettings = Gtk.Settings.get_default(); let gtkSettings = Gtk.Settings.get_default();