[waffle] [PATCH 2/2] x11: Support visuals that don't match root visual
Chad Versace
chad.versace at linux.intel.com
Fri May 25 10:35:44 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/24/2012 07:33 AM, Pauli Nieminen wrote:
> If window is created with a visual that doesn't match parent window
> visual X11 protocol requires application to set depth and broder pixel
> for the new window.
>
> Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
> ---
> src/waffle/x11/x11.c | 23 ++++++++++++++++++++---
> 1 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/src/waffle/x11/x11.c b/src/waffle/x11/x11.c
> index 1a9394b..6c4776d 100644
> --- a/src/waffle/x11/x11.c
> +++ b/src/waffle/x11/x11.c
> @@ -57,6 +57,22 @@ x11_display_disconnect(Display *dpy)
> return !error;
> }
>
> +uint8_t
> +x11_get_depth_for_visual(xcb_connection_t *conn, const xcb_screen_t *screen,
> + xcb_visualid_t id)
This function should be static.
The signature needs to follow the layout of other signatures in waffle. Long parameter
lists are placed in a column.
x11_get_depth_for_visual(
xcb_connection_t *conn,
const xcb_screen_t *screen,
xcb_visual_t id)
> +{
> + xcb_depth_iterator_t depth = xcb_screen_allowed_depths_iterator(screen);
> + for (; depth.rem; xcb_depth_next(&depth)) {
> + xcb_visualtype_iterator_t visual =
> + xcb_depth_visuals_iterator (depth.data);
> + for (; visual.rem; xcb_visualtype_next(&visual)) {
> + if (visual.data->visual_id == id)
> + return depth.data->depth;
> + }
> + }
> + return 0;
> +}
There are tabs here. Please remove them and use 4-space indent.
> +
> xcb_window_t
> x11_window_create(
> xcb_connection_t *conn,
> @@ -95,12 +111,13 @@ x11_window_create(
> const uint32_t event_mask = XCB_EVENT_MASK_BUTTON_PRESS
> | XCB_EVENT_MASK_EXPOSURE
> | XCB_EVENT_MASK_KEY_PRESS;
> - const uint32_t attrib_mask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
> - const uint32_t attrib_list[] = {event_mask, colormap, 0};
> + const uint32_t attrib_mask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP |
> + XCB_CW_BORDER_PIXEL;
^ tab here
> + const uint32_t attrib_list[] = {0, event_mask, colormap, 0};
>
> xcb_void_cookie_t create_cookie = xcb_create_window_checked(
> conn,
> - XCB_COPY_FROM_PARENT, // depth
> + x11_get_depth_for_visual(conn, screen, visual_id), // depth
> window,
> screen->root, // parent
> 0, 0, // x, y
- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPv8LuAAoJEAIvNt057x8isKAP/jUz/VmJvsodRgCPnZqFOYwc
SpW7/YKRFVWanIU2/4uO2gC8+8nak/cimQXBjr0Zxm5kW+ALy8qk4EZQ5F90forz
b7jFv9N0GNXEQ+ebIc7xcVwKru9ilbWrb6duR+rODjVtmDSi/SgCjG9y/oUTe87S
7I1uACNKYOe5PmBiaaK8DzJJ7errj/VxI/24w+HxR7suRk0LU2s+ugKstWorvYI5
4MsSCc6F2jA2b5+507hudle8HJEpJ445xXduH4yidb9LoQAPdTblmevdEBVcXxUP
GYE3oJ8g2kPjXAq4leI5/c3n3fpfJa2EcKbZSOQq+4t3BGDpKTVleciXnCm3YAVJ
fcMwdUBfjU+tJ8jMorYI3lsOb0Y5aNIkcEgV8JXv8wZaL92wBp4lIJcrq9r7lsRn
Ow2vMUDL5MkYsP/vfAUzqDJ3xpR29DmnsteHrii2E/Sm202duFRpWV16LvCewolt
01U14wlCtKrwHq1olpSHP0sPDwwksPla856oCEv9jgr1GuOJDJYdbOYZiKe4j0lF
kPZtdrZY3KLsrsEwO8Wmn4eS1+aWMqO3QAfrNwJ3r42DXKrGogshRionmX31n1wK
h1Jw4VSJnln8DADNOW7fMDTMTyB3xQEqFHF9wbiDXvTUfBTePit4GocyToMgR1/o
tL5Yb3M82rDM8YbJWrFm
=UQ4k
-----END PGP SIGNATURE-----
More information about the waffle
mailing list