annotate include/sys/x11/settings.h @ 353:2f094656e775

sys/x11/settings: misc fixups
author Paper <paper@paper.us.eu.org>
date Sun, 14 Jul 2024 23:27:43 -0400
parents c844f8bb87ce
children 99c961c91809
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
351
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 #ifndef MINORI_SYS_X11_SETTINGS_H_
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 #define MINORI_SYS_X11_SETTINGS_H_
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 #include <cstdint>
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5 #include <string>
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6 #include <vector>
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 namespace x11 {
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10 /* stores the item, type, etc */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11 struct SettingsItem {
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 enum Type {
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13 TypeInt = 0,
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14 TypeStr = 1,
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15 TypeRgba = 2,
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
16 };
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 /* could technically be a union */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19 struct Data {
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 std::uint32_t integer;
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21 std::string string;
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 struct {
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23 std::uint16_t red, green, blue, alpha;
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 } rgba;
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25 };
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27 bool VerifyType();
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29 std::uint8_t type; /* one of Type */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 std::string name; /* name of the item */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31 std::uint32_t serial; /* last-changed serial */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 Data data; /* type-specific data */
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33 };
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35 bool GetSettings(std::vector<SettingsItem>& settings);
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 bool FindSetting(const std::string& name, SettingsItem& setting);
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38 }
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39
c844f8bb87ce gui/theme: add xsettings backend
Paper <paper@paper.us.eu.org>
parents:
diff changeset
40 #endif /* MINORI_SYS_X11_SETTINGS_H_ */