From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: mouse-autoselect-window Date: Fri, 28 Sep 2007 11:11:00 +0200 Message-ID: <46FCC524.1070507@gmx.at> References: <46F00107.4030405@gmx.at> <87zlzjpu29.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090401040702080903040300" X-Trace: sea.gmane.org 1190970793 19928 80.91.229.12 (28 Sep 2007 09:13:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2007 09:13:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Berman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 28 11:13:08 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IbBu9-0005oI-PG for ged-emacs-devel@m.gmane.org; Fri, 28 Sep 2007 11:13:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IbBu5-0006XK-Mn for ged-emacs-devel@m.gmane.org; Fri, 28 Sep 2007 05:12:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IbBu0-0006Wx-Ng for emacs-devel@gnu.org; Fri, 28 Sep 2007 05:12:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IbBtz-0006WP-LX for emacs-devel@gnu.org; Fri, 28 Sep 2007 05:12:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IbBtz-0006WM-Eo for emacs-devel@gnu.org; Fri, 28 Sep 2007 05:12:51 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IbBty-0000xA-Nf for emacs-devel@gnu.org; Fri, 28 Sep 2007 05:12:51 -0400 Original-Received: (qmail invoked by alias); 28 Sep 2007 09:12:48 -0000 Original-Received: from N797P026.adsl.highway.telekom.at (EHLO [62.47.43.154]) [62.47.43.154] by mail.gmx.net (mp051) with SMTP; 28 Sep 2007 11:12:48 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18hBCYzr5Yh8KqPFO7DMunfv81Xhn8mxUo/7dbN72 8qYeIVu2iwPm5W User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <87zlzjpu29.fsf@escher.local.home> X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:79986 Archived-At: This is a multi-part message in MIME format. --------------090401040702080903040300 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > With this and with mouse-autoselect-window set to t, moving the mouse > to another Emacs frame of the same session immediately raises and > focusses it, just like with your other patch using select-frame and > raise-frame. Again, that is the same as when I set the KDE focus > policy to focus follows mouse -- but again, since I have the policy > set to focus follows click, I would not expect Emacs to behave > differently. > > With mouse-autoselect-window set to a number, I get both raising and > focussing, but only with split windows and only in alternation. As > before, with unsplit frame moving the mouse over another frame neither > raises nor focusses. I tried to fix a couple of bugs. Could you please try again with the attached patches (against CVS EMACS_22_BASE) and all settings you can reasonably test. --------------090401040702080903040300 Content-Type: text/plain; name="mouse-autoselect-src.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="mouse-autoselect-src.patch" *** frame.c Wed Jul 25 07:15:52 2007 --- frame.c Fri Sep 28 10:39:16 2007 *************** *** 118,123 **** --- 118,125 ---- Lisp_Object Vmouse_position_function; Lisp_Object Vmouse_highlight; Lisp_Object Vdelete_frame_functions; +=20 + int focus_follows_mouse; =0C static void set_menu_bar_lines_1 (window, n) *************** *** 4151,4156 **** --- 4153,4173 ---- =20 This variable is local to the current terminal and cannot be buffer-loc= al. */); =20 + DEFVAR_BOOL ("focus-follows-mouse", &focus_follows_mouse, + doc: /* Non-nil if window system changes focus when you move th= e mouse. + You should set this variable to tell Emacs how your window manager + handles focus, since there is no way in general for Emacs to find out + automatically. */); + #ifdef HAVE_WINDOW_SYSTEM + #if defined(HAVE_NTGUI) || defined(MAC_OS) + focus_follows_mouse =3D 0; + #else + focus_follows_mouse =3D 1; + #endif + #else + focus_follows_mouse =3D 0; + #endif + =20 staticpro (&Vframe_list); =20 defsubr (&Sactive_minibuffer_window); *** frame.h Fri Sep 14 22:50:14 2007 --- frame.h Fri Sep 28 10:40:38 2007 *************** *** 39,44 **** --- 39,49 ---- =20 extern int message_buf_print; =20 + /* Nonzero means window system changes focus when moving the + mouse. */ +=20 + extern int focus_follows_mouse; +=20 =0C /* The structure representing a frame. */ =20 *** keyboard.c Fri Sep 14 22:50:16 2007 --- keyboard.c Fri Sep 28 10:42:30 2007 *************** *** 3995,4000 **** --- 3995,4003 ---- /* Wait until there is input available. */ for (;;) { + if (CONSP (Vunread_command_events)) + break; + =20 if (kbd_fetch_ptr !=3D kbd_store_ptr) break; #ifdef HAVE_MOUSE *** macterm.c Tue Aug 28 08:27:32 2007 --- macterm.c Fri Sep 28 10:43:52 2007 *************** *** 11119,11125 **** will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) ! && !EQ (window, selected_window)) { inev.kind =3D SELECT_WINDOW_EVENT; inev.frame_or_window =3D window; --- 11119,11128 ---- will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) ! && !EQ (window, selected_window) ! && (focus_follows_mouse ! || (EQ (XWINDOW (window)->frame, ! XWINDOW (selected_window)->frame)))) { inev.kind =3D SELECT_WINDOW_EVENT; inev.frame_or_window =3D window; *** msdos.c Wed Aug 8 23:12:16 2007 --- msdos.c Fri Sep 28 10:46:08 2007 *************** *** 3393,3399 **** it is active. */ if (WINDOWP (mouse_window) && !EQ (mouse_window, last_mouse_window) ! && !EQ (mouse_window, selected_window)) { event.kind =3D SELECT_WINDOW_EVENT; event.frame_or_window =3D mouse_window; --- 3393,3402 ---- it is active. */ if (WINDOWP (mouse_window) && !EQ (mouse_window, last_mouse_window) ! && !EQ (window, selected_window) ! && (focus_follows_mouse ! || (EQ (XWINDOW (window)->frame, ! XWINDOW (selected_window)->frame)))) { event.kind =3D SELECT_WINDOW_EVENT; event.frame_or_window =3D mouse_window; *** w32term.c Sat Sep 22 10:39:36 2007 --- w32term.c Fri Sep 28 10:44:58 2007 *************** *** 4339,4345 **** only when it is active. */ if (WINDOWP(window) && !EQ (window, last_window) ! && !EQ (window, selected_window)) { inev.kind =3D SELECT_WINDOW_EVENT; inev.frame_or_window =3D window; --- 4339,4348 ---- only when it is active. */ if (WINDOWP(window) && !EQ (window, last_window) ! && !EQ (window, selected_window) ! && (focus_follows_mouse ! || (EQ (XWINDOW (window)->frame, ! XWINDOW (selected_window)->frame)))) { inev.kind =3D SELECT_WINDOW_EVENT; inev.frame_or_window =3D window; *** xterm.c Fri Sep 14 22:50:16 2007 --- xterm.c Fri Sep 28 10:45:24 2007 *************** *** 6628,6634 **** will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) ! && !EQ (window, selected_window)) { inev.ie.kind =3D SELECT_WINDOW_EVENT; inev.ie.frame_or_window =3D window; --- 6628,6637 ---- will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) ! && !EQ (window, selected_window) ! && (focus_follows_mouse ! || (EQ (XWINDOW (window)->frame, ! XWINDOW (selected_window)->frame)))) { inev.ie.kind =3D SELECT_WINDOW_EVENT; inev.ie.frame_or_window =3D window; --------------090401040702080903040300 Content-Type: text/plain; name="mouse-autoselect-lisp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mouse-autoselect-lisp.patch" *** cus-start.el Wed Jul 25 06:47:32 2007 --- cus-start.el Fri Sep 28 10:48:14 2007 *************** *** 167,172 **** --- 167,173 ---- ;; fns.c (use-dialog-box menu boolean "21.1") (use-file-dialog menu boolean "22.1") + (focus-follows-mouse frames boolean "20.3") ;; frame.c (default-frame-alist frames (repeat (cons :format "%v" *** frame.el Fri Sep 28 10:33:36 2007 --- frame.el Fri Sep 28 10:49:38 2007 *************** *** 681,695 **** (nreverse frame-initial-geometry-arguments)) (cdr param-list)) - (defcustom focus-follows-mouse (not (memq window-system '(mac w32))) - "*Non-nil if window system changes focus when you move the mouse. - You should set this variable to tell Emacs how your window manager - handles focus, since there is no way in general for Emacs to find out - automatically." - :type 'boolean - :group 'frames - :version "20.3") - (defun select-frame-set-input-focus (frame) "Select FRAME, raise it, and set input focus, if possible." (select-frame frame) --- 681,686 ---- *** window.el Wed Aug 8 23:12:06 2007 --- window.el Fri Sep 28 10:53:36 2007 *************** *** 805,814 **** "Cancel delayed window autoselection. Optional argument FORCE means cancel unconditionally." (unless (and (not force) ! ;; Don't cancel while the user drags a scroll bar. ! (eq this-command 'scroll-bar-toolkit-scroll) ! (memq (nth 4 (event-end last-input-event)) ! '(handle end-scroll))) (setq mouse-autoselect-window-state nil) (when (timerp mouse-autoselect-window-timer) (cancel-timer mouse-autoselect-window-timer)) --- 805,817 ---- "Cancel delayed window autoselection. Optional argument FORCE means cancel unconditionally." (unless (and (not force) ! ;; Don't cancel for select-window or select-frame events ! ;; or when the user drags a scroll bar. ! (or (memq this-command ! '(handle-select-window handle-switch-frame)) ! (and (eq this-command 'scroll-bar-toolkit-scroll) ! (memq (nth 4 (event-end last-input-event)) ! '(handle end-scroll))))) (setq mouse-autoselect-window-state nil) (when (timerp mouse-autoselect-window-timer) (cancel-timer mouse-autoselect-window-timer)) *************** *** 896,928 **** "Handle select-window events." (interactive "e") (let ((window (posn-window (event-start event)))) ! (when (and (window-live-p window) ! ;; Don't switch if we're currently in the minibuffer. ! ;; This tries to work around problems where the minibuffer gets ! ;; unselected unexpectedly, and where you then have to move ! ;; your mouse all the way down to the minibuffer to select it. ! (not (window-minibuffer-p (selected-window))) ! ;; Don't switch to a minibuffer window unless it's active. ! (or (not (window-minibuffer-p window)) ! (minibuffer-window-active-p window))) ! (unless (and (numberp mouse-autoselect-window) ! (not (zerop mouse-autoselect-window)) ! (not (eq mouse-autoselect-window-state 'select)) ! (progn ! ;; Cancel any delayed autoselection. ! (mouse-autoselect-window-cancel t) ! ;; Start delayed autoselection from current mouse position ! ;; and window. ! (mouse-autoselect-window-start (mouse-position) window) ! ;; Executing a command cancels delayed autoselection. ! (add-hook ! 'pre-command-hook 'mouse-autoselect-window-cancel))) ;; Reset state of delayed autoselection. (setq mouse-autoselect-window-state nil) ! (when mouse-autoselect-window ! ;; Run `mouse-leave-buffer-hook' when autoselecting window. ! (run-hooks 'mouse-leave-buffer-hook)) ! (select-window window))))) (define-key ctl-x-map "2" 'split-window-vertically) (define-key ctl-x-map "3" 'split-window-horizontally) --- 899,937 ---- "Handle select-window events." (interactive "e") (let ((window (posn-window (event-start event)))) ! (unless (or (not (window-live-p window)) ! ;; Don't switch if we're currently in the minibuffer. ! ;; This tries to work around problems where the ! ;; minibuffer gets unselected unexpectedly, and where ! ;; you then have to move your mouse all the way down to ! ;; the minibuffer to select it. ! (window-minibuffer-p (selected-window)) ! ;; Don't switch to minibuffer window unless it's active. ! (and (window-minibuffer-p window) ! (not (minibuffer-window-active-p window))) ! ;; Don't switch when autoselection shall be delayed. ! (and (numberp mouse-autoselect-window) ! (not (zerop mouse-autoselect-window)) ! (not (eq mouse-autoselect-window-state 'select)) ! (progn ! ;; Cancel any delayed autoselection. ! (mouse-autoselect-window-cancel t) ! ;; Start delayed autoselection from current mouse position ! ;; and window. ! (mouse-autoselect-window-start (mouse-position) window) ! ;; Executing a command cancels delayed autoselection. ! (add-hook ! 'pre-command-hook 'mouse-autoselect-window-cancel)))) ! (when mouse-autoselect-window ;; Reset state of delayed autoselection. (setq mouse-autoselect-window-state nil) ! ;; Set input focus to handle cross-frame movement. Bind ! ;; `focus-follows-mouse' to avoid moving the mouse cursor. ! (let (focus-follows-mouse) ! (select-frame-set-input-focus (window-frame window))) ! ;; Run `mouse-leave-buffer-hook' when autoselecting window. ! (run-hooks 'mouse-leave-buffer-hook)) ! (select-window window)))) (define-key ctl-x-map "2" 'split-window-vertically) (define-key ctl-x-map "3" 'split-window-horizontally) --------------090401040702080903040300 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------090401040702080903040300--