diff options
| author | bakkeby <[email protected]> | 2019-10-07 22:56:53 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-10-07 22:56:53 +0200 |
| commit | 2612060419c9c19a743f63393154abe176177f3c (patch) | |
| tree | 414fe971c92e8f222fed09c62c70b71363f8a155 /patch/sortscreens.c | |
| parent | fc28c6a7b2befb1af04863c022e24820f2ac5d4c (diff) | |
| download | dwm-flexipatch-2612060419c9c19a743f63393154abe176177f3c.tar.gz dwm-flexipatch-2612060419c9c19a743f63393154abe176177f3c.zip | |
Adding sortscreens patch
Diffstat (limited to 'patch/sortscreens.c')
| -rw-r--r-- | patch/sortscreens.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/patch/sortscreens.c b/patch/sortscreens.c new file mode 100644 index 0000000..6250848 --- /dev/null +++ b/patch/sortscreens.c @@ -0,0 +1,15 @@ +void +sortscreens(XineramaScreenInfo *screens, int n) +{ + int i, j; + XineramaScreenInfo *screen = ecalloc(1, sizeof(XineramaScreenInfo)); + + for (i = 0; i < n; i++) + for (j = i + 1; j < n; j++) + if (RIGHTOF(screens[i], screens[j])) { + memcpy(&screen[0], &screens[i], sizeof(XineramaScreenInfo)); + memcpy(&screens[i], &screens[j], sizeof(XineramaScreenInfo)); + memcpy(&screens[j], &screen[0], sizeof(XineramaScreenInfo)); + } + XFree(screen); +}
\ No newline at end of file |
