Allow negative coordinates in MonitorRules

Monitor/output position (-1, -1) remains as a single indicator value for autoconfigure layout.
Additionally, one minor comment typo is corrected.
This commit is contained in:
A Frederick Christensen 2024-06-02 14:19:24 -05:00
parent 0047ff740a
commit bca077b927
No known key found for this signature in database
GPG key ID: 6183FA655784FC36
2 changed files with 4 additions and 2 deletions

View file

@ -36,6 +36,8 @@ static const Layout layouts[] = {
}; };
/* monitors */ /* monitors */
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator */
/* WARNING: negative values other than (-1, -1) cause problems with xwayland clients' menus */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */ /* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = { static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */ /* name mfact nmaster scale layout rotate/reflect x y */

4
dwl.c
View file

@ -927,14 +927,14 @@ createmon(struct wl_listener *listener, void *data)
m->fullscreen_bg = wlr_scene_rect_create(layers[LyrFS], 0, 0, fullscreen_bg); m->fullscreen_bg = wlr_scene_rect_create(layers[LyrFS], 0, 0, fullscreen_bg);
wlr_scene_node_set_enabled(&m->fullscreen_bg->node, 0); wlr_scene_node_set_enabled(&m->fullscreen_bg->node, 0);
/* Adds this to the output layout in the order it was configured in. /* Adds this to the output layout in the order it was configured.
* *
* 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
* output (such as DPI, scale factor, manufacturer, etc). * output (such as DPI, scale factor, manufacturer, etc).
*/ */
m->scene_output = wlr_scene_output_create(scene, wlr_output); m->scene_output = wlr_scene_output_create(scene, wlr_output);
if (m->m.x < 0 || m->m.y < 0) if (m->m.x == -1 && m->m.y == -1)
wlr_output_layout_add_auto(output_layout, wlr_output); wlr_output_layout_add_auto(output_layout, wlr_output);
else else
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);