From 6e2b4f4bdd36844721f50b71d0cbc159363ba25f Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Fri, 21 Apr 2017 23:44:43 +0200
Subject: Distinguish between widget and window wrt. visible().

---
 plugingui/eventhandler.cc | 3 ++-
 plugingui/window.cc       | 7 ++-----
 plugingui/window.h        | 1 -
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc
index decca01..4200d49 100644
--- a/plugingui/eventhandler.cc
+++ b/plugingui/eventhandler.cc
@@ -67,7 +67,8 @@ void EventHandler::processEvents()
 	bool block_interaction{false};
 	for(auto dialog : dialogs)
 	{
-		if(dialog->visible())
+		// Check if the dialog nativewindow (not the contained widget) is visible
+		if(dialog->native->visible())
 		{
 			block_interaction |= dialog->isModal();
 			dialog->eventHandler()->processEvents();
diff --git a/plugingui/window.cc b/plugingui/window.cc
index 3840643..099cb91 100644
--- a/plugingui/window.cc
+++ b/plugingui/window.cc
@@ -71,6 +71,8 @@ Window::Window(void* native_window)
 #endif // !UI_PUGL
 
 	eventhandler = new EventHandler(*native, *this);
+
+	setVisible(true); // The root widget is always visible.
 }
 
 Window::~Window()
@@ -118,11 +120,6 @@ void Window::hide()
 	Widget::hide();
 }
 
-bool Window::visible() const
-{
-	return native->visible();
-}
-
 Window* Window::window()
 {
 	return this;
diff --git a/plugingui/window.h b/plugingui/window.h
index e248b69..218beec 100644
--- a/plugingui/window.h
+++ b/plugingui/window.h
@@ -52,7 +52,6 @@ public:
 	void move(int x, int y) override;
 	void show() override;
 	void hide() override;
-	bool visible() const override;
 	Window* window() override;
 
 	ImageCache& getImageCache() override;
-- 
cgit v1.2.3