From d896e8f6e0ab0f007db75f6e3fa9203ee4ea3118 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Mon, 21 Nov 2011 04:42:29 +0200 Subject: [PATCH] Wxwidgets: Allow application to bought to foreground on Mac OS X --- include/plat-wxwidgets/common.hpp | 1 + src/plat-wxwidgets/common.cpp | 13 +++++++++++++ src/plat-wxwidgets/main.cpp | 1 + 3 files changed, 15 insertions(+) diff --git a/include/plat-wxwidgets/common.hpp b/include/plat-wxwidgets/common.hpp index c4a0a1cf..e4c12d6c 100644 --- a/include/plat-wxwidgets/common.hpp +++ b/include/plat-wxwidgets/common.hpp @@ -6,6 +6,7 @@ wxString towxstring(const std::string& str); std::string tostdstring(const wxString& str); +void foreground_application(); extern long primary_window_style; extern long secondary_window_style; typedef wxStaticText* wxStaticText_ptr; diff --git a/src/plat-wxwidgets/common.cpp b/src/plat-wxwidgets/common.cpp index be48aee7..97ed3cee 100644 --- a/src/plat-wxwidgets/common.cpp +++ b/src/plat-wxwidgets/common.cpp @@ -1,5 +1,9 @@ #include "plat-wxwidgets/common.hpp" +#ifdef __WXMAC__ +#include +#endif + wxString towxstring(const std::string& str) { return wxString(str.c_str(), wxConvUTF8); @@ -10,6 +14,15 @@ std::string tostdstring(const wxString& str) return std::string(str.mb_str(wxConvUTF8)); } +void foreground_application() +{ +#ifdef __WXMAC__ + ProcessSerialNumber PSN; + GetCurrentProcess(&PSN); + TransformProcessType(&PSN,kProcessTransformToForegroundApplication); +#endif +} + long primary_window_style = wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxCLOSE_BOX; long secondary_window_style = wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN; diff --git a/src/plat-wxwidgets/main.cpp b/src/plat-wxwidgets/main.cpp index 1ad4f97a..8a3e4196 100644 --- a/src/plat-wxwidgets/main.cpp +++ b/src/plat-wxwidgets/main.cpp @@ -36,6 +36,7 @@ IMPLEMENT_APP(lsnes_app) bool lsnes_app::OnInit() { set_random_seed(); + foreground_application(); { std::ostringstream x;