13
0

defer creating a visibility tracker for a window until the window is mapped

Without this, the visibility tracker will report that the window is not visible at startup, and
this overrides the XML _visible property which denotes that the window should be made visible
This commit is contained in:
Paul Davis 2018-09-23 12:57:31 -04:00
parent b9d8f75119
commit d48dd0ccd5

View File

@ -27,8 +27,9 @@ bool VisibilityTracker::_use_window_manager_visibility = true;
VisibilityTracker::VisibilityTracker (Gtk::Window& win)
: _window (win)
, _visibility (GdkVisibilityState (0))
, _visibility (GDK_VISIBILITY_FULLY_OBSCURED)
{
std::cerr << " vis tracker for " << _window.get_title() << " created\n";
_window.add_events (Gdk::VISIBILITY_NOTIFY_MASK);
_window.signal_visibility_notify_event().connect (sigc::mem_fun (*this, &VisibilityTracker::handle_visibility_notify_event));
}
@ -42,7 +43,9 @@ VisibilityTracker::set_use_window_manager_visibility (bool yn)
bool
VisibilityTracker::handle_visibility_notify_event (GdkEventVisibility* ev)
{
std::cerr << _window.get_title() << " VISIBILITY CHANGE " << " from " << _visibility;
_visibility = ev->state;
std::cerr << " to " << _visibility << std::endl;
return false;
}
@ -80,8 +83,10 @@ bool
VisibilityTracker::partially_visible () const
{
if (_use_window_manager_visibility) {
std::cerr << _window.get_title() << " pvis from vis = " << _visibility << " mapped " << _window.is_mapped() << std::endl;
return _window.is_mapped() && ((_visibility == GDK_VISIBILITY_PARTIAL) || (_visibility == GDK_VISIBILITY_UNOBSCURED));
} else {
std::cerr << _window.get_title() << " pvis from mapped " << _window.is_mapped() << std::endl;
return _window.is_mapped();
}
}