Exemplo n.º 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);
	}
}
Exemplo n.º 2
0
void frame_release_client(struct wm_frame *self)
{
	if(!xqueue_exists_local(find_reparent, self)) {
		XReparentWindow(t_display, self->client->window, DefaultRootWindow(t_display), self->client->area.x,
			self->client->area.y);
	}
	window_remove(self->window);
}
Exemplo n.º 3
0
void window_manage(Window win)
{
    XWindowAttributes attrib;
    gboolean no_manage = FALSE;
    gboolean is_dockapp = FALSE;
    Window icon_win = None;

    grab_server(TRUE);

    /* check if it has already been unmapped by the time we started
       mapping. the grab does a sync so we don't have to here */
    if (xqueue_exists_local(check_unmap, &win)) {
        ob_debug("Trying to manage unmapped window. Aborting that.");
        no_manage = TRUE;
    }
    else if (!XGetWindowAttributes(obt_display, win, &attrib))
        no_manage = TRUE;
    else {
        XWMHints *wmhints;

        /* is the window a docking app */
        is_dockapp = FALSE;
        if ((wmhints = XGetWMHints(obt_display, win))) {
            if ((wmhints->flags & StateHint) &&
                wmhints->initial_state == WithdrawnState)
            {
                if (wmhints->flags & IconWindowHint)
                    icon_win = wmhints->icon_window;
                is_dockapp = TRUE;
            }
            XFree(wmhints);
        }
    }

    if (!no_manage) {
        if (attrib.override_redirect) {
            ob_debug("not managing override redirect window 0x%x", win);
            grab_server(FALSE);
        }
        else if (is_dockapp) {
            if (!icon_win)
                icon_win = win;
            dock_manage(icon_win, win);
        }
        else
            client_manage(win, NULL);
    }
    else {
        grab_server(FALSE);
        ob_debug("FAILED to manage window 0x%x", win);
    }
}