aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pugl/pugl.h6
-rw-r--r--pugl/pugl_internal.h7
-rw-r--r--pugl/pugl_osx.m2
-rw-r--r--pugl/pugl_win.cpp2
-rw-r--r--pugl/pugl_x11.c2
5 files changed, 19 insertions, 0 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 4d5467a..07d3cf4 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -278,6 +278,12 @@ PUGL_API void*
puglGetContext(PuglView* view);
/**
+ Return true iff the view is currently visible.
+*/
+PUGL_API bool
+puglGetVisible(PuglView* view);
+
+/**
Return the timestamp (if any) of the currently-processing event.
*/
PUGL_API uint32_t
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h
index 778ff1f..6e7e621 100644
--- a/pugl/pugl_internal.h
+++ b/pugl/pugl_internal.h
@@ -68,6 +68,7 @@ struct PuglViewImpl {
bool ignoreKeyRepeat;
bool redisplay;
bool resizable;
+ bool visible;
uint32_t event_timestamp_ms;
};
@@ -167,6 +168,12 @@ puglGetHandle(PuglView* view)
return view->handle;
}
+bool
+puglGetVisible(PuglView* view)
+{
+ return view->visible;
+}
+
uint32_t
puglGetEventTimestamp(PuglView* view)
{
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m
index 7888c6c..ecf9373 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -526,12 +526,14 @@ void
puglShowWindow(PuglView* view)
{
[view->impl->window setIsVisible:YES];
+ view->visible = true;
}
void
puglHideWindow(PuglView* view)
{
[view->impl->window setIsVisible:NO];
+ view->visible = false;
}
void
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp
index b834143..c061f25 100644
--- a/pugl/pugl_win.cpp
+++ b/pugl/pugl_win.cpp
@@ -209,6 +209,7 @@ puglShowWindow(PuglView* view)
PuglInternals* impl = view->impl;
ShowWindow(impl->hwnd, SW_SHOWNORMAL);
+ view->visible = true;
}
void
@@ -217,6 +218,7 @@ puglHideWindow(PuglView* view)
PuglInternals* impl = view->impl;
ShowWindow(impl->hwnd, SW_HIDE);
+ view->visible = false;
}
void
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index 5cd4373..4d7010b 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -347,12 +347,14 @@ void
puglShowWindow(PuglView* view)
{
XMapRaised(view->impl->display, view->impl->win);
+ view->visible = true;
}
void
puglHideWindow(PuglView* view)
{
XUnmapWindow(view->impl->display, view->impl->win);
+ view->visible = false;
}
void