From 93632dc4258f511137c0b652c462af536056b1ea Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Fri, 16 May 2025 09:05:42 +0200 Subject: Add a function to get the window attributes In that function must be defined what events to catch on the UI loop. --- src/main/ui/x11/ui.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/ui/x11/ui.c b/src/main/ui/x11/ui.c index e577bcf..2c605bd 100644 --- a/src/main/ui/x11/ui.c +++ b/src/main/ui/x11/ui.c @@ -55,6 +55,17 @@ gl_choose_visual(int screen) return vi; } +static XSetWindowAttributes +ui_get_attributes(Window root, XVisualInfo *vi) +{ + Colormap colormap = XCreateColormap(display, root, vi->visual, AllocNone); + XSetWindowAttributes swa; + swa.colormap = colormap; + swa.event_mask = ExposureMask | KeyPressMask; + + return swa; +} + void ui_init() { @@ -64,11 +75,7 @@ ui_init() Window root = RootWindow(display, screen); XVisualInfo *vi = gl_choose_visual(screen); - - Colormap colormap = XCreateColormap(display, root, vi->visual, AllocNone); - XSetWindowAttributes swa; - swa.colormap = colormap; - swa.event_mask = ExposureMask | KeyPressMask; + XSetWindowAttributes swa = ui_get_attributes(root, vi); window = XCreateWindow(display, root, 0, 0, 640, 480, 0, vi->depth, InputOutput, vi->visual, CWColormap | CWEventMask, &swa); XMapWindow(display, window); -- cgit v1.2.3