apply dwm-xinerama-monitors-xorder-6.4.diff
This commit is contained in:
12
dwm.c
12
dwm.c
@@ -2164,6 +2164,16 @@ updateclientlist(void)
|
|||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XINERAMA
|
||||||
|
// Custom comparator: sort monitors by x_org to match physical layout left-to-right
|
||||||
|
static int
|
||||||
|
compare_xinerama_x(const void *a, const void *b) {
|
||||||
|
const XineramaScreenInfo *sa = (const XineramaScreenInfo *)a;
|
||||||
|
const XineramaScreenInfo *sb = (const XineramaScreenInfo *)b;
|
||||||
|
return sa->x_org - sb->x_org;
|
||||||
|
}
|
||||||
|
#endif /* XINERAMA */
|
||||||
|
|
||||||
int
|
int
|
||||||
updategeom(void)
|
updategeom(void)
|
||||||
{
|
{
|
||||||
@@ -2180,6 +2190,8 @@ updategeom(void)
|
|||||||
for (n = 0, m = mons; m; m = m->next, n++);
|
for (n = 0, m = mons; m; m = m->next, n++);
|
||||||
/* only consider unique geometries as separate screens */
|
/* only consider unique geometries as separate screens */
|
||||||
unique = ecalloc(nn, sizeof(XineramaScreenInfo));
|
unique = ecalloc(nn, sizeof(XineramaScreenInfo));
|
||||||
|
// Sort monitors by x_org so dwm handles screens in left-to-right order
|
||||||
|
qsort(info, nn, sizeof(XineramaScreenInfo), compare_xinerama_x);
|
||||||
for (i = 0, j = 0; i < nn; i++)
|
for (i = 0, j = 0; i < nn; i++)
|
||||||
if (isuniquegeom(unique, j, &info[i]))
|
if (isuniquegeom(unique, j, &info[i]))
|
||||||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||||
|
|||||||
Reference in New Issue
Block a user