Ticket UUID: | 29ba539501279600f13e97c2f1635985279e40cb | |||
Title: | many PIXEL options don't keep their configured value | |||
Type: | Bug | Version: | 8.7 | |
Submitter: | jan.nijtmans | Created on: | 2024-06-07 07:23:18 | |
Subsystem: | 23. Option Parsing | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2024-09-08 21:23:36 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | 2024-08-17 08:56:04 | |||
Description: |
Example: % entry .e -borderwidth 3m .e % pack .e % .e cget -borderwidth 11 We can see that the advise in the documentation is not followed here. Therefore the number of millimeters is converted to pixels. If - later - the scaling factor of the screen changes, the borderwidth of the entry will not scale correctly. Solution: Add `Tcl_Obj *` fields to the structures to store the unmodified value. | |||
User Comments: |
jan.nijtmans added on 2024-09-08 21:23:36:
Now [788c1c6615751bc0|fixed] for listbox too. fvogel added on 2024-08-17 08:56:04:
>> In tkText.h, line 775, why is heightObj a Tcl_Obj* but width still an int? >> If correct, this looks asymmetrical. > > The reason for this is that width is counted in characters while the height > is counted in pixels. Might be worth a separate ticket, I don't want to > touch/change this as part of this ticket. OK but then the comment on line 769-770 (in trunk, now) has become incorrect for the height. This is now misleading and should be fixed I think. >> I don't understand the BUILD_tk thing at all > > Let me explain. Fields like padX are cached versions of padXObj. It's not a > good idea to cache this value: If the scaling changes it must be re-calculated, > otherwise the screen-distance is not accurate any more. > > Using BUILD_tk means that those fields are only visible when building Tk > (On any platform, not only Windows), not when building extensions (which > shouldn't use these internal values anyway). So, just read them as a kind > of 'private' fields. Thanks for the explanation. I didn't notice this BUILD_tk thing was already existing before your changes. I believe its use should be documented but I don't know where, perhaps in the makefiles. I continue to observe it seems to be used (defined) when building Tk on Windows and Linux but not on macOS. There is no occurrence of BUILD_tk in the ./macos directory. What am I missing? Last thing: could you please merge trunk into revised_text? This looks non-trivial to me, there are lots of conflicts. Thanks! </p>
Given the above I will refrain from merging to trunk. I'm bouncing the ticket back to you, Jan. jan.nijtmans added on 2024-07-12 06:49:38: François, I did some more work on the bug-23ba539501 branch: All testcases are now working. Please review, if you are OK, please merge it to trunk. What's not done yet is correct the caching, but I made a [separate] ticket for that. jan.nijtmans added on 2024-07-08 22:09:38: Correction (I was confused with another branch) The bug-23ba539501 works, but is not done yet for all widgets. Also, for several fields it introduces both a Tcl_Obj field and a pixel field. Experimenting more shows that it's better to use a Tcl_Obj field only, that would make the cashing of the scaling factor simpler. But that's a large rewrite which I don't want to delay Tk 9.0 for. So, better not merge the branch yet. jan.nijtmans added on 2024-07-07 20:32:06: Branch bug-23ba539501 is a fix attempt, but it doesn't work as expected. Still some debugging to be done, but I won't have time to look at that any time soon. Low prio for 9.0, just leave it open. Don't merge the non-working branch! fvogel added on 2024-07-07 20:13:30: Is your branch bug-29ba539501 ready to be merged or is there something remaining to be done? jan.nijtmans added on 2024-06-07 07:31:10: Proposed solution [cbe80fc5ce4cd326|here] |