mirror of
https://github.com/brl/mutter.git
synced 2025-01-11 12:12:25 +00:00
monitor-config-store: Add parsing support for "maxbpc" in monitors.xml
For example: <monitor> ... <maxbpc>8</maxbpc> </monitor> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>
This commit is contained in:
parent
d39137c631
commit
03336788fb
@ -167,6 +167,7 @@ typedef enum
|
||||
STATE_MONITOR_MODE_RATE,
|
||||
STATE_MONITOR_MODE_FLAG,
|
||||
STATE_MONITOR_UNDERSCANNING,
|
||||
STATE_MONITOR_MAXBPC,
|
||||
STATE_DISABLED,
|
||||
STATE_POLICY,
|
||||
STATE_STORES,
|
||||
@ -451,6 +452,10 @@ handle_start_element (GMarkupParseContext *context,
|
||||
{
|
||||
parser->state = STATE_MONITOR_UNDERSCANNING;
|
||||
}
|
||||
else if (g_str_equal (element_name, "maxbpc"))
|
||||
{
|
||||
parser->state = STATE_MONITOR_MAXBPC;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
@ -544,6 +549,13 @@ handle_start_element (GMarkupParseContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_MONITOR_MAXBPC:
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
"Invalid element '%s' under maxbpc", element_name);
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_DISABLED:
|
||||
{
|
||||
if (!g_str_equal (element_name, "monitorspec"))
|
||||
@ -818,6 +830,14 @@ handle_end_element (GMarkupParseContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_MONITOR_MAXBPC:
|
||||
{
|
||||
g_assert (g_str_equal (element_name, "maxbpc"));
|
||||
|
||||
parser->state = STATE_MONITOR;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_MONITOR:
|
||||
{
|
||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
||||
@ -1309,6 +1329,29 @@ handle_text (GMarkupParseContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_MONITOR_MAXBPC:
|
||||
{
|
||||
int signed_max_bpc;
|
||||
|
||||
if (read_int (text, text_len, &signed_max_bpc, error))
|
||||
{
|
||||
if (signed_max_bpc >= 0)
|
||||
{
|
||||
parser->current_monitor_config->has_max_bpc = TRUE;
|
||||
parser->current_monitor_config->max_bpc = signed_max_bpc;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR,
|
||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid negative maxbpc value \"%s\"",
|
||||
text);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_STORE:
|
||||
{
|
||||
MetaConfigStore store;
|
||||
@ -1480,6 +1523,12 @@ append_monitors (GString *buffer,
|
||||
g_string_append (buffer, " </mode>\n");
|
||||
if (monitor_config->enable_underscanning)
|
||||
g_string_append (buffer, " <underscanning>yes</underscanning>\n");
|
||||
|
||||
if (monitor_config->has_max_bpc)
|
||||
{
|
||||
g_string_append_printf (buffer, " <maxbpc>%u</maxbpc>\n",
|
||||
monitor_config->max_bpc);
|
||||
}
|
||||
g_string_append (buffer, " </monitor>\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user