Пример #1
0
void window_manage(Window win)
{
	XWindowAttributes attrib;
	gboolean no_manage = FALSE;
	Window icon_win = None;
	grab_server(TRUE);
	if(xqueue_exists_local(check_unmap, &win)) {
		wm_debug("Trying to manage unmapped window. Aborting that.");
		no_manage = TRUE;
	} else if(!XGetWindowAttributes(t_display, win, &attrib))
		no_manage = TRUE;
	else {
		XWMHints *wmhints;
		if((wmhints = XGetWMHints(t_display, win))) {
			if((wmhints->flags & StateHint) && wmhints->initial_state == WithdrawnState) {
				if(wmhints->flags & IconWindowHint)
					icon_win = wmhints->icon_window;
			}
			XFree(wmhints);
		}
	}
	if(!no_manage) {
		if(attrib.override_redirect) {
			wm_debug("not managing override redirect window 0x%x", win);
			grab_server(FALSE);
		} else
			client_manage(win);
	} else {
		grab_server(FALSE);
		wm_debug("FAILED to manage window 0x%x", win);
	}
}
Пример #2
0
void client_print()
{
    Client* c;

    if (head == NULL)
    {
        wm_debug("No head");
        return;
    }

    printf("--- Clientlist ---\n");
    for (c = head; c; c = c->next)
    {
        if (c == current)
            printf("*");
        if (c->focus)
            printf("!");
        printf("Managed window %s [%d] @ %d:%d\n", c->name, c->win, c->geom.x, c->geom.y);
    }
    printf("------------------\n");
}
Пример #3
0
void window_manage_all(void)
{
	guint i, j, nchild;
	Window w, *children;
	XWMHints *wmhints;
	XWindowAttributes attrib;
	if(!XQueryTree(t_display, DefaultRootWindow(t_display), &w, &w, &children, &nchild)) {
		wm_debug("XQueryTree failed in window_manage_all");
		nchild = 0;
	}
	for(i = 0; i < nchild; i++) {
		if(children[i] == None)
			continue;
		wmhints = XGetWMHints(t_display, children[i]);
		if(wmhints) {
			if((wmhints->flags & IconWindowHint) && (wmhints->icon_window != children[i]))
				for(j = 0; j < nchild; j++)
					if(children[j] == wmhints->icon_window) {
						children[j] = None;
						break;
					}
			XFree(wmhints);
		}
	}
	for(i = 0; i < nchild; ++i) {
		if(children[i] == None)
			continue;
		if(window_find(children[i]))
			continue;
		if(XGetWindowAttributes(t_display, children[i], &attrib)) {
			if(attrib.map_state == IsUnmapped);
			else
				window_manage(children[i]);
		}
	}
	if(children)
		XFree(children);
}
Пример #4
0
gboolean stacking_restack_request(struct wm_client *client, struct wm_client *sibling, gint detail)
{
	gboolean ret = FALSE;
	if(sibling && (client->desktop != sibling->desktop && client->desktop != DESKTOP_ALL && sibling->desktop != DESKTOP_ALL)) {
		wm_debug("Setting restack sibling to NULL, they are not on the same desktop");
		sibling = NULL;
	}
	switch (detail) {
	case Below:
		wm_debug("Restack request Below for client %s sibling %s", client->title, sibling ? sibling->title : "(all)");
		stacking_lower(CLIENT_AS_WINDOW(client));
		ret = TRUE;
		break;
	case BottomIf:
		wm_debug("Restack request BottomIf for client %s sibling %s", client->title, sibling ? sibling->title : "(all)");
		if(stacking_occludes(client, sibling)) {
			stacking_lower(CLIENT_AS_WINDOW(client));
			ret = TRUE;
		}
		break;
	case Above:
		wm_debug("Restack request Above for client %s sibling %s", client->title, sibling ? sibling->title : "(all)");
		stacking_raise(CLIENT_AS_WINDOW(client));
		ret = TRUE;
		break;
	case TopIf:
		wm_debug("Restack request TopIf for client %s sibling %s", client->title, sibling ? sibling->title : "(all)");
		if(stacking_occluded(client, sibling)) {
			stacking_raise(CLIENT_AS_WINDOW(client));
			ret = TRUE;
		}
		break;
	case Opposite:
		wm_debug("Restack request Opposite for client %s sibling %s", client->title, sibling ? sibling->title : "(all)");
		if(stacking_occluded(client, sibling)) {
			stacking_raise(CLIENT_AS_WINDOW(client));
			ret = TRUE;
		} else if(stacking_occludes(client, sibling)) {
			stacking_lower(CLIENT_AS_WINDOW(client));
			ret = TRUE;
		}
		break;
	}
	return ret;
}