wlmaker
Loading...
Searching...
No Matches
Macros | Functions | Variables
config.c File Reference
#include "config.h"
#include <limits.h>
#include <wlr/types/wlr_keyboard.h>
#include "default_configuration.h"
#include "default_state.h"
#include "style_default.h"
Include dependency graph for config.c:

Functions

static wlmcfg_dict_t_wlmaker_config_from_plist (const char *fname_ptr)
 
static bool _wlmaker_config_decode_fill_style (wlmcfg_object_t *object_ptr, void *dest_ptr)
 
wlmcfg_dict_twlmaker_config_load (const char *fname_ptr)
 
wlmcfg_dict_twlmaker_state_load (const char *fname_ptr)
 
static void test_embedded (bs_test_t *test_ptr)
 
static void test_file (bs_test_t *test_ptr)
 
static void test_style_file (bs_test_t *test_ptr)
 
static void test_decode_fill (bs_test_t *test_ptr)
 
static void test_decode_font (bs_test_t *test_ptr)
 

Variables

const float config_output_scale = 1.0
 
static const wlmcfg_enum_desc_t _wlmaker_config_fill_type_desc []
 
static const wlmcfg_enum_desc_t _wlmaker_config_font_weight_desc []
 
static const wlmcfg_desc_t _wlmaker_config_fill_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_style_color_solid_desc []
 
static const wlmcfg_desc_t _wlmaker_config_style_color_gradient_desc []
 
static const wlmcfg_desc_t _wlmaker_config_tile_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_margin_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_dock_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_font_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_window_titlebar_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_window_resize_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_window_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_menu_item_style_desc []
 
static const wlmcfg_desc_t _wlmaker_config_menu_style_desc []
 
static const wlmcfg_desc_t _wlmaker_task_list_style_desc []
 
static const wlmcfg_desc_t _wlmaker_clip_style_desc []
 
static const wlmcfg_desc_t _wlmaker_cursor_style_desc []
 
const wlmcfg_desc_t wlmaker_config_style_desc []
 
static const char * _wlmaker_config_fname_ptrs []
 
static const char * _wlmaker_state_fname_ptrs []
 
const bs_test_case_t wlmaker_config_test_cases []
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Configurables for wlmaker. Currently, this file lists hardcoded entities, and mainly serves as a catalog about which entities should be dynamically configurable.

Function Documentation

◆ _wlmaker_config_decode_fill_style()

bool _wlmaker_config_decode_fill_style ( wlmcfg_object_t * object_ptr,
void * dest_ptr )
static

Custom decoder for fill style struct from a plist dict.

Parameters
object_ptr
dest_ptr
Returns
true on success.

◆ _wlmaker_config_from_plist()

wlmcfg_dict_t * _wlmaker_config_from_plist ( const char * fname_ptr)
static

Loads a plist dict from fname_ptr. Returns NULL on error.

◆ test_decode_fill()

void test_decode_fill ( bs_test_t * test_ptr)
static

Tests the decoder for the fill style.

◆ test_decode_font()

void test_decode_font ( bs_test_t * test_ptr)
static

Tests the decoder for a font descriptor.

◆ test_embedded()

void test_embedded ( bs_test_t * test_ptr)
static

Verifies that the embedded config loads.

◆ test_file()

void test_file ( bs_test_t * test_ptr)
static

Verifies that the (example) config files are loading.

◆ test_style_file()

void test_style_file ( bs_test_t * test_ptr)
static

Loads and decodes the style file.

◆ wlmaker_config_load()

wlmcfg_dict_t * wlmaker_config_load ( const char * fname_ptr)

Loads the configuration for wlmaker.

If fname_ptr is give, it will attempt to load the configuration from the specified file. Otherwise, it will attempt to load the files specified in _wlmaker_config_fname_ptrs, or (at last) use the built-in default.

Parameters
fname_ptrOptional: Name of the file to load it from. May be NULL.
Returns
A dict object, or NULL on error. Errors will already be logged. The caller must free the associated resources by calling wlmcfg_object_unref.

◆ wlmaker_state_load()

wlmcfg_dict_t * wlmaker_state_load ( const char * fname_ptr)

Loads the state for wlmaker.

Behaviour is similar to wlmaker_config_load.

Parameters
fname_ptr
Returns
A dict object or NULL on error.

Variable Documentation

◆ _wlmaker_clip_style_desc

const wlmcfg_desc_t _wlmaker_clip_style_desc[]
static
Initial value:
= {
"Font", true, wlmaker_config_clip_style_t, font,
"TextColor", true, wlmaker_config_clip_style_t,
text_color, 0),
}
static const wlmcfg_desc_t _wlmaker_config_font_style_desc[]
Definition config.c:123
#define WLMCFG_DESC_ARGB32(_key, _required, _base, _field, _default)
Definition decode.h:186
#define WLMCFG_DESC_DICT(_key, _required, _base, _field, _desc)
Definition decode.h:234
Definition config.h:57

Descriptor for decoding the "Clip" dictionary.

◆ _wlmaker_config_dock_style_desc

const wlmcfg_desc_t _wlmaker_config_dock_style_desc[]
static
Initial value:
= {
"Margin", true, wlmtk_dock_style_t, margin,
}
static const wlmcfg_desc_t _wlmaker_config_margin_style_desc[]
Definition config.c:106
Definition style.h:120

Plist decoding descriptor of the dock's style.

◆ _wlmaker_config_fill_style_desc

const wlmcfg_desc_t _wlmaker_config_fill_style_desc[]
static
Initial value:
= {
WLMCFG_DESC_ENUM("Type", true, wlmtk_style_fill_t, type,
}
static const wlmcfg_enum_desc_t _wlmaker_config_fill_type_desc[]
Definition config.c:51
#define WLMCFG_DESC_ENUM(_key, _required, _base, _field, _default, _desc_ptr)
Definition decode.h:204
Definition style.h:73
@ WLMTK_STYLE_COLOR_SOLID
Definition style.h:33

Plist decoding descriptor of the fill style.

◆ _wlmaker_config_fill_type_desc

const wlmcfg_enum_desc_t _wlmaker_config_fill_type_desc[]
static
Initial value:
= {
}
#define WLMCFG_ENUM(_name, _value)
Definition decode.h:52
@ WLMTK_STYLE_COLOR_VGRADIENT
Definition style.h:37
@ WLMTK_STYLE_COLOR_ADGRADIENT
Definition style.h:55
@ WLMTK_STYLE_COLOR_HGRADIENT
Definition style.h:35
@ WLMTK_STYLE_COLOR_DGRADIENT
Definition style.h:45

Plist decoding descriptor of the fill type.

◆ _wlmaker_config_fname_ptrs

const char* _wlmaker_config_fname_ptrs[]
static
Initial value:
= {
"~/.wlmaker.plist",
NULL
}

Lookup paths for the configuration file.

◆ _wlmaker_config_font_style_desc

const wlmcfg_desc_t _wlmaker_config_font_style_desc[]
static
Initial value:
= {
"Face", true, wlmtk_style_font_t, face,
"Weight", true, wlmtk_style_font_t, weight,
WLMTK_FONT_WEIGHT_NORMAL, _wlmaker_config_font_weight_desc),
"Size", true, wlmtk_style_font_t, size, 10),
}
static const wlmcfg_enum_desc_t _wlmaker_config_font_weight_desc[]
Definition config.c:61
#define WLMCFG_DESC_CHARBUF(_key, _required, _base, _field, _len, _default)
Definition decode.h:224
#define WLMCFG_DESC_UINT64(_key, _required, _base, _field, _default)
Definition decode.h:159
Definition style.h:101
#define WLMTK_STYLE_FONT_FACE_LENGTH
Definition style.h:92

Descriptor for decoding "Font" sections.

◆ _wlmaker_config_font_weight_desc

const wlmcfg_enum_desc_t _wlmaker_config_font_weight_desc[]
static
Initial value:
= {
WLMCFG_ENUM("Normal", WLMTK_FONT_WEIGHT_NORMAL),
WLMCFG_ENUM("Bold", WLMTK_FONT_WEIGHT_BOLD),
}

Plist decoding descriptor for font weight.

◆ _wlmaker_config_margin_style_desc

const wlmcfg_desc_t _wlmaker_config_margin_style_desc[]
static
Initial value:
= {
"Width", true, wlmtk_margin_style_t, width, 0),
"Color", true, wlmtk_margin_style_t, color, 0xff000000),
}
Definition style.h:112

Plist decoding descriptor of a margin's style.

◆ _wlmaker_config_menu_item_style_desc

const wlmcfg_desc_t _wlmaker_config_menu_item_style_desc[]
static
Initial value:
= {
"Fill", true, wlmtk_menu_item_style_t, fill,
"HighlightedFill", true, wlmtk_menu_item_style_t, highlighted_fill,
"Font", true, wlmtk_menu_item_style_t, font,
"EnabledTextColor", true, wlmtk_menu_item_style_t,
enabled_text_color, 0),
"HighlightedTextColor", true, wlmtk_menu_item_style_t,
highlighted_text_color, 0),
"DisabledTextColor", true, wlmtk_menu_item_style_t,
disabled_text_color, 0),
"Height", true, wlmtk_menu_item_style_t, height, 20),
"BezelWidth", true, wlmtk_menu_item_style_t, bezel_width, 1),
"Width", true, wlmtk_menu_item_style_t, width, 80),
}
static bool _wlmaker_config_decode_fill_style(wlmcfg_object_t *object_ptr, void *dest_ptr)
Definition config.c:412
#define WLMCFG_DESC_CUSTOM(_key, _required, _base, _field, _d,_i, _f)
Definition decode.h:243
Definition menu_item.h:49

Descriptor for decoding the "Item" dictionary.

◆ _wlmaker_config_menu_style_desc

const wlmcfg_desc_t _wlmaker_config_menu_style_desc[]
static
Initial value:
= {
"Item", true, wlmtk_menu_style_t, item,
"Margin", true, wlmtk_menu_style_t, margin,
"Border", true, wlmtk_menu_style_t, border,
}
static const wlmcfg_desc_t _wlmaker_config_menu_item_style_desc[]
Definition config.c:194
Definition menu.h:38

Descriptor for decoding the "Menu" dictionary.

◆ _wlmaker_config_style_color_gradient_desc

const wlmcfg_desc_t _wlmaker_config_style_color_gradient_desc[]
static
Initial value:

Plist decoding descriptor of a color gradient.

◆ _wlmaker_config_style_color_solid_desc

const wlmcfg_desc_t _wlmaker_config_style_color_solid_desc[]
static
Initial value:
= {
"Color", true, wlmtk_style_color_solid_data_t, color, 0),
}
Definition style.h:59

Plist decoding descriptor of the solid color.

◆ _wlmaker_config_tile_style_desc

const wlmcfg_desc_t _wlmaker_config_tile_style_desc[]
static
Initial value:
= {
"Size", true, wlmtk_tile_style_t, size, 64),
"ContentSize", true, wlmtk_tile_style_t, content_size, 48),
"BezelWidth", true, wlmtk_tile_style_t, bezel_width, 2),
"Fill", true, wlmtk_tile_style_t, fill,
}
Definition tile.h:35

Plist decoding descriptor of a tile style.

◆ _wlmaker_config_window_resize_style_desc

const wlmcfg_desc_t _wlmaker_config_window_resize_style_desc[]
static
Initial value:
= {
"Fill", true, wlmtk_resizebar_style_t, fill,
"Height", true, wlmtk_resizebar_style_t, height, 7),
"BezelWidth", true, wlmtk_resizebar_style_t, bezel_width, 1),
"CornerWidth", true, wlmtk_resizebar_style_t, corner_width, 1),
}
Definition resizebar.h:34

Descroptor for decoding the "TitleBar" dict below "Window".

◆ _wlmaker_config_window_style_desc

const wlmcfg_desc_t _wlmaker_config_window_style_desc[]
static
Initial value:
= {
"TitleBar", true, wlmtk_window_style_t, titlebar,
"ResizeBar", true, wlmtk_window_style_t, resizebar,
"Border", true, wlmtk_window_style_t, border,
"Margin", true, wlmtk_window_style_t, margin,
}
static const wlmcfg_desc_t _wlmaker_config_window_titlebar_style_desc[]
Definition config.c:136
static const wlmcfg_desc_t _wlmaker_config_window_resize_style_desc[]
Definition config.c:163
Definition window.h:43

Descriptor for decoding the "Window" dictionary.

◆ _wlmaker_config_window_titlebar_style_desc

const wlmcfg_desc_t _wlmaker_config_window_titlebar_style_desc[]
static
Initial value:
= {
"FocussedFill", true, wlmtk_titlebar_style_t, focussed_fill,
"FocussedTextColor", true, wlmtk_titlebar_style_t,
focussed_text_color, 0),
"BlurredFill", true, wlmtk_titlebar_style_t, blurred_fill,
"BlurredTextColor", true, wlmtk_titlebar_style_t,
blurred_text_color, 0),
"Height", true, wlmtk_titlebar_style_t, height, 22),
"BezelWidth", true, wlmtk_titlebar_style_t, bezel_width, 1),
"Margin", true, wlmtk_titlebar_style_t, margin,
"Font", true, wlmtk_titlebar_style_t, font,
}
Definition titlebar.h:30

Descroptor for decoding the "TitleBar" dict below "Window".

◆ _wlmaker_cursor_style_desc

const wlmcfg_desc_t _wlmaker_cursor_style_desc[]
static
Initial value:
= {
"Name", true, wlmaker_config_cursor_style_t, name_ptr, "default"),
"Size", true, wlmaker_config_cursor_style_t, size, 24),
}
#define WLMCFG_DESC_STRING(_key, _required, _base, _field, _default)
Definition decode.h:215
Definition config.h:65

Descriptor for decoding the "Cursor" dictionary.

◆ _wlmaker_state_fname_ptrs

const char* _wlmaker_state_fname_ptrs[]
static
Initial value:
= {
"~/.wlmaker-state.plist",
NULL
}

Lookup paths for the configuration file.

◆ _wlmaker_task_list_style_desc

const wlmcfg_desc_t _wlmaker_task_list_style_desc[]
static
Initial value:

Descriptor for decoding the "TaskList" dictionary.

◆ config_output_scale

const float config_output_scale = 1.0

Overall scale of output.

◆ wlmaker_config_style_desc

const wlmcfg_desc_t wlmaker_config_style_desc[]
Initial value:
= {
"BackgroundColor", true, wlmaker_config_style_t, background_color, 0),
"Tile", true, wlmaker_config_style_t, tile,
"Dock", true, wlmaker_config_style_t, dock,
"Window", true, wlmaker_config_style_t, window,
"Menu", true, wlmaker_config_style_t, menu,
"TaskList", true, wlmaker_config_style_t, task_list,
"Clip", true, wlmaker_config_style_t, clip,
"Cursor", true, wlmaker_config_style_t, cursor,
}
static const wlmcfg_desc_t _wlmaker_task_list_style_desc[]
Definition config.c:237
static const wlmcfg_desc_t _wlmaker_config_window_style_desc[]
Definition config.c:177
static const wlmcfg_desc_t _wlmaker_clip_style_desc[]
Definition config.c:251
static const wlmcfg_desc_t _wlmaker_config_dock_style_desc[]
Definition config.c:115
static const wlmcfg_desc_t _wlmaker_config_menu_style_desc[]
Definition config.c:223
static const wlmcfg_desc_t _wlmaker_cursor_style_desc[]
Definition config.c:262
static const wlmcfg_desc_t _wlmaker_config_tile_style_desc[]
Definition config.c:92
Definition config.h:73

Desciptor for decoding the style information from a plist.

◆ wlmaker_config_test_cases

const bs_test_case_t wlmaker_config_test_cases[]
Initial value:
= {
{ 1, "embedded", test_embedded },
{ 1, "file", test_file },
{ 1, "style_file", test_style_file },
{ 1, "decode_fill", test_decode_fill },
{ 1, "decode_font", test_decode_font },
{ 0, NULL, NULL }
}
static void test_file(bs_test_t *test_ptr)
Definition config.c:509
static void test_style_file(bs_test_t *test_ptr)
Definition config.c:534
static void test_embedded(bs_test_t *test_ptr)
Definition config.c:481
static void test_decode_font(bs_test_t *test_ptr)
Definition config.c:617
static void test_decode_fill(bs_test_t *test_ptr)
Definition config.c:565

Unit test cases.