Summary: | HWResolution does not change X-Window resolution | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Eponymous <eponymousalias> |
Component: | X Display Driver | Assignee: | Chris Liddell (chrisl) <chris.liddell> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | eponymousalias |
Priority: | P4 | ||
Version: | 9.53.3 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: |
test file for HWResolution failure
test image showing proper behavior test image showing incorrect behavior |
Description
Eponymous
2020-12-26 16:43:48 UTC
Created attachment 20393 [details]
test image showing proper behavior
Created attachment 20394 [details]
test image showing incorrect behavior
Unfortunately, I cannot help much here. The commit you mention was uploaded by me but probably a patch created by someone else and after testing that it fixes the originally reported bug I have uploaded the patch. So I do not know the exact meanings of each of the lines of the patch. So if someone more knowledgeable than me about the X11 device could check whether removing the 4 lines mentioned does not cause any other problem, this would be great. This presents something of a problem. Obviously, we can't just allow attempts to resize the window with the media size or resolution which would potentially crash (or even just massively slow down) the X server. So simply removing those lines isn't really an option. OTOH, I agree the current behaviour is not what I would expect. Further, I'm loath to just add some arbitrary limits because, really, sensible limits will differ hugely between different machines. On that basis, I think it makes sense to still limit the requested dimensions by the available screen area. This is where I'm at right now: https://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commitdiff;h=502112b78469 The remaining oddity is related to a specific implementation detail of how Ghostscript's setpagedevice/currentpagedevice work. If I change your Postscript to use the "/.MediaSize" key, instead of the "/PageSize" it all behaves as I expect. I'd welcome opinions on that approach. There are times when I, perhaps accidentally, set the page size to something much larger than my screen size. And sometimes it is then convenient to grab the window top framestripe and move the window left and right so I can see some part of what would not fit all at once on my screen. But that doesn't work for vertical panning, because the other edges of the window just resize the window, so it's not a general solution. Which means, that is literally an edge case ([not] sorry for the pun), that I would not expect you to support. That said, your proposed code change goes beyond just clamping to the screen size. It also attempts to maintain a notion of the page aspect ratio, by changing the height when the width needs to be clamped, and vice versa. I think that is a bridge too far. Each dimension should be limited on its own, without thereby limiting the other dimension. Which means that these lines should be dropped: dev->height *= ((float)area_width / dev->width); dev->width *= ((float)area_height / dev->height); While perhaps there is no perfect solution, perhaps the way to think of this is to compare it to what happens when you print on paper. In that situation, there is a natural clipping at the edges of the paper, or as close to the edges as the printer can image. But that's it; no additional restriction is imposed. My perspective is that it would be nice to have scrollbars appear only when needed, when the requested area is larger than the visible window area. But I'm not expecting that sort of development just to fix this bug. It's maybe something to ruminate over for the future. I guess my reasoning was that I would expect the the content to scale with the dimensions, and thus we'd want to maintain the aspect ratio to avoid the content being distorted. I'm wary about using "what a printer would do" as much of a guide because a real printer can't (in general) arbitrarily change page sizes, nor resolutions, and also whether a Postscript printer clips, scales, scales down only.... are all, or should be, configurable to the users needs (see the PLRM "PageSize Policies"). Also, the X11 devices were intended to be, and are, pretty dumb. Their architecture makes adding things like scrolling, at best, extremely awkward, and worst maybe impossible (without a substantial re-architecting). Obviously, the ideal solution would be that we could rely on the X server to reject a unreasonable requests, but that seems not to be the case. Or, alternatively, provide some way to identify what is an unreasonable request before trying it, also seems not to be the case. Hence the available screen area still feels like the best compromise. I don't see any specific problem clamping each dimension individually, so it would looks like: https://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commitdiff;h=afb3c1d9597 Above proposed change pushed: https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=1030e59c64c9 |