Exemple #1
0
static Client *
strclient(View *v, char *s) {
	ulong id;

	if(!strcmp(s, "sel"))
		return view_selclient(v);
	if(getulong(s, &id))
		return win2client(id);

	return nil;
}
Exemple #2
0
static void
mapreq_event(Window *w, XMapRequestEvent *e) {
	XWindowAttributes wa;

	if(!XGetWindowAttributes(display, e->window, &wa))
		return;
	if(wa.override_redirect) {
		/* Do I really want these? */
		/* Probably not.
		XSelectInput(display, e->window,
			 PropertyChangeMask | StructureNotifyMask);
		*/
		return;
	}
	if(!win2client(e->window))
		client_create(e->window, &wa);
}
Exemple #3
0
static char*
select_frame(Frame *f, IxpMsg *m, int sym) {
	Frame *fp;
	Client *c;
	Area *a;
	char *s;
	ulong i;

	if(!f)
		return Ebadvalue;
	a = f->area;

	SET(fp);
	switch(sym) {
	case LUP:
		for(fp = a->frame; fp->anext; fp = fp->anext)
			if(fp->anext == f) break;
		break;
	case LDOWN:
		fp = f->anext;
		if(fp == nil)
			fp = a->frame;
		break;
	case LCLIENT:
		s = getword(m);
		if(s == nil || !getulong(s, &i))
			return "usage: select client <client>";
		c = win2client(i);
		if(c == nil)
			return "unknown client";
		fp = view_clientframe(f->view, c);
		break;
	default:
		assert(!"can't get here");
	}

	if(fp == nil)
		return "invalid selection";

	focus_frame(fp, False);
	frame_to_top(fp);
	if(f->view == screen->sel)
		restack_view(f->view);
	return nil;
}