aboutsummaryrefslogtreecommitdiffstats
path: root/common/list.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-11 19:50:02 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-11 19:50:02 +1000
commit15dc5286e280ddd06e845dc57115243e72f2339e (patch)
treec24efe7dbbc93098dd4c2273ebc2dc809c576901 /common/list.c
parentMerge pull request #2241 from rustysec/master (diff)
downloadsway-15dc5286e280ddd06e845dc57115243e72f2339e.tar.gz
sway-15dc5286e280ddd06e845dc57115243e72f2339e.tar.zst
sway-15dc5286e280ddd06e845dc57115243e72f2339e.zip
Move floating windows to front when focused
Diffstat (limited to 'common/list.c')
-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 @@
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h> 4#include <string.h>
5#include "log.h"
5 6
6list_t *create_list(void) { 7list_t *create_list(void) {
7 list_t *list = malloc(sizeof(list_t)); 8 list_t *list = malloc(sizeof(list_t));
@@ -82,6 +83,20 @@ void list_swap(list_t *list, int src, int dest) {
82 list->items[dest] = tmp; 83 list->items[dest] = tmp;
83} 84}
84 85
86void list_move_to_end(list_t *list, void *item) {
87 int i;
88 for (i = 0; i < list->length; ++i) {
89 if (list->items[i] == item) {
90 break;
91 }
92 }
93 if (!sway_assert(i < list->length, "Item not found in list")) {
94 return;
95 }
96 list_del(list, i);
97 list_add(list, item);
98}
99
85static void list_rotate(list_t *list, int from, int to) { 100static void list_rotate(list_t *list, int from, int to) {
86 void *tmp = list->items[to]; 101 void *tmp = list->items[to];
87 102