Code by Kevin

About
Code by Kevin, Programming, code, business, and other pursuits

Your Host
Kevin Walzer, software developer.



Home

Subscribe to RSS Feed
Get a syndicated feed of my weblog.

Archives
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008
2007
2006

Categories
Business
Software
General

Privacy Policy

Site design: Skeleton

 

Thu, 14 Dec 2017

Tk-Cocoa 2.5

Nearly three years ago I announced a significant overhaul of Tk on the Mac that amounted to a redesign of major portions of the GUI library. The changes were intended to address flaws that had emerged in the initial, whole-cloth migration of Tk from the Carbon to the Cocoa API by Daniel Steffen. At the time I envisioned that this overhaul would put Tk on sound, stable footing going forward, and would require only routine maintenance and the occasional feature enhancement.

Ah, the best-laid plans of developers. Tk on the Mac in fact was NOT in a complete place, and later that summer, Marc Culler, who contributed many of the critical patches for Tk-Cocoa 2.0, and I did some additional major refinements. At that point Marc's contributions were so substantial that he essentially became the co-maintainer of Tk on the Mac, and I added his name to the author list.

Over the past six months, we have gone through an additional heavy round of development on Tk, to the point where I consider this yet another major iteration of the toolkit and not just an incremental set of updates. Should this round be called, informally at least, Tk-Cocoa 2.5? I think so.

This round of development was led by Christian Gollwitzer, who implemented some long-broken functionality in file dialogs; Marc Culler, who fixed some major crashing bugs on macOS 10.13 and implemented several major, low-level improvements to drawing and image code; and Francois Vogel, who worked closely with Marc on the drawing code specifically with the text widget and who has undertaken an ongoing cleanup of the Tk test suite on macOS.

Here's a quick overview:

  • Cleanup of clipping regions in drawing code fixes many subtle, low-level drawing bugs especially with embedded windows and in text widget (Culler and Vogel). Marc dove into some very subtle, long-standing bugs with widget rendering in specific contexts--especially with embedded windows and the text widget. Francois assisted with these changes as well as providing guidance on applying them to the text widget, one of Tk's most complex components internally. Francois has also worked at integrating these changes, and fixing other issues, in Tk's test suite.
  • Cleanup, enhancement, and re-organizing of image rendering code to make it easier to develop with (Culler). Marc re-factored Tk's native image-rendering code on the Mac into a separate file to make it simpler to understand and work with (previously it had been in the drawing code). This work also led to the fixing of several bugs related to image rendering especially with transparency.
  • Implementation of wm_iconphoto command to allow setting of custom icons (Walzer). I implemented this command, with assistance from Marc's work on the image code.
  • Overhaul of app initialization code to make it easier to manage (Culler). Marc re-worked Tk's app startup code to conform to Cocoa conventions.
  • Cleanup and simplification of memory management to improve stability (Culler). The episode that triggered this entire round of development was Tk suddenly crashing on macOS 10.13. I'm not sure what caused this to occur when Tk ran stably on older versions, but Marc, who had updated most of the memory management code over the past couple of years, was able to streamline it a bit to avoid crashes.
  • Overhaul of file dialogs on macOS (Gollwitzer). Christian put together a significant update of the file dialog code to provide better filtering of file options and to take full advantage of dialog customization on macOS.
  • Detailed documentation of macOS-specific API design (expose events, clipping regions, HITheme, etc.) in the "Readme" file. (Culler). Marc put together detailed documentation on the design approach to Tk, especially with the recent changes. This documentation will help future developers understand the design of Tk. It formalized many things I understood intuitively, and also made clear portions of the API that eluded me.
  • While I did most of the early heavy lifting on updating Tk-Cocoa and was later joined by Marc, in this round I contributed far less code. Marc has done most of the substantial work, with Christian making a major contribution with the file dialogs, and Francois has provided ongoing consulting on integrating these changes into other aspects of Tk. It's great to have more developers working on Tk on the Mac these days; it has allowed us to make infinitely faster progress on fixing bugs. It also adds far more expertise to specific problems; Marc and Francois have expertise in certain areas that I've never been able to master, and Christian's work would have taken me some time to equal. I'm grateful for their efforts.

    Right now this work can be downloaded from the core-8-6-branch of Tk at its core development site, and it will soon make its way into the next stable point release. Keep an eye out for it, and give it a try.

    [/software] permanent link