---
name: "xcb_destroy_window"
section: "3"
platform: "linux"
package: "libxcb"
version: "1.17.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/xcb_destroy_window"
---

# xcb\_destroy\_window(3)

Destroys a window

## NAME

xcb\_destroy\_window - Destroys a window

## SYNOPSIS

**#include \<xcb/xproto.h\>**

### Request function

xcb\_void\_cookie\_t **xcb\_destroy\_window**(xcb\_connection\_t \**conn*, xcb\_window\_t *window*);\

## REQUEST ARGUMENTS

- *conn*

  The XCB connection to X11.

- *window*

  The window to destroy.

## DESCRIPTION

Destroys the specified window and all of its subwindows. A DestroyNotify event is generated for each destroyed window (a DestroyNotify event is first generated for any given window's inferiors). If the window was mapped, it will be automatically unmapped before destroying.

Calling DestroyWindow on the root window will do nothing.

## RETURN VALUE

Returns an *xcb\_void\_cookie\_t*. Errors (if any) have to be handled in the event loop.

If you want to handle errors directly with *xcb\_request\_check* instead, use *xcb\_destroy\_window\_checked*. See **[xcb-requests(3)](/xcb-requests/3.md)** for details.

## ERRORS

- *xcb\_window\_error\_t*

  The specified window does not exist.

## SEE ALSO

[**xcb-requests**(3)](/xcb-requests/3.md), [**xcb\_destroy\_notify\_event\_t**(3)](/xcb_destroy_notify_event_t/3.md), [**xcb\_map\_window**(3)](/xcb_map_window/3.md), [**xcb\_unmap\_window**(3)](/xcb_unmap_window/3.md)

## AUTHOR

Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.
