9 #ifndef EAGINE_INTEROP_X11_WINDOW_HPP
10 #define EAGINE_INTEROP_X11_WINDOW_HPP
22 class window :
public display_object<::Window> {
24 static auto make_window(
26 const visual_info& vi,
31 unsigned height) -> ::Window {
32 ::XSetWindowAttributes swa;
34 swa.background_pixmap = None;
37 swa.event_mask = StructureNotifyMask;
39 return ::XCreateWindow(
41 RootWindow(dpy.get(), vi->screen),
51 CWBorderPixel | CWColormap | CWEventMask,
58 const visual_info& vi,
65 : display_object<::Window>(
67 make_window(dpy, vi, cmap, pos_x, pos_y, width, height),
69 "Error creating X Window") {
70 ::XSizeHints size_hints;
71 size_hints.width = int(width);
72 size_hints.height = int(height);
74 size_hints.flags = USSize;
75 ::XSetNormalHints(dpy, this->handle(), &size_hints);
77 ::Atom wmDelete = ::XInternAtom(dpy,
"WM_DELETE_WINDOW", True);
78 ::XSetWMProtocols(dpy, this->handle(), &wmDelete, 1);
80 ::XStoreName(dpy, this->handle(), title);
81 ::XMapWindow(dpy, this->handle());
84 void select_input(
long event_mask)
const {
85 ::XSelectInput(this->display_ref(), this->handle(), event_mask);