Community
Participate
Working Groups
Build ID: M20060921-0945 Steps To Reproduce: 1. Create a FigureCanvas with multiple lables 2. Invoke paint() on one label 3. All labels are repainted instead of only the one requested! This does not happen under Windows or if the SWT.NONE style is given on creating the FigureCanvas. More information: GEF is version 3.2.1.v20060921 The bug might as well be in the gtk/swt. I traced it and the problem seems to be that the clipping region is 0 in the gc that comes with the SWT paint event: (from Line 105 in LightWeightSystem) canvas.addListener(SWT.Paint, new Listener() { public void handleEvent(Event e) { LightweightSystem.this.paint(e.gc); } }); The event object has the x,y,width and height set to the rectangle that needs repainting. Invoking e.gc.getClipping() however returns a rectangle for the whole figure. This is done in the paint(GC) method of the DeferredUpdateManager when the SWTGraphics object is created. So a workaround might be to pass the clipping rectangle from the event together with the gc to the paint methods and use this to create the SWTGraphics object.
Created attachment 57256 [details] Program showing the problem This example shows that all figures are repainted. Expected output: ... request repaint of label 4 paint label 4 Actual output: ... request repaint of label 4 paint label 1 paint label 2 paint label 3 paint label 4 paint label 5 paint label 6
I can verify this one. A workaround is to hook into the control before the lightweightsystem does it and then set the clipping on the GC when a paint event occurs. I haven't added OS detection for the workaround. Extending GraphicalViewerImpl and override this method: @Override protected LightweightSystem createLightweightSystem() { return new LightweightSystem() { private Canvas canvas; @Override protected void addListeners() { canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setClipping(e.x, e.y, e.width, e.height); } }); super.addListeners(); } @Override public void setControl(Canvas c) { canvas = c; super.setControl(c); } }; }
Please move this bug to the SWT component in Platform.
Seems really strange that the right clipping is in the paint rectangle but not in the GC (as implied by comment #2).
... I meant to say "clipping is in the paint event rectangle" ...
I re-run my example application and the bug does not show any more with * GEF 3.4.1 I do not know what has changed though.
Do you still experience this issue?
Closing this bug now due to age and inactivity. Please re-open this ticket if the issue is reproducible on 4.8 with GTK3.22.