aboutsummaryrefslogtreecommitdiffstats
path: root/lib/et/src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2010-09-03 12:15:49 +0200
committerDan Gudmundsson <[email protected]>2010-09-03 12:15:49 +0200
commit7890861fcf7a55bd8869dca004fa042715a05f0b (patch)
treeae1cd6b7847d0d54f6fc80b02f134d799c04040d /lib/et/src
parentf0c4e27ef0a5a365cab7b1dc69dbecf7856c3f3f (diff)
downloadotp-7890861fcf7a55bd8869dca004fa042715a05f0b.tar.gz
otp-7890861fcf7a55bd8869dca004fa042715a05f0b.tar.bz2
otp-7890861fcf7a55bd8869dca004fa042715a05f0b.zip
Fix wx viewer so it works on windows/mac.
A wxPaintDC must created and destroyed when paint event happens. Otherwise redrawing will not work on windows, this is documented but since it works on linux without it, many misses it.
Diffstat (limited to 'lib/et/src')
-rw-r--r--lib/et/src/et_wx_viewer.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/et/src/et_wx_viewer.erl b/lib/et/src/et_wx_viewer.erl
index 5cd3563aed..d42f8c0c86 100644
--- a/lib/et/src/et_wx_viewer.erl
+++ b/lib/et/src/et_wx_viewer.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2000-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1233,7 +1233,7 @@ create_main_window(S) ->
[{flag, ?wxEXPAND}]),
CanvasSizer = wxBoxSizer:new(?wxHORIZONTAL),
- Canvas = wxPanel:new(Panel, []),
+ Canvas = wxPanel:new(Panel, [{style, ?wxFULL_REPAINT_ON_RESIZE}]),
{CanvasW,CanvasH} = wxPanel:getSize(Canvas),
ScrollBar = wxScrollBar:new(Panel, ?wxID_ANY, [{style, ?wxSB_VERTICAL}]),
@@ -1244,7 +1244,13 @@ create_main_window(S) ->
wxPanel:connect(Canvas, left_up),
wxPanel:connect(Canvas, right_up),
wxPanel:connect(Canvas, size),
- wxPanel:connect(Canvas, paint),
+ Self = self(),
+ wxPanel:connect(Canvas, paint, [{callback, %% Needed on windows
+ fun(Ev, _) ->
+ DC = wxPaintDC:new(Canvas),
+ wxPaintDC:destroy(DC),
+ Self ! Ev
+ end}]),
wxPanel:connect(Canvas, key_down),
wxPanel:connect(Canvas, kill_focus),
wxPanel:connect(Canvas, enter_window, [{skip, true}]),
@@ -1437,6 +1443,7 @@ create_help_menu(Bar) ->
clear_canvas(S) ->
DC = wxClientDC:new(S#state.canvas),
+ wxDC:setBackground(DC, ?wxWHITE_BRUSH), %% Needed on mac
wxDC:clear(DC),
{CanvasW, CanvasH} = wxPanel:getSize(S#state.canvas),
wxSizer:recalcSizes(S#state.canvas_sizer),