{ "lwkey", Glwkeyaction },
{ "tweol", Gtweolaction },
{ "qwpop", Gqwpopaction },
+ { "qwdel", Gqwdelaction },
{ "wmdel", Gwmdelaction },
};
static char defcwanytrans[] = "\
<KeyUp>: lwkey()";
static char deftweoltrans[] = "<Key>Return: newline()\n<KeyUp>Return: tweol()";
static char defqwpoptrans[] = "<KeyDown>Return:\n<KeyUp>Return: qwpop()";
+static char defqwdeltrans[] = "<Message>WM_PROTOCOLS: qwdel()\n";
static char defwmdeltrans[] = "<Message>WM_PROTOCOLS: wmdel()\n";
XtTranslations Gtweoltable;
XtTranslations Gqwpoptable;
XtTranslations Glwanytable;
XtTranslations Gcwanytable;
+XtTranslations Gqwdeltable;
XtTranslations Gwmdeltable;
-Atom Gwmdelatom;
+Atom Gqwdelatom, Gwmdelatom;
static XtAppContext appcontext;
static XFontStruct *deffont;
Gqwpoptable = XtParseTranslationTable (defqwpoptrans);
Glwanytable = XtParseTranslationTable (deflwanytrans);
Gcwanytable = XtParseTranslationTable (defcwanytrans);
+ Gqwdeltable = XtParseTranslationTable (defqwdeltrans);
Gwmdeltable = XtParseTranslationTable (defwmdeltrans);
XtRegisterGrabAction (
Glwbutaction, True,
Gdepth = DefaultDepth (Gdisplay, Gscreenn);
deffont = XLoadQueryFont (Gdisplay, "fixed");
Gxfd = ConnectionNumber (Gdisplay);
+ Gqwdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
Gwmdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
Gpopdownflag = FALSE;
Glazyq.flag = 0;
void Glwkeyaction (Widget, XEvent *, char **, unsigned int *);
void Gtweolaction (Widget, XEvent *, char **, unsigned int *);
void Gqwpopaction (Widget, XEvent *, char **, unsigned int *);
+void Gqwdelaction (Widget, XEvent *, char **, unsigned int *);
void Gwmdelaction (Widget, XEvent *, char **, unsigned int *);
extern XtTranslations Gtweoltable;
extern XtTranslations Gqwpoptable;
extern XtTranslations Glwanytable;
extern XtTranslations Gcwanytable;
+extern XtTranslations Gqwdeltable;
extern XtTranslations Gwmdeltable;
-extern Atom Gwmdelatom;
+extern Atom Gqwdelatom, Gwmdelatom;
#endif /* _GCOMMON_H */
#include "common.h"
#include "g.h"
#include "gcommon.h"
-
#include "SF.h"
#define WQU widget->u.q
return -1;
}
XtOverrideTranslations (w, Gqwpoptable);
+ XtOverrideTranslations (widget->w, Gqwdeltable);
break;
case G_QWFILE:
widget->w = 0;
Gerr (POS, G_ERRCANNOTCREATEWIDGET);
return -1;
}
+ XtOverrideTranslations (widget->w, Gqwdeltable);
break;
}
return 0;
ADD2ARGS (XtNvalue, args ? args : "");
XtSetValues (WQU->w, argp, argn);
XtRealizeWidget (widget->w);
+ XSetWMProtocols (Gdisplay, XtWindow (widget->w), &Gqwdelatom, 1);
XQueryPointer (
Gdisplay, XtWindow (widget->w),
&rwin, &cwin, &rx, &ry, &x, &y, &mask
s1++;
}
XtRealizeWidget (widget->w);
+ XSetWMProtocols (Gdisplay, XtWindow (widget->w), &Gqwdelatom, 1);
XQueryPointer (
Gdisplay, XtWindow (widget->w),
&rwin, &cwin, &rx, &ry, &x, &y, &mask
WQU->state = 1;
}
+void Gqwdelaction (Widget w, XEvent *evp, char **app, unsigned int *anp) {
+ Gwidget_t *widget;
+
+ widget = findwidget ((unsigned long) w, G_QUERYWIDGET);
+ WQU->state = 1;
+}
+
static void qwcallback (Widget w, XtPointer clientdata, XtPointer calldata) {
Gwidget_t *widget;