From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: "Jan D." <jan.h.d@swipnet.se>,
emacs-devel@gnu.org, rms@gnu.org, Jason Rumney <jasonr@gnu.org>
Subject: Re: [hober0@gmail.com: Re: mode-line redisplay bug]
Date: Tue, 11 Oct 2005 21:38:18 +0900 [thread overview]
Message-ID: <wlhdbo8c05.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <m3k6gk9ww1.fsf@kfs-l.imdomain.dk>
>>>>> On Tue, 11 Oct 2005 12:21:50 +0200, storm@cua.dk (Kim F. Storm) said:
> Below is a patch which does this, but I have only tested it on X.
> Could somebody test it on W32 and MAC?
I think it still has some off-by-one errors.
*** xdisp.c.bak Tue Oct 11 20:52:32 2005
--- xdisp.c Tue Oct 11 21:20:35 2005
***************
*** 2085,2110 ****
goto text_glyph;
case ON_LEFT_FRINGE:
! x = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)
! : window_box_right_offset (w, LEFT_MARGIN_AREA));
width = WINDOW_LEFT_FRINGE_WIDTH (w);
goto row_glyph;
case ON_RIGHT_FRINGE:
! x = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? window_box_right_offset (w, RIGHT_MARGIN_AREA)
! : window_box_right_offset (w, TEXT_AREA));
width = WINDOW_RIGHT_FRINGE_WIDTH (w);
goto row_glyph;
case ON_SCROLL_BAR:
! x = (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
! ? 0
! : (window_box_right_offset (w, RIGHT_MARGIN_AREA)
! + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? WINDOW_RIGHT_FRINGE_WIDTH (w)
! : 0)));
width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
goto row_glyph;
--- 2085,2110 ----
goto text_glyph;
case ON_LEFT_FRINGE:
! gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)
! : window_box_right_offset (w, LEFT_MARGIN_AREA));
width = WINDOW_LEFT_FRINGE_WIDTH (w);
goto row_glyph;
case ON_RIGHT_FRINGE:
! gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? window_box_right_offset (w, RIGHT_MARGIN_AREA)
! : window_box_right_offset (w, TEXT_AREA));
width = WINDOW_RIGHT_FRINGE_WIDTH (w);
goto row_glyph;
case ON_SCROLL_BAR:
! gx = (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
! ? 0
! : (window_box_right_offset (w, RIGHT_MARGIN_AREA)
! + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
! ? WINDOW_RIGHT_FRINGE_WIDTH (w)
! : 0)));
width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
goto row_glyph;
***************
*** 2114,2131 ****
text_glyph:
gr = 0; gy = 0;
! for (; r < end_row && r->enabled_p && r->y + r->height < y; ++r)
! gr = r; gy = r->y;
! if (gr && gy <= y && gy + gr->height > y)
{
struct glyph *g = gr->glyphs[area];
struct glyph *end = g + gr->used[area];
height = gr->height;
! gx = gr->x;
! while (g < end && gx < x)
! gx += g->pixel_width, ++g;
if (g < end)
width = g->pixel_width;
--- 2114,2135 ----
text_glyph:
gr = 0; gy = 0;
! for (; r < end_row && r->enabled_p; ++r)
! if (r->y + r->height > y)
! {
! gr = r; gy = r->y;
! break;
! }
! if (gr && gy <= y)
{
struct glyph *g = gr->glyphs[area];
struct glyph *end = g + gr->used[area];
height = gr->height;
! for (gx = gr->x; g < end; gx += g->pixel_width, ++g)
! if (gx + g->pixel_width > x)
! break;
if (g < end)
width = g->pixel_width;
***************
*** 2156,2165 ****
row_glyph:
gr = 0, gy = 0;
! for (; r < end_row && r->enabled_p && r->y + r->height < y; ++r)
! gr = r, gy = r->y;
! if (gr && gy <= y && gy + gr->height > y)
height = gr->height;
else
{
--- 2160,2173 ----
row_glyph:
gr = 0, gy = 0;
! for (; r < end_row && r->enabled_p; ++r)
! if (r->y + r->height > y)
! {
! gr = r; gy = r->y;
! break;
! }
! if (gr && gy <= y)
height = gr->height;
else
{
(The ON_SCROLL_BAR case still does not work well.)
And again, if it is corrected, the problems 2.1 and 2.2 I said in
http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-06/msg00148.html
will appear.
> But the MAC version doesn't actually call "remember_mouse_glyph"
> anywhere (it uses pixel_to_glyph_coords as the other versions used
> to do) so I don't expect this to have any effect on the Mac...?
The patch below adds "remember_mouse_glyph" calls. Actually, a part
of this patch is included in the patch in the above URL.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
*** macterm.c.bak Tue Oct 11 20:23:08 2005
--- macterm.c Tue Oct 11 21:25:15 2005
***************
*** 4190,4195 ****
--- 4190,4197 ----
frame->mouse_moved = 1;
last_mouse_scroll_bar = Qnil;
note_mouse_highlight (frame, pos->h, pos->v);
+ /* Remember which glyph we're now on. */
+ remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph);
}
}
***************
*** 4226,4243 ****
/* Return the current position of the mouse.
! *fp should be a frame which indicates which display to ask about.
! If the mouse movement started in a scroll bar, set *fp, *bar_window,
! and *part to the frame, window, and scroll bar part that the mouse
! is over. Set *x and *y to the portion and whole of the mouse's
position on the scroll bar.
! If the mouse movement started elsewhere, set *fp to the frame the
! mouse is on, *bar_window to nil, and *x and *y to the character cell
the mouse is over.
! Set *time to the server time-stamp for the time at which the mouse
was at this position.
Don't store anything if we don't have a valid set of values to report.
--- 4228,4245 ----
/* Return the current position of the mouse.
! *FP should be a frame which indicates which display to ask about.
! If the mouse movement started in a scroll bar, set *FP, *BAR_WINDOW,
! and *PART to the frame, window, and scroll bar part that the mouse
! is over. Set *X and *Y to the portion and whole of the mouse's
position on the scroll bar.
! If the mouse movement started elsewhere, set *FP to the frame the
! mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell
the mouse is over.
! Set *TIME to the server time-stamp for the time at which the mouse
was at this position.
Don't store anything if we don't have a valid set of values to report.
***************
*** 4254,4264 ****
Lisp_Object *x, *y;
unsigned long *time;
{
! Point mouse_pos;
! int ignore1, ignore2;
! struct frame *f = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp));
! WindowPtr wp = FRAME_MAC_WINDOW (f);
! Lisp_Object frame, tail;
BLOCK_INPUT;
--- 4256,4262 ----
Lisp_Object *x, *y;
unsigned long *time;
{
! FRAME_PTR f1;
BLOCK_INPUT;
***************
*** 4266,4290 ****
x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
else
{
/* Clear the mouse-moved flag for every frame on this display. */
FOR_EACH_FRAME (tail, frame)
! XFRAME (frame)->mouse_moved = 0;
last_mouse_scroll_bar = Qnil;
! SetPortWindowPort (wp);
!
! GetMouse (&mouse_pos);
!
! pixel_to_glyph_coords (f, mouse_pos.h, mouse_pos.v, &ignore1, &ignore2,
! &last_mouse_glyph, insist);
!
! *bar_window = Qnil;
! *part = scroll_bar_handle;
! *fp = f;
! XSETINT (*x, mouse_pos.h);
! XSETINT (*y, mouse_pos.v);
! *time = last_mouse_movement_time;
}
UNBLOCK_INPUT;
--- 4264,4306 ----
x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
else
{
+ Lisp_Object frame, tail;
+
/* Clear the mouse-moved flag for every frame on this display. */
FOR_EACH_FRAME (tail, frame)
! XFRAME (frame)->mouse_moved = 0;
last_mouse_scroll_bar = Qnil;
! if (FRAME_MAC_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
! && FRAME_LIVE_P (last_mouse_frame))
! f1 = last_mouse_frame;
! else
! f1 = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp));
!
! if (f1)
! {
! /* Ok, we found a frame. Store all the values.
! last_mouse_glyph is a rectangle used to reduce the
! generation of mouse events. To not miss any motion
! events, we must divide the frame into rectangles of the
! size of the smallest character that could be displayed
! on it, i.e. into the same rectangles that matrices on
! the frame are divided into. */
! Point mouse_pos;
!
! SetPortWindowPort (FRAME_MAC_WINDOW (f1));
! GetMouse (&mouse_pos);
! remember_mouse_glyph (f1, mouse_pos.h, mouse_pos.v,
! &last_mouse_glyph);
!
! *bar_window = Qnil;
! *part = 0;
! *fp = f1;
! XSETINT (*x, mouse_pos.h);
! XSETINT (*y, mouse_pos.v);
! *time = last_mouse_movement_time;
! }
}
UNBLOCK_INPUT;
next prev parent reply other threads:[~2005-10-11 12:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-12 14:59 [hober0@gmail.com: Re: mode-line redisplay bug] Richard M. Stallman
2005-08-12 16:58 ` Eli Zaretskii
2005-08-12 17:19 ` Edward O'Connor
2005-08-12 17:31 ` Edward O'Connor
2005-08-12 18:58 ` Henrik Enberg
2005-08-16 12:58 ` Kim F. Storm
2005-08-12 18:19 ` Robert J. Chassell
2005-08-12 22:56 ` Jason Rumney
2005-08-13 21:54 ` Richard M. Stallman
2005-08-13 22:51 ` Jason Rumney
2005-10-08 21:26 ` Jason Rumney
2005-10-09 1:57 ` mituharu
2005-10-09 6:11 ` Jan D.
2005-10-10 19:40 ` Jason Rumney
[not found] ` <wlwtp6ijoz.wl%mituharu@math.s.chiba-u.ac.jp>
2005-10-11 1:21 ` YAMAMOTO Mitsuharu
2005-10-11 10:21 ` Kim F. Storm
2005-10-11 12:38 ` YAMAMOTO Mitsuharu [this message]
2005-10-11 15:14 ` Kim F. Storm
2005-10-11 14:50 ` Jason Rumney
2005-10-11 22:43 ` Kim F. Storm
2005-10-12 3:15 ` YAMAMOTO Mitsuharu
2005-10-12 8:39 ` Kim F. Storm
2005-10-12 8:41 ` YAMAMOTO Mitsuharu
2005-10-12 9:29 ` Kim F. Storm
2005-10-12 9:59 ` YAMAMOTO Mitsuharu
2005-10-11 10:47 ` Jason Rumney
2005-10-11 11:25 ` Kim F. Storm
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=wlhdbo8c05.wl%mituharu@math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
--cc=emacs-devel@gnu.org \
--cc=jan.h.d@swipnet.se \
--cc=jasonr@gnu.org \
--cc=rms@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).