diff --git a/programs/dtfile/Columns.c b/programs/dtfile/Columns.c index 78d17a51..fa9afcde 100644 --- a/programs/dtfile/Columns.c +++ b/programs/dtfile/Columns.c @@ -329,6 +329,18 @@ AddColumn(int k, const char *dir) (XtPointer)rec); XtAddCallback(c->list, XmNdefaultActionCallback, ColumnOpen, (XtPointer)rec); + /* MCDE: Space and Escape mean the same here as in the work area, which + * the list has taken the focus from (Peek.c) */ + { + char trans[256]; + + (void)snprintf(trans, sizeof trans, + "space:McdeKey(%p,peek)\n" + "osfCancel:McdeKey(%p,peekesc)", (void *)rec, + (void *)rec); + XtOverrideTranslations(c->list, + XtParseTranslationTable(trans)); + } XtManageChild(c->list); wins[k].ncol++; } diff --git a/programs/dtfile/Peek.c b/programs/dtfile/Peek.c index 4b3f2084..efa181e9 100644 --- a/programs/dtfile/Peek.c +++ b/programs/dtfile/Peek.c @@ -73,6 +73,7 @@ typedef struct { char *path; /* what is shown, NULL for none */ void *request; /* the picture still being read */ int iw, ih; + Widget focus; /* what had the keys before the preview */ Boolean shown; /* XtPopup has been called */ Boolean fullscreen; } Peek; @@ -645,14 +646,20 @@ PictureReady(void *client, Pixmap pixmap, int w, int h) /* ---- what the file manager calls ---------------------------------------- */ -/* the window whose keys these are: the file window, not the preview */ +/* the keys go back where they were before the preview: the work area of + * the icon and list views, the column list in the column view */ static void -Refocus(FileMgrRec *rec) +Refocus(Peek *p) { - if (rec == NULL || rec->shell == NULL || XtWindow(rec->shell) == None) + FileMgrRec *rec; + Widget w; + + if (p == NULL || (rec = p->rec) == NULL || rec->shell == NULL || + XtWindow(rec->shell) == None) return; - if (rec->file_window != NULL) - XtSetKeyboardFocus(rec->shell, (Widget) rec->file_window); + w = p->focus != NULL ? p->focus : (Widget) rec->file_window; + if (w != NULL) + XtSetKeyboardFocus(rec->shell, w); XSetInputFocus(XtDisplay(rec->shell), XtWindow(rec->shell), RevertToPointerRoot, CurrentTime); } @@ -661,7 +668,7 @@ static void RefocusLater(XtPointer client, XtIntervalId *id) { (void)id; - Refocus((FileMgrRec *) client); + Refocus((Peek *) client); } void @@ -702,15 +709,16 @@ _McdePeekToggle(FileMgrRec *rec) return; } Fit(p); + p->focus = XmGetFocusWidget(rec->shell); XtPopup(p->shell, XtGrabNone); p->shown = True; /* a viewer takes no focus: the keys stay with the list behind it. * The window manager hands the focus to the new window after it is * mapped, so the window's own focus is taken back once more, a * moment later (one shot, no polling). */ - Refocus(rec); + Refocus(p); XtAppAddTimeOut(XtWidgetToApplicationContext(rec->shell), 150, - RefocusLater, rec); + RefocusLater, p); } void