From e17f75b351356279778e4ea4adbb6c0d544ba755 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 15 Apr 2013 15:50:08 +0200 Subject: [PATCH 1/6] option to ignore feedback detection - /i know what i'm doing/ mode. This currently only has effect if the loop connection is made/unmade while the option was set/unset. Toggling the option itself won't trigger a graph re-order --- gtk2_ardour/rc_option_editor.cc | 8 ++++++++ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/session.cc | 5 +++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 676ebf8332..bbb0a277fa 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1512,6 +1512,14 @@ RCOptionEditor::RCOptionEditor () add_option (_("Audio"), oac); + add_option (_("Audio"), + new BoolOption ( + "ignore-feedback-loops", + _("Ignore Feedback Loops"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_ignore_feedback_loops), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_ignore_feedback_loops) + )); + add_option (_("Audio"), new OptionEditorHeading (_("Denormals"))); add_option (_("Audio"), diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index f19f8fe808..5b094afefc 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -192,6 +192,7 @@ CONFIG_VARIABLE (bool, sound_midi_notes, "sound-midi-notes", false) CONFIG_VARIABLE (bool, use_plugin_own_gui, "use-plugin-own-gui", true) CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10) CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0) +CONFIG_VARIABLE (bool, ignore_feedback_loops, "ignore-feedback-loops", false) /* denormal management */ diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6fe51961d2..394fa73079 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1522,7 +1522,7 @@ Session::resort_routes_using (boost::shared_ptr r) /* Attempt a topological sort of the route graph */ boost::shared_ptr sorted_routes = topological_sort (r, edges); - if (sorted_routes) { + if (Config->get_ignore_feedback_loops() || sorted_routes) { /* We got a satisfactory topological sort, so there is no feedback; use this new graph. @@ -1553,8 +1553,9 @@ Session::resort_routes_using (boost::shared_ptr r) #endif SuccessfulGraphSort (); /* EMIT SIGNAL */ + } - } else { + if (!sorted_routes) { /* The topological sort failed, so we have a problem. Tell everyone and stick to the old graph; this will continue to be processed, so until the feedback is fixed, what is played back will not quite From 90a4d0166292b8e7335db33f80334a03561ce5da Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 15 Apr 2013 16:02:57 +0200 Subject: [PATCH 2/6] Revert "option to ignore feedback detection - /i know what i'm doing/ mode." This reverts commit e17f75b351356279778e4ea4adbb6c0d544ba755. --- gtk2_ardour/rc_option_editor.cc | 8 -------- libs/ardour/ardour/rc_configuration_vars.h | 1 - libs/ardour/session.cc | 5 ++--- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index bbb0a277fa..676ebf8332 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1512,14 +1512,6 @@ RCOptionEditor::RCOptionEditor () add_option (_("Audio"), oac); - add_option (_("Audio"), - new BoolOption ( - "ignore-feedback-loops", - _("Ignore Feedback Loops"), - sigc::mem_fun (*_rc_config, &RCConfiguration::get_ignore_feedback_loops), - sigc::mem_fun (*_rc_config, &RCConfiguration::set_ignore_feedback_loops) - )); - add_option (_("Audio"), new OptionEditorHeading (_("Denormals"))); add_option (_("Audio"), diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 5b094afefc..f19f8fe808 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -192,7 +192,6 @@ CONFIG_VARIABLE (bool, sound_midi_notes, "sound-midi-notes", false) CONFIG_VARIABLE (bool, use_plugin_own_gui, "use-plugin-own-gui", true) CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10) CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0) -CONFIG_VARIABLE (bool, ignore_feedback_loops, "ignore-feedback-loops", false) /* denormal management */ diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 394fa73079..6fe51961d2 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1522,7 +1522,7 @@ Session::resort_routes_using (boost::shared_ptr r) /* Attempt a topological sort of the route graph */ boost::shared_ptr sorted_routes = topological_sort (r, edges); - if (Config->get_ignore_feedback_loops() || sorted_routes) { + if (sorted_routes) { /* We got a satisfactory topological sort, so there is no feedback; use this new graph. @@ -1553,9 +1553,8 @@ Session::resort_routes_using (boost::shared_ptr r) #endif SuccessfulGraphSort (); /* EMIT SIGNAL */ - } - if (!sorted_routes) { + } else { /* The topological sort failed, so we have a problem. Tell everyone and stick to the old graph; this will continue to be processed, so until the feedback is fixed, what is played back will not quite From 7bb24872e532cc1c0067bc3a8fcf7e4ec7f52beb Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 16 Apr 2013 21:53:38 +0200 Subject: [PATCH 3/6] update linux packaging script to include xjadeo & harvid --- tools/linux_packaging/build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/linux_packaging/build b/tools/linux_packaging/build index b332365407..9f70f95eb2 100755 --- a/tools/linux_packaging/build +++ b/tools/linux_packaging/build @@ -530,9 +530,13 @@ done if test x$WITH_HARVID != x ; then cd $APPBIN - HARVID_VERSION=$(curl http://ardour.org/files/video-tools/latest_version_numer.txt) + HARVID_VERSION=$(curl http://ardour.org/files/video-tools/harvid_version.txt) curl -L http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ | tar -x -z --exclude=README --exclude=harvid.1 --strip-components=1 || exit 1 + XJADEO_VERSION=$(curl http://ardour.org/files/video-tools/xjadeo_version.txt) + curl -L http://ardour.org/files/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \ + | tar -x -z --exclude=README --exclude=xjadeo.1 --strip-components=1 || exit 1 + mv xjadeo xjremote cd - fi From d1c4910f13bcc58fc897b164542d89c0e0b13677 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 20 Apr 2013 14:31:11 +0200 Subject: [PATCH 4/6] add script to install video-tools --- tools/videotimeline/install_video_tools.sh | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 tools/videotimeline/install_video_tools.sh diff --git a/tools/videotimeline/install_video_tools.sh b/tools/videotimeline/install_video_tools.sh new file mode 100755 index 0000000000..28d31f748c --- /dev/null +++ b/tools/videotimeline/install_video_tools.sh @@ -0,0 +1,105 @@ +#!/bin/sh +TARGETDIR="$1" + +if test -z "$(which curl)"; then + echo "This script requires 'curl' - please install it" >&2 + exit 1 +fi + +checkdir () { + DUT="$1" + CHECKPATH="${2:-yes}" + ECHO="${3:-echo}" + + if test -z "$DUT"; then + echo "-1" + return + fi + + if test ! -d "$DUT"; then + $ECHO "ERROR: '$DUT' is not a directory'"; >&2 + echo "-1" + return + fi + + if test ! -w "$DUT"; then + $ECHO "ERROR: no write permissions for '$DUT'" >&2 + echo "-1" + return + fi + + echo $PATH | grep -q "$DUT" + if test $? != 0; then + if test "$CHECKPATH" != "yes"; then + $ECHO "WARNING: '$DUT' is not in \$PATH" >&2 + else + $ECHO "ERROR: '$DUT' is not in \$PATH" >&2 + echo "-1" + return + fi + fi + + echo 0 +} + +while test $(checkdir "$TARGETDIR" no) != 0 ; do + + ARDOUR=$(ls -td /opt/Ardour* 2>/dev/null | head -n 1) + if test -n "${ARDOUR}" -a $(checkdir "${ARDOUR}/bin" no true) = 0; then + echo -n "found ardour installation in '${ARDOUR}/bin'. Install there? [Y|n] " + read a; + if test "$a" != "n" -a "$a" != "N"; then + TARGETDIR="${ARDOUR}/bin" + continue + fi + fi + + if test $(checkdir "/usr/bin" yes true) = 0; then + echo -n "Can write to '/usr/bin' Install there? [Y|n] " + read a; + if test "$a" != "n" -a "$a" != "N"; then + TARGETDIR="/usr/bin" + continue + fi + fi + + if test $(checkdir "${HOME}/bin" yes true) = 0; then + echo -n "Found '${HOME}/bin' in PATH. Install there? [Y|n] " + read a; + if test "$a" != "n" -a "$a" != "N"; then + TARGETDIR="${HOME}/bin" + continue + fi + fi + + if test $(checkdir "/usr/local/bin" yes true) = 0; then + echo -n "Can write to '/usr/local/bin' Install there? [Y|n] " + read a; + if test "$a" != "n" -a "$a" != "N"; then + TARGETDIR="/usr/local/bin" + continue + fi + fi + + echo + echo "ERROR: Cannot find a suitable installation directory" >&2 + echo "run: $0 /install/path/bin" >&2 + echo "'/install/path/bin' must be an existing directory and should be in \$PATH" >&2 + exit 1 +done + +############################################################################### +### actual install procedure +echo "installing video-tools to '${TARGETDIR}'.." +exit +cd "$TARGETDIR" || exit 1 + +HARVID_VERSION=$(curl http://ardour.org/files/video-tools/harvid_version.txt) +curl -L http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ + | tar -x -z --exclude=README --exclude=harvid.1 --strip-components=1 || exit 1 +XJADEO_VERSION=$(curl http://ardour.org/files/video-tools/xjadeo_version.txt) +curl -L http://ardour.org/files/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \ + | tar -x -z --exclude=README --exclude=xjadeo.1 --strip-components=1 || exit 1 +mv xjadeo xjremote + +echo "ardour video tools installed successfully" From a366fba7d0933a8f2d97d95fefcbcdc9692d2117 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 20 Apr 2013 14:52:18 +0200 Subject: [PATCH 5/6] refine video-tools installer: * arch/platform detection * curl progress-bar --- tools/videotimeline/install_video_tools.sh | 55 +++++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/tools/videotimeline/install_video_tools.sh b/tools/videotimeline/install_video_tools.sh index 28d31f748c..8ad900a99e 100755 --- a/tools/videotimeline/install_video_tools.sh +++ b/tools/videotimeline/install_video_tools.sh @@ -6,6 +6,42 @@ if test -z "$(which curl)"; then exit 1 fi +############################################################################### +### look-up architecture + +case $(uname -m) in + i[3456789]86|x86|i86pc) + echo "Architecture is x86" + MULTIARCH="i386" + ;; + x86_64|amd64|AMD64) + echo "Architecture is x86_64" + MULTIARCH="x86_64" + ;; + *) + echo + echo "ERROR: Unknown architecture `uname -m`" >&2 + exit 1 + ;; +esac + +case $(uname) in + Linux|linux) + MULTIARCH="${MULTIARCH}-linux-gnu" + ;; + *) + echo + echo "ERROR: Platform `uname` is not supported by this script" >&2 + exit 1 + ;; +esac + +echo "Multiarch triplet is '$MULTIARCH'" + + +############################################################################### +### install target directory + checkdir () { DUT="$1" CHECKPATH="${2:-yes}" @@ -90,16 +126,21 @@ done ############################################################################### ### actual install procedure -echo "installing video-tools to '${TARGETDIR}'.." -exit + +echo "installing video-tools to '${TARGETDIR}'." cd "$TARGETDIR" || exit 1 -HARVID_VERSION=$(curl http://ardour.org/files/video-tools/harvid_version.txt) -curl -L http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ +HARVID_VERSION=$(curl -s http://ardour.org/files/video-tools/harvid_version.txt) +echo "Downloading harvid-${MULTIARCH}-${HARVID_VERSION}." +curl -L --progress-bar \ + http://ardour.org/files/video-tools/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz \ | tar -x -z --exclude=README --exclude=harvid.1 --strip-components=1 || exit 1 -XJADEO_VERSION=$(curl http://ardour.org/files/video-tools/xjadeo_version.txt) -curl -L http://ardour.org/files/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \ + +XJADEO_VERSION=$(curl -s http://ardour.org/files/video-tools/xjadeo_version.txt) +echo "Downloading xjadeo-${MULTIARCH}-${XJADEO_VERSION}." +curl -L --progress-bar \ + http://ardour.org/files/video-tools/xjadeo-${MULTIARCH}-${XJADEO_VERSION}.tgz \ | tar -x -z --exclude=README --exclude=xjadeo.1 --strip-components=1 || exit 1 mv xjadeo xjremote -echo "ardour video tools installed successfully" +echo "ardour video tools installed successfully." From db34831b183d511d76ea1f29606e1933e5ad4caf Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 26 Apr 2013 14:12:52 -0400 Subject: [PATCH 6/6] redesign toggling of editor/mixer stacking to use Gtkmm2ext::VisibilityTracker --- gtk2_ardour/ardour.menus.in | 2 +- gtk2_ardour/ardour_ui.h | 2 +- gtk2_ardour/ardour_ui_dependents.cc | 50 +++++++++++++++---- gtk2_ardour/ardour_ui_ed.cc | 2 +- gtk2_ardour/editor.cc | 3 +- gtk2_ardour/editor.h | 3 +- gtk2_ardour/mixer_ui.cc | 1 + gtk2_ardour/mixer_ui.h | 4 +- gtk2_ardour/mnemonic-us.bindings.in | 2 +- libs/gtkmm2ext/gtkmm2ext/visibility_tracker.h | 4 ++ libs/gtkmm2ext/visibility_tracker.cc | 19 ++++++- 11 files changed, 73 insertions(+), 19 deletions(-) diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 10881a0fb0..0279384fb5 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -506,7 +506,7 @@ - + diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 6300a352d5..a326669ec3 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -310,7 +310,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void goto_editor_window (); void goto_mixer_window (); void toggle_mixer_window (); - void toggle_mixer_on_top (); + void toggle_editor_mixer (); int setup_windows (); void setup_transport (); diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index b9b0cdb6a2..7438fab9f0 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -150,21 +150,49 @@ ARDOUR_UI::toggle_mixer_window () } void -ARDOUR_UI::toggle_mixer_on_top () +ARDOUR_UI::toggle_editor_mixer () { + if (editor && mixer) { - if (gtk_window_is_active(Mixer_UI::instance()->gobj())) { + if (editor->get_screen() != mixer->get_screen()) { + // different screens, so don't do anything + return; + } + + /* See if they are obscuring each other */ + + gint ex, ey, ew, eh; + gint mx, my, mw, mh; + + editor->get_position (ex, ey); + editor->get_size (ew, eh); + + mixer->get_position (mx, my); + mixer->get_size (mw, mh); + + GdkRectangle e; + GdkRectangle m; + GdkRectangle r; + + e.x = ex; + e.y = ey; + e.width = ew; + e.height = eh; + + m.x = mx; + m.y = my; + m.width = mw; + m.height = mh; + + if (!gdk_rectangle_intersect (&e, &m, &r)) { + /* they do not intersect so do not toggle */ + return; + } + } + + if (mixer && mixer->fully_visible()) { goto_editor_window (); } else { - Glib::RefPtr act = ActionManager::get_action (X_("Common"), X_("toggle-mixer")); - if (act) { - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - - /* Toggle the mixer to `visible' if required */ - if (!tact->get_active ()) { - tact->set_active (true); - } - } goto_mixer_window (); } } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 2d279385ae..66335bb55b 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -239,7 +239,7 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::register_toggle_action (common_actions, X_("toggle-mixer"), S_("Window|Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_window)); - ActionManager::register_action (common_actions, X_("toggle-mixer-on-top"), _("Mixer on Top"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_mixer_on_top)); + ActionManager::register_action (common_actions, X_("toggle-editor-mixer"), _("Toggle Editor+Mixer"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_editor_mixer)); ActionManager::register_toggle_action (common_actions, X_("ToggleRCOptionsEditor"), _("Preferences"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_rc_options_window)); ActionManager::register_toggle_action (common_actions, X_("ToggleSessionOptionsEditor"), _("Properties"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_session_options_window)); act = ActionManager::register_toggle_action (common_actions, X_("ToggleInspector"), _("Tracks and Busses"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_route_params_window)); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index b7cc7b9f27..280f401fdf 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -233,7 +233,8 @@ pane_size_watcher (Paned* pane) } Editor::Editor () - : _join_object_range_state (JOIN_OBJECT_RANGE_NONE) + : VisibilityTracker (*((Gtk::Window*) this)) + , _join_object_range_state (JOIN_OBJECT_RANGE_NONE) /* time display buttons */ , minsec_label (_("Mins:Secs")) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 910df94c26..1c246a3f3b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -43,6 +43,7 @@ #include "gtkmm2ext/dndtreeview.h" #include "gtkmm2ext/stateful_button.h" #include "gtkmm2ext/bindings.h" +#include "gtkmm2ext/visibility_tracker.h" #include "pbd/stateful.h" #include "pbd/signals.h" @@ -146,7 +147,7 @@ class ImageFrameSocketHandler ; class TimeAxisViewItem ; /* */ -class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr +class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public Gtkmm2ext::VisibilityTracker { public: Editor (); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 74556c8eda..e3a97daa6f 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -83,6 +83,7 @@ Mixer_UI::instance () Mixer_UI::Mixer_UI () : Window (Gtk::WINDOW_TOPLEVEL) + , VisibilityTracker (*((Gtk::Window*) this)) , _visible (false) , no_track_list_redisplay (false) , in_group_row_change (false) diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 2946d0ae59..8a293f7f9f 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -40,6 +40,8 @@ #include "ardour/types.h" #include "ardour/session_handle.h" +#include "gtkmm2ext/visibility_tracker.h" + #include "enums.h" #include "mixer_actor.h" @@ -53,7 +55,7 @@ class PluginSelector; class MixerGroupTabs; class MonitorSection; -class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor +class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor, public Gtkmm2ext::VisibilityTracker { public: static Mixer_UI* instance(); diff --git a/gtk2_ardour/mnemonic-us.bindings.in b/gtk2_ardour/mnemonic-us.bindings.in index 0f0415c983..ef596478fc 100644 --- a/gtk2_ardour/mnemonic-us.bindings.in +++ b/gtk2_ardour/mnemonic-us.bindings.in @@ -219,7 +219,7 @@ This mode provides many different operations on both regions and control points, @sess|Main/AddTrackBus|<@PRIMARY@><@TERTIARY@>n|add track(s) or bus(ses) @sess|Main/New|<@PRIMARY@>n|open a new session @rop|Region/toggle-region-mute|<@PRIMARY@>m|mute/unmute -@wvis|Common/toggle-mixer-on-top|<@WINDOW@>m|rotate editor \& mixer window +@wvis|Common/toggle-editor-mixer|<@WINDOW@>m|rotate editor \& mixer window ;; arrow keys, navigation etc. diff --git a/libs/gtkmm2ext/gtkmm2ext/visibility_tracker.h b/libs/gtkmm2ext/gtkmm2ext/visibility_tracker.h index 6415dd6d2b..f4ed62bb21 100644 --- a/libs/gtkmm2ext/gtkmm2ext/visibility_tracker.h +++ b/libs/gtkmm2ext/gtkmm2ext/visibility_tracker.h @@ -35,6 +35,10 @@ class VisibilityTracker { void cycle_visibility (); + bool fully_visible() const; + bool not_visible() const; + bool partially_visible() const; + private: Gtk::Window& window; GdkVisibilityState _visibility; diff --git a/libs/gtkmm2ext/visibility_tracker.cc b/libs/gtkmm2ext/visibility_tracker.cc index c0aabdfca6..d5a020d370 100644 --- a/libs/gtkmm2ext/visibility_tracker.cc +++ b/libs/gtkmm2ext/visibility_tracker.cc @@ -41,10 +41,27 @@ VisibilityTracker::handle_visibility_notify_event (GdkEventVisibility* ev) void VisibilityTracker::cycle_visibility () { - if (window.is_mapped() && (_visibility == GDK_VISIBILITY_UNOBSCURED)) { + if (fully_visible ()) { window.hide (); } else { window.present (); } } +bool +VisibilityTracker::fully_visible () const +{ + return window.is_mapped() && (_visibility == GDK_VISIBILITY_UNOBSCURED); +} + +bool +VisibilityTracker::not_visible () const +{ + return !window.is_mapped() || (_visibility == GDK_VISIBILITY_FULLY_OBSCURED); +} + +bool +VisibilityTracker::partially_visible () const +{ + return window.is_mapped() && (_visibility == GDK_VISIBILITY_PARTIAL); +}