X bug fix so application closes properly when there is a window manager
This commit is contained in:
parent
e2f3a68c3b
commit
4cf198aad2
1 changed files with 17 additions and 7 deletions
|
@ -44,6 +44,7 @@ static XEvent evt;
|
|||
static Colormap cmap;
|
||||
static XVisualInfo vis;
|
||||
static XContext cxt;
|
||||
static Atom wmDelete;
|
||||
#if GINPUT_NEED_MOUSE
|
||||
static coord_t mousex, mousey;
|
||||
static uint16_t mousebuttons;
|
||||
|
@ -65,6 +66,12 @@ static void ProcessEvent(GDisplay *g, xPriv *priv) {
|
|||
XCloseDisplay(dis);
|
||||
exit(0);
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((Atom)evt.xclient.data.l[0] == wmDelete) {
|
||||
XCloseDisplay(dis);
|
||||
exit(0);
|
||||
}
|
||||
break;
|
||||
case Expose:
|
||||
XCopyArea(dis, priv->pix, evt.xexpose.window, priv->gc,
|
||||
evt.xexpose.x, evt.xexpose.y,
|
||||
|
@ -152,6 +159,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
dis = XOpenDisplay(0);
|
||||
scr = DefaultScreen(dis);
|
||||
cxt = XUniqueContext();
|
||||
wmDelete = XInternAtom(dis, "WM_DELETE_WINDOW", False);
|
||||
XSetIOErrorHandler(FatalXIOError);
|
||||
|
||||
#if GDISP_FORCE_24BIT
|
||||
|
@ -195,6 +203,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
XSync(dis, TRUE);
|
||||
|
||||
XSaveContext(dis, priv->win, cxt, (XPointer)g);
|
||||
XSetWMProtocols(dis, priv->win, &wmDelete, 1);
|
||||
|
||||
{
|
||||
char buf[132];
|
||||
|
@ -236,6 +245,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
g->g.Contrast = 50;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue