make it possible to disable VisibilityTracker's use of WM visibility
This commit is contained in:
parent
207fa93cf9
commit
73f3abedea
|
@ -35,6 +35,8 @@ class LIBGTKMM2EXT_API VisibilityTracker : public virtual sigc::trackable {
|
|||
VisibilityTracker (Gtk::Window&);
|
||||
virtual ~VisibilityTracker() {}
|
||||
|
||||
static void set_use_window_manager_visibility (bool);
|
||||
static bool use_window_manager_visibility() { return _use_window_manager_visibility; }
|
||||
void cycle_visibility ();
|
||||
|
||||
bool fully_visible() const;
|
||||
|
@ -46,6 +48,9 @@ class LIBGTKMM2EXT_API VisibilityTracker : public virtual sigc::trackable {
|
|||
private:
|
||||
Gtk::Window& _window;
|
||||
GdkVisibilityState _visibility;
|
||||
|
||||
static bool _use_window_manager_visibility;
|
||||
|
||||
bool handle_visibility_notify_event (GdkEventVisibility*);
|
||||
};
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public vi
|
|||
sigc::connection delete_connection;
|
||||
sigc::connection configure_connection;
|
||||
|
||||
|
||||
void save_pos_and_size ();
|
||||
void set_pos_and_size ();
|
||||
void set_pos ();
|
||||
|
|
|
@ -477,6 +477,7 @@ Keyboard::leave_window (GdkEventCrossing *ev, Gtk::Window* /*win*/)
|
|||
current_window = 0;
|
||||
}
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::Keyboard, "LEAVE window without event\n");
|
||||
current_window = 0;
|
||||
}
|
||||
|
||||
|
@ -498,7 +499,9 @@ Keyboard::focus_out_window (GdkEventFocus * ev, Gtk::Window* win)
|
|||
state.clear ();
|
||||
current_window = 0;
|
||||
} else {
|
||||
current_window = 0;
|
||||
if (win == current_window) {
|
||||
current_window = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::Keyboard, string_compose ("Foucusing out window, title = %1\n", win->get_title()));
|
||||
|
|
|
@ -304,6 +304,7 @@ Tabbable::show_tab ()
|
|||
add_to_notebook (*_parent_notebook, _tab_title);
|
||||
}
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
|
||||
current_toplevel()->present ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
bool VisibilityTracker::_use_window_manager_visibility = true;
|
||||
|
||||
VisibilityTracker::VisibilityTracker (Gtk::Window& win)
|
||||
: _window (win)
|
||||
, _visibility (GdkVisibilityState (0))
|
||||
|
@ -31,11 +33,16 @@ VisibilityTracker::VisibilityTracker (Gtk::Window& win)
|
|||
_window.signal_visibility_notify_event().connect (sigc::mem_fun (*this, &VisibilityTracker::handle_visibility_notify_event));
|
||||
}
|
||||
|
||||
void
|
||||
VisibilityTracker::set_use_window_manager_visibility (bool yn)
|
||||
{
|
||||
_use_window_manager_visibility = yn;
|
||||
}
|
||||
|
||||
bool
|
||||
VisibilityTracker::handle_visibility_notify_event (GdkEventVisibility* ev)
|
||||
{
|
||||
_visibility = ev->state;
|
||||
// std::cerr << "VT: " << _window.get_title() << " vis event, fv = " << fully_visible() << " pv = " << partially_visible() << " nv = " << not_visible() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,17 +59,29 @@ VisibilityTracker::cycle_visibility ()
|
|||
bool
|
||||
VisibilityTracker::fully_visible () const
|
||||
{
|
||||
return _window.is_mapped() && (_visibility == GDK_VISIBILITY_UNOBSCURED);
|
||||
if (_use_window_manager_visibility) {
|
||||
return _window.is_mapped() && (_visibility == GDK_VISIBILITY_UNOBSCURED);
|
||||
} else {
|
||||
return _window.is_mapped();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
VisibilityTracker::not_visible () const
|
||||
{
|
||||
return !_window.is_mapped() || (_visibility == GDK_VISIBILITY_FULLY_OBSCURED);
|
||||
if (_use_window_manager_visibility) {
|
||||
return !_window.is_mapped() || (_visibility == GDK_VISIBILITY_FULLY_OBSCURED);
|
||||
} else {
|
||||
return !_window.is_mapped();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
VisibilityTracker::partially_visible () const
|
||||
{
|
||||
return _window.is_mapped() && ((_visibility == GDK_VISIBILITY_PARTIAL) || (_visibility == GDK_VISIBILITY_UNOBSCURED));
|
||||
if (_use_window_manager_visibility) {
|
||||
return _window.is_mapped() && ((_visibility == GDK_VISIBILITY_PARTIAL) || (_visibility == GDK_VISIBILITY_UNOBSCURED));
|
||||
} else {
|
||||
return _window.is_mapped();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user