Groups | Search | Server Info | Login | Register
Groups > comp.graphics.misc > #549
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.graphics.misc |
| Subject | Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio |
| Date | 2023-06-12 14:48 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87y1kovlj5.fsf@bsb.me.uk> (permalink) |
| References | <u65kfe$2r139$2@bluemanedhawk.eternal-september.org> <87352xy24e.fsf@bsb.me.uk> <u65qbu$2rlio$1@bluemanedhawk.eternal-september.org> <87legox6s0.fsf@bsb.me.uk> |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Blue-Maned_Hawk <bluemanedhawk@gmail.com> writes:
>
>> On 6/11/23 20:07, Ben Bacarisse wrote:
>>> Blue-Maned_Hawk <bluemanedhawk@gmail.com> writes:
> <cut>
>>>> cairo_xlib_surface_set_size(cairo_get_target(root_instance), fmax(width,
>>>> e.xconfigure.width), fmax(height, e.xconfigure.height));
>>> This case looks odd. What's the intent? Do you want stop the user
>>> making the window narrower than width or shorted than height?
>>
>> Yes, i do. I didn't know of any other way to do this.
>>
>>> If that's
>>> what you want you should probably limit e.xconfigure.{width,height}, set
>>> the X window size and then carry on as before because you still need to
>>> set the offset and scale and offset the source in this case as well.
>>
>> How would i do that?
>
> You could change e.xconfigure.width (and height) but rather than do that
> I'd base all the code on two new sizes
>
> int new_width = e.xconfigure.width, new_height = e.xconfigure.height;
> if (new_width < width || new_height < height) {
> new_width = fmax(width, new_width);
> ditto height
> set Xwindow size to new_width/new_height
> }
> what goes here is what was your else clause but using new_width and
> new_height rather than the e.xconfigure versions
Correction. This is a bad idea! The correct way to do this is to rope
in the window manager. Include X11/Xutil.h and then, after creating the
window, do
XSizeHints sizeHints = {
.flags = PMinSize, .min_width = width, .min_height = height
};
XSetWMNormalHints(display, window, &sizeHints);
--
Ben.
Back to comp.graphics.misc | Previous | Next — Previous in thread | Next in thread | Find similar
Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-06-11 19:13 -0400
Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-12 01:07 +0100
Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-06-11 20:54 -0400
Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-12 12:24 +0100
Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-06-12 14:48 +0100
Re: Running into problems while trying to scale Cairo surface to take up maximum space at specific aspect ratio Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-06-12 14:23 -0400
csiph-web