update comments and remove debugging printf

This commit is contained in:
Guido Cella 2020-12-21 11:21:59 +01:00
parent 5668c61616
commit 33e8a3f1f3
2 changed files with 6 additions and 13 deletions

View file

@ -24,7 +24,9 @@ static const Layout layouts[] = {
{ "[M]", monocle }, { "[M]", monocle },
}; };
/* monitors */ /* monitors
* The order in which monitors are defined determines their position.
* Non-configured monitors are always added to the left. */
static const MonitorRule monrules[] = { static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect */ /* name mfact nmaster scale layout rotate/reflect */
/* example of a HiDPI laptop monitor: /* example of a HiDPI laptop monitor:
@ -32,9 +34,6 @@ static const MonitorRule monrules[] = {
*/ */
/* defaults */ /* defaults */
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL }, { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
/* with the outputOder patch, the order in which every monitor is defined
* defines its actual position. Non configured monitor, are always added to
* the left */
}; };
/* keyboard */ /* keyboard */

12
dwl.c
View file

@ -866,20 +866,15 @@ createmon(struct wl_listener *listener, void *data)
if (insertmon) { if (insertmon) {
x = insertmon->w.x + insertmon->w.width; x = insertmon->w.x + insertmon->w.width;
wl_list_insert(&insertmon->link, &m->link); wl_list_insert(&insertmon->link, &m->link);
fprintf(stderr, "%s inserted in pos %d\n", m->wlr_output->name, m->position);
} else { } else {
wl_list_insert(&mons, &m->link); wl_list_insert(&mons, &m->link);
fprintf(stderr, "%s defaulting\n", m->wlr_output->name);
} }
wlr_output_enable(wlr_output, true); wlr_output_enable(wlr_output, true);
if (!wlr_output_commit(wlr_output)) if (!wlr_output_commit(wlr_output))
return; return;
/* Adds this to the output layout. The add_auto function arranges outputs /* Adds this to the output layout in the order it was configured in.
* from left-to-right in the order they appear. A more sophisticated
* compositor would let the user configure the arrangement of outputs in the
* layout.
* *
* The output layout utility automatically adds a wl_output global to the * The output layout utility automatically adds a wl_output global to the
* display, which Wayland clients can see to find out information about the * display, which Wayland clients can see to find out information about the
@ -887,11 +882,10 @@ createmon(struct wl_listener *listener, void *data)
*/ */
wlr_output_layout_add(output_layout, wlr_output, x, 0); wlr_output_layout_add(output_layout, wlr_output, x, 0);
wl_list_for_each_reverse(moni, &mons, link) { wl_list_for_each_reverse(moni, &mons, link) {
/* all monitors that on the right of the new one must be moved */ /* All monitors to the right of the new one must be moved */
if (moni == m) if (moni == m)
break; break;
wlr_output_layout_move(output_layout, moni->wlr_output, moni->w.x + m->wlr_output->width, 0); wlr_output_layout_move(output_layout, moni->wlr_output, moni->w.x + m->wlr_output->width, 0);
fprintf(stderr, "moved %s to %d", moni->wlr_output->name, moni->w.x + m->wlr_output->width);
} }
sgeom = *wlr_output_layout_get_box(output_layout, NULL); sgeom = *wlr_output_layout_get_box(output_layout, NULL);
@ -902,7 +896,7 @@ createmon(struct wl_listener *listener, void *data)
/* When adding monitors, the geometries of all monitors must be updated */ /* When adding monitors, the geometries of all monitors must be updated */
updatemons(); updatemons();
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
/* the first monitor in the list is the most recently added */ /* The first monitor in the list is the most recently added */
Client *c; Client *c;
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (c->isfloating) if (c->isfloating)