2015-08-25 19:53:59 +02:00
|
|
|
#ifndef _SWAY_UTIL_H
|
|
|
|
#define _SWAY_UTIL_H
|
|
|
|
|
2016-01-05 18:07:43 +01:00
|
|
|
#include <stdint.h>
|
2018-07-30 14:03:46 +02:00
|
|
|
#include <stdbool.h>
|
2019-02-11 01:56:57 +01:00
|
|
|
#include <wayland-server-protocol.h>
|
2016-01-05 18:07:43 +01:00
|
|
|
|
2015-08-25 15:17:18 +02:00
|
|
|
/**
|
|
|
|
* Wrap i into the range [0, max[
|
|
|
|
*/
|
|
|
|
int wrap(int i, int max);
|
2015-08-25 19:53:59 +02:00
|
|
|
|
2016-07-31 01:50:13 +02:00
|
|
|
/**
|
|
|
|
* Given a string that represents an RGB(A) color, return a uint32_t
|
|
|
|
* version of the color.
|
|
|
|
*/
|
|
|
|
uint32_t parse_color(const char *color);
|
|
|
|
|
2018-07-23 21:04:46 +02:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2018-07-23 22:22:09 +02:00
|
|
|
bool parse_boolean(const char *boolean, bool current);
|
2018-07-23 21:04:46 +02:00
|
|
|
|
2018-11-17 20:31:33 +01:00
|
|
|
/**
|
|
|
|
* Given a string that represents a floating point value, return a float.
|
|
|
|
* Returns NAN on error.
|
|
|
|
*/
|
|
|
|
float parse_float(const char *value);
|
|
|
|
|
2019-02-11 01:56:57 +01:00
|
|
|
const char *sway_wl_output_subpixel_to_string(enum wl_output_subpixel subpixel);
|
|
|
|
|
2019-04-14 06:27:47 +02:00
|
|
|
bool set_cloexec(int fd, bool cloexec);
|
|
|
|
|
2015-08-25 19:53:59 +02:00
|
|
|
#endif
|