mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 12:33:50 +01:00
d7ff776552
Modifier handling functions were moved into sway/input/keyboard.c; opposite_direction for enum wlr_direction into sway/tree/output.c; and get_parent_pid into sway/tree/root.c .
38 lines
868 B
C
38 lines
868 B
C
#ifndef _SWAY_UTIL_H
|
|
#define _SWAY_UTIL_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* Wrap i into the range [0, max[
|
|
*/
|
|
int wrap(int i, int max);
|
|
|
|
/**
|
|
* Count number of digits in int, including '-' sign if there is one
|
|
*/
|
|
int numlen(int n);
|
|
|
|
/**
|
|
* Given a string that represents an RGB(A) color, return a uint32_t
|
|
* version of the color.
|
|
*/
|
|
uint32_t parse_color(const char *color);
|
|
|
|
/**
|
|
* Given a string that represents a boolean, return the boolean value. This
|
|
* function also takes in the current boolean value to support toggling. If
|
|
* toggling is not desired, pass in true for current so that toggling values
|
|
* get parsed as not true.
|
|
*/
|
|
bool parse_boolean(const char *boolean, bool current);
|
|
|
|
/**
|
|
* Given a string that represents a floating point value, return a float.
|
|
* Returns NAN on error.
|
|
*/
|
|
float parse_float(const char *value);
|
|
|
|
#endif
|