From dec9dfb80410add59334ca44c5dd65eb5c6602da Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 19 Jan 2026 14:27:28 +0100 Subject: [PATCH 1/4] CtrlCore: Wayland fixes --- uppsrc/CtrlCore/GtkCreate.cpp | 36 +++++++++++++++++------------------ uppsrc/CtrlCore/GtkWnd.cpp | 8 ++++++++ uppsrc/ide/ide.upp | 1 + 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/uppsrc/CtrlCore/GtkCreate.cpp b/uppsrc/CtrlCore/GtkCreate.cpp index a935da7e3..06fd78821 100644 --- a/uppsrc/CtrlCore/GtkCreate.cpp +++ b/uppsrc/CtrlCore/GtkCreate.cpp @@ -68,20 +68,15 @@ void Ctrl::Create(Ctrl *owner, bool popup) w.ctrl = this; w.gtk = top->window; w.gdk = nullptr; - + TopWindow *tw = dynamic_cast(this); - GdkWindowTypeHint type_hint; - if(popup && !owner) { + if(popup) gtk_window_set_decorated(gtk(), FALSE); - type_hint = GDK_WINDOW_TYPE_HINT_POPUP_MENU; - } - else { - type_hint = popup ? GDK_WINDOW_TYPE_HINT_COMBO - : tw && tw->tool ? GDK_WINDOW_TYPE_HINT_UTILITY - : owner ? GDK_WINDOW_TYPE_HINT_DIALOG - : GDK_WINDOW_TYPE_HINT_NORMAL; - } - gtk_window_set_type_hint(gtk(), type_hint); + gtk_window_set_type_hint(gtk(), + popup ? /*owner ? GDK_WINDOW_TYPE_HINT_COMBO : */GDK_WINDOW_TYPE_HINT_POPUP_MENU + : tw && tw->tool ? GDK_WINDOW_TYPE_HINT_UTILITY + : owner ? GDK_WINDOW_TYPE_HINT_DIALOG + : GDK_WINDOW_TYPE_HINT_NORMAL); Rect r = GetRect(); bool custom_bar = tw && tw->custom_bar; @@ -107,11 +102,7 @@ void Ctrl::Create(Ctrl *owner, bool popup) } else { top->header = gtk_header_bar_new(); - if(findarg(type_hint, GDK_WINDOW_TYPE_HINT_POPUP_MENU) >= 0) - gtk_widget_set_size_request(top->header, 1, 1); - else - gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(top->header), TRUE); - + gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(top->header), TRUE); gtk_header_bar_set_has_subtitle(GTK_HEADER_BAR(top->header), false); } @@ -153,7 +144,16 @@ void Ctrl::Create(Ctrl *owner, bool popup) if(findarg(gtk_window_get_type_hint(gtk()), GDK_WINDOW_TYPE_HINT_NORMAL, GDK_WINDOW_TYPE_HINT_DIALOG, GDK_WINDOW_TYPE_HINT_UTILITY) >= 0) tw->SyncSizeHints(); - gtk_widget_show_all(top->window); + if(IsWayland()) { + gtk_window_set_default_size(gtk(), LSC(r.GetWidth()), LSC(r.GetHeight())); + gtk_window_move(gtk(), LSC(r.left), LSC(r.top)); + gtk_window_resize(gtk(), LSC(r.GetWidth()), LSC(r.GetHeight())); + } + + if(IsWayland() && popup) + gtk_widget_realize(top->window); + else + gtk_widget_show_all(top->window); w.gdk = gtk_widget_get_window(top->window); diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index 9e399a37c..d69ec8cee 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -228,6 +228,14 @@ void Ctrl::WndRectsSync() const } else gdk_window_get_position(gdk(), &x, &y); + + if(IsPopUp()) { + DDUMP(Name(this)); + DDUMP(x); + DDUMP(y); + DDUMP(width); + DDUMP(height); + } return SCL(x, y, width, height); }; diff --git a/uppsrc/ide/ide.upp b/uppsrc/ide/ide.upp index 93d10d131..bc4643c17 100644 --- a/uppsrc/ide/ide.upp +++ b/uppsrc/ide/ide.upp @@ -133,6 +133,7 @@ mainconfig "" = "GUI PEAKMEM", "" = "GUI HEAPLOG", "" = "GUI X11", + "" = "GUI WAYLAND", "" = "GUI DEBUGCODE"; custom() "", From 58384f9d01f437ddc05cecc149ba860e002883c6 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 19 Jan 2026 14:35:18 +0100 Subject: [PATCH 2/4] .cosmetics --- uppsrc/CtrlCore/X11Wnd.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/uppsrc/CtrlCore/X11Wnd.cpp b/uppsrc/CtrlCore/X11Wnd.cpp index b73a29dae..1ff07fb96 100644 --- a/uppsrc/CtrlCore/X11Wnd.cpp +++ b/uppsrc/CtrlCore/X11Wnd.cpp @@ -50,6 +50,8 @@ Ptr Ctrl::popupWnd; Point Ctrl::mousePos; +static int s_starttime; + void Ctrl::DoPaint(const Vector& invalid) { GuiLock __; @@ -498,9 +500,9 @@ void Ctrl::Create(Ctrl *owner, bool redirect, bool savebits) cw.ctrl = this; cw.exposed = false; cw.owner = owner; - + cw.xic = NULL; - + if(xim) { cw.xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing|XIMStatusNothing, @@ -529,9 +531,9 @@ void Ctrl::Create(Ctrl *owner, bool redirect, bool savebits) XChangeProperty(Xdisplay, w, XInternAtom(Xdisplay, "_NET_WM_WINDOW_TYPE", false), XA_ATOM, 32, PropModeReplace, (byte *)&windowType, 1); } - + RefreshLayoutDeep(); - + SyncIMPosition(); } @@ -1147,4 +1149,4 @@ TopFrameDraw::~TopFrameDraw() } -#endif +#endif \ No newline at end of file From f0b7a98ef276f2fe529db3261e0f8298438522b5 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 19 Jan 2026 14:57:06 +0100 Subject: [PATCH 3/4] .DDUMPs --- uppsrc/CtrlCore/GtkWnd.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index d69ec8cee..e644fa456 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -229,14 +229,6 @@ void Ctrl::WndRectsSync() const else gdk_window_get_position(gdk(), &x, &y); - if(IsPopUp()) { - DDUMP(Name(this)); - DDUMP(x); - DDUMP(y); - DDUMP(width); - DDUMP(height); - } - return SCL(x, y, width, height); }; From 70574123061a1f4721da7125275700717fa01f41 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 19 Jan 2026 15:12:51 +0100 Subject: [PATCH 4/4] ide: Fixed problems with disabling custom titlebar --- uppsrc/CtrlCore/TopWindow.cpp | 1 + uppsrc/ide/ide.h | 1 + uppsrc/ide/idewin.cpp | 3 +-- uppsrc/ide/main.cpp | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/uppsrc/CtrlCore/TopWindow.cpp b/uppsrc/CtrlCore/TopWindow.cpp index 42957b63a..7678b5a8f 100644 --- a/uppsrc/CtrlCore/TopWindow.cpp +++ b/uppsrc/CtrlCore/TopWindow.cpp @@ -437,6 +437,7 @@ bool TopWindow::IsCustomTitleBar() const Ctrl * TopWindow::CustomTitleBar(Color bk, int min_cy) { + DLOG("CUSTOM BAR"); #ifdef flagNOCUSTOMBAR // suppress custom title bar for testing return nullptr; #else diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 82007b54b..1451ca072 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -635,6 +635,7 @@ public: false; #endif bool disable_custom_caption = false; + bool disable_custom_caption2 = true; // this one is initial config bool show_tabs; bool show_spaces; bool warnwhitespace; diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index 95d4e5a7c..8e2f1abe8 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -309,7 +309,7 @@ void Ide::SetupBars() display.IgnoreMouse(); bararea.Add(barrect.SizePos()); Ctrl *custom_bar = nullptr; - if(!disable_custom_caption) + if(!disable_custom_caption2) custom_bar = CustomTitleBar(GetBarAreaAvgColor()); if(custom_bar) *custom_bar << bararea.SizePos(); @@ -742,7 +742,6 @@ Ide::Ide() editfile_line_endings = Null; HideBottom(); - SetupBars(); SetBar(); libclang_options = "-Wno-logical-op-parentheses -Wno-pragma-pack"; diff --git a/uppsrc/ide/main.cpp b/uppsrc/ide/main.cpp index b1becb87b..764806779 100644 --- a/uppsrc/ide/main.cpp +++ b/uppsrc/ide/main.cpp @@ -402,6 +402,10 @@ void AppMain___() #endif ide.LoadConfig(); + + ide.disable_custom_caption2 = ide.disable_custom_caption; + + ide.SetupBars(); #ifdef PLATFORM_COCOA if(!ide.macos_update_icon)