This commit is contained in:
Mirek Fidler 2026-01-19 15:15:56 +01:00
commit ab6fbbd85e
8 changed files with 34 additions and 26 deletions

View file

@ -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<TopWindow *>(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);

View file

@ -228,7 +228,7 @@ void Ctrl::WndRectsSync() const
}
else
gdk_window_get_position(gdk(), &x, &y);
return SCL(x, y, width, height);
};

View file

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

View file

@ -50,6 +50,8 @@ Ptr<Ctrl> Ctrl::popupWnd;
Point Ctrl::mousePos;
static int s_starttime;
void Ctrl::DoPaint(const Vector<Rect>& 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

View file

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

View file

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

View file

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

View file

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