allow configure x and y of outputs

This commit is contained in:
Leonardo Hernández Hernández 2022-09-08 12:24:13 -05:00 committed by Leonardo Hernández Hernández
parent f7d6a34cd9
commit 23ede80f74
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
2 changed files with 10 additions and 4 deletions

View File

@ -29,12 +29,12 @@ static const Layout layouts[] = {
/* monitors */ /* monitors */
static const MonitorRule monrules[] = { static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect */ /* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor: /* example of a HiDPI laptop monitor:
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL }, { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL -1, -1 },
*/ */
/* defaults */ /* defaults */
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL }, { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
}; };
/* keyboard */ /* keyboard */

8
dwl.c
View File

@ -194,6 +194,7 @@ typedef struct {
float scale; float scale;
const Layout *lt; const Layout *lt;
enum wl_output_transform rr; enum wl_output_transform rr;
int x, y;
} MonitorRule; } MonitorRule;
typedef struct { typedef struct {
@ -908,6 +909,8 @@ createmon(struct wl_listener *listener, void *data)
wlr_xcursor_manager_load(cursor_mgr, r->scale); wlr_xcursor_manager_load(cursor_mgr, r->scale);
m->lt[0] = m->lt[1] = r->lt; m->lt[0] = m->lt[1] = r->lt;
wlr_output_set_transform(wlr_output, r->rr); wlr_output_set_transform(wlr_output, r->rr);
m->m.x = r->x;
m->m.y = r->y;
break; break;
} }
} }
@ -953,7 +956,10 @@ createmon(struct wl_listener *listener, void *data)
* 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);
wlr_output_layout_add_auto(output_layout, wlr_output); if (m->m.x < 0 || m->m.y < 0)
wlr_output_layout_add_auto(output_layout, wlr_output);
else
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
} }
void void