diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index 6d16e2884..209942633 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -38,9 +38,6 @@ #ifndef flagGTK #define flagGTK #endif - #ifdef flagWAYLAND - #define GUI_GTK_WAYLAND - #endif #define GUIPLATFORM_INCLUDE "Gtk.h" #endif #endif diff --git a/uppsrc/CtrlCore/GtkApp.cpp b/uppsrc/CtrlCore/GtkApp.cpp index f6e8b9b82..2b97ef577 100644 --- a/uppsrc/CtrlCore/GtkApp.cpp +++ b/uppsrc/CtrlCore/GtkApp.cpp @@ -90,15 +90,24 @@ void Ctrl::ThemeChanged(void *) PostReSkin(); } +static bool sUseWayland; + +void Ctrl::UseWayland() +{ + sUseWayland = true; +} + bool InitGtkApp(int argc, char **argv, const char **envptr) { LLOG(rmsecs() << " InitGtkApp"); #if GTK_CHECK_VERSION(3, 10, 0) String backends = "x11,wayland"; -#ifdef GUI_GTK_WAYLAND +#ifdef flagWAYLAND backends = "wayland,x11"; #endif + if(FileExists(ConfigFile("USE_WAYLAND")) || sUseWayland) + backends = "wayland,x11"; gdk_set_allowed_backends(backends); #endif diff --git a/uppsrc/CtrlCore/GtkCtrl.h b/uppsrc/CtrlCore/GtkCtrl.h index a71461438..d998ca1c2 100644 --- a/uppsrc/CtrlCore/GtkCtrl.h +++ b/uppsrc/CtrlCore/GtkCtrl.h @@ -210,6 +210,8 @@ public: static bool IsRunningOnWayland(); static bool IsXWayland() { return IsX11() && IsRunningOnWayland(); } + static void UseWayland(); + static Point CurrentMousePos; static guint CurrentState; static guint32 CurrentTime; diff --git a/uppsrc/ide/Setup.cpp b/uppsrc/ide/Setup.cpp index 1ef6c1330..1bbff0ec3 100644 --- a/uppsrc/ide/Setup.cpp +++ b/uppsrc/ide/Setup.cpp @@ -374,6 +374,15 @@ void Ide::SetupFormat() { .Add(20, "C++ 20") .Add(23, "C++ 23") ; + + ide.wayland.Hide(); +#ifdef GUI_GTK + String use_wayland_path = ConfigFile("USE_WAYLAND"); + if(IsWayland() || IsXWayland()) { + ide.wayland.Show(); + ide.wayland <<= FileExists(use_wayland_path); + } +#endif rtvr (hlt.hilite_scope, hs) @@ -575,6 +584,17 @@ void Ide::SetupFormat() { CurrentFileDeleteCache(); editor.SyncCurrentFile(); } + +#ifdef GUI_GTK + if(IsWayland() || IsXWayland()) { + if(FileExists(use_wayland_path) != ide.wayland) { + if(ide.wayland) + Upp::SaveFile(use_wayland_path, Null); + else + DeleteFile(use_wayland_path); + } + } +#endif } void Ide::FinishConfig() diff --git a/uppsrc/ide/clang/util.cpp b/uppsrc/ide/clang/util.cpp index a08c82622..90d27a172 100644 --- a/uppsrc/ide/clang/util.cpp +++ b/uppsrc/ide/clang/util.cpp @@ -33,7 +33,8 @@ void ClangConfigSetDefaults() IndexerThreads = max(min(CPU_Cores() - 2, (mem_mb - 4000) / 1000), 1); - AutoIndexer = CPU_Cores() >= 8 && mem_mb > 8000; +// AutoIndexer = CPU_Cores() >= 8 && mem_mb > 8000; + AutoIndexer = true; LibClangCppVersion = 17; } diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index 7b4fc4189..3a02a68e7 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -619,7 +619,7 @@ LAYOUT(SetupAssistLayout, 544, 368) ITEM(Upp::DropList, std_cpp, LeftPosZ(116, 80).TopPosZ(288, 19)) END_LAYOUT -LAYOUT(SetupIdeLayout, 512, 352) +LAYOUT(SetupIdeLayout, 512, 376) ITEM(Upp::Option, mute_sounds, SetLabel(t_("Mute sounds")).LeftPosZ(4, 160).TopPosZ(4, 16)) ITEM(Upp::Label, dv___1, SetLabel(t_("HYDRA threads")).LeftPosZ(212, 80).TopPosZ(4, 19)) ITEM(Upp::EditIntSpin, hydra1_threads, Min(1).Max(64).LeftPosZ(344, 48).TopPosZ(4, 19)) @@ -655,6 +655,7 @@ LAYOUT(SetupIdeLayout, 512, 352) ITEM(Upp::Label, dv___32, SetLabel(t_("Default UppHub folder")).LeftPosZ(4, 192).TopPosZ(328, 20)) ITEM(Upp::EditString, upphub, HSizePosZ(172, 28).TopPosZ(328, 19)) ITEM(Upp::Button, upphub_sel, RightPosZ(4, 20).TopPosZ(328, 19)) + ITEM(Upp::Option, wayland, SetLabel(t_("Use Wayland (experimental, needs restart)")).LeftPosZ(4, 408).TopPosZ(352, 16)) END_LAYOUT LAYOUT(SetupWebSearchEngineLayout, 564, 84) diff --git a/uppsrc/ide/ide.upp b/uppsrc/ide/ide.upp index b15678ec4..16bd4de88 100644 --- a/uppsrc/ide/ide.upp +++ b/uppsrc/ide/ide.upp @@ -134,7 +134,6 @@ mainconfig "" = "GUI PEAKMEM", "" = "GUI HEAPLOG", "" = "GUI X11", - "" = "GUI GTK WAYLAND", "" = "GUI DEBUGCODE"; custom() "", diff --git a/uppsrc/ide/main.cpp b/uppsrc/ide/main.cpp index de16a8702..0d3be8b81 100644 --- a/uppsrc/ide/main.cpp +++ b/uppsrc/ide/main.cpp @@ -171,6 +171,7 @@ void OnCrash() INITBLOCK { // libclang does not work in Linux unless this is set SetEnv("LC_CTYPE", "en_US.UTF-8"); + SetConfigName("theide"); } #ifdef flagMAIN @@ -179,7 +180,6 @@ GUI_APP_MAIN void AppMain___() #endif { - SetConfigName("theide"); #ifdef DYNAMIC_LIBCLANG if(FindIndex(CommandLine(), "--noclang") < 0) { String wfile = ConfigFile(".nolibclang");