aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/config.h11
-rw-r--r--include/sway/container.h2
-rw-r--r--include/sway/criteria.h42
-rw-r--r--include/sway/input/input-manager.h6
-rw-r--r--include/sway/view.h17
5 files changed, 75 insertions, 3 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 967d3756..48a8b0ab 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -350,6 +350,14 @@ struct sway_config {
350 list_t *command_policies; 350 list_t *command_policies;
351 list_t *feature_policies; 351 list_t *feature_policies;
352 list_t *ipc_policies; 352 list_t *ipc_policies;
353
354 // Context for command handlers
355 struct {
356 struct input_config *input_config;
357 struct seat_config *seat_config;
358 struct sway_seat *seat;
359 swayc_t *current_container;
360 } handler_context;
353}; 361};
354 362
355void pid_workspace_add(struct pid_workspace *pw); 363void pid_workspace_add(struct pid_workspace *pw);
@@ -375,6 +383,9 @@ bool read_config(FILE *file, struct sway_config *config);
375 * Free config struct 383 * Free config struct
376 */ 384 */
377void free_config(struct sway_config *config); 385void free_config(struct sway_config *config);
386
387void config_clear_handler_context(struct sway_config *config);
388
378void free_sway_variable(struct sway_variable *var); 389void free_sway_variable(struct sway_variable *var);
379/** 390/**
380 * Does variable replacement for a string based on the config's currently loaded variables. 391 * Does variable replacement for a string based on the config's currently loaded variables.
diff --git a/include/sway/container.h b/include/sway/container.h
index 9a5e312b..a99e2694 100644
--- a/include/sway/container.h
+++ b/include/sway/container.h
@@ -145,4 +145,6 @@ swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type);
145swayc_t *swayc_at(swayc_t *parent, double lx, double ly, 145swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
146 struct wlr_surface **surface, double *sx, double *sy); 146 struct wlr_surface **surface, double *sx, double *sy);
147 147
148void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data);
149
148#endif 150#endif
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
new file mode 100644
index 00000000..9b4b4bef
--- /dev/null
+++ b/include/sway/criteria.h
@@ -0,0 +1,42 @@
1#ifndef _SWAY_CRITERIA_H
2#define _SWAY_CRITERIA_H
3
4#include "container.h"
5#include "list.h"
6
7/**
8 * Maps criteria (as a list of criteria tokens) to a command list.
9 *
10 * A list of tokens together represent a single criteria string (e.g.
11 * '[class="abc" title="xyz"]' becomes two criteria tokens).
12 *
13 * for_window: Views matching all criteria will have the bound command list
14 * executed on them.
15 *
16 * Set via `for_window <criteria> <cmd list>`.
17 */
18struct criteria {
19 list_t *tokens; // struct crit_token, contains compiled regex.
20 char *crit_raw; // entire criteria string (for logging)
21
22 char *cmdlist;
23};
24
25int criteria_cmp(const void *item, const void *data);
26void free_criteria(struct criteria *crit);
27
28// Pouplate list with crit_tokens extracted from criteria string, returns error
29// string or NULL if successful.
30char *extract_crit_tokens(list_t *tokens, const char *criteria);
31
32// Returns list of criteria that match given container. These criteria have
33// been set with `for_window` commands and have an associated cmdlist.
34list_t *criteria_for(swayc_t *cont);
35
36// Returns a list of all containers that match the given list of tokens.
37list_t *container_for_crit_tokens(list_t *tokens);
38
39// Returns true if any criteria in the given list matches this container
40bool criteria_any(swayc_t *cont, list_t *criteria);
41
42#endif
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 53064eed..2bf297ce 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -5,9 +5,6 @@
5#include "sway/config.h" 5#include "sway/config.h"
6#include "list.h" 6#include "list.h"
7 7
8extern struct input_config *current_input_config;
9extern struct seat_config *current_seat_config;
10
11/** 8/**
12 * The global singleton input manager 9 * The global singleton input manager
13 * TODO: make me not a global 10 * TODO: make me not a global
@@ -46,4 +43,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
46void sway_input_manager_apply_seat_config(struct sway_input_manager *input, 43void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
47 struct seat_config *seat_config); 44 struct seat_config *seat_config);
48 45
46struct sway_seat *sway_input_manager_get_default_seat(
47 struct sway_input_manager *input);
48
49#endif 49#endif
diff --git a/include/sway/view.h b/include/sway/view.h
index 08c5480b..ac33e11a 100644
--- a/include/sway/view.h
+++ b/include/sway/view.h
@@ -92,10 +92,27 @@ struct sway_view {
92 void (*set_position)(struct sway_view *view, 92 void (*set_position)(struct sway_view *view,
93 double ox, double oy); 93 double ox, double oy);
94 void (*set_activated)(struct sway_view *view, bool activated); 94 void (*set_activated)(struct sway_view *view, bool activated);
95 void (*close)(struct sway_view *view);
95 } iface; 96 } iface;
96 97
97 // only used for unmanaged views (shell specific) 98 // only used for unmanaged views (shell specific)
98 struct wl_list unmanaged_view_link; // sway_root::unmanaged views 99 struct wl_list unmanaged_view_link; // sway_root::unmanaged views
99}; 100};
100 101
102const char *view_get_title(struct sway_view *view);
103
104const char *view_get_app_id(struct sway_view *view);
105
106const char *view_get_class(struct sway_view *view);
107
108const char *view_get_instance(struct sway_view *view);
109
110void view_set_size(struct sway_view *view, int width, int height);
111
112void view_set_position(struct sway_view *view, double ox, double oy);
113
114void view_set_activated(struct sway_view *view, bool activated);
115
116void view_close(struct sway_view *view);
117
101#endif 118#endif