summaryrefslogtreecommitdiff
path: root/src/main_linux.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@mailbox.org>2026-01-12 14:27:43 +0100
committerAldrik Ramaekers <aldrik@mailbox.org>2026-01-12 14:27:43 +0100
commitafc58c547f25affd9075ee5eef4444b7c0855e06 (patch)
treed90311c217fd02d989bbffa720407fe254958474 /src/main_linux.cpp
parent74748ae725ca3cdcc450473ea0ccd245ab36533d (diff)
ui improvements
Diffstat (limited to 'src/main_linux.cpp')
-rw-r--r--src/main_linux.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main_linux.cpp b/src/main_linux.cpp
index 092fd80..2455c06 100644
--- a/src/main_linux.cpp
+++ b/src/main_linux.cpp
@@ -23,6 +23,7 @@
#include <IconFontCppHeaders/IconsFontAwesome5.h>
#include "ui.hpp"
+#include "strops.hpp"
#include "administration.hpp"
#include "administration_writer.hpp"
#include "administration_reader.hpp"
@@ -48,6 +49,15 @@ static void glfw_error_callback(int error, const char* description)
fprintf(stderr, "GLFW Error %d: %s\n", error, description);
}
+void ui::set_window_title(const char* filename)
+{
+ char final_title[256];
+ if (filename) strops::format(final_title, 256, "OpenBooks (%s)", filename);
+ else strops::copy(final_title, "OpenBooks", 256);
+
+ if (window) glfwSetWindowTitle(window, final_title);
+}
+
static void _create_window(bool is_setup_window)
{
if (window) {
@@ -71,12 +81,18 @@ static void _create_window(bool is_setup_window)
}
glfwWindowHint(GLFW_SAMPLES, 4);
+
+
window = glfwCreateWindow(windowWidth, windowHeight, "OpenBooks", nullptr, nullptr);
if (window == nullptr)
return;
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
+ if (!is_setup_window) {
+ ui::set_window_title(administration::get_file_path());
+ }
+
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;