aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/types/wlr_list.h71
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h25
-rw-r--r--include/wlr/xwayland.h2
3 files changed, 57 insertions, 41 deletions
diff --git a/include/wlr/types/wlr_list.h b/include/wlr/types/wlr_list.h
index 8ddd30b6..78a30995 100644
--- a/include/wlr/types/wlr_list.h
+++ b/include/wlr/types/wlr_list.h
@@ -2,6 +2,7 @@
#define WLR_UTIL_LIST_H
#include <stddef.h>
+#include <stdbool.h>
struct wlr_list {
size_t capacity;
@@ -10,51 +11,65 @@ struct wlr_list {
};
/**
- * Creates a new list, may return `NULL` on failure
+ * Initialize a list. Returns true on success, false on failure.
*/
-struct wlr_list *wlr_list_create(void);
-void wlr_list_free(struct wlr_list *list);
-void wlr_list_foreach(struct wlr_list *list, void (*callback)(void *item));
+bool wlr_list_init(struct wlr_list *list);
+
/**
- * Add `item` to the end of a list.
- * Returns: new list length or `-1` on failure
+ * Deinitialize a list.
*/
-int wlr_list_add(struct wlr_list *list, void *item);
+void wlr_list_finish(struct wlr_list *list);
+
+/**
+ * Executes `callback` on each element in the list.
+ */
+void wlr_list_for_each(struct wlr_list *list, void (*callback)(void *item));
+
/**
* Add `item` to the end of a list.
- * Returns: new list length or `-1` on failure
+ * Returns: new list length or `-1` on failure.
*/
-int wlr_list_push(struct wlr_list *list, void *item);
+ssize_t wlr_list_push(struct wlr_list *list, void *item);
+
/**
- * Place `item` into index `index` in the list
- * Returns: new list length or `-1` on failure
+ * Place `item` into index `index` in the list.
+ * Returns: new list length or `-1` on failure.
*/
-int wlr_list_insert(struct wlr_list *list, size_t index, void *item);
+ssize_t wlr_list_insert(struct wlr_list *list, size_t index, void *item);
+
/**
- * Remove an item from the list
+ * Remove an item from the list.
*/
void wlr_list_del(struct wlr_list *list, size_t index);
+
/**
- * Remove and return an item from the end of the list
+ * Remove and return an item from the end of the list.
*/
void *wlr_list_pop(struct wlr_list *list);
+
/**
- * Get a reference to the last item of a list without removal
+ * Get a reference to the last item of a list without removal.
*/
void *wlr_list_peek(struct wlr_list *list);
+
+/**
+ * Append each item in `source` to `list`.
+ * Does not modify `source`.
+ * Returns: new list length or `-1` on failure.
+ */
+ssize_t wlr_list_cat(struct wlr_list *list, const struct wlr_list *source);
+
/**
- * Append each item in `source` to `list`
- * Does not modify `source`
- * Returns: new list length or `-1` on failure
- */
-int wlr_list_cat(struct wlr_list *list, struct wlr_list *source);
-// See qsort. Remember to use *_qsort functions as compare functions,
-// because they dereference the left and right arguments first!
-void wlr_list_qsort(struct wlr_list *list, int compare(const void *left, const void *right));
-// Return index for first item in list that returns 0 for given compare
-// function or -1 if none matches.
-int wlr_list_seq_find(struct wlr_list *list,
- int compare(const void *item, const void *cmp_to),
- const void *cmp_to);
+ * Sort a list using `qsort`.
+ */
+void wlr_list_qsort(struct wlr_list *list,
+ int compare(const void *left, const void *right));
+
+/**
+ * Return the index of the first item in the list that returns 0 for the given
+ * `compare` function, or -1 if none matches.
+ */
+ssize_t wlr_list_find(struct wlr_list *list,
+ int compare(const void *item, const void *cmp_to), const void *cmp_to);
#endif
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index 7e89ec74..4eb957be 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -107,7 +107,9 @@ struct wlr_xdg_surface_v6 {
bool configured;
bool added;
+ uint32_t configure_serial;
struct wl_event_source *configure_idle;
+ uint32_t configure_next_serial;
struct wl_list configure_list;
char *title;
@@ -123,7 +125,6 @@ struct wlr_xdg_surface_v6 {
struct {
struct wl_signal commit;
struct wl_signal destroy;
- struct wl_signal ack_configure;
struct wl_signal ping_timeout;
struct wl_signal request_maximize;
@@ -173,37 +174,38 @@ void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell);
void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface);
/**
- * Request that this toplevel surface be the given size.
+ * Request that this toplevel surface be the given size. Returns the associated
+ * configure serial.
*/
-void wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
+uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
uint32_t width, uint32_t height);
/**
* Request that this toplevel surface show itself in an activated or deactivated
- * state.
+ * state. Returns the associated configure serial.
*/
-void wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
+uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
bool activated);
/**
* Request that this toplevel surface consider itself maximized or not
- * maximized.
+ * maximized. Returns the associated configure serial.
*/
-void wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
+uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
bool maximized);
/**
* Request that this toplevel surface consider itself fullscreen or not
- * fullscreen.
+ * fullscreen. Returns the associated configure serial.
*/
-void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
+uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
bool fullscreen);
/**
* Request that this toplevel surface consider itself to be resizing or not
- * resizing.
+ * resizing. Returns the associated configure serial.
*/
-void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
+uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
bool resizing);
/**
@@ -225,4 +227,5 @@ void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at(
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
double *popup_sx, double *popup_sy);
+
#endif
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index 6518b703..9b493d88 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -5,7 +5,6 @@
#include <stdbool.h>
#include <wlr/types/wlr_compositor.h>
#include <xcb/xcb.h>
-#include <wlr/types/wlr_list.h>
#ifdef HAS_XCB_ICCCM
#include <xcb/xcb_icccm.h>
@@ -86,7 +85,6 @@ struct wlr_xwayland_surface {
char *class;
char *instance;
struct wlr_xwayland_surface *parent;
- struct wlr_list *state; // list of xcb_atom_t
pid_t pid;
xcb_atom_t *window_type;