unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Darren Hoo <darren.hoo@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Input for TTY menus
Date: Fri, 18 Oct 2013 15:37:06 +0800	[thread overview]
Message-ID: <m238nzni71.fsf@gmail.com> (raw)
In-Reply-To: 83bo2nnkel.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> Also with GPM, click on the top menu  it gives:
>>       <nil> <mouse-1> is undefined
>
> That's strange, maybe there's some bug in keyboard.c.  Could you
> please step with a debugger into the code in keyboard.c that starts
> like this:
>
> 	/* A mouse click.  Figure out where it is, decide whether it's
> 	   a press, click or drag, and build the appropriate structure.  */
>       case MOUSE_CLICK_EVENT:
>   #ifndef USE_TOOLKIT_SCROLL_BARS
>       case SCROLL_BAR_CLICK_EVENT:
>   #endif
> 	{
> 	  int button = event->code;
> 	  bool is_double;
> 	  Lisp_Object position;
> 	  Lisp_Object *start_pos_ptr;
> 	  Lisp_Object start_pos;
>
> 	  position = Qnil;
>
> 	  /* Build the position as appropriate for this mouse click.  */
> 	  if (event->kind == MOUSE_CLICK_EVENT)
> 	    {
> 	      struct frame *f = XFRAME (event->frame_or_window);
> 	      int row, column;
>
> and see what is going on there when GPM mouse is clicked on the menu
> bar?  The expected result is that Emacs loops through menu items below
> this code, finds the menu-bar menu item where you clicked, and return
> a menu-bar click event like this:
>
> 		    position = list4 (event->frame_or_window,
> 				      Qmenu_bar,
> 				      Fcons (event->x, event->y),
> 				      make_number (event->timestamp));
>
> 		    return list2 (item, position);

I am not quite handy on this code, but I'll give it a try, is what follows
helpul?

Breakpoint 1, make_lispy_event (event=event@entry=0x841ddf0) at keyboard.c:5425
5425	{
(gdb) 
(gdb) list
5420	   are received; this function stores the location of button presses
5421	   in order to build drag events when the button is released.  */
5422	
5423	static Lisp_Object
5424	make_lispy_event (struct input_event *event)
5425	{
5426	  int i;
5427	
5428	  switch (event->kind)
5429	    {
(gdb) p event->kind
$3 = GPM_CLICK_EVENT
(gdb) n
5428	  switch (event->kind)
(gdb) 
5425	{
(gdb) 
5428	  switch (event->kind)
(gdb) 
6037		if (button >= ASIZE (button_down_location))
(gdb) 
6031		struct frame *f = XFRAME (event->frame_or_window);
(gdb) 
6035		int button = event->code;
(gdb) 
6037		if (button >= ASIZE (button_down_location))
(gdb) 
6031		struct frame *f = XFRAME (event->frame_or_window);
(gdb) 
6037		if (button >= ASIZE (button_down_location))
(gdb) 
6046		start_pos = *start_pos_ptr;
(gdb) 
6048		position = make_lispy_position (f, event->x, event->y,
(gdb) 
6046		start_pos = *start_pos_ptr;
(gdb) 
6048		position = make_lispy_position (f, event->x, event->y,
(gdb) 
6051	 	if (event->modifiers & down_modifier)
(gdb) 
6048		position = make_lispy_position (f, event->x, event->y,
(gdb) 
6051	 	if (event->modifiers & down_modifier)
(gdb) 
6052		  *start_pos_ptr = Fcopy_alist (position);
(gdb) 
6060		head = modify_event_symbol (button,
(gdb) 
6067		if (event->modifiers & drag_modifier)
(gdb) 
6069		else if (event->modifiers & double_modifier)
(gdb) 
6071		else if (event->modifiers & triple_modifier)
(gdb) 
6074		  return list2 (head, position);
(gdb) p head
$4 = 140490514
(gdb) p position
$5 = 142829718
(gdb) n




  reply	other threads:[~2013-10-18  7:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 13:38 Input for TTY menus Eli Zaretskii
2013-09-19 13:52 ` Masatake YAMATO
2013-09-19 14:33 ` Stefan Monnier
2013-09-19 15:47   ` Eli Zaretskii
2013-09-19 19:21     ` Stefan Monnier
2013-09-23 13:18       ` Eli Zaretskii
2013-09-23 14:43         ` Stefan Monnier
2013-09-21 14:56   ` Eli Zaretskii
2013-10-17  5:34 ` Darren Hoo
2013-10-17 15:49   ` Eli Zaretskii
2013-10-18  4:55     ` Darren Hoo
2013-10-18  6:49       ` Eli Zaretskii
2013-10-18  7:37         ` Darren Hoo [this message]
2013-10-18  9:13           ` Eli Zaretskii
2013-10-18 10:39             ` Darren Hoo
2013-10-18 13:38               ` Eli Zaretskii
2013-10-18 13:40               ` Eli Zaretskii
2013-10-19 18:38                 ` Darren Hoo
2013-10-19 18:58                 ` Darren Hoo
2013-10-19 19:07                   ` Darren Hoo
2013-10-20  9:32                     ` Jan Djärv
2013-10-18 14:11         ` Eli Zaretskii
2013-10-18 15:12           ` Stefan Monnier
2013-10-18 15:28             ` Eli Zaretskii
2013-10-18 18:17               ` Stefan Monnier
2013-10-19  8:40             ` Eli Zaretskii
2013-10-19 13:45               ` Stefan Monnier
2013-10-18 17:41         ` chad
2013-10-18 17:43           ` chad
2013-10-18 18:14           ` Eli Zaretskii
2013-10-18 19:26             ` Jan Djärv
2013-10-18 20:04             ` Stefan Monnier
2013-10-19  7:35               ` Eli Zaretskii
2013-10-19  9:43                 ` Eli Zaretskii
2013-10-19 13:40                   ` Stefan Monnier
2013-10-19 14:45                     ` Eli Zaretskii
2013-10-19 15:25                       ` Stefan Monnier
2013-10-19 16:32                         ` Eli Zaretskii
2013-10-19  8:58             ` Jan Djärv
2013-10-19  9:01               ` Eli Zaretskii

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=m238nzni71.fsf@gmail.com \
    --to=darren.hoo@gmail.com \
    --cc=emacs-devel@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).