summaryrefslogtreecommitdiffhomepage
path: root/patch/sortscreens.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-07 22:56:53 +0200
committerbakkeby <[email protected]>2019-10-07 22:56:53 +0200
commit2612060419c9c19a743f63393154abe176177f3c (patch)
tree414fe971c92e8f222fed09c62c70b71363f8a155 /patch/sortscreens.c
parentfc28c6a7b2befb1af04863c022e24820f2ac5d4c (diff)
downloaddwm-flexipatch-2612060419c9c19a743f63393154abe176177f3c.tar.gz
dwm-flexipatch-2612060419c9c19a743f63393154abe176177f3c.zip
Adding sortscreens patch
Diffstat (limited to 'patch/sortscreens.c')
-rw-r--r--patch/sortscreens.c15
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