Fix window "fullscreen-changed" signal

This commit is contained in:
Rafostar
2020-10-06 12:04:28 +02:00
parent bae0b805ea
commit dbdb6988a2
2 changed files with 16 additions and 13 deletions

View File

@@ -164,6 +164,9 @@ var App = GObject.registerClass({
if(!this.player.widget)
return this.quit();
this.player.widget.width_request = 960;
this.player.widget.height_request = 540;
/*
this.player.widget.add_events(
Gdk.EventMask.SCROLL_MASK

View File

@@ -13,14 +13,11 @@ var Window = GObject.registerClass({
super._init({
application: application,
title: title || 'Clapper',
//border_width: 0,
resizable: true,
//window_position: Gtk.WindowPosition.CENTER,
width_request: 960,
height_request: 642,
destroy_with_parent: true,
});
this.isFullscreen = false;
this.mapSignal = this.connect('map', this._onMap.bind(this));
}
toggleFullscreen()
@@ -28,15 +25,11 @@ var Window = GObject.registerClass({
let un = (this.isFullscreen) ? 'un' : '';
this[`${un}fullscreen`]();
}
/*
vfunc_window_state_event(event)
{
super.vfunc_window_state_event(event);
let isFullscreen = Boolean(
event.new_window_state
& Gdk.WindowState.FULLSCREEN
);
_onStateNotify(toplevel)
{
let { state } = toplevel;
let isFullscreen = Boolean(state & Gdk.ToplevelState.FULLSCREEN);
if(this.isFullscreen === isFullscreen)
return;
@@ -44,5 +37,12 @@ var Window = GObject.registerClass({
this.isFullscreen = isFullscreen;
this.emit('fullscreen-changed', this.isFullscreen);
}
*/
_onMap()
{
this.disconnect(this.mapSignal);
let surface = this.get_surface();
surface.connect('notify::state', this._onStateNotify.bind(this));
}
});