since: 1.4

Declaration [src]

adw_breakpoint_condition_parse (
  const char* str

Description [src]

Parses a condition from a string.

Length conditions are specified as <type>: <value>[<unit>], where:

  • <type> can be min-width, max-width, min-height or max-height
  • <value> is a fractional number
  • <unit> can be px, pt or sp

If the unit is omitted, px is assumed.

See adw_breakpoint_condition_new_length().


  • min-width: 500px
  • min-height: 400pt
  • max-width: 100sp
  • max-height: 500

Ratio conditions are specified as <type>: <width>[/<height>], where:

  • <type> can be min-aspect-ratio or max-aspect-ratio
  • <width> and <height> are integer numbers

See adw_breakpoint_condition_new_ratio().

The ratio is represented as <width> divided by <height>.

If <height> is omitted, it’s assumed to be 1.


  • min-aspect-ratio: 4/3
  • max-aspect-ratio: 1

The logical operators and, or can be used to compose a complex condition as follows:


  • min-width: 400px and max-aspect-ratio: 4/3
  • max-width: 360sp or max-width: 360px

Conditions can be further nested using parentheses, for example:

  • min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)

If parentheses are omitted, the first operator takes priority.

Available since: 1.4



Type: const char*

The string specifying the condition.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: AdwBreakpointCondition

The parsed condition.

The caller of the function takes ownership of the data, and is responsible for freeing it.