aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
Diffstat (limited to 'src/window')
-rw-r--r--src/window/window.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/window/window.c b/src/window/window.c
index 3f902e3..1b15558 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -293,6 +293,8 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window
PointerMotionMask | Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask | ButtonMotionMask |
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | VisibilityChangeMask | PropertyChangeMask | FocusChangeMask;
+ const bool hide_window = params ? params->hidden : false;
+
if(existing_window) {
if(!XChangeWindowAttributes(context->connection, existing_window, CWColormap | CWEventMask, &window_attr)) {
fprintf(stderr, "XChangeWindowAttributes failed\n");
@@ -301,6 +303,8 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window
}
self->window = existing_window;
+ if(hide_window)
+ XUnmapWindow(context->connection, existing_window);
} else {
self->window = XCreateWindow(context->connection, parent_window, params->position.x, params->position.y,
window_size.x, window_size.y, 0,
@@ -313,7 +317,8 @@ static int mgl_window_init(mgl_window *self, const char *title, const mgl_window
}
XStoreName(context->connection, self->window, title);
- XMapWindow(context->connection, self->window);
+ if(!hide_window)
+ XMapWindow(context->connection, self->window);
}
if(params)
@@ -744,6 +749,14 @@ void mgl_window_get_scissor(mgl_window *self, mgl_scissor *scissor) {
*scissor = self->scissor;
}
+void mgl_window_set_visible(mgl_window *self, bool visible) {
+ mgl_context *context = mgl_get_context();
+ if(visible)
+ XMapWindow(context->connection, self->window);
+ else
+ XUnmapWindow(context->connection, self->window);
+}
+
bool mgl_window_is_open(const mgl_window *self) {
return self->open;
}