Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experimental] Wayland build on Linux #13307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deps/+GLEW/GLEW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ add_cmake_project(
SOURCE_SUBDIR build/cmake
CMAKE_ARGS
-DBUILD_UTILS=OFF
)
-DGLEW_EGL=ON
)
6 changes: 3 additions & 3 deletions deps/+wxWidgets/wxWidgets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ else ()
endif ()

add_cmake_project(wxWidgets
URL https://github.com/prusa3d/wxWidgets/archive/323a465e577e03f330e2e6a4c78e564d125340cb.zip
URL_HASH SHA256=B538E4AD3CC93117932F4DED70C476D6650F9C70A9D4055A08F3693864C47465
URL https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.5/wxWidgets-3.2.5.tar.bz2
URL_HASH SHA256=0AD86A3AD3E2E519B6A705248FC9226E3A09BBF069C6C692A02ACF7C2D1C6B51
CMAKE_ARGS
"-DCMAKE_DEBUG_POSTFIX:STRING="
-DwxBUILD_PRECOMP=ON
Expand All @@ -50,7 +50,7 @@ add_cmake_project(wxWidgets
-DwxUSE_EXPAT=sys
-DwxUSE_LIBSDL=OFF
-DwxUSE_XTEST=OFF
-DwxUSE_GLCANVAS_EGL=OFF
-DwxUSE_GLCANVAS_EGL=ON
-DwxUSE_WEBREQUEST=OFF
${_wx_webview}
${_wx_secretstore}
Expand Down
37 changes: 15 additions & 22 deletions src/PrusaSlicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ int CLI::run(int argc, char **argv)
// Save the thread ID of the main thread.
save_main_thread_id();

#ifdef __WXGTK__
// On Linux, wxGTK has no support for Wayland, and the app crashes on
// startup if gtk3 is used. This env var has to be set explicitly to
// instruct the window manager to fall back to X server mode.
::setenv("GDK_BACKEND", "x11", /* replace */ true);
#endif

// Switch boost::filesystem to utf8.
try {
boost::nowide::nowide_filesystem();
Expand All @@ -117,7 +110,7 @@ int CLI::run(int argc, char **argv)

m_extra_config.apply(m_config, true);
m_extra_config.normalize_fdm();

PrinterTechnology printer_technology = get_printer_technology(m_config);

bool start_gui = m_actions.empty() &&
Expand Down Expand Up @@ -173,7 +166,7 @@ int CLI::run(int argc, char **argv)
m_print_config.apply(config);
}

bool has_config_from_profiles = m_profiles_sharing.empty() &&
bool has_config_from_profiles = m_profiles_sharing.empty() &&
(!m_config.opt_string("print-profile").empty() ||
!m_config.option<ConfigOptionStrings>("material-profile")->values.empty() ||
!m_config.opt_string("printer-profile").empty() );
Expand Down Expand Up @@ -351,33 +344,33 @@ int CLI::run(int argc, char **argv)
// Initialize full print configs for both the FFF and SLA technologies.
FullPrintConfig fff_print_config;
SLAFullPrintConfig sla_print_config;

// Synchronize the default parameters and the ones received on the command line.
if (printer_technology == ptFFF) {
fff_print_config.apply(m_print_config, true);
m_print_config.apply(fff_print_config, true);
} else {
assert(printer_technology == ptSLA);
sla_print_config.output_filename_format.value = "[input_filename_base].sl1";

// The default bed shape should reflect the default display parameters
// and not the fff defaults.
double w = sla_print_config.display_width.getFloat();
double h = sla_print_config.display_height.getFloat();
sla_print_config.bed_shape.values = { Vec2d(0, 0), Vec2d(w, 0), Vec2d(w, h), Vec2d(0, h) };

sla_print_config.apply(m_print_config, true);
m_print_config.apply(sla_print_config, true);
}

{
std::string validity = m_print_config.validate();
if (! validity.empty()) {
boost::nowide::cerr << "Error: The composite configation is not valid: " << validity << std::endl;
return 1;
}
}

// Loop through transform options.
bool user_center_specified = false;
arr2::ArrangeBed bed = arr2::to_arrange_bed(get_bed_shape(m_print_config));
Expand Down Expand Up @@ -406,10 +399,10 @@ int CLI::run(int argc, char **argv)
model.objects.begin(), model.objects.end(),
[](ModelObject* o){ return o->instances.empty(); }
);

int dups = m_config.opt_int("duplicate");
if (!all_objects_have_instances) model.add_default_instances();

try {
if (dups > 1) {
// if all input objects have defined position(s) apply duplication to the whole model
Expand Down Expand Up @@ -879,7 +872,7 @@ bool CLI::setup(int argc, char **argv)
set_data_dir(get_default_datadir());
} else
set_data_dir(provided_datadir);

//FIXME Validating at this stage most likely does not make sense, as the config is not fully initialized yet.
if (!validity.empty()) {
boost::nowide::cerr << "error: " << validity << std::endl;
Expand Down Expand Up @@ -1019,8 +1012,8 @@ bool CLI::processed_profiles_sharing()

if (ret.empty())
boost::nowide::cerr << "Printer_model '" << m_config.opt_string("printer_model") <<
"' with printer_variant '" << m_config.opt_string("printer_variant") <<
"' wasn't found among installed printers." << std::endl <<
"' with printer_variant '" << m_config.opt_string("printer_variant") <<
"' wasn't found among installed printers." << std::endl <<
"Or the request can be wrong." << std::endl;
}
*/
Expand All @@ -1033,7 +1026,7 @@ bool CLI::processed_profiles_sharing()

if (ret.empty())
boost::nowide::cerr << "Printer profile '" << m_config.opt_string("printer-profile") <<
"' wasn't found among installed printers." << std::endl <<
"' wasn't found among installed printers." << std::endl <<
"Or the request can be wrong." << std::endl;
}
else {
Expand Down Expand Up @@ -1077,9 +1070,9 @@ bool CLI::processed_profiles_sharing()
bool CLI::check_and_load_input_profiles(PrinterTechnology& printer_technology)
{
Slic3r::DynamicPrintConfig config = {};
std::string ret = Slic3r::load_full_print_config(m_config.opt_string("print-profile"),
std::string ret = Slic3r::load_full_print_config(m_config.opt_string("print-profile"),
m_config.option<ConfigOptionStrings>("material-profile")->values,
m_config.opt_string("printer-profile"),
m_config.opt_string("printer-profile"),
config, printer_technology);
if (!ret.empty()) {
boost::nowide::cerr << ret << std::endl;
Expand Down
49 changes: 25 additions & 24 deletions src/slic3r/GUI/PhysicalPrinterDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/wupdlock.h>
#if wxUSE_SECRETSTORE
#if wxUSE_SECRETSTORE
#include <wx/secretstore.h>
#endif
#include <wx/clipbrd.h>
Expand Down Expand Up @@ -76,14 +76,14 @@ PresetForPrinter::PresetForPrinter(PhysicalPrinterDialog* parent, const std::str
if (m_parent->get_printer()->has_empty_config()) {
// update Print Host upload from the selected preset
m_parent->get_printer()->update_from_preset(*preset);
// update values in parent (PhysicalPrinterDialog)
}
// update values in parent (PhysicalPrinterDialog)
}


// update PrinterTechnology if it was changed
if (m_presets_list->set_printer_technology(preset->printer_technology()))
m_parent->set_printer_technology(preset->printer_technology());
else
else
m_parent->update(true);

update_full_printer_name();
Expand Down Expand Up @@ -136,7 +136,7 @@ std::string PresetForPrinter::get_preset_name()
void PresetForPrinter::SuppressDelete()
{
m_delete_preset_btn->Enable(false);

// this case means that now we have only one related preset for the printer
// So, allow any selection
m_presets_list->set_printer_technology(ptAny);
Expand All @@ -162,7 +162,7 @@ namespace {

bool is_secret_store_ok()
{
#if wxUSE_SECRETSTORE
#if wxUSE_SECRETSTORE
wxSecretStore store = wxSecretStore::GetDefault();
wxString errmsg;
if (!store.IsOk(&errmsg)) {
Expand All @@ -176,7 +176,7 @@ bool is_secret_store_ok()
}
bool save_secret(const std::string& id, const std::string& opt, const std::string& usr, const std::string& psswd)
{
#if wxUSE_SECRETSTORE
#if wxUSE_SECRETSTORE
wxSecretStore store = wxSecretStore::GetDefault();
wxString errmsg;
if (!store.IsOk(&errmsg)) {
Expand All @@ -198,7 +198,7 @@ bool save_secret(const std::string& id, const std::string& opt, const std::strin
#else
BOOST_LOG_TRIVIAL(error) << "wxUSE_SECRETSTORE not supported. Cannot save password to the system store.";
return false;
#endif // wxUSE_SECRETSTORE
#endif // wxUSE_SECRETSTORE
}
bool load_secret(const std::string& id, const std::string& opt, std::string& usr, std::string& psswd)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ bool load_secret(const std::string& id, const std::string& opt, std::string& usr
#else
BOOST_LOG_TRIVIAL(error) << "wxUSE_SECRETSTORE not supported. Cannot load password from the system store.";
return false;
#endif // wxUSE_SECRETSTORE
#endif // wxUSE_SECRETSTORE
}
}

Expand Down Expand Up @@ -258,7 +258,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_

m_add_preset_btn = new ScalableButton(this, wxID_ANY, "add_copies");
m_add_preset_btn->SetFont(wxGetApp().normal_font());
m_add_preset_btn->SetToolTip(_L("Add preset for this printer device"));
m_add_preset_btn->SetToolTip(_L("Add preset for this printer device"));
m_add_preset_btn->Bind(wxEVT_BUTTON, &PhysicalPrinterDialog::AddPreset, this);

m_printer_name = new ::TextInput(this,printer_name);
Expand Down Expand Up @@ -326,7 +326,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_
topSizer->Add(nameSizer , 0, wxEXPAND | wxLEFT | wxRIGHT, BORDER_W);
topSizer->Add(m_presets_sizer , 0, wxEXPAND | wxLEFT | wxRIGHT, BORDER_W);
topSizer->Add(m_optgroup->sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W);
topSizer->Add(btns , 0, wxEXPAND | wxALL, BORDER_W);
topSizer->Add(btns , 0, wxEXPAND | wxALL, BORDER_W);

SetSizer(topSizer);
topSizer->SetSizeHints(this);
Expand Down Expand Up @@ -390,7 +390,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
return sizer;
};

auto printhost_browse = [=](wxWindow* parent)
auto printhost_browse = [=](wxWindow* parent)
{
auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, "browse", _L("Browse") + " " + dots);
m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) {
Expand Down Expand Up @@ -510,7 +510,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_line(cafile_hint);
}
else {

Line line{ "", "" };
line.full_width = 1;

Expand All @@ -529,7 +529,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_line(line);
}

// Text line with info how passwords and api keys are stored
// Text line with info how passwords and api keys are stored
if (is_secret_store_ok()) {
Line line{ "", "" };
line.full_width = 1;
Expand Down Expand Up @@ -561,7 +561,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_line(line);
}

for (const std::string& opt_key : std::vector<std::string>{ "printhost_user", "printhost_password" }) {
for (const std::string& opt_key : std::vector<std::string>{ "printhost_user", "printhost_password" }) {
option = m_optgroup->get_option(opt_key);
option.opt.width = Field::def_width_wider();
m_optgroup->append_single_option_line(option);
Expand Down Expand Up @@ -606,7 +606,8 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
// Always fill in the "printhost_port" combo box from the config and select it.
{
Choice* choice = dynamic_cast<Choice*>(m_optgroup->get_field("printhost_port"));
choice->set_values({ m_config->opt_string("printhost_port") });
std::vector<std::string> vals { m_config->opt_string("printhost_port") };
choice->set_values(vals);
choice->set_selection();
}

Expand Down Expand Up @@ -637,7 +638,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
AuthorizationType auth_type = m_config->option<ConfigOptionEnum<AuthorizationType>>("printhost_authorization_type")->value;
m_optgroup->show_field("printhost_apikey", auth_type == AuthorizationType::atKeyPassword);
for (const char* opt_key : { "printhost_user", "printhost_password" })
m_optgroup->show_field(opt_key, auth_type == AuthorizationType::atUserPassword);
m_optgroup->show_field(opt_key, auth_type == AuthorizationType::atUserPassword);
} else {
m_optgroup->hide_field("printhost_authorization_type");
m_optgroup->show_field("printhost_apikey", true);
Expand Down Expand Up @@ -666,7 +667,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
m_stored_host = temp_host;
}
}

m_last_host_type = opt->value;
}
else {
Expand Down Expand Up @@ -702,7 +703,7 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
bool supported { true };
wxString label;
} link, connect;
// allowed models are: all MINI, all MK3 and newer, MK2.5 and MK2.5S
// allowed models are: all MINI, all MK3 and newer, MK2.5 and MK2.5S
auto model_supports_prusalink = [](const std::string& model) {
return model.size() >= 2 &&
(( boost::starts_with(model, "MK") && model[2] > '2' && model[2] <= '9')
Expand All @@ -711,7 +712,7 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|| boost::starts_with(model, "XL")
);
};
// allowed models are: all MK3/S and MK2.5/S.
// allowed models are: all MK3/S and MK2.5/S.
// Since 2.6.2 also MINI, which makes list of supported printers same for both services.
// Lets keep these 2 functions separated for now.
auto model_supports_prusaconnect = [](const std::string& model) {
Expand All @@ -727,7 +728,7 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
for (PresetForPrinter* prstft : m_presets) {
std::string preset_name = prstft->get_preset_name();
if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) {
std::string model_id = preset->config.opt_string("printer_model");
std::string model_id = preset->config.opt_string("printer_model");
if (preset->vendor) {
if (preset->vendor->name == "Prusa Research") {
const std::vector<VendorProfile::PrinterModel>& models = preset->vendor->models;
Expand Down Expand Up @@ -824,7 +825,7 @@ void PhysicalPrinterDialog::update_full_printer_names()
if (pos != std::string::npos) {
wxString str = printer_name.SubString(pos, 1);
printer_name.Remove(pos, 1);
InfoDialog(this, format_wxstr("%1%: \"%2%\" ", _L("Unexpected character"), str),
InfoDialog(this, format_wxstr("%1%: \"%2%\" ", _L("Unexpected character"), str),
_L("The following characters are not allowed in the name") + ": " + unusable_symbols).ShowModal();
m_printer_name->SetValue(printer_name);
m_printer_name->GetTextCtrl()->SetInsertionPointEnd();
Expand Down Expand Up @@ -896,7 +897,7 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event)
}
}
}


PhysicalPrinterCollection& printers = wxGetApp().preset_bundle->physical_printers;
const PhysicalPrinter* existing = printers.find_printer(into_u8(printer_name), false);
Expand Down
Loading