diff options
author | Dan Gudmundsson <[email protected]> | 2014-03-28 10:16:51 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2014-03-28 10:16:51 +0100 |
commit | 7811310ee2c72173824007d3db73ae2b62a725d9 (patch) | |
tree | 3ed1b81ed09a5230551dbb2aca7135a0942735bf /lib/wx/src/wxe_master.erl | |
parent | e3f9bf8dbfe4e055753f04125406d29af0ae1050 (diff) | |
parent | c15c7c6b2117320aa5feb2c77781634d055cfcd7 (diff) | |
download | otp-7811310ee2c72173824007d3db73ae2b62a725d9.tar.gz otp-7811310ee2c72173824007d3db73ae2b62a725d9.tar.bz2 otp-7811310ee2c72173824007d3db73ae2b62a725d9.zip |
Merge branch 'dgud/wx/fix-wx3-windows64'
* dgud/wx/fix-wx3-windows64:
wx: Send destroy message direct
wx: Add wxLocale class
wx: Added misc functions
wx: Fix memory garbage collector
wx: Fix possibility to fetch early open msgs on mac
wx: Fix listCtrl sort callback
wx: Fix configure for win64 with wxWidgets-3.0
Diffstat (limited to 'lib/wx/src/wxe_master.erl')
-rw-r--r-- | lib/wx/src/wxe_master.erl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/wx/src/wxe_master.erl b/lib/wx/src/wxe_master.erl index b98a7c793e..4b8a8f5720 100644 --- a/lib/wx/src/wxe_master.erl +++ b/lib/wx/src/wxe_master.erl @@ -28,7 +28,7 @@ -behaviour(gen_server). %% API --export([start/1, init_port/1, init_opengl/0]). +-export([start/1, init_port/1, init_opengl/0, fetch_msgs/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -36,7 +36,9 @@ -record(state, {cb_port, %% Callback port and to erlang messages goes via it. users, %% List of wx servers, needed ?? - driver}). %% Driver name so wx_server can create it's own port + driver, %% Driver name so wx_server can create it's own port + msgs=[] %% Early messages (such as openfiles on OSX) + }). -include("wxe.hrl"). -include("gen/wxe_debug.hrl"). @@ -76,12 +78,18 @@ init_port(SilentStart) -> %%-------------------------------------------------------------------- -%% Initlizes the opengl library +%% Initalizes the opengl library %%-------------------------------------------------------------------- init_opengl() -> GLLib = wxe_util:wxgl_dl(), wxe_util:call(?WXE_INIT_OPENGL, <<(list_to_binary(GLLib))/binary, 0:8>>). +%%-------------------------------------------------------------------- +%% Fetch early messages, hack to get start up args on mac +%%-------------------------------------------------------------------- +fetch_msgs() -> + gen_server:call(?MODULE, fetch_msgs, infinity). + %%==================================================================== %% gen_server callbacks %%==================================================================== @@ -152,6 +160,8 @@ init([SilentStart]) -> %%-------------------------------------------------------------------- handle_call(init_port, From, State=#state{driver=Driver,cb_port=CBPort, users=Users}) -> {reply, {Driver,CBPort}, State#state{users=gb_sets:add(From,Users)}}; +handle_call(fetch_msgs, _From, State=#state{msgs=Msgs}) -> + {reply, lists:reverse(Msgs), State#state{msgs=[]}}; handle_call(_Request, _From, State) -> %%io:format("Unknown request ~p sent to ~p from ~p ~n",[_Request, ?MODULE, _From]), Reply = ok, @@ -182,6 +192,8 @@ handle_info({wxe_driver, internal_error, Msg}, State) -> handle_info({wxe_driver, debug, Msg}, State) -> io:format("WX DBG: ~s~n", [Msg]), {noreply, State}; +handle_info({wxe_driver, open_file, File}, State=#state{msgs=Msgs}) -> + {noreply, State#state{msgs=[File|Msgs]}}; handle_info(_Info, State) -> io:format("Unknown message ~p sent to ~p~n",[_Info, ?MODULE]), {noreply, State}. |