mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Improve the photo image viewer selection.
* g10/exec.c (w32_system): Add "!ShellExecute" special. * g10/photoid.c (get_default_photo_command): Use the new ShellExecute under Windows and fallbac to 'display' and 'xdg-open' in the Unix case. (show_photos): Flush stdout so that the output is shown before the image pops up. -- For Unix this basically syncs the code with what we have in gpg 1.4. Note that xdg-open may not be used when running as root which we support here. For Windows we now use ShellExecute as this seems to be preferred over "cmd /c start"; however this does not solve the actual problem we had in the bug report. To solve that problem we resort to a wait parameter which defaults to 400ms. This works on my Windows-10 virtualized test box. If we can figure out which simple viewers are commonly installed on Windows we should enhance this patch to test for them. GnuPG-bug-id: 4334 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
6fc5df1e10
commit
7e5847da0f
3 changed files with 113 additions and 36 deletions
23
doc/gpg.texi
23
doc/gpg.texi
|
@ -1426,19 +1426,24 @@ viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g.
|
|||
and "%%" for an actual percent sign. If neither %i or %I are present,
|
||||
then the photo will be supplied to the viewer on standard input.
|
||||
|
||||
The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
|
||||
STDIN". Note that if your image viewer program is not secure, then
|
||||
executing it from GnuPG does not make it secure.
|
||||
On Unix the default viewer is
|
||||
@code{xloadimage -fork -quiet -title 'KeyID 0x%k' STDIN}
|
||||
with a fallback to
|
||||
@code{display -title 'KeyID 0x%k' %i}
|
||||
and finally to
|
||||
@code{xdg-open %i}.
|
||||
On Windows
|
||||
@code{!ShellExecute 400 %i} is used; here the command is a meta
|
||||
command to use that API call followed by a wait time in milliseconds
|
||||
which is used to give the viewer time to read the temporary image file
|
||||
before gpg deletes it again. Note that if your image viewer program
|
||||
is not secure, then executing it from gpg does not make it secure.
|
||||
|
||||
@item --exec-path @var{string}
|
||||
@opindex exec-path
|
||||
@efindex PATH
|
||||
Sets a list of directories to search for photo viewers and keyserver
|
||||
helpers. If not provided, keyserver helpers use the compiled-in
|
||||
default directory, and photo viewers use the @code{PATH} environment
|
||||
variable.
|
||||
Note, that on W32 system this value is ignored when searching for
|
||||
keyserver helpers.
|
||||
Sets a list of directories to search for photo viewers If not provided
|
||||
photo viewers use the @code{PATH} environment variable.
|
||||
|
||||
@item --keyring @var{file}
|
||||
@opindex keyring
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue