Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cube/cube.c
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,7 @@ static void demo_create_xlib_window(struct demo *demo) {
XMapWindow(demo->xlib_display, demo->xlib_window);
XFlush(demo->xlib_display);
demo->xlib_wm_delete_window = XInternAtom(demo->xlib_display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(demo->xlib_display, demo->xlib_window, &demo->xlib_wm_delete_window, 1);
}
static void demo_handle_xlib_event(struct demo *demo, const XEvent *event) {
switch (event->type) {
Expand Down
1 change: 1 addition & 0 deletions cube/cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,7 @@ void Demo::create_window<WsiPlatform::xlib>() {
XMapWindow(xlib_display, xlib_window);
XFlush(xlib_display);
xlib_wm_delete_window = XInternAtom(xlib_display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(xlib_display, xlib_window, &xlib_wm_delete_window, 1);
}

void Demo::handle_xlib_event(const XEvent *event) {
Expand Down
4 changes: 4 additions & 0 deletions cube/xlib_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef int (*PFN_XCloseDisplay)(Display* /* display */
typedef Status (*PFN_XInitThreads)(void);
typedef int (*PFN_XFlush)(Display* /* display */
);
typedef Status (*PFN_XSetWMProtocols)(Display*, Window, Atom*, int);

static PFN_XDestroyWindow cube_XDestroyWindow = NULL;
static PFN_XOpenDisplay cube_XOpenDisplay = NULL;
Expand All @@ -55,6 +56,7 @@ static PFN_XGetVisualInfo cube_XGetVisualInfo = NULL;
static PFN_XCloseDisplay cube_XCloseDisplay = NULL;
static PFN_XInitThreads cube_XInitThreads = NULL;
static PFN_XFlush cube_XFlush = NULL;
static PFN_XSetWMProtocols cube_XSetWMProtocols = NULL;

#define XDestroyWindow cube_XDestroyWindow
#define XOpenDisplay cube_XOpenDisplay
Expand All @@ -69,6 +71,7 @@ static PFN_XFlush cube_XFlush = NULL;
#define XCloseDisplay cube_XCloseDisplay
#define XInitThreads cube_XInitThreads
#define XFlush cube_XFlush
#define XSetWMProtocols cube_XSetWMProtocols

void* initialize_xlib() {
void* xlib_library = NULL;
Expand Down Expand Up @@ -101,6 +104,7 @@ void* initialize_xlib() {
cube_XCloseDisplay = TYPE_CONVERSION(PFN_XCloseDisplay)(dlsym(xlib_library, "XCloseDisplay"));
cube_XInitThreads = TYPE_CONVERSION(PFN_XInitThreads)(dlsym(xlib_library, "XInitThreads"));
cube_XFlush = TYPE_CONVERSION(PFN_XFlush)(dlsym(xlib_library, "XFlush"));
cube_XSetWMProtocols = TYPE_CONVERSION(PFN_XSetWMProtocols)(dlsym(xlib_library, "XSetWMProtocols"));

return xlib_library;
}
Loading