From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gerd.moellmann@t-online.de (Gerd Moellmann) Newsgroups: gmane.emacs.devel Subject: Re: x_autoselect_window_p Date: 01 Apr 2002 11:25:16 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <86r8lz3h4z.fsf@gerd.dnsq.org> References: <200203131058.g2DAwnL05479@wijiji.santafe.edu> Reply-To: gerd@gnu.org NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1017653434 28969 127.0.0.1 (1 Apr 2002 09:30:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 1 Apr 2002 09:30:34 +0000 (UTC) Cc: emacs-devel@gnu.org Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16ry94-0007X8-00 for ; Mon, 01 Apr 2002 11:30:34 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16ryKD-0007OA-00 for ; Mon, 01 Apr 2002 11:42:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ry8l-0007rx-00; Mon, 01 Apr 2002 04:30:15 -0500 Original-Received: from mailout02.sul.t-online.com ([194.25.134.17]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16ry86-0007ls-00 for ; Mon, 01 Apr 2002 04:29:34 -0500 Original-Received: from fwd10.sul.t-online.de by mailout02.sul.t-online.com with smtp id 16ry40-0007r8-02; Mon, 01 Apr 2002 11:25:20 +0200 Original-Received: from gerd.dnsq.org (520015515780-0001@[217.85.169.74]) by fwd10.sul.t-online.com with esmtp id 16ry3y-1uaCdUC; Mon, 1 Apr 2002 11:25:18 +0200 Original-Received: from gerd.dnsq.org (localhost [127.0.0.1]) by gerd.dnsq.org (8.12.2/8.12.2) with ESMTP id g319PGwa000553; Mon, 1 Apr 2002 11:25:16 +0200 (CEST) (envelope-from gerd@gnu.org) Original-Received: (from gerd@localhost) by gerd.dnsq.org (8.12.2/8.12.2/Submit) id g319PGWr000550; Mon, 1 Apr 2002 11:25:16 +0200 (CEST) X-Authentication-Warning: gerd.dnsq.org: gerd set sender to gerd@gnu.org using -f Original-To: Pavel =?iso-8859-2?q?Jan=EDk?= In-Reply-To: Original-Lines: 104 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 X-Sender: 520015515780-0001@t-dialin.net Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2299 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2299 Pavel@janik.cz (Pavel Jan=EDk) 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, >=20=20 > + /* 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 >=20 >=20 > xterm.c now generates this event when it should: >=20 > --- 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); > } >=20=20 > - 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 =3D 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 =3D WINDOW_IN_EVENT; > + XSETFRAME (bufp->frame_or_window, window); > + bufp->arg =3D Qnil; Strictly speaking, it might be a good idea to check for numchars > 0 before filling in the event. > + ++bufp, ++count, --numchars; > + } > + > + last_window=3Dwindow; > + } > note_mouse_movement (f, &event.xmotion); > + } > else > { > #ifndef USE_TOOLKIT_SCROLL_BARS >=20 >=20 > So far, it is without problems, WINDOW_IN_EVENT is generated and seen in > keyboard.c without problems. Now, we should process it: >=20 > --- 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; >=20=20 > +/* 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.