File 2583-Use-wxBG_STYLE_PAINT-instead-of-STYLE_SYSTEM.patch of Package erlang

From d53ae42404dfd443ecf4306fc4ffe38956a97075 Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Wed, 5 Aug 2020 11:29:20 +0200
Subject: [PATCH] Use wxBG_STYLE_PAINT instead of STYLE_SYSTEM

Avoid flickering graphs (on windows) by using wxBG_STYLE_PAINT,
i.e. telling wx that observer code handles the drawing the window.
---
 lib/observer/src/observer_app_wx.erl  | 2 +-
 lib/observer/src/observer_perf_wx.erl | 8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/observer/src/observer_app_wx.erl b/lib/observer/src/observer_app_wx.erl
index c4527ba063..862772669c 100644
--- a/lib/observer/src/observer_app_wx.erl
+++ b/lib/observer/src/observer_app_wx.erl
@@ -93,7 +93,7 @@ init([Notebook, Parent, _Config]) ->
     DrawingArea = wxScrolledWindow:new(P2, [{winid, ?DRAWAREA},
 					    {style,?wxFULL_REPAINT_ON_RESIZE}]),
     BG = wxWindow:getBackgroundColour(Apps),
-    wxWindow:setBackgroundStyle(DrawingArea, ?wxBG_STYLE_SYSTEM),
+    wxWindow:setBackgroundStyle(DrawingArea, ?wxBG_STYLE_PAINT),
     wxWindow:setVirtualSize(DrawingArea, 800, 800),
     wxSplitterWindow:setMinimumPaneSize(Splitter,50),
     wxSizer:add(Extra, DrawingArea, [{flag, ?wxEXPAND},{proportion, 1}]),
diff --git a/lib/observer/src/observer_perf_wx.erl b/lib/observer/src/observer_perf_wx.erl
index 50a6d6a915..6a848a8d27 100644
--- a/lib/observer/src/observer_perf_wx.erl
+++ b/lib/observer/src/observer_perf_wx.erl
@@ -99,13 +99,9 @@ make_win(Name, Parent, Sizer, Border) ->
     #win{name=Name, panel=Panel}.
 
 setup_graph_drawing(Panels) ->
-    IsWindows = element(1, os:type()) =:= win32,
-    IgnoreCB = {callback, fun(_,_) -> ok end},
     Do = fun(#win{panel=Panel}) ->
-		 wxWindow:setBackgroundStyle(Panel, ?wxBG_STYLE_SYSTEM),
-		 wxPanel:connect(Panel, paint, [callback]),
-		 IsWindows andalso
-		     wxPanel:connect(Panel, erase_background, [IgnoreCB])
+		 wxWindow:setBackgroundStyle(Panel, ?wxBG_STYLE_PAINT),
+		 wxPanel:connect(Panel, paint, [callback])
 	 end,
     _ = [Do(Panel) || Panel <- Panels],
     UseGC = haveGC(),
-- 
2.26.2

openSUSE Build Service is sponsored by