aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/multiple/X/gdisp_lld_X.c19
-rw-r--r--src/ginput/driver_mouse.h6
2 files changed, 20 insertions, 5 deletions
diff --git a/drivers/multiple/X/gdisp_lld_X.c b/drivers/multiple/X/gdisp_lld_X.c
index 0462d0d6..6e0233ba 100644
--- a/drivers/multiple/X/gdisp_lld_X.c
+++ b/drivers/multiple/X/gdisp_lld_X.c
@@ -81,6 +81,7 @@ static XEvent evt;
static Colormap cmap;
static XVisualInfo vis;
static XContext cxt;
+static Atom wmDelete;
typedef struct xPriv {
Pixmap pix;
@@ -103,6 +104,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,
@@ -184,6 +191,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
@@ -227,6 +235,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];
@@ -254,6 +263,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
XSetBackground(dis, priv->gc, BlackPixel(dis, scr));
XSync(dis, TRUE);
+ // Create the associated mouse before the map
+ #if GINPUT_NEED_MOUSE
+ priv->mouse = (GMouse *)gdriverRegister((const GDriverVMT const *)GMOUSE_DRIVER_VMT, g);
+ #endif
+
XSelectInput(dis, priv->win, StructureNotifyMask);
XMapWindow(dis, priv->win);
@@ -269,11 +283,6 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT;
- // Create the associated mouse
- #if GINPUT_NEED_MOUSE
- priv->mouse = (GMouse *)gdriverRegister((const GDriverVMT const *)GMOUSE_DRIVER_VMT, g);
- #endif
-
return TRUE;
}
diff --git a/src/ginput/driver_mouse.h b/src/ginput/driver_mouse.h
index 0f4c475a..4a61d46b 100644
--- a/src/ginput/driver_mouse.h
+++ b/src/ginput/driver_mouse.h
@@ -116,6 +116,8 @@ extern "C" {
* @param[in] systeminstance The mouse instance ToDo: Add some more details
*
* @return TRUE on success, FALSE otherwise
+ * @note This routine is provided by the high level code for
+ * use in the driver VMT's GMouseVMT.d structure.
*
* @notapi
*/
@@ -125,6 +127,8 @@ extern "C" {
* @brief Routine that is called after initialization
*
* @param[in] g The mouse driver
+ * @note This routine is provided by the high level code for
+ * use in the driver VMT's GMouseVMT.d structure.
*
* @notapi
*/
@@ -134,6 +138,8 @@ extern "C" {
* @brief Deinitialize a mouse driver
*
* @param[in] g The mouse driver
+ * @note This routine is provided by the high level code for
+ * use in the driver VMT's GMouseVMT.d structure.
*
* @notapi
*/