From 0f6bf458d8967963d4ba6c9b1855c8a1c657a294 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sun, 16 Feb 2014 01:05:51 +0200 Subject: [PATCH] wxwidgets: Allow entering fullscreen mode from commandline --- include/platform/wxwidgets/platform.hpp | 2 +- include/platform/wxwidgets/window_mainwindow.hpp | 2 +- src/platform/wxwidgets/main.cpp | 7 ++++++- src/platform/wxwidgets/mainwindow.cpp | 10 +++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/platform/wxwidgets/platform.hpp b/include/platform/wxwidgets/platform.hpp index e614d577..735c3f3a 100644 --- a/include/platform/wxwidgets/platform.hpp +++ b/include/platform/wxwidgets/platform.hpp @@ -31,7 +31,7 @@ wxString towxstring(const std::u32string& str) throw(std::bad_alloc); std::u32string tou32string(const wxString& str) throw(std::bad_alloc); void bring_app_foreground(); std::string pick_archive_member(wxWindow* parent, const std::string& filename) throw(std::bad_alloc); -void boot_emulator(loaded_rom& rom, moviefile& movie); +void boot_emulator(loaded_rom& rom, moviefile& movie, bool fscreen); void handle_wx_keyboard(wxKeyEvent& e, bool polarity); std::string map_keycode_to_key(int kcode); void initialize_wx_keyboard(); diff --git a/include/platform/wxwidgets/window_mainwindow.hpp b/include/platform/wxwidgets/window_mainwindow.hpp index 6e9f786a..7ba33f43 100644 --- a/include/platform/wxwidgets/window_mainwindow.hpp +++ b/include/platform/wxwidgets/window_mainwindow.hpp @@ -28,7 +28,7 @@ public: void on_keyboard_up(wxKeyEvent& e); void on_mouse(wxMouseEvent& e); }; - wxwin_mainwindow(); + wxwin_mainwindow(bool fscreen); void request_paint(); void notify_update() throw(); void notify_update_status() throw(); diff --git a/src/platform/wxwidgets/main.cpp b/src/platform/wxwidgets/main.cpp index e234d373..d4c38fb8 100644 --- a/src/platform/wxwidgets/main.cpp +++ b/src/platform/wxwidgets/main.cpp @@ -356,6 +356,7 @@ private: std::map c_settings; std::vector c_lua; bool exit_immediately; + bool fullscreen_mode; }; IMPLEMENT_APP(lsnes_app) @@ -365,6 +366,7 @@ lsnes_app::lsnes_app() settings_mode = false; pluginmanager_mode = false; exit_immediately = false; + fullscreen_mode = false; } void lsnes_app::OnInitCmdLine(wxCmdLineParser& parser) @@ -382,6 +384,7 @@ bool lsnes_app::OnCmdLineParsed(wxCmdLineParser& parser) if(i == "--help" || i == "-h") { std::cout << "--settings: Show the settings dialog" << std::endl; std::cout << "--pluginmanager: Show the plugin manager" << std::endl; + std::cout << "--fullscreen: Start fullscreen" << std::endl; std::cout << "--rom=: Load specified ROM on startup" << std::endl; std::cout << "--load=: Load specified save/movie on starup" << std::endl; std::cout << "--lua=: Load specified Lua script on startup" << std::endl; @@ -392,6 +395,8 @@ bool lsnes_app::OnCmdLineParsed(wxCmdLineParser& parser) } if(i == "--settings") settings_mode = true; + if(i == "--fullscreen") + fullscreen_mode = true; if(i == "--pluginmanager") pluginmanager_mode = true; if(r = regex("--set=([^=]+)=(.+)", i)) @@ -496,7 +501,7 @@ bool lsnes_app::OnInit() mov->start_paused = true; for(auto i : c_lua) lua_add_startup_script(i); - boot_emulator(rom, *mov); + boot_emulator(rom, *mov, fullscreen_mode); return true; } diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index 7ae218d9..84ae3e14 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -762,7 +762,7 @@ namespace }; } -void boot_emulator(loaded_rom& rom, moviefile& movie) +void boot_emulator(loaded_rom& rom, moviefile& movie, bool fscreen) { update_preferences(); try { @@ -772,7 +772,7 @@ void boot_emulator(loaded_rom& rom, moviefile& movie) a->load_has_to_succeed = false; modal_pause_holder hld; emulation_thread = new thread_class(emulator_main, a); - main_window = new wxwin_mainwindow(); + main_window = new wxwin_mainwindow(fscreen); main_window->Show(); } catch(std::bad_alloc& e) { OOM_panic(); @@ -1014,7 +1014,7 @@ void wxwin_mainwindow::panel::on_mouse(wxMouseEvent& e) handle_wx_mouse(e); } -wxwin_mainwindow::wxwin_mainwindow() +wxwin_mainwindow::wxwin_mainwindow(bool fscreen) : wxFrame(NULL, wxID_ANY, getname(), wxDefaultPosition, wxSize(-1, -1), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxCLOSE_BOX) { @@ -1184,6 +1184,10 @@ wxwin_mainwindow::wxwin_mainwindow() reinterpret_cast(sysmenu)->update(false); menubar->SetMenuLabel(1, towxstring(our_rom.rtype->get_systemmenu_name())); focus_timer = new _focus_timer; + if(fscreen) { + wx_escape_count = 0; + enter_or_leave_fullscreen(true); + } } void wxwin_mainwindow::request_paint() -- 2.11.4.GIT