aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-21 12:39:16 -0500
committerLibravatar M Stoeckl <code@mstoeckl.com>2019-01-21 12:39:16 -0500
commitd7ff776552bef524e905d85c2a5e7651c8408658 (patch)
treeae20feac64f93f776e9c9e136c62459705e97987 /include
parentswaybar: fix setting floating watcher slots (diff)
downloadsway-d7ff776552bef524e905d85c2a5e7651c8408658.tar.gz
sway-d7ff776552bef524e905d85c2a5e7651c8408658.tar.zst
sway-d7ff776552bef524e905d85c2a5e7651c8408658.zip
Move sway-specific functions in common/util.c into sway/
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 .
Diffstat (limited to 'include')
-rw-r--r--include/sway/input/keyboard.h21
-rw-r--r--include/sway/output.h2
-rw-r--r--include/util.h35
3 files changed, 24 insertions, 34 deletions
diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h
index 65137a08..0c8ada0f 100644
--- a/include/sway/input/keyboard.h
+++ b/include/sway/input/keyboard.h
@@ -5,6 +5,27 @@
5 5
6#define SWAY_KEYBOARD_PRESSED_KEYS_CAP 32 6#define SWAY_KEYBOARD_PRESSED_KEYS_CAP 32
7 7
8/**
9 * Get modifier mask from modifier name.
10 *
11 * Returns the modifer mask or 0 if the name isn't found.
12 */
13uint32_t get_modifier_mask_by_name(const char *name);
14
15/**
16 * Get modifier name from modifier mask.
17 *
18 * Returns the modifier name or NULL if it isn't found.
19 */
20const char *get_modifier_name_by_mask(uint32_t modifier);
21
22/**
23 * Get an array of modifier names from modifier_masks
24 *
25 * Populates the names array and return the number of names added.
26 */
27int get_modifier_names(const char **names, uint32_t modifier_masks);
28
8struct sway_shortcut_state { 29struct sway_shortcut_state {
9 /** 30 /**
10 * A list of pressed key ids (either keysyms or keycodes), 31 * A list of pressed key ids (either keysyms or keycodes),
diff --git a/include/sway/output.h b/include/sway/output.h
index 9ebdb6c1..479897ef 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -152,4 +152,6 @@ void premultiply_alpha(float color[4], float opacity);
152 152
153void scale_box(struct wlr_box *box, float scale); 153void scale_box(struct wlr_box *box, float scale);
154 154
155enum wlr_direction opposite_direction(enum wlr_direction d);
156
155#endif 157#endif
diff --git a/include/util.h b/include/util.h
index 84318fe7..e3269d6b 100644
--- a/include/util.h
+++ b/include/util.h
@@ -3,9 +3,6 @@
3 3
4#include <stdint.h> 4#include <stdint.h>
5#include <stdbool.h> 5#include <stdbool.h>
6#include <unistd.h>
7#include <wlr/types/wlr_output_layout.h>
8#include <xkbcommon/xkbcommon.h>
9 6
10/** 7/**
11 * Wrap i into the range [0, max[ 8 * Wrap i into the range [0, max[
@@ -13,39 +10,11 @@
13int wrap(int i, int max); 10int wrap(int i, int max);
14 11
15/** 12/**
16 * Count number of digits in int 13 * Count number of digits in int, including '-' sign if there is one
17 */ 14 */
18int numlen(int n); 15int numlen(int n);
19 16
20/** 17/**
21 * Get modifier mask from modifier name.
22 *
23 * Returns the modifer mask or 0 if the name isn't found.
24 */
25uint32_t get_modifier_mask_by_name(const char *name);
26
27/**
28 * Get modifier name from modifier mask.
29 *
30 * Returns the modifier name or NULL if it isn't found.
31 */
32const char *get_modifier_name_by_mask(uint32_t modifier);
33
34/**
35 * Get an array of modifier names from modifier_masks
36 *
37 * Populates the names array and return the number of names added.
38 */
39int get_modifier_names(const char **names, uint32_t modifier_masks);
40
41/**
42 * Get the pid of a parent process given the pid of a child process.
43 *
44 * Returns the parent pid or NULL if the parent pid cannot be determined.
45 */
46pid_t get_parent_pid(pid_t pid);
47
48/**
49 * Given a string that represents an RGB(A) color, return a uint32_t 18 * Given a string that represents an RGB(A) color, return a uint32_t
50 * version of the color. 19 * version of the color.
51 */ 20 */
@@ -65,6 +34,4 @@ bool parse_boolean(const char *boolean, bool current);
65 */ 34 */
66float parse_float(const char *value); 35float parse_float(const char *value);
67 36
68enum wlr_direction opposite_direction(enum wlr_direction d);
69
70#endif 37#endif