discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Problem ... very slow scrolling.


From: Enrico Sersale
Subject: Re: Problem ... very slow scrolling.
Date: Fri, 1 Feb 2002 16:38:34 +0200 (EET)

On Fri, 1 Feb 2002, Nicola Pero wrote:

>
> > Actually it already does this. When the operation is NSCompositeCopy, it
> > calls the copyBits:fromRect:toPoint: method. The slow scrolling (in this
> > case) is caused in GWorkspace iteself by an unecessary(*) call to
> > setNeedsDisplay:
> >
> > GWorkspace/Viewers/IconsViewer/IconsPanel.m:712
> > (gwscrollView:scrollViewScrolled:hitPart:)
> >
> > (*) I say unecessarily warily as taking this line out exposes some odd
> > scrolling bug which causes the display to get messed up when scrolling
> > continuously (but gets cleaned up if you just click outside the scroller
> > knob).
>
> The scrolling bug is not actually in scrolling in the gui, but in the
> drawing of the icons in GWorkspace (if you notice, the text is always
> correct if you scroll, only the icons are drawn wrong).
> ...

The bug is caused by the fact that, when I wrote the IconsViewer classes,
there was some bugs in the libraries that cause the display to not be
updated while scrolling.

To go around this, I added a subclass of NSScrollView that notifies the
icons' superview when it has scrolled.

Actually, this is not necessary anymore. I'll trow away this class...

In the meantime, a simple solution is:

1) edit IconsViewerIcon.m and substitute [drawRect:] with this:

- (void)drawRect:(NSRect)rect
{
  NSRect r = [self bounds];
  NSSize s = [icon size];
  NSPoint p = NSMakePoint((r.size.width - s.width) / 2,
                                    (r.size.height - s.height) / 2);

  if (isSelect)
    [highlight compositeToPoint: NSZeroPoint operation: NSCompositeSourceOver];

  [icon compositeToPoint: p operation: NSCompositeSourceOver];
}

2) edit IconsPanel.m, look for "scrollview delegate methods" and, in
[gwscrollView:scrollViewScrolled:hitPart:], comment-out:

[self setNeedsDisplay: YES];

This solves the problem.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]