# HG changeset patch # User Edouard Tisserant # Date 1630813397 -7200 # Node ID 841fb2ee1213be83bc2b89d7a61afb065ab89dc3 # Parent ca11385ea5e95152b68d51b5ab7402ff7ec1f829 Workaround RubberBand drawing problem on GTK3 diff -r ca11385ea5e9 -r 841fb2ee1213 graphics/RubberBand.py --- a/graphics/RubberBand.py Sun Sep 05 05:03:36 2021 +0200 +++ b/graphics/RubberBand.py Sun Sep 05 05:43:17 2021 +0200 @@ -195,3 +195,25 @@ """ # Erase last bbox and draw current bbox self.DrawBoundingBoxes([self.CurrentBBox], dc) + + +def PatchRubberBandForGTK3(): + """ + GTK3 implementation of DC doesn't support SetLogicalFuntion(XOR) + Then Rubberband can't be erased by just redrawing it on the same place + So this is a complete refresh instead, eating a lot of CPU. + """ + def Redraw(self, dc=None): + self.Viewer.Refresh() + self.Draw() + + RubberBand.Redraw = Redraw + + def Erase(self, dc=None): + self.Viewer.Refresh() + + RubberBand.Erase = Erase + + +if "gtk3" in wx.PlatformInfo: + PatchRubberBandForGTK3()