aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-30 16:10:56 +0200
committerdec05eba <dec05eba@protonmail.com>2022-03-30 16:10:56 +0200
commit956c86fe4728e6e5239202f1402fd65260ece7c8 (patch)
tree70b638cac96eb164c5320be05d14e07a142794d7 /src/window
parent131a2f0b5c51fc821224bf7637ba58df0a5ae15a (diff)
Proper y offset for text, add option to create hidden window and add function to make it visible (map, unmap)
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;
}