aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-11 19:50:02 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-11 19:50:02 +1000
commit15dc5286e280ddd06e845dc57115243e72f2339e (patch)
treec24efe7dbbc93098dd4c2273ebc2dc809c576901 /common
parent0f14abf5120db02ee80df4cc931e2abcd05af396 (diff)
Move floating windows to front when focused
Diffstat (limited to 'common')
-rw-r--r--common/list.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c
index 39cc10e1..66d52f70 100644
--- a/common/list.c
+++ b/common/list.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "log.h"
list_t *create_list(void) {
list_t *list = malloc(sizeof(list_t));
@@ -82,6 +83,20 @@ void list_swap(list_t *list, int src, int dest) {
list->items[dest] = tmp;
}
+void list_move_to_end(list_t *list, void *item) {
+ int i;
+ for (i = 0; i < list->length; ++i) {
+ if (list->items[i] == item) {
+ break;
+ }
+ }
+ if (!sway_assert(i < list->length, "Item not found in list")) {
+ return;
+ }
+ list_del(list, i);
+ list_add(list, item);
+}
+
static void list_rotate(list_t *list, int from, int to) {
void *tmp = list->items[to];