all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* text mode menubar events get confused by left margin
@ 2007-04-03 10:23 Nick Roberts
  2007-04-03 21:49 ` Nick Roberts
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Roberts @ 2007-04-03 10:23 UTC (permalink / raw)
  To: emacs-devel


If a buffer has a non-zero left margin where are the co-ordinates of the text
mode menubar measured from?

Here's a recipe for looking at what Emacs does:

With emacs -nw, or in a console

Load tmm (click on the menubar).
Run gdb in Emacs.
Set a breakpoint in a source file.  This generates a margin.
Instrument tmm-menubar-mouse with Edebug.

Click on the menubar on the first characters of the menubar and
evaluate event.

The margin is two characters wide.  If I click on the first four characters
I get:

1  (mouse-1 (nil menu-bar (0 . 0) 1541858 nil 1 (2 . 0) nil (0 . 0) (0 . 1)))
2  (mouse-1 (nil menu-bar (1 . 0) 1551105 nil 1 (3 . 0) nil (1 . 0) (0 . 1)))
3  (mouse-1 (nil menu-bar (0 . 0) 1560616 nil 1 (0 . 0) nil (0 . 0) (1 . 0)))
4  (mouse-1 (nil menu-bar (1 . 0) 1567674 nil 2 (1 . 0) nil (0 . 0) (1 . 0)))

I can't make sense of this.  I feel that I should be able to add two numbers
to get the number on the left.


-- 
Nick                                           http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: text mode menubar events get confused by left margin
  2007-04-03 10:23 text mode menubar events get confused by left margin Nick Roberts
@ 2007-04-03 21:49 ` Nick Roberts
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Roberts @ 2007-04-03 21:49 UTC (permalink / raw)
  To: emacs-devel

 > The margin is two characters wide.  If I click on the first four characters
 > I get:
 > 
 > 1  (mouse-1 (nil menu-bar (0 . 0) 1541858 nil 1 (2 . 0) nil (0 . 0) (0 . 1)))
 > 2  (mouse-1 (nil menu-bar (1 . 0) 1551105 nil 1 (3 . 0) nil (1 . 0) (0 . 1)))
 > 3  (mouse-1 (nil menu-bar (0 . 0) 1560616 nil 1 (0 . 0) nil (0 . 0) (1 . 0)))
 > 4  (mouse-1 (nil menu-bar (1 . 0) 1567674 nil 2 (1 . 0) nil (0 . 0) (1 . 0)))
 > 
 > I can't make sense of this.  I feel that I should be able to add two numbers
 > to get the number on the left.

Sorry, this was due to my misunderstanding of posn-at-x-y.

On a related note, the doc string for this function says:

    Return position information for pixel coordinates x and y.
                                    ^^^^^
It accepts character co-ordinates for a text only terminal.

    By default, x and y are relative to text area of the selected window.
    Optional third arg frame-or-window non-nil specifies frame or window.
    If optional fourth arg whole is non-nil, x is relative to the left
    edge of the window.

    The return value is similar to a mouse click position:
       (WINDOW AREA-OR-POS (x . y) TIMESTAMP OBJECT POS (COL . ROW)
        IMAGE (DX . DY) (WIDTH . HEIGHT))
    The `posn-' functions access elements of such lists.

The elisp manual (click events node) doesn't say what WIDTH or HEIGHT are
(glyph size on a graphical display?)

STRING and STRING-POS could be indented in the list in that node as they are
subcomponents of OBJECT.  X,Y are character co-ordinates on a text only
terminal.

-- 
Nick                                           http://www.inet.net.nz/~nickrob

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-03 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03 10:23 text mode menubar events get confused by left margin Nick Roberts
2007-04-03 21:49 ` Nick Roberts

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.