MCDE dtfile: Space and Escape in the column list too (t0171)
The column view's lists take the focus, so the work area's translations did
not reach them: XtOverrideTranslations on every column list binds Space and
Escape to the same McdeKey action ("peek", "peekesc"), with the window's
record as the action's parameter, as translations_da does it.
The keys also go back where they were instead of always to the work area:
the preview remembers XmGetFocusWidget() of the window before it opens and
restores that, so that the arrow keys of a column list keep moving the
selection and the preview follows it (_McdePeekPath).
Measured under Xvfb with xdotool: Cmd+3, a row chosen, Space opens the
preview; Down moves the selection to Bild-2.png and the preview changes with
it (docs/screenshots/leopard/finder-quick-look-columns-mcde.png); Escape
closes it. In the icon view Space still opens and closes (no preview in the
picture after the second Space).
This commit is contained in:
1 parent
ff5248a6de
commit
92c3dc5165
2 files changed
+28
-8
No files matched your search
@@ -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,
|
||||
"<Key>space:McdeKey(%p,peek)\n"
|
||||
"<Key>osfCancel:McdeKey(%p,peekesc)", (void *)rec,
|
||||
(void *)rec);
|
||||
XtOverrideTranslations(c->list,
|
||||
XtParseTranslationTable(trans));
|
||||
}
|
||||
XtManageChild(c->list);
|
||||
wins[k].ncol++;
|
||||
}
|
||||
|
||||
+16
-8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user