unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6468: A couple of problem related to frame raising (partly w32)
@ 2010-06-19 18:23 Lennart Borgman
  2010-06-19 18:35 ` Juanma Barranquero
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Lennart Borgman @ 2010-06-19 18:23 UTC (permalink / raw)
  To: 6468

After struggling with the getting raise-frame to workaround the
current problems with raise-frame I gave up. There are a couple of
problems so I am not sure where to begin.

I think the basic problem is that there is no hook so you can be sure
when a call to raise-frame (and other frame functions) will work after
frame creation. Since part of the frame creation as I understand it is
done asynchronously be the OS/window manager I think this is a really
basic need to get Emacs to work.

But I tried to do the raise-frame in a hook to and that does not work
either in all situations and I am not quite sure why.

One problem is that the system API calls currently is not checked and
partly in bad order. Here is the relevant part from w32fns.c:

    case WM_EMACS_SETFOREGROUND:
      {
        HWND foreground_window;
        DWORD foreground_thread, retval;

        /* On NT 5.0, and apparently Windows 98, it is necessary to
           attach to the thread that currently has focus in order to
           pull the focus away from it.  */
        foreground_window = GetForegroundWindow ();
	foreground_thread = GetWindowThreadProcessId (foreground_window, NULL);
        if (!foreground_window
            || foreground_thread == GetCurrentThreadId ()
            || !AttachThreadInput (GetCurrentThreadId (),
                                   foreground_thread, TRUE))
          foreground_thread = 0;

        retval = SetForegroundWindow ((HWND) wParam);

        /* Detach from the previous foreground thread.  */
        if (foreground_thread)
          AttachThreadInput (GetCurrentThreadId (),
                             foreground_thread, FALSE);

        return retval;
      }

The first call to GetWindowThreadProcessId should not be done if the
call to GetForegroundWindow does not succeed.

If there had been error checking this problem should have been
detected long ago. I have suggested adding that but the answer so far
has not been positive. In my opinion this is a huge waste of time. (I
can surely add this to my patched version but in the current situation
where I unfortunately have to keep a lot of bug fixes in my code it
costs my just too much time.)

Next problem is that if foreground_window is not 0 then the value of
foreground_thread will be erased if do not misunderstand the C
priorities. Can someone please confirm/disconfirm this?





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2011-10-06 20:39 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-19 18:23 bug#6468: A couple of problem related to frame raising (partly w32) Lennart Borgman
2010-06-19 18:35 ` Juanma Barranquero
2010-06-19 19:14   ` Lennart Borgman
2010-06-19 19:20     ` Juanma Barranquero
2010-06-19 20:32       ` Lennart Borgman
2010-06-19 20:50         ` Juanma Barranquero
2010-06-19 23:36           ` Lennart Borgman
2010-06-19 23:58             ` Juanma Barranquero
2010-06-20  1:07               ` Lennart Borgman
2010-06-20 12:21                 ` Lennart Borgman
2010-06-21 23:19             ` Lennart Borgman
2010-06-22  8:17               ` Juanma Barranquero
2010-06-22 10:39                 ` Lennart Borgman
2010-06-22 10:58                   ` Juanma Barranquero
2010-06-23 10:17                     ` Lennart Borgman
2010-06-23 10:34                       ` Juanma Barranquero
2010-06-23 10:41                         ` Lennart Borgman
2010-06-23 10:54                           ` Juanma Barranquero
2010-06-23 11:08                             ` Lennart Borgman
2010-06-19 21:47 ` Eli Zaretskii
2011-10-06 20:35   ` Glenn Morris
     [not found] ` <handler.6468.D6468.131793333925336.notifdone@debbugs.gnu.org>
2011-10-06 20:39   ` bug#6468: closed (Re: bug#6468: A couple of problem related to frame raising (partly w32)) Lennart Borgman

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).