* x_autoselect_window_p @ 2002-03-13 10:58 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 0 siblings, 2 replies; 13+ messages in thread From: Richard Stallman @ 2002-03-13 10:58 UTC (permalink / raw) Cc: gerd Gerd commented out the code for x_autoselect_window_p because he saw it was running Lisp code from a signal handler. ISTR that shortly after the code was installed I pointed out that it had to be rewritten for this reason, but that apparently was not done. It is best for it to stay commented out until someone rewrites it the right way. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-03-13 10:58 x_autoselect_window_p Richard Stallman @ 2002-03-13 23:01 ` Pavel Janík 2002-03-31 19:57 ` x_autoselect_window_p Pavel Janík 1 sibling, 0 replies; 13+ messages in thread From: Pavel Janík @ 2002-03-13 23:01 UTC (permalink / raw) Cc: emacs-devel, gerd From: Richard Stallman <rms@gnu.org> Date: Wed, 13 Mar 2002 03:58:49 -0700 (MST) > Gerd commented out the code for x_autoselect_window_p because he > saw it was running Lisp code from a signal handler. > ISTR that shortly after the code was installed I pointed > out that it had to be rewritten for this reason, but that > apparently was not done. It is best for it to stay > commented out until someone rewrites it the right way. I have it on my TODO list. -- Pavel Janík Make sure input cannot violate the limits of the program. -- The Elements of Programming Style (Kernighan & Plaugher) _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 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 ` Pavel Janík 2002-03-31 20:38 ` x_autoselect_window_p Gerd Moellmann 2002-04-01 9:25 ` x_autoselect_window_p Gerd Moellmann 1 sibling, 2 replies; 13+ messages in thread From: Pavel Janík @ 2002-03-31 19:57 UTC (permalink / raw) Cc: emacs-devel, gerd From: Richard Stallman <rms@gnu.org> Date: Wed, 13 Mar 2002 03:58:49 -0700 (MST) > Gerd commented out the code for x_autoselect_window_p because he > saw it was running Lisp code from a signal handler. > ISTR that shortly after the code was installed I pointed > out that it had to be rewritten for this reason, but that > apparently was not done. It is best for it to stay > commented out until someone rewrites it the right way. I found some time today and tried to rewrote it. But failed :-( I patched four files: /home/pavel/.Emacs/Work/emacs/src: -rw-r--r-- (modified) bře 31 21:23 keyboard.c -rw-r--r-- (modified) bře 31 20:59 keyboard.h -rw-r--r-- (modified) bře 31 20:55 termhooks.h -rw-r--r-- (modified) bře 31 20:58 xterm.c termhooks.h only adds new event type: --- 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, + /* 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) { + + /* Generate WINDOW_IN_EVENTs when needed. */ + if (x_autoselect_window_p) + { + Lisp_Object window; + int area; + static Lisp_Object last_window; + + 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))) + { + fprintf(stderr, "WINDOW_IN_EVENT generated!\n"); + + bufp->kind = WINDOW_IN_EVENT; + XSETFRAME (bufp->frame_or_window, window); + bufp->arg = Qnil; + ++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; + /* Total number of times read_char has returned, outside of macros. */ extern EMACS_INT num_nonmacro_input_events; --- keyboard.c.~1.665.~ Sun Mar 24 21:28:14 2002 +++ keyboard.c Sun Mar 31 21:23:08 2002 @@ -544,6 +544,7 @@ Lisp_Object Qdelete_frame; Lisp_Object Qiconify_frame; Lisp_Object Qmake_frame_visible; +Lisp_Object Qselect_window; Lisp_Object Qhelp_echo; /* Symbols to denote kinds of events. */ @@ -3791,6 +3792,17 @@ internal_last_event_frame = frame; kbd_fetch_ptr = event + 1; } + else if (event->kind == WINDOW_IN_EVENT) + { + + fprintf(stderr, "WINDOW_IN_EVENT received!\n"); + + /* Make an event (select-window (WINDOW)). */ + obj = Fcons (event->frame_or_window, Qnil); + obj = Fcons (Qselect_window, Fcons (obj, Qnil)); + + kbd_fetch_ptr = event + 1; + } else { /* If this event is on a different frame, return a switch-frame this @@ -10302,7 +10314,8 @@ {&Qswitch_frame, "switch-frame", &Qswitch_frame}, {&Qdelete_frame, "delete-frame", &Qdelete_frame}, {&Qiconify_frame, "iconify-frame", &Qiconify_frame}, - {&Qmake_frame_visible, "make-frame-visible", &Qmake_frame_visible} + {&Qmake_frame_visible, "make-frame-visible", &Qmake_frame_visible}, + {&Qselect_window, "select-window", &Qselect_window} }; void @@ -10968,6 +10981,8 @@ "ignore-event"); initial_define_lispy_key (Vspecial_event_map, "make-frame-visible", "ignore-event"); + initial_define_lispy_key (Vspecial_event_map, "select-window", + "handle-select-window"); initial_define_lispy_key (Vspecial_event_map, "save-session", "handle-save-session"); } I use this fake function to do the real work: (defun handle-select-window (event) "Handle delete-frame events from the X server." (interactive "e") (message "Switching to: %s" (car (event-start event))) (select-window (car (event-start event)))) To test this, I run emacs -q -eval '(setq x-autoselect-window t)', C-x 2 and move between those two windows. After about 20 calls to select-window, Emacs will crash in mark_font_cache. There is a problem somewhere, but I do not see it :-( Can you please help me so we can clear this issue? -- Pavel Janík /* These are the most dangerous and useful defines. They do printk() during * the interrupt processing routine(s), so if you manage to get "flooded" by * irq's, start thinking about the "Power off/on" button... */ -- 2.2.16 drivers/sbus/char/aurora.h ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-03-31 19:57 ` x_autoselect_window_p Pavel Janík @ 2002-03-31 20:38 ` Gerd Moellmann 2002-03-31 21:48 ` x_autoselect_window_p Gerd Moellmann 2002-04-01 9:25 ` x_autoselect_window_p Gerd Moellmann 1 sibling, 1 reply; 13+ messages in thread From: Gerd Moellmann @ 2002-03-31 20:38 UTC (permalink / raw) Cc: emacs-devel Pavel@janik.cz (Pavel Janík) writes: > --- xterm.c.~1.716.~ Sun Mar 31 18:32:34 2002 > +++ xterm.c Sun Mar 31 20:58:44 2002 > + bufp->kind = WINDOW_IN_EVENT; > + XSETFRAME (bufp->frame_or_window, window); ^^^^^^^^^ XSETWINDOW ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-03-31 20:38 ` x_autoselect_window_p Gerd Moellmann @ 2002-03-31 21:48 ` Gerd Moellmann 2002-03-31 22:44 ` x_autoselect_window_p Pavel Janík 0 siblings, 1 reply; 13+ messages in thread From: Gerd Moellmann @ 2002-03-31 21:48 UTC (permalink / raw) Cc: emacs-devel Gerd Moellmann <gerd@gnu.org> writes: > Pavel@janik.cz (Pavel Janík) writes: > > > --- xterm.c.~1.716.~ Sun Mar 31 18:32:34 2002 > > +++ xterm.c Sun Mar 31 20:58:44 2002 > > + bufp->kind = WINDOW_IN_EVENT; > > + XSETFRAME (bufp->frame_or_window, window); > ^^^^^^^^^ > XSETWINDOW Actually, since WINDOW is already a Lisp_Object, TRT would be to just use `=' here. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-03-31 21:48 ` x_autoselect_window_p Gerd Moellmann @ 2002-03-31 22:44 ` Pavel Janík 0 siblings, 0 replies; 13+ messages in thread From: Pavel Janík @ 2002-03-31 22:44 UTC (permalink / raw) Cc: emacs-devel From: gerd.moellmann@t-online.de (Gerd Moellmann) Date: 31 Mar 2002 23:48:49 +0200 > > Pavel@janik.cz (Pavel Janík) writes: > > > > > --- xterm.c.~1.716.~ Sun Mar 31 18:32:34 2002 > > > +++ xterm.c Sun Mar 31 20:58:44 2002 > > > + bufp->kind = WINDOW_IN_EVENT; > > > + XSETFRAME (bufp->frame_or_window, window); > > ^^^^^^^^^ > > XSETWINDOW > > Actually, since WINDOW is already a Lisp_Object, TRT would be to just > use `=' here. Thank you, Gerd - it took me about two hours and I did not found it :-(. BTW - do you think that this patch is correct? I do not have overview as you have... -- Pavel Janík How can you say emacs and 'no flame war' in the same sentence :-) -- Jens Axboe in private e-mail ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-03-31 19:57 ` x_autoselect_window_p Pavel Janík 2002-03-31 20:38 ` x_autoselect_window_p Gerd Moellmann @ 2002-04-01 9:25 ` Gerd Moellmann 2002-04-01 10:47 ` x_autoselect_window_p Pavel Janík 1 sibling, 1 reply; 13+ messages in thread From: Gerd Moellmann @ 2002-04-01 9:25 UTC (permalink / raw) Cc: emacs-devel 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. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-04-01 9:25 ` x_autoselect_window_p Gerd Moellmann @ 2002-04-01 10:47 ` Pavel Janík 2002-04-01 14:55 ` x_autoselect_window_p Gerd Moellmann 2002-04-02 6:44 ` x_autoselect_window_p Eli Zaretskii 0 siblings, 2 replies; 13+ messages in thread From: Pavel Janík @ 2002-04-01 10:47 UTC (permalink / raw) Cc: emacs-devel From: gerd.moellmann@t-online.de (Gerd Moellmann) Date: 01 Apr 2002 11:25:16 +0200 > I'll add some notes below. The principle seems correct to me. Thank you. > People might be more happy with a more telling name > (SELECT_WINDOW_EVENT, SWITCH_WINDOW_EVENT, ...?) Yes, I have chosen SELECT_WINDOW_EVENT for now because it matches the real functionality. > > - if (f) > > + if (f) { > > (signal 'coding-convention-error "{") :-) ;-) Fixed. > On some systems, `static' gets defined away, so if you need such a > variable in Emacs, you must move it to global scope. I moved it up. > > + /* 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. Well, we can split this. I do not want to generate an event for every mouse move, so I think it is OK to have + if (!EQ (window, last_window) + && !EQ (window, selected_window) here, but the rest can in fact be moved to Elisp. > > > + { > > + 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. Like this? + /* 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) + && numchars > 0) + { + bufp->kind = SELECT_WINDOW_EVENT; + bufp->frame_or_window = window; + bufp->arg = Qnil; + ++bufp, ++count, --numchars; + } > If this isn't an X-only feature, the `x_' prefix might be a bit > confusing. Yes, this was already proposed by both Eli and Richard. I will change that before really committing to autoselect-window (autoselect_window_p). -- Pavel Janík kwintv is always crashing. Please fix it fast.. I want to watch Star Trek. -- Thomas Biege <thomas@suse.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-04-01 10:47 ` x_autoselect_window_p Pavel Janík @ 2002-04-01 14:55 ` 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 1 sibling, 1 reply; 13+ messages in thread From: Gerd Moellmann @ 2002-04-01 14:55 UTC (permalink / raw) Pavel@janik.cz (Pavel Janík) writes: > > > + /* 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. > > Well, we can split this. I do not want to generate an event for every > mouse move, so I think it is OK to have > > + if (!EQ (window, last_window) > + && !EQ (window, selected_window) > > here, but the rest can in fact be moved to Elisp. Yes, probably. > > > > > + { > > > + 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. > > Like this? Yup. I guess that's all, then. Except maybe that I forgot to warn that I didn't see the case handled where the mouse is moved to something that's not selectable. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-04-01 14:55 ` x_autoselect_window_p Gerd Moellmann @ 2002-04-01 16:55 ` Pavel Janík 0 siblings, 0 replies; 13+ messages in thread From: Pavel Janík @ 2002-04-01 16:55 UTC (permalink / raw) Cc: emacs-devel From: gerd.moellmann@t-online.de (Gerd Moellmann) Date: 01 Apr 2002 16:55:54 +0200 > I guess that's all, then. Except maybe that I forgot to warn that I > didn't see the case handled where the mouse is moved to something > that's not selectable. Yup, like tool-bar ;-) I already fixed that. -- Pavel Janík It is better to keep your mouth shut and be thought a fool, than to open it and remove all doubt. -- Ion Badulescu in linux-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 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-02 6:44 ` Eli Zaretskii 2002-04-03 4:55 ` x_autoselect_window_p Richard Stallman 1 sibling, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2002-04-02 6:44 UTC (permalink / raw) Cc: gerd, emacs-devel On Mon, 1 Apr 2002, Pavel =?iso-8859-2?q?Jan=EDk?= wrote: > > If this isn't an X-only feature, the `x_' prefix might be a bit > > confusing. > > Yes, this was already proposed by both Eli and Richard. I will change that > before really committing to autoselect-window (autoselect_window_p). Wouldn't it be better to have something in the name of the feature that would hint it's connected with the mouse? Something like mouse-autoselect-window-p? ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-04-02 6:44 ` x_autoselect_window_p Eli Zaretskii @ 2002-04-03 4:55 ` Richard Stallman 2002-04-03 8:33 ` x_autoselect_window_p Pavel Janík 0 siblings, 1 reply; 13+ messages in thread From: Richard Stallman @ 2002-04-03 4:55 UTC (permalink / raw) Cc: Pavel, gerd, emacs-devel Wouldn't it be better to have something in the name of the feature that would hint it's connected with the mouse? Something like mouse-autoselect-window-p? I agree. Also, the ending "-p" is not appropriate for a variable. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: x_autoselect_window_p 2002-04-03 4:55 ` x_autoselect_window_p Richard Stallman @ 2002-04-03 8:33 ` Pavel Janík 0 siblings, 0 replies; 13+ messages in thread From: Pavel Janík @ 2002-04-03 8:33 UTC (permalink / raw) Cc: eliz, gerd, emacs-devel From: Richard Stallman <rms@gnu.org> Date: Tue, 2 Apr 2002 21:55:40 -0700 (MST) > Wouldn't it be better to have something in the name of the feature that > would hint it's connected with the mouse? Something like > mouse-autoselect-window-p? > > I agree. Also, the ending "-p" is not appropriate for a variable. So, I will rename it to mouse-autoselect-window. Thank you. -- Pavel Janík It's known to be very buggy (it comes directly from the hardware manufacturer). -- Hubert Mantel about some driver for eth. card ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2002-04-03 8:33 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` x_autoselect_window_p Gerd Moellmann 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
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.