Fixed a few bugs as reported by Fredrik Ljungberg <flag@it.kth.se>.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@278 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -56,7 +56,7 @@ char STRING[] = "****************";
|
|||||||
#define X_INCR 3
|
#define X_INCR 3
|
||||||
#define Y_INCR 2
|
#define Y_INCR 2
|
||||||
#define CTRL 1
|
#define CTRL 1
|
||||||
#define NOCTRL 1
|
#define NOCTRL 0
|
||||||
|
|
||||||
XtAppContext app;
|
XtAppContext app;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
@@ -466,6 +466,18 @@ post_prompt_box(Window window)
|
|||||||
time_y += 2*font_height(font);
|
time_y += 2*font_height(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
RaiseWindow(Widget w, XEvent *ev, String *s, Cardinal *n)
|
||||||
|
{
|
||||||
|
Widget x;
|
||||||
|
if(!XtIsRealized(w))
|
||||||
|
return;
|
||||||
|
x = XtParent(w);
|
||||||
|
fprintf(stderr, "%s\n", XtName(x));
|
||||||
|
XRaiseWindow(dpy, XtWindow(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ClearWindow(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
ClearWindow(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
||||||
{
|
{
|
||||||
@@ -489,12 +501,6 @@ ClearWindow(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
Visibility(Widget w, XtPointer client_data, XEvent *event, Boolean *_b)
|
|
||||||
{
|
|
||||||
XRaiseWindow(dpy, XtWindow(w));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
countdown(XtPointer _t, XtIntervalId *_d)
|
countdown(XtPointer _t, XtIntervalId *_d)
|
||||||
{
|
{
|
||||||
@@ -636,7 +642,7 @@ GetPasswd(Widget w, XEvent *_event, String *_s, Cardinal *_n)
|
|||||||
if (keysym == XK_BackSpace || keysym == XK_Delete || keysym == XK_Left) {
|
if (keysym == XK_BackSpace || keysym == XK_Delete || keysym == XK_Left) {
|
||||||
if (cnt)
|
if (cnt)
|
||||||
passwd[cnt--] = ' ';
|
passwd[cnt--] = ' ';
|
||||||
} else if (keysym == XK_u && is_ctrl == 1) {
|
} else if (keysym == XK_u && is_ctrl == CTRL) {
|
||||||
while (cnt) {
|
while (cnt) {
|
||||||
passwd[cnt--] = ' ';
|
passwd[cnt--] = ' ';
|
||||||
XDrawImageString(dpy, XtWindow(w), gc,
|
XDrawImageString(dpy, XtWindow(w), gc,
|
||||||
@@ -901,12 +907,14 @@ main (int argc, char **argv)
|
|||||||
Width = DisplayWidth(dpy, DefaultScreen(dpy)) + 2;
|
Width = DisplayWidth(dpy, DefaultScreen(dpy)) + 2;
|
||||||
Height = DisplayHeight(dpy, DefaultScreen(dpy)) + 2;
|
Height = DisplayHeight(dpy, DefaultScreen(dpy)) + 2;
|
||||||
override = XtVaAppCreateShell("xnlock", "XNlock",
|
override = XtVaAppCreateShell("xnlock", "XNlock",
|
||||||
overrideShellWidgetClass, dpy, XtNx, -1, XtNy, -1, NULL);
|
overrideShellWidgetClass, dpy,
|
||||||
|
XtNx, -1,
|
||||||
|
XtNy, -1,
|
||||||
|
NULL);
|
||||||
|
|
||||||
XtGetApplicationResources(override, &Resrcs,
|
XtGetApplicationResources(override, &Resrcs,
|
||||||
resources, XtNumber(resources), NULL, 0);
|
resources, XtNumber(resources), NULL, 0);
|
||||||
|
|
||||||
XtAddEventHandler(override, VisibilityChangeMask, FALSE, Visibility, NULL);
|
|
||||||
|
|
||||||
widget = XtVaCreateManagedWidget("_foo", widgetClass, override,
|
widget = XtVaCreateManagedWidget("_foo", widgetClass, override,
|
||||||
XtNwidth, Width,
|
XtNwidth, Width,
|
||||||
XtNheight, Height,
|
XtNheight, Height,
|
||||||
@@ -950,13 +958,16 @@ main (int argc, char **argv)
|
|||||||
static XtActionsRec actions[] = {
|
static XtActionsRec actions[] = {
|
||||||
{ "ClearWindow", ClearWindow },
|
{ "ClearWindow", ClearWindow },
|
||||||
{ "GetPasswd", GetPasswd },
|
{ "GetPasswd", GetPasswd },
|
||||||
|
{ "RaiseWindow", RaiseWindow },
|
||||||
};
|
};
|
||||||
XtAppAddActions(app, actions, XtNumber(actions));
|
XtAppAddActions(app, actions, XtNumber(actions));
|
||||||
XtOverrideTranslations(widget,
|
XtOverrideTranslations(widget,
|
||||||
XtParseTranslationTable(
|
XtParseTranslationTable(
|
||||||
"<Expose>: ClearWindow() \n\
|
"<Expose>: ClearWindow() \n"
|
||||||
<BtnDown>: GetPasswd() \n\
|
"<BtnDown>: GetPasswd() \n"
|
||||||
<KeyPress>: GetPasswd()"));
|
"<Visible>: RaiseWindow() \n"
|
||||||
|
"<KeyRelease>: GetPasswd() \n"
|
||||||
|
"<KeyPress>: GetPasswd()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
XtRealizeWidget(override);
|
XtRealizeWidget(override);
|
||||||
|
Reference in New Issue
Block a user