[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: Re: mode-line redisplay bug]
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: address@hidden: Re: mode-line redisplay bug] |
Date: |
Tue, 11 Oct 2005 21:38:18 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Tue, 11 Oct 2005 12:21:50 +0200, address@hidden (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
address@hidden
*** 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;
- Re: address@hidden: Re: mode-line redisplay bug], Jason Rumney, 2005/10/08
- Re: address@hidden: Re: mode-line redisplay bug], mituharu, 2005/10/08
- Re: address@hidden: Re: mode-line redisplay bug], Jan D., 2005/10/09
- Re: address@hidden: Re: mode-line redisplay bug], Jason Rumney, 2005/10/10
- Re: address@hidden: Re: mode-line redisplay bug], Jason Rumney, 2005/10/11
- Re: address@hidden: Re: mode-line redisplay bug], Kim F. Storm, 2005/10/11
- Re: address@hidden: Re: mode-line redisplay bug], YAMAMOTO Mitsuharu, 2005/10/11
- Re: address@hidden: Re: mode-line redisplay bug], Kim F. Storm, 2005/10/12
- Re: address@hidden: Re: mode-line redisplay bug], YAMAMOTO Mitsuharu, 2005/10/12
- Re: address@hidden: Re: mode-line redisplay bug], Kim F. Storm, 2005/10/12
- Re: address@hidden: Re: mode-line redisplay bug], YAMAMOTO Mitsuharu, 2005/10/12
- Re: address@hidden: Re: mode-line redisplay bug], Jason Rumney, 2005/10/11
- Re: address@hidden: Re: mode-line redisplay bug], Kim F. Storm, 2005/10/11