Skip to content

Commit 3b34657

Browse files
committed
Add emerald-gtk3_add-spacer-title-object.patch
1 parent 390fdcd commit 3b34657

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
diff --color -ru emerald-gtk3.ORIG/src/emerald-v0.8.18/include/titlebar.h emerald-gtk3/src/emerald-v0.8.18/include/titlebar.h
2+
--- emerald-gtk3.ORIG/src/emerald-v0.8.18/include/titlebar.h 2024-02-07 09:13:06.958541263 -0800
3+
+++ emerald-gtk3/src/emerald-v0.8.18/include/titlebar.h 2024-02-07 10:04:44.648234602 -0800
4+
@@ -84,6 +84,7 @@
5+
TBT_TITLE=B_T_COUNT,
6+
TBT_ICON,
7+
TBT_ONBOTTOM,
8+
+ TBT_SPACER,
9+
TBT_COUNT,
10+
};
11+
#define BX_COUNT B_COUNT+2
12+
diff --color -ru emerald-gtk3.ORIG/src/emerald-v0.8.18/src/main.c emerald-gtk3/src/emerald-v0.8.18/src/main.c
13+
--- emerald-gtk3.ORIG/src/emerald-v0.8.18/src/main.c 2024-02-07 09:13:06.958541263 -0800
14+
+++ emerald-gtk3/src/emerald-v0.8.18/src/main.c 2024-02-07 10:04:33.874807595 -0800
15+
@@ -2854,6 +2854,8 @@
16+
return TBT_ONBOTTOM;
17+
case 'Y':
18+
return TBT_STICKY;
19+
+ case 'Q':
20+
+ return TBT_SPACER;
21+
default:
22+
return -2;
23+
}
24+
@@ -2880,6 +2882,23 @@
25+
return 2;
26+
case TBT_ICON:
27+
return 18;
28+
+ /*
29+
+ * The spacer equals the width of the visible NRC buttons. Useful for
30+
+ * actually centering the title, without consideration for visible
31+
+ * buttons.
32+
+ *
33+
+ * This is pretty custom, as it really only works with a layout string
34+
+ * like "Q:T:NRC" - nothing but the spacer on the left, title in the
35+
+ * center, and NRC buttons on the right.
36+
+ *
37+
+ * A more general-purpose solution would parse `ws->tobj_layout`.
38+
+ */
39+
+ case TBT_SPACER:
40+
+ return (
41+
+ !BUTTON_NOT_VISIBLE(d, B_T_MINIMIZE) +
42+
+ !BUTTON_NOT_VISIBLE(d, B_T_MAXIMIZE) +
43+
+ !BUTTON_NOT_VISIBLE(d, B_T_CLOSE)
44+
+ ) * get_title_object_width('C', ws, d);
45+
default:
46+
if (i >= 0 && i < B_T_COUNT)
47+
return (d->actions & button_actions[i]) ?

0 commit comments

Comments
 (0)