Re: Patch for gtktextlayout.c



On Thu, Sep 20, 2001 at 05:03:16PM -0400, Havoc Pennington wrote:
> dov imagic weizmann ac il writes:
>  
> I think this first change is right, I made it slightly more elaborate
> by removing the "align" variable entirely.
> 
> > @@ -2142,8 +2140,8 @@
> >    */
> >    if (x < 0)
> >      x = 0;
> > -  if (x > layout->width)
> > -    x = layout->width;
> > +  if (x > display->x_offset + layout->width)
> > +    x = display->x_offset + layout->width;
> >  
> >    get_line_at_y (layout, y, &line, &line_top);
>
> This is in get_iter_at_pixel()? isn't display uninitialized here?

Oops. 8-( That's probably why the patch wasn't working properly...
Of course the check should be after display has been initialized.

I don't really understand what is going on though. What really is 
the meaning of x_offset? Is it the shift with or without the internal
pango align? It does include the margins, that much I understand. There
certainly is a bug in the current code that makes it impossible to position 
the cursor on a line with a mouse click "to the right of the distance 
of display->width starting at the left margin". 

Perhaps the correct solution is to do the 

    if (x<0)
      x=0;
    if (x>layout->width)
      x=layout->width;

after
    x-= display->x_offset;

I'll test it at home later on today.

Regards,
Dov
> >  
> 
> 
> Havoc
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]