ide: Use Wayland flag in settings

This commit is contained in:
Mirek Fidler 2025-02-13 10:20:34 +01:00
parent c20c2afc6b
commit 2b7617cb89
6 changed files with 26 additions and 7 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

@ -96,9 +96,11 @@ bool InitGtkApp(int argc, char **argv, const char **envptr)
#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")))
backends = "wayland,x11";
gdk_set_allowed_backends(backends);
#endif

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

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