~moody/drawterm

4d5bae54db51817144bbe37f65775608817c0cd5 — Jacob Moody a month ago d3f8a34 front
cleanup
4 files changed, 12 insertions(+), 20 deletions(-)

M gui-wl/wl-cb.c
M gui-wl/wl-screen.c
M gui-wl/wl-util.c
M kern/devaudio-pipewire.c
M gui-wl/wl-cb.c => gui-wl/wl-cb.c +1 -1
@@ 517,7 517,7 @@ wlsetcb(Wlwin *wl)
	wl_registry_add_listener(registry, &registry_listener, wl);
	wl_display_roundtrip(wl->display);
	wl->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
	

	if(wl->shm == nil || wl->compositor == nil || wl->xdg_wm_base == nil || wl->seat == nil || wl->decoman == nil)
		sysfatal("Registration fell short");


M gui-wl/wl-screen.c => gui-wl/wl-screen.c +7 -12
@@ 25,9 25,7 @@

#undef close

static Wlwin *snarfwin;

static int clientruning;
static Wlwin *gwin;

Memimage *gscreen;



@@ 98,7 96,7 @@ wlattach(char *label)
	Wlwin *wl;

	wl = newwlwin();
	snarfwin = wl;
	gwin = wl;
	wl->display = wl_display_connect(NULL);
	if(wl->display == nil)
		sysfatal("could not connect to display");


@@ 138,9 136,6 @@ guimain(void)
Memdata*
attachscreen(Rectangle *r, ulong *chan, int *depth, int *width, int *softscreen)
{
	Wlwin *wl;

	wl = snarfwin;
	*r = gscreen->clipr;
	*chan = gscreen->chan;
	*depth = gscreen->depth;


@@ 156,7 151,7 @@ flushmemscreen(Rectangle r)
{
	Wlwin *wl;

	wl = snarfwin;
	wl = gwin;
	wl->dirty = 1;
	wlflush(wl);
}


@@ 164,14 159,14 @@ flushmemscreen(Rectangle r)
void
screensize(Rectangle r, ulong chan)
{
	snarfwin->dirty = 1;
	gwin->dirty = 1;
}

void
setcursor(void)
{
	qlock(&drawlock);
	wldrawcursor(snarfwin, &cursor);
	wldrawcursor(gwin, &cursor);
	qunlock(&drawlock);
}



@@ 183,13 178,13 @@ mouseset(Point p)
char*
clipread(void)
{
	return wlgetsnarf(snarfwin);
	return wlgetsnarf(gwin);
}

int
clipwrite(char *data)
{
	wlsetsnarf(snarfwin, data);
	wlsetsnarf(gwin, data);
	return strlen(data);
}


M gui-wl/wl-util.c => gui-wl/wl-util.c +1 -1
@@ 42,7 42,7 @@ randname(char *buf)
static int
wlcreateshm(off_t size)
{
	char name[] = "/devdraw--XXXXXX";
	char name[] = "/drawterm--XXXXXX";
	int retries = 100;
	int fd;


M kern/devaudio-pipewire.c => kern/devaudio-pipewire.c +3 -6
@@ 50,7 50,7 @@ on_process(void *data)
	buf->datas[0].chunk->offset = 0;
	buf->datas[0].chunk->stride = sizeof(int16_t) * 2;
	buf->datas[0].chunk->size = pwstate.written;
	

	pw_stream_queue_buffer(pwstate.output, b);
	pwstate.written = 0;
	unlock(&pwstate.lk);


@@ 68,18 68,16 @@ pwproc(void *arg)
	struct pw_main_loop *loop;

	loop = arg;
	fprintf(stderr, "running main pipewire loop\n");
	pw_main_loop_run(loop);
}

void
audiodevopen(void)
{
	struct spa_pod *params[1];
	const struct spa_pod *params[1];
	struct spa_pod_builder b = SPA_POD_BUILDER_INIT(pwstate.buf, sizeof(pwstate.buf));
	int err;

	fprintf(stderr, "opening...\n");
	lock(&pwstate.lk);
	if(pwstate.init > 0){
		kproc("pipewire main loop", pwproc, pwstate.loop);


@@ 88,8 86,7 @@ audiodevopen(void)
	}

	pwstate.init++;
	fprintf(stderr, "initint...\n");
	pw_init(&argc, &argv);
	pw_init(&argc, (char***)&argv);
	pwstate.loop = pw_main_loop_new(NULL);
	if(pwstate.loop == NULL)
		sysfatal("could not create loop");