File center_window_title.patch of Package xfwm4
diff -rub xfwm4-4.18.0/settings-dialogs/xfwm4-settings.c xfwm4-4.18.0-patched/settings-dialogs/xfwm4-settings.c
--- xfwm4-4.18.0/settings-dialogs/xfwm4-settings.c 2022-12-01 12:47:40.000000000 +0200
+++ xfwm4-4.18.0-patched/settings-dialogs/xfwm4-settings.c 2024-11-09 12:03:47.146935176 +0200
@@ -226,7 +226,8 @@
static const MenuTemplate title_align_values[] = {
{ N_("Left"), "left" },
- { N_("Center"), "center" },
+ { N_("Center in Free Space"), "center" },
+ { N_("Center in Window"), "center_window" },
{ N_("Right"), "right" },
{ NULL, NULL },
};
diff -rub xfwm4-4.18.0/src/frame.c xfwm4-4.18.0-patched/src/frame.c
--- xfwm4-4.18.0/src/frame.c 2022-11-01 11:53:49.000000000 +0200
+++ xfwm4-4.18.0-patched/src/frame.c 2024-11-09 12:04:20.760049428 +0200
@@ -253,6 +253,9 @@
case ALIGN_CENTER:
hoffset = (w3 / 2) - (logical_rect.width / 2);
break;
+ case ALIGN_CENTER_WINDOW:
+ hoffset = (width / 2) - (logical_rect.width / 2) - left;
+ break;
}
if (hoffset < screen_info->params->title_horizontal_offset)
{
@@ -282,6 +285,9 @@
case ALIGN_CENTER:
w1 = left + ((right - left) / 2) - (w3 / 2) - w2;
break;
+ case ALIGN_CENTER_WINDOW:
+ w1 = (width / 2) - (logical_rect.width / 2) - w2;
+ break;
}
if (w1 < left)
{
diff -rub xfwm4-4.18.0/src/settings.c xfwm4-4.18.0-patched/src/settings.c
--- xfwm4-4.18.0/src/settings.c 2022-11-12 22:57:54.000000000 +0200
+++ xfwm4-4.18.0-patched/src/settings.c 2024-11-09 12:05:21.014046767 +0200
@@ -527,6 +527,10 @@
{
screen_info->params->title_alignment = ALIGN_RIGHT;
}
+ else if (!g_ascii_strcasecmp ("center_window", getStringValue ("title_alignment", rc)))
+ {
+ screen_info->params->title_alignment = ALIGN_CENTER_WINDOW;
+ }
else
{
screen_info->params->title_alignment = ALIGN_CENTER;
diff -rub xfwm4-4.18.0/src/settings.h xfwm4-4.18.0-patched/src/settings.h
--- xfwm4-4.18.0/src/settings.h 2022-11-12 22:57:54.000000000 +0200
+++ xfwm4-4.18.0-patched/src/settings.h 2024-11-09 12:05:06.129553372 +0200
@@ -142,7 +142,8 @@
{
ALIGN_LEFT,
ALIGN_RIGHT,
- ALIGN_CENTER
+ ALIGN_CENTER,
+ ALIGN_CENTER_WINDOW
};
enum