mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
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.
69 lines
1.6 KiB
JavaScript
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);
|
|
}
|
|
});
|