Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix colormap handling for containers. #2450

Merged
merged 1 commit into from
Sep 14, 2016
Merged

Conversation

Airblader
Copy link
Member

This commit correctly handles colormaps by

  • Using the static default colormap we determine on startup if the
    con has the corresponding depth. This avoids creating pointless
    colormaps.
  • Not freeing the default colormap to not have stray colormaps on
    containers. This fixes an issue with certain programs such as xwd.
  • Creating a custom colormap when necessary and freeing it when the
    container is killed.

fixes #2435

@Airblader
Copy link
Member Author

Airblader commented Sep 12, 2016

I think we also need to dump this property so we can restore it after an in-place restart. Otherwise we leave garbage in the server.

@Airblader Airblader added the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Sep 12, 2016
@Airblader
Copy link
Member Author

Actually I can't quite explain why, but not doing so seems to be correct. At least when I attempt to dump & parse it, I get pretty bad glitching. Perhaps colormaps are freed by the server if the client disconnects? Either way, everything seems to be OK.

@Airblader Airblader removed the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Sep 12, 2016
if (con->depth != root_depth) {
/* We need to create a custom colormap. */
win_colormap = xcb_generate_id(conn);
xcb_create_colormap_checked(conn, XCB_COLORMAP_ALLOC_NONE, win_colormap, root, visual);
Copy link
Contributor

@psychon psychon Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Airblader made me look at this diff and now I am again complaining about an unrelated issue:

This line has a memory leak. When using a _checked request you should eventually pass the resulting xcb_void_cookie_t* to xcb_request_check to know about the result of the operation. If you don't care about it, then don't use the _checked variant. (Or call xcb_discard_reply on the cookie, but that would be quite pointless)

Edit: Ok, sorry, I was (partly) wrong. This does not actually cause a memory leak (only if the CreateColormap request fails which should never happen), but it's still weird.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it definitely is unnecessary. I'll change it, thanks. :-) And as always thanks for reviewing (and answering my questions.)

This commit correctly handles colormaps by

* Using the static default colormap we determine on startup if the
  con has the corresponding depth. This avoids creating pointless
  colormaps.
* Not freeing the default colormap to not have stray colormaps on
  containers. This fixes an issue with certain programs such as xwd.
* Creating a custom colormap when necessary and freeing it when the
  container is killed.

fixes i3#2435
@Airblader
Copy link
Member Author

@stapelberg OK, should be good to go now.

@stapelberg stapelberg merged commit d48c9b1 into i3:next Sep 14, 2016
stapelberg added a commit that referenced this pull request Sep 14, 2016
@Airblader Airblader modified the milestone: 4.13 Sep 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Colormap not installed for container windows / can not take screenshot with xwd
3 participants