Created attachment 6713 Cursor on OS X when taking an area screenshot On OS X, when you drag the cursor to create a screenshot of a specific area, the current width and height of the area is shown next to the cursor. This let's the user quickly measure something on the screen without external programs and get a screenshot of an area with requested dimensions. A feature similar to this should be implemented to Xfce4-screenshooter either as the default when creating a screenshot of an area or with a specific option set. Attached is a picture on how it looks on OS X.
Created attachment 7693 Patch that shows the width and height in composited environments
It works neatly! Just a couple of questions: 1) shouldn't we free css_string and coords, and perhaps unref css_provider and context? 2) when the cursor reaches the edge, the user can't see the values. Probably it would be over-engineering to handle this. What do you think? 3) I prefer the "%d x %d" format, is there any advantage to keep the line break?
ad 1) Yeah, sounds like a good idea (remember: I said hackidy-hacky implementation ;)) Might also be nicer to put the window and the label inside a struct or something or try to pass it around instead of making it a global var. ad 2) That's the reason for 3) to some extent, because it makes the size label more compact and you're less likely to hit the right screen edge. I would also not try to handle this corner-case (pun intended) because it'd then have to overlay the area you wanna take a screenshot of and that could be irritating. Finally I haven't made this optional (which was my original intention), not sure whether you want to.
Created attachment 7995 Updated patch Updated patch: 1) coords and css_provider are now accordingly handled. 2) when the cursor reaches the edge, the size window is shifted so it won't be out of screen. 3) I went for the "%d x %d" format, now that the label won't be out of screen. And other smaller improvements here and there.
So this patch works quite nicely. I like how the label flips around when you reach the screen edges. A few things I noticed: * I noticed that the margin to the right is a bit more than to the left of the cursor (very minor) * The actual format is "%dx%d", I guess if you really don't care about the width "%d x %d" would be better. I know "%d\n%d" is a bit unconventional, but I felt it was easily readable. (minor) * I also preferred the text shadow with the 2px blur, a bit smoother than the current hard edge (very minor, opinion) So all in all the patch is ready to go! All the above points are decisions that are up to you as the maintainer. Well done!
Andre Miranda referenced this bugreport in commit 31bed658702f0e9a16ed5bcb712499fa39716c36 Show width and height of selection area (Bug #12664) https://git.xfce.org/apps/xfce4-screenshooter/commit?id=31bed658702f0e9a16ed5bcb712499fa39716c36
(In reply to Simon Steinbeiss from comment #5) > So this patch works quite nicely. I like how the label flips around when you > reach the screen edges. I'm glad you liked it :) > A few things I noticed: > * I noticed that the margin to the right is a bit more than to the left of > the cursor (very minor) I improved how the offset is calculated and now it uses monospace font. > * The actual format is "%dx%d", I guess if you really don't care about the > width "%d x %d" would be better. I know "%d\n%d" is a bit unconventional, > but I felt it was easily readable. (minor) Ok, went with spaces, I don't like macOS' format. > * I also preferred the text shadow with the 2px blur, a bit smoother than > the current hard edge (very minor, opinion) That blur is barely visible and when that text is over a white part of screen, the crisp shadow provides better contrast. > So all in all the patch is ready to go! All the above points are decisions > that are up to you as the maintainer. > Well done! Thank you for the original implementation!