diff options
author | 2025-05-16 09:05:42 +0200 | |
---|---|---|
committer | 2025-05-16 09:05:42 +0200 | |
commit | 93632dc4258f511137c0b652c462af536056b1ea (patch) | |
tree | 51241900deff43a0e06729a7fcdd4fec5588aa54 /src/main/ui/x11/ui.c | |
parent | efdb37413e5acf24bf21150479176ad060a8a216 (diff) | |
download | tris-93632dc4258f511137c0b652c462af536056b1ea.tar.gz tris-93632dc4258f511137c0b652c462af536056b1ea.zip |
Add a function to get the window attributes
In that function must be defined what events to catch on the UI loop.
Diffstat (limited to 'src/main/ui/x11/ui.c')
-rw-r--r-- | src/main/ui/x11/ui.c | 17 |
1 files changed, 12 insertions, 5 deletions
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); |