[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calculating screen relative X when horizontal scrolling.
From: |
Keith David Bershatsky |
Subject: |
Re: Calculating screen relative X when horizontal scrolling. |
Date: |
Wed, 17 Oct 2018 10:54:01 -0700 |
I apologize for having misspoken about using the 3rd argument of
draw_window_cursor to control the relative x coordinate of the fake cursor. I
had forgotten that I actually temporarily hijack w->phys_cursor.x and assign my
own relative x just prior to calling draw_window_cursor. Here is a snippet
from the relevant section of feature requests 17684 (crosshairs) and 22873
(multiple fake cursors):
/* Record some of the current values for the cursor and glyph_row. */
bool phys_cursor_on_p = w->phys_cursor_on_p;
struct glyph_row *glyph_row = MATRIX_ROW (w->current_matrix, vpos);
bool cursor_in_fringe_p = glyph_row->cursor_in_fringe_p;
bool reversed_p = glyph_row->reversed_p;
ptrdiff_t phys_cursor_x = w->phys_cursor.x;
ptrdiff_t phys_cursor_y = w->phys_cursor.y;
ptrdiff_t phys_cursor_hpos = w->phys_cursor.hpos;
ptrdiff_t phys_cursor_vpos = w->phys_cursor.vpos;
ptrdiff_t phys_cursor_ascent = w->phys_cursor_ascent;
ptrdiff_t phys_cursor_height = w->phys_cursor_height;
ptrdiff_t phys_cursor_width = w->phys_cursor_width;
enum text_cursor_kinds phys_cursor_type = w->phys_cursor_type;
/* Hijack w->phys_cursor. */
w->phys_cursor.x = x;
w->phys_cursor.y = glyph_row->y;
w->phys_cursor.hpos = hpos;
w->phys_cursor.vpos = vpos;
w->phys_cursor_type = cursor_type;
w->phys_cursor_ascent = glyph_row->ascent;
w->phys_cursor_height = glyph_row->height;
w->phys_cursor_width = cursor_width;
FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y, cursor_type,
cursor_width, true, active_cursor_p);
/* Restore the previous values for w->phys_cursor and glyph_row. */
w->phys_cursor_on_p = phys_cursor_on_p;
w->phys_cursor.x = phys_cursor_x;
w->phys_cursor.y = phys_cursor_y;
w->phys_cursor.hpos = phys_cursor_hpos;
w->phys_cursor.vpos = phys_cursor_vpos;
w->phys_cursor_type = phys_cursor_type;
glyph_row->cursor_in_fringe_p = cursor_in_fringe_p;
glyph_row->reversed_p = reversed_p;
w->phys_cursor_ascent = phys_cursor_ascent;
w->phys_cursor_height = phys_cursor_height;
w->phys_cursor_width = phys_cursor_width;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Date: [10-17-2018 09:25:41] <17 Oct 2018 19:25:41 +0300>
> From: Eli Zaretskii <address@hidden>
> To: Keith David Bershatsky <address@hidden>
> CC: address@hidden
> Subject: Re: Calculating screen relative X when horizontal scrolling.
>
> > Date: Tue, 16 Oct 2018 08:41:00 -0700
> > From: Keith David Bershatsky <address@hidden>
> > Cc: address@hidden
> >
> > The x coordinate sought will be used as the 3rd argument to
> > draw_window_cursor in conjunction with feature requests 17684 (crosshairs)
> > and 22873 (multiple fake cursors).
> >
> > The method of calculation used in the initial post is off by a few pixels
> > when dealing with each of the fact patterns described. Here is a sample
> > _current_ line (miscellaneous characters of varying pixel widths) where my
> > calculations go awry:
>
> I'm sorry, I still don't have a clear understanding of the issue. In
> particular, the implementations of draw_window_cursor method don't use
> the 3rd argument for positioning the cursor. So I still don't
> understand what you mean by "relative x".
- Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/15
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/16
- Re: Calculating screen relative X when horizontal scrolling.,
Keith David Bershatsky <=
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/17
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/19
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/19
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/20
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/24