aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/c_src/wxe_impl.cpp')
-rw-r--r--lib/wx/c_src/wxe_impl.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 69fcd4e362..527fabc315 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2011. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2012. 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
@@ -30,6 +30,11 @@
// Ok ugly but needed for wxBufferedDC crash workaround
#define private public
#include <wx/dcbuffer.h>
+
+#if defined(__WXMSW__)
+ #include <wx/msw/private.h> // for wxSetInstance
+#endif
+
#undef private
#include "wxe_impl.h"
@@ -222,6 +227,11 @@ void *wxe_main_loop(void *vpdl)
// This should be done in emulator but it's not in yet.
#ifndef _WIN32
erts_thread_disable_fpe();
+#else
+ // Setup that wxWidgets should look for cursors and icons in
+ // this dll and not in werl.exe (which is the default)
+ HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver"));
+ wxSetInstance((HINSTANCE) WXEHandle);
#endif
result = wxEntry(argc, argv);
@@ -248,20 +258,30 @@ wxFrame * dummy_window;
void create_dummy_window() {
dummy_window = new wxFrame(NULL,-1, wxT("wx driver"),
- wxDefaultPosition, wxSize(5,5),
+ wxPoint(0,0), wxSize(5,5),
wxFRAME_NO_TASKBAR);
+
+ wxMenuBar * menubar = new wxMenuBar();
+ dummy_window->SetMenuBar(menubar);
+ // wx-2.9 Don't delete the app menubar correctly
dummy_window->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW,
(wxObjectEventFunction) (wxEventFunction) &WxeApp::dummy_close);
+ dummy_window->Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) (wxEventFunction) &WxeApp::dummy_close);
+ dummy_window->Show(true);
+ // dummy_window->Show(false);
}
// wxMac really wants a top level window which command-q quits if there are no
// windows open, and this will kill the thread, so restart the dummy_window each
// time a we receive a close.
void WxeApp::dummy_close(wxEvent& Ev) {
- // fprintf(stderr, "Tried to close dummy window\r\n"); fflush(stderr);
- create_dummy_window();
+ if(Ev.GetEventType() == wxEVT_CLOSE_WINDOW) {
+ create_dummy_window();
+ }
}
+
// Init wx-widgets thread
bool WxeApp::OnInit()
{
@@ -272,7 +292,7 @@ bool WxeApp::OnInit()
wxe_batch_cb_saved = new wxList;
cb_buff = NULL;
- wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED);
+ // wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); Hmm printpreview doesn't work in 2.9 with this
this->Connect(wxID_ANY, wxEVT_IDLE,
(wxObjectEventFunction) (wxEventFunction) &WxeApp::idle);
@@ -290,7 +310,11 @@ bool WxeApp::OnInit()
/* Create a dummy window so wxWidgets don't automagicly quits the main loop
after the last window */
+#ifdef __DARWIN__
create_dummy_window();
+#else
+ SetExitOnFrameDelete(false);
+#endif
init_nonconsts(global_me, init_caller);
erl_drv_mutex_lock(wxe_status_m);
@@ -301,7 +325,9 @@ bool WxeApp::OnInit()
}
void WxeApp::shutdown(wxeMetaCommand& Ecmd) {
+#ifdef __DARWIN__
delete dummy_window;
+#endif
ExitMainLoop();
}