diff --git a/gui/src/tascar_mainwindow.cc b/gui/src/tascar_mainwindow.cc index 37431acd..6cb14a69 100644 --- a/gui/src/tascar_mainwindow.cc +++ b/gui/src/tascar_mainwindow.cc @@ -26,6 +26,9 @@ #include "tascar.res.c" #include +#undef WEBKIT2GTK30 +#undef WEBKIT2GTK40 + #define GET_WIDGET(x) \ m_refBuilder->get_widget(#x, x); \ if(!x) \ @@ -249,6 +252,8 @@ tascar_window_t::tascar_window_t(BaseObjectType* cobject, bool load_news(TASCAR::config("tascar.gui.newspage", true)); if(load_news) webkit_web_view_load_uri(news_view, url.c_str()); +#else + notebook->remove_page(-1); #endif notebook->show_all(); auto css = Gtk::CssProvider::create(); @@ -513,6 +518,8 @@ void tascar_window_t::load(const std::string& fname) { get_warnings().clear(); numlastwarnings = 0; + while(Gtk::Main::events_pending()) + Gtk::Main::iteration(false); scene_load(fname); tascar_filename = fname; sessionquit = false; @@ -723,7 +730,7 @@ void tascar_window_t::reset_gui() Glib::filename_display_basename(tascar_filename) + "]"); } else { set_title("tascar"); - resize(200, 60); + //resize(200, 60); } update_object_list(); if(session && (session->scenes.size() > selected_scene)) { @@ -750,8 +757,11 @@ void tascar_window_t::reset_gui() TASCAR::env_expand(session->starturl).c_str()); notebook->set_current_page(6); } - webkit_web_view_reload_bypass_cache(news_view); + if(session) + webkit_web_view_reload_bypass_cache(news_view); #endif + while(Gtk::Main::events_pending()) + Gtk::Main::iteration(false); } void tascar_window_t::on_menu_file_quit() @@ -763,6 +773,7 @@ void tascar_window_t::on_menu_file_close() { try { scene_destroy(); + resize(200, 60); // get_warnings().clear(); #if defined(WEBKIT2GTK30) || defined(WEBKIT2GTK40) webkit_web_view_try_close(news_view); @@ -1013,6 +1024,8 @@ void tascar_window_t::on_menu_file_reload() scene_destroy(); reset_gui(); // wait? + while(Gtk::Main::events_pending()) + Gtk::Main::iteration(false); std::this_thread::sleep_for(std::chrono::milliseconds(500)); scene_load(tascar_filename); sessionquit = false; @@ -1087,6 +1100,8 @@ void tascar_window_t::on_menu_file_open() try { get_warnings().clear(); numlastwarnings = 0; + while(Gtk::Main::events_pending()) + Gtk::Main::iteration(false); scene_load(filename); tascar_filename = filename; sessionquit = false; @@ -1133,6 +1148,8 @@ void tascar_window_t::on_menu_file_open_example() try { get_warnings().clear(); numlastwarnings = 0; + while(Gtk::Main::events_pending()) + Gtk::Main::iteration(false); scene_load(filename); tascar_filename = filename; sessionquit = false; diff --git a/libtascar/src/osc_helper.cc b/libtascar/src/osc_helper.cc index a0684ffc..3456c551 100644 --- a/libtascar/src/osc_helper.cc +++ b/libtascar/src/osc_helper.cc @@ -65,7 +65,14 @@ TASCAR::osc_server_t::data_element_t::data_element_t(const std::string& p, void err_handler(int num, const char* msg, const char* where) { liblo_errflag = true; - std::cout << "liblo error " << num << ": " << msg << "\n(" << where << ")\n"; + std::string smsg; + if(msg) + smsg = msg; + std::string swhere = "null"; + if(where) + swhere = where; + std::cout << "liblo error " << num << ": " << smsg << "\n(" << swhere + << ")\n"; } int osc_set_bool_true(const char*, const char*, lo_arg**, int, lo_message, @@ -603,9 +610,10 @@ osc_server_t::osc_server_t(const std::string& multicast, port.c_str(), string2proto(proto), err_handler); initialized = true; } - if((!lost) || liblo_errflag) + if((!lost) || liblo_errflag) { throw ErrMsg("liblo error (srv_addr: \"" + multicast + "\" srv_port: \"" + port + "\" " + proto + ")."); + } } if(lost) { char* ctmp(lo_server_thread_get_url(lost)); @@ -655,10 +663,12 @@ osc_server_t::~osc_server_t() cond_var_script.notify_one(); if(scriptthread.joinable()) scriptthread.join(); - if(isactive) + if(isactive) { deactivate(); - if(initialized) + } + if(initialized) { lo_server_thread_free(lost); + } } void osc_server_t::set_prefix(const std::string& prefix_) @@ -883,8 +893,11 @@ void osc_server_t::add_string(const std::string& path, std::string* data, void osc_server_t::activate() { if(initialized) { - lo_server_thread_start(lost); - isactive = true; + int result = lo_server_thread_start(lost); + if(result < 0) + std::cerr << "lo_server_thread_start failed\n"; + else + isactive = true; if(verbose) std::cerr << "server active\n"; } @@ -894,7 +907,9 @@ void osc_server_t::deactivate() { if(initialized) { isactive = false; - lo_server_thread_stop(lost); + int result = lo_server_thread_stop(lost); + if(result < 0) + std::cerr << "lo_server_thread_stop failed\n"; if(verbose) std::cerr << "server inactive\n"; }