This commit is contained in:
Mirek Fidler 2025-02-13 10:45:01 +01:00
commit 90e678e30f
8 changed files with 37 additions and 8 deletions

View file

@ -38,9 +38,6 @@
#ifndef flagGTK
#define flagGTK
#endif
#ifdef flagWAYLAND
#define GUI_GTK_WAYLAND
#endif
#define GUIPLATFORM_INCLUDE "Gtk.h"
#endif
#endif

View file

@ -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

View file

@ -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;

View file

@ -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()

View file

@ -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;
}

View file

@ -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)

View file

@ -134,7 +134,6 @@ mainconfig
"" = "GUI PEAKMEM",
"" = "GUI HEAPLOG",
"" = "GUI X11",
"" = "GUI GTK WAYLAND",
"" = "GUI DEBUGCODE";
custom() "",

View file

@ -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");