emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: focus follows mouse in C


From: Pavel Janík
Subject: PATCH: focus follows mouse in C
Date: Sun, 03 Feb 2002 19:38:19 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i386-suse-linux-gnu)

Hi,

in etc/TODO we have this:

* Implement, in C, a ``focus follows mouse'' mode that selects a window
  when the mouse enters it.

So I coded this as a proof of concept and am trying it. Any comments?

Please note that this is only proof of concept, to make it complete, I have
to edit etc/TODO, lisp/cus-start.el, etc/NEWS and the manual. This is only
to test if you like it.

P.S. My opinion: I do not really like it. It is very inconvenient. I also
do not know how it will cooperate with other pieces like
mouse-avoidance-mode etc.

--- xterm.c.~1.703.~    Sun Jan 27 17:15:53 2002
+++ xterm.c     Sun Feb  3 18:12:28 2002
@@ -253,6 +253,10 @@
 
 static int any_help_event_p;
 
+/* Non-zero means autoselect window with the mouse cursor.  */
+
+int x_autoselect_window_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 +6609,17 @@
   last_mouse_motion_event = *event;
   XSETFRAME (last_mouse_motion_frame, frame);
 
+  if (x_autoselect_window_p)
+    {
+      int area;
+      Lisp_Object window;
+
+      window = window_from_coordinates (frame, XINT (event->x), XINT 
(event->y), &area, 0);
+
+      if (WINDOW_LIVE_P (window) && !MINI_WINDOW_P (XWINDOW(window)))
+       Fselect_window(window);
+    }
+
   if (event->window != FRAME_X_WINDOW (frame))
     {
       frame->mouse_moved = 1;
@@ -15002,6 +15017,10 @@
   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-stretch-cursor", &x_stretch_cursor_p,
     doc: /* *Non-nil means draw block cursor as wide as the glyph under it.

-- 
Pavel Janík

panic("Attempted to kill the idle task!");
                  -- 2.2.16 kernel/exit.c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]