Files
clapper/clapper_src/app.js
Rafostar 094de19018 Remove "new-window" functionality
I were never able to get setifactionary results with this because:
* In GTK apps new window is created from the same process
* OpenGL is single-threaded so performance per window is halfed
* GTK4 has problems with rendeing using multiple contexts resulting in some frames being upside down

So for the time being I am removing a non-working option. There is a chance
that it will be fixed and added in future, but for now lets not
advertise a functionality that does not work.
2020-12-24 12:18:17 +01:00

69 lines
1.6 KiB
JavaScript

const { Gio, GObject } = imports.gi;
const { AppBase } = imports.clapper_src.appBase;
const { HeaderBar } = imports.clapper_src.headerbar;
const { Widget } = imports.clapper_src.widget;
const Debug = imports.clapper_src.debug;
let { debug } = Debug;
var App = GObject.registerClass(
class ClapperApp extends AppBase
{
_init()
{
super._init();
this.set_flags(
this.get_flags()
| Gio.ApplicationFlags.HANDLES_OPEN
);
this.playlist = [];
}
vfunc_startup()
{
super.vfunc_startup();
this.active_window.isClapperApp = true;
this.active_window.add_css_class('nobackground');
let clapperWidget = new Widget();
this.active_window.set_child(clapperWidget);
let headerBar = new HeaderBar(this.active_window);
this.active_window.set_titlebar(headerBar);
let size = clapperWidget.windowSize;
this.active_window.set_default_size(size[0], size[1]);
debug(`restored window size: ${size[0]}x${size[1]}`);
}
vfunc_open(files, hint)
{
super.vfunc_open(files, hint);
this.playlist = files;
if(!this.doneFirstActivate)
this._handleAppStart();
else
this.setWindowPlaylist(this.active_window);
}
_onWindowShow(window)
{
super._onWindowShow(window);
this.setWindowPlaylist(window);
}
setWindowPlaylist(window)
{
if(!this.playlist.length)
return;
let { player } = window.get_child();
player.set_playlist(this.playlist);
}
});