GNOME Bugzilla – Bug 587101
black bar in in single window or area screenshot with multiple screens
Last modified: 2013-03-14 14:31:40 UTC
Please describe the problem: Using gnome-screenshot to take a picture of a window or an area of the screen yields an image with a black bar at the top. I discovered that gnome-screenshot will work correctly if I align the top edge of both my monitors instead of the bottom edge. (See screenshots.) Taking a picture of the entire desktop works fine since the black bar only appears in the gap left by the smaller monitor. Steps to reproduce: 1. Configure multiple monitors of differing sizes in Ubuntu Jaunty. 2. Open the Display preferences, and align the bottom of edges of both monitors. 3. Use gnome-screenshot to take a picture of a window or an area of the screen. Actual results: There is a black bar at the top of the image covering part of the screenshot. Expected results: No black bar. Does this happen every time? Yes Other information:
Created attachment 137443 [details] Bad screenshot with monitors aligned at bottom
Created attachment 137444 [details] Good screenshot with monitors aligned at top
Bug still present in GNOME 2.28.1 (as distributed by Ubuntu). My dualhead config is as follows: Monitor 0: 1280x800 at (0, 224) Monitor 1: 1280x1024 at (1280, 0) and the topmost 224 pixels of any screenshot taken with Alt+PrintScreen are black (except for the image of a mouse cursor, if it happens to be in that part of the window). Small correction: the top-left 1280x224 area of any screenshot is black; if I make the window wider than 1280 pixels, the area in the top-right corner is undamaged.
Can confirm that this bug still exists in the Ubuntu Lucid alphas, running gnome-utils version 2.29.5-ubuntu2.
*** Bug 616568 has been marked as a duplicate of this bug. ***
(In reply to comment #5) > *** Bug 616568 has been marked as a duplicate of this bug. *** More screenshots at 616568
I just spent a little more time screwing around and here's what more I learned about the behavior on my screen: If I cycle through Fn-F7 twice, I find myself with a good looking dual display from which I *can* take good screenshots. This also seems to re-align my displays so that the top edges are parallel. Similarly, if I manually realign my displays so that the top edges are parallel, I can also take good screenshots.
Created attachment 166279 [details] Fedora 13 (properties)
Confirmed with Fedora13 (gnome-utils-2.30.0) See attached screenshot "properties"
I'm just going to throw this out there, looking at this issue with gnome-utils 2.26.0 (we're using Fedora 11) as well as 2.30.0, it seems like the issue is that screenshot_utils.c:mask_monitors() is getting called with a pixbuf of the screenshot, regardless of whether the screenshot is of the full desktop, a single application, or an area. The problem occurs when the pixbuf is smaller than the root display, and if the monitor that houses the top-left corner of the root display is smaller than the monitor on which the screenshot of the window or area was taken. The pixbuf passed to mask_monitors has no positioning information, only a size, so the function has no way of knowing where to crop (or if the crop is necessary) -- it always applies the crop as if the screenshot image was located at pixel position 0,0. The quick an easy fix for me is to include a check to only call mask_monitors() if the screenshot is of the entire desktop. I think in general, I wouldn't want a screenshot of a window or area to be blanked even if part of it does hang off the edge of the monitor, but if that were necessary, then the position of the screenshot pixbuf would have to be passed so that it can be positioned properly for the masking.
Oh, and an easy way for me to reproduce this (works every time): Set up X to use two monitors. The left runs at 1600x1200, the right monitor runs at 2560x1600. Open a terminal on the right monitor, full-screen it, and run gnome-screenshot -w from that terminal. It will pop up a 2560x1600 image with the bottom-left 1600x400 pixels blacked out.
The more I thought about this, the more I felt I couldn't think of a situation where I wanted black bar masking if I was drawing out an area for a screenshot, nor did I want a black bar overlaid on the window I was taking a picture of even if part of that window was off-screen. So I wrote a patch to gnome-utils to only enable masking if the screenshot is of the entire desktop. The patch is against 2.26.0, but it applies cleanly all the way up to 2.32.0.
Created attachment 173916 [details] [review] Disable masking for area or window screenshots.
Review of attachment 173916 [details] [review]: the patch looks good from a cursory glance. Cosimo should have another look. ::: gnome-screenshot/gnome-screenshot.c.orig @@ +677,3 @@ + */ + if (include_mask) + mask_monitors (screenshot, root); slight code style issue: only 2 space indentation.
I can confirm that the bug exists as described for multiple monitors with the left most being a lower resolution monitor aligned at the bottom of the right monitor. I applied the patch submitted above and verified that this corrects the problem. I'm looking forward to this being corrected in the distribution.
Forgot to mention, I tested at version 2.30.0-0ubuntu1
I also agree that it's fine that when doing region selection no mask is applied, some kind of "advanced feature" ;-) Any hope to apply this patch? Emmanuele, how can we ask Cosimo to have another look at it? Do you need a new version with the indentation fixed? BTW, bug #591435 seems a dupe of this bug.
(In reply to comment #17) > Any hope to apply this patch? Emmanuele, how can we ask Cosimo to have another > look at it? you just did. Cosimo is Cc:'ed in on gnome-screenshot bugs. > Do you need a new version with the indentation fixed? it's always the best option; this way, we can just use git-bz and apply the patch/close the bug in one go. > BTW, bug #591435 seems a dupe of this bug. looks like it, yes.
*** Bug 591435 has been marked as a duplicate of this bug. ***
confirming from own experience and duplicate bug reports
I still have this problem with Gnome 2.32.1 on Ubuntu 11.04. What's with the patch from nine months ago?
patch works fine in Ubuntu Lucid
Can somebody please confirm whether this is still a problem with gnome-utils 3.x? The patch only applies to 2.x source.
I can still confirm this with gnome-screenshot 3.1.2-0ubuntu2 from Ubuntu oneiric. Taking a screenshot of a window (the window has to be higher than the height of the smaller screen to see it) has still a black block where the nonvisible area is in my desktop.
*** Bug 645904 has been marked as a duplicate of this bug. ***
Attachment 173916 [details] pushed as 56f50c7 - Disable masking for area or window screenshots. Sorry for the long delay, I pushed this to master now.
i using nvidia tweanview and i get transparent or black window screeshots. GNOME Shell 3.6.3.1 gnome-screenshot 3.6.1-1 Archlinux