unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pavel@Janik.cz (Pavel Janík)
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: PATCH: focus follows mouse in C
Date: Sat, 09 Feb 2002 12:53:12 +0100	[thread overview]
Message-ID: <m3sn8aeus7.fsf@Janik.cz> (raw)
In-Reply-To: <6480-Sat09Feb2002120145+0200-eliz@is.elta.co.il> ("Eli Zaretskii"'s message of "Sat, 09 Feb 2002 12:01:46 +0200")

   From: "Eli Zaretskii" <eliz@is.elta.co.il>
   Date: Sat, 09 Feb 2002 12:01:46 +0200

   > > Of course, because "focus follows mouse".
   > 
   > That sounds like a misfeature to me: it's very easy to make small
   > mouse movements just by tapping on the table or on the keyboard.  Some
   > users might become annoyed enough to not use the feature, just because
   > of this.
   > 
   > How about if window reselection will only be done if the mouse is in a
   > window different from the one it was the last time, at least as a user
   > option?

Yes, now I finally understand your and RMS' point. I agree and I think that
it should default to behaviour described by you. I think that when I have
two windows and point is in the bottom one and I do C-x o, small mouse
movement (still in bottom window) should not (by default, but user should
be able to change it) select the bottom window again. This should be it
(module cus-start.el etc. changes):

--- xterm.c.~1.703.~	Sun Jan 27 17:15:53 2002
+++ xterm.c	Sat Feb  9 12:45:39 2002
@@ -253,6 +253,15 @@
 
 static int any_help_event_p;
 
+/* Non-zero means autoselect window with the mouse cursor.  */
+
+int x_autoselect_window_p;
+
+/* Non-zero means always autoselect window even if user switched to
+   the different window.  */
+
+int x_autoselect_always_p;
+
 /* Non-zero means draw block and hollow cursor as wide as the glyph
    under it.  For example, if a block cursor is over a tab, it will be
    drawn as wide as that tab on the display.  */
@@ -6605,6 +6614,26 @@
   last_mouse_motion_event = *event;
   XSETFRAME (last_mouse_motion_frame, frame);
 
+  if (x_autoselect_window_p)
+    {
+      int area;
+      Lisp_Object window;
+      static Lisp_Object last_window;
+
+      window = window_from_coordinates (frame, XINT (event->x), XINT (event->y), &area, 0);
+
+      /* Window will be selected only when it is not selected now and
+	 last mouse movement event was not in it.  Minubuffer window
+	 will be selected iff it is active.  */
+      if ( (x_autoselect_always_p || !EQ (window, last_window))
+	  && !EQ (window, selected_window)
+	  && (!MINI_WINDOW_P (XWINDOW (window))
+	      || (EQ (window, minibuf_window) && minibuf_level > 0)))
+	Fselect_window (window);
+
+      last_window=window;
+    }
+
   if (event->window != FRAME_X_WINDOW (frame))
     {
       frame->mouse_moved = 1;
@@ -15002,6 +15031,15 @@
   previous_help_echo = Qnil;
   staticpro (&previous_help_echo);
   help_echo_pos = -1;
+
+  DEFVAR_BOOL ("x-autoselect-window", &x_autoselect_window_p,
+    doc: /* *Non-nil means autoselect window with mouse pointer.  */);
+  x_autoselect_window_p = 0;
+
+  DEFVAR_BOOL ("x-autoselect-always", &x_autoselect_always_p,
+    doc: /* *Non-nil means always autoselect window with mouse pointer
+even if user switched to different window.  */);
+  x_autoselect_always_p = 0;
 
   DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p,
     doc: /* *Non-nil means draw block cursor as wide as the glyph under it.

-- 
Pavel Janík

panic("IRQ, you lose...");
                  -- 2.2.16 arch/mips/sgi/kernel/indy_int.c

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


  reply	other threads:[~2002-02-09 11:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m3665ewgv8.fsf@Janik.cz>
2002-02-07 14:56 ` PATCH: focus follows mouse in C Richard Stallman
2002-02-07 21:31   ` Pavel Janík
2002-02-08 23:24     ` Richard Stallman
2002-02-09  7:29       ` Pavel Janík
2002-02-09 10:01         ` Eli Zaretskii
2002-02-09 11:53           ` Pavel Janík [this message]
2002-02-09 14:52             ` Eli Zaretskii
2002-02-09 15:08               ` Pavel Janík
2002-02-09 16:26               ` Pavel Janík
2002-02-09 21:40                 ` Al Petrofsky
2002-02-10 11:15                   ` Eli Zaretskii
2002-02-10 17:52                     ` Al Petrofsky
2002-02-16 10:35               ` Pavel Janík
2002-02-16 16:46                 ` Eli Zaretskii
2002-02-11  2:08             ` Richard Stallman
2002-02-11  5:45               ` Pavel Janík
2002-02-12 15:24                 ` Richard Stallman

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=m3sn8aeus7.fsf@Janik.cz \
    --to=pavel@janik.cz \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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).