unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Du Yanning <duyanning@gmail.com>, jasonr@gnu.org
Cc: 13065@debbugs.gnu.org
Subject: bug#13065: Bug in x-file-dialog with GetOpenFileName
Date: Tue, 04 Dec 2012 21:10:39 +0200	[thread overview]
Message-ID: <83liddr5u8.fsf@gnu.org> (raw)
In-Reply-To: <CALr_ej1QA+12p__TQvKC0JPLudKai_t3JaPN9EiEk6YMbaWXww@mail.gmail.com>

> Date: Mon, 3 Dec 2012 19:09:49 +0800
> From: Du Yanning <duyanning@gmail.com>
> 
> Platform: Windows 7
> Emacs version: 24.2.1
> 
> Steps to reproduce this bug:
> emacs -Q
> 
> copy and paste the next line into the *scratch* buffer:
> (x-file-dialog "hi" "c:\\")
> 
> C-x C-e to evaluate it.
> The dialog appears.
> 
> Type "abc" (without the enclosing double quotes) in the "File name" field.
> Click the "Desktop" icon on the left side of the dialog.
> Click the "Open" button.
> The dialog does NOT disappear while it should.

This works fine on XP.  On Windows 7, I indeed see the problem, and it
seems to be related to any action in the dialog that changes the
original directory, which results in receiving in the dialog hook
procedure of the CDN_FOLDERCHANGE and CDN_SELCHANGE notifications
(which we don't handle).  If you just type "abc" and click "Open", the
dialog works as expected.  It also works if you do change to another
directory and select an existing file.

> I have tried GetOpenFileName/GetSaveFileName in my own Win32 programs and
> found that this behavior is casued by GetOpenFileName and GetSaveFileName
> is OK in such situation.

GetSaveFileName only works with existing files, which might explain
why it works where GetOpenFileName fails.

I tried to get this to work on Windows 7, or at least figure out why
it doesn't, but came up empty-handed.  Which is not surprising, since
I know absolutely nothing about Windows GUI dialogs in general, and
this dialog in particular.  It doesn't particularly help that:

 a) Windows 7 deprecated this kind of dialogs and instead wants us to
    use some hotshot new ones.  So it could be simply a bug in the
    implementation of this dialog on Windows 7.

 b) We use a file selection dialog in non-standard ways, to be able to
    open directories, not just files.  The way we do this employs some
    undocumented tricks which I don't fully understand.  E.g., when
    the hook gets the CDN_INITDONE notification, we access the File
    Name field of the dialog, but don't do anything with it, and just
    call EnableWindow.  Is that really necessary, and if so, why?

 c) The filter string uses some "*|*" magic in the directory filter,
    which doesn't seem to be documented anywhere.  What does it do?

I CC Jason, who is the author of this code, in the hope that he will
be able to give some advice.  Failing that, I really don't know what
to do to fix this.  Ideas and advice will be most appreciated.





  reply	other threads:[~2012-12-04 19:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 11:09 bug#13065: Bug in x-file-dialog with GetOpenFileName Du Yanning
2012-12-04 19:10 ` Eli Zaretskii [this message]
2013-01-08 13:10   ` Jason Rumney
2013-01-08 21:26     ` Eli Zaretskii
2013-01-13 12:52       ` Jason Rumney
2013-01-13 16:35         ` Eli Zaretskii
2013-01-15 18:03           ` Eli Zaretskii
2013-01-16 12:23             ` Jason Rumney
2013-01-16 18:54               ` Eli Zaretskii
2013-01-22 13:32                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83liddr5u8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=13065@debbugs.gnu.org \
    --cc=duyanning@gmail.com \
    --cc=jasonr@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).