all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: gerd.moellmann@t-online.de (Gerd Moellmann)
Cc: emacs-devel@gnu.org
Subject: Re: x_autoselect_window_p
Date: 01 Apr 2002 11:25:16 +0200	[thread overview]
Message-ID: <86r8lz3h4z.fsf@gerd.dnsq.org> (raw)
In-Reply-To: <m3bsd4zf17.fsf@Janik.cz>

Pavel@janik.cz (Pavel Janík) writes:

> BTW - do you think that this patch is correct? I do not have
> overview as you have...

I'll add some notes below.  The principle seems correct to me.


> --- termhooks.h.~1.57.~	Sun Mar 10 19:22:28 2002
> +++ termhooks.h	Sun Mar 31 20:55:30 2002
> @@ -325,6 +325,9 @@
>       `switch-frame' events in kbd_buffer_get_event, if necessary.  */
>    FOCUS_IN_EVENT,
>  
> +  /* Generated when mouse moves over window not currently selected.  */
> +  WINDOW_IN_EVENT,

People might be more happy with a more telling name
(SELECT_WINDOW_EVENT, SWITCH_WINDOW_EVENT, ...?)

> +
>    /* Queued from XTread_socket when session manager sends
>       save yourself before shutdown. */
>    save_session_event
> 
> 
> xterm.c now generates this event when it should:
> 
> --- xterm.c.~1.716.~	Sun Mar 31 18:32:34 2002
> +++ xterm.c	Sun Mar 31 20:58:44 2002
> @@ -10894,8 +10894,39 @@
>  		    clear_mouse_face (dpyinfo);
>  		  }
>  
> -		if (f)
> +		if (f) {

(signal 'coding-convention-error "{") :-)

> +
> +		  /* Generate WINDOW_IN_EVENTs when needed.  */
> +		  if (x_autoselect_window_p)
> +		    {
> +		      Lisp_Object window;
> +		      int area;
> +		      static Lisp_Object last_window;

On some systems, `static' gets defined away, so if you need such a
variable in Emacs, you must move it to global scope.

> +
> +		      window = window_from_coordinates (f,
> +							XINT (event.xmotion.x), XINT (event.xmotion.y),
> +							&area, 0);
> +
> +		      /* Window will be selected only when it is not selected now and
> +			 last mouse movement event was not in it.  Minibuffer window
> +			 will be selected iff it is active.  */
> +		      if (!EQ (window, last_window)
> +			  && !EQ (window, selected_window)
> +			  && (!MINI_WINDOW_P (XWINDOW (window))
> +			      || (EQ (window, minibuf_window) && minibuf_level > 0)))

Maybe it's better to leave this condition testing to the Lisp function
that is called at the end for handling the event?  It would have the
advantage of being more flexible.

> +			{
> +			  fprintf(stderr, "WINDOW_IN_EVENT generated!\n");
> +
> +			  bufp->kind = WINDOW_IN_EVENT;
> +			  XSETFRAME (bufp->frame_or_window, window);
> +			  bufp->arg = Qnil;

Strictly speaking, it might be a good idea to check for numchars > 0
before filling in the event.

> +			  ++bufp, ++count, --numchars;
> +			}
> +
> +		      last_window=window;
> +		    }
>  		  note_mouse_movement (f, &event.xmotion);
> +		}
>  		else
>  		  {
>  #ifndef USE_TOOLKIT_SCROLL_BARS
> 
> 
> So far, it is without problems, WINDOW_IN_EVENT is generated and seen in
> keyboard.c without problems. Now, we should process it:
> 
> --- keyboard.h.~1.57.~	Wed Mar  6 17:03:10 2002
> +++ keyboard.h	Sun Mar 31 20:59:52 2002
> @@ -181,6 +181,9 @@
>  /* Total number of times read_char has returned.  */
>  extern int num_input_events;
>  
> +/* Defined in xterm.c  */
> +extern int x_autoselect_window_p;
> +

If this isn't an X-only feature, the `x_' prefix might be a bit
confusing.

  parent reply	other threads:[~2002-04-01  9:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-13 10:58 x_autoselect_window_p Richard Stallman
2002-03-13 23:01 ` x_autoselect_window_p Pavel Janík
2002-03-31 19:57 ` x_autoselect_window_p Pavel Janík
2002-03-31 20:38   ` x_autoselect_window_p Gerd Moellmann
2002-03-31 21:48     ` x_autoselect_window_p Gerd Moellmann
2002-03-31 22:44       ` x_autoselect_window_p Pavel Janík
2002-04-01  9:25   ` Gerd Moellmann [this message]
2002-04-01 10:47     ` x_autoselect_window_p Pavel Janík
2002-04-01 14:55       ` x_autoselect_window_p Gerd Moellmann
2002-04-01 16:55         ` x_autoselect_window_p Pavel Janík
2002-04-02  6:44       ` x_autoselect_window_p Eli Zaretskii
2002-04-03  4:55         ` x_autoselect_window_p Richard Stallman
2002-04-03  8:33           ` x_autoselect_window_p Pavel Janík

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

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

  git send-email \
    --in-reply-to=86r8lz3h4z.fsf@gerd.dnsq.org \
    --to=gerd.moellmann@t-online.de \
    --cc=emacs-devel@gnu.org \
    --cc=gerd@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.