From 54bbcd2eb1414750f69522733a993a5d9ec3e49a Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 3 Sep 2020 23:08:32 +0200 Subject: [PATCH] Make all interface buttons flat --- clapper_src/app.js | 12 +++++++++++- clapper_src/controls.js | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/clapper_src/app.js b/clapper_src/app.js index 0527433c..d2192a70 100644 --- a/clapper_src/app.js +++ b/clapper_src/app.js @@ -91,7 +91,7 @@ var App = GObject.registerClass({ this.interface = new Interface(); this.interface.controls.toggleFullscreenButton.connect( - 'clicked', () => this.window.toggleFullscreen() + 'clicked', this._onInterfaceToggleFullscreenClicked.bind(this) ); this.window.add(this.interface); @@ -200,6 +200,16 @@ var App = GObject.registerClass({ } } + _onInterfaceToggleFullscreenClicked() + { + // we need some way to refresh toggle fullscreen button on click + // otherwise it does not lose the hover effect after window transition + // for now hide->transition->show does the job done + this.interface.controls.toggleFullscreenButton.hide(); + this.window.toggleFullscreen(); + this.interface.controls.toggleFullscreenButton.show(); + } + _onPlayerRealize() { let display = this.player.widget.get_display(); diff --git a/clapper_src/controls.js b/clapper_src/controls.js index 2a849497..54e59377 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -56,6 +56,12 @@ var Controls = GObject.registerClass({ ], size: Gtk.IconSize.SMALL_TOOLBAR }); + let style = this.volumeButton.get_style_context(); + let styleStr = style.to_string(Gtk.StyleContextPrintFlags.SHOW_STYLE); + + if(!styleStr.includes('flat')) + style.add_class('flat'); + this.volumeButtonImage = this.volumeButton.get_child(); this.volumeAdjustment = this.volumeButton.get_adjustment(); this._prepareVolumeButton(); @@ -81,6 +87,7 @@ var Controls = GObject.registerClass({ let button = Gtk.Button.new_from_icon_name(iconName, size); this.setDefaultWidgetBehaviour(button); + button.get_style_context().add_class('flat'); if(!noPack) { this.pack_start(button, false, false, 0);