aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-02-06 16:02:28 +0100
committerDan Gudmundsson <[email protected]>2012-02-21 15:06:43 +0100
commitdac51a6042e01081056899dc1d694f68e99be782 (patch)
tree3c69ba597ce2af7b96fe2048b4e56de29d84d59c /lib/observer/src
parent12cce9d67fe2644a986820dcdbeecc34ff929b29 (diff)
downloadotp-dac51a6042e01081056899dc1d694f68e99be782.tar.gz
otp-dac51a6042e01081056899dc1d694f68e99be782.tar.bz2
otp-dac51a6042e01081056899dc1d694f68e99be782.zip
[observer] Mac workaround
Diffstat (limited to 'lib/observer/src')
-rw-r--r--lib/observer/src/observer_perf_wx.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/observer/src/observer_perf_wx.erl b/lib/observer/src/observer_perf_wx.erl
index 3b6befdf9b..8f4e317d99 100644
--- a/lib/observer/src/observer_perf_wx.erl
+++ b/lib/observer/src/observer_perf_wx.erl
@@ -107,14 +107,20 @@ handle_event(Event, _State) ->
error({unhandled_event, Event}).
%%%%%%%%%%
-handle_sync_event(#wx{id=Id, event = #wxPaint{}},_,
+handle_sync_event(#wx{obj=Panel, event = #wxPaint{}},_,
#state{active=Active, offset=Offset, paint=Paint,
windows=Windows, data=Data}) ->
%% PaintDC must be created in a callback to work on windows.
- Panel = element(Id, Windows),
+ %% Sigh workaround bug on MacOSX (Id in paint event is always 0)
+ %% Panel = element(Id, Windows),
+ Id = if Panel =:= element(?RQ_W, Windows) -> ?RQ_W;
+ Panel =:= element(?MEM_W, Windows) -> ?MEM_W;
+ Panel =:= element(?IO_W, Windows) -> ?IO_W
+ end,
DC = wxPaintDC:new(Panel),
%% Nothing is drawn until wxPaintDC is destroyed.
- try draw(Offset, Id, DC, Panel, Paint, Data, Active)
+ try
+ draw(Offset, Id, DC, Panel, Paint, Data, Active)
catch _:Err ->
io:format("Internal error ~p ~p~n",[Err, erlang:get_stacktrace()])
end,
@@ -253,6 +259,7 @@ draw(Offset, Id, DC, Panel, Paint=#paint{pens=Pens, small=Small}, Data, Active)
Start = max(61-Len, 0)*WS+X0 - Offset*WS,
case Hs of
[] -> ignore;
+ [_] -> ignore;
_ ->
Draw = fun(N) ->
Lines = make_lines(Hs, Start, N, {X0,round(Max*HS)}, Y0, WS, HS),