[haiku-development] Zoom sucks and what to do about it

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Fri, 30 Jan 2015 16:51:42 -0500

Recently, a new developer sambuddhabasu1 asked if he could implement zoom on the About System window and so created bug report #11808 in order to serve as a platform for the feature. This bug report was then closed as being silly, and I have reopened it because IMHO it is not (completely) silly. The window is both movable and resizable so it makes sense for it to be zoomable as well.


Now, Haiku won't live or die based on whether or not the About System window is zoomable or not, however, the developer asked "if there were any examples or any existing app which implements [zoom] functions" and sadly the answer to my knowledge is no. Worse yet, implementing zoom appropriately is far from trivial. The applications that come with Haiku either use the default zooming behavior as implemented in BWindow or do not utilize zoom. This is a tragedy because it sets an example for third parties that zoom is unimportant; I would like to change this.

The zoom behavior set by BWindow is quite basic and should not be used by nearly any application, it is merely a sane default. Instead we should implement better zoom behaviors for our apps to serve as examples for third party developer. In short we should do a much better job than we are currently doing in regards to zoom.

I have implemented zoom on Paladin, a third party app and so am keenly aware of the difficulties involved.

Firstly, zoom should take into account the size and position of Deskbar. This can be done now using the BDeskbar API and I suggest we implement this on the windows of all first party apps that utilize zoom.

Secondly, we should take into account the border width and tab size of the window. Unfortunately, there doesn't appear to be any public way to do this so we are going to have to provide one. I simply faked it on Paladin by measuring and hardcoding the values used by the default decorator. BWindow however does provides this information from the private BWindow::_GetDecoratorSize() method. This needs to be made public if we expect zoom to be implemented seriously by third party apps.

Thirdly, apps should make sure to not position themselves off-screen and should resize themselves in such a way that the contents of their window are formatted nicely. This unfortunately takes quite a bit of code to implement (~50 lines or so) but can be done once and then copied from app to app or better yet put in a common location so that it can be reused.

What do you guys think, is implementing zoom sanely worth the effort or not? If so, I'd like to create a series of trac tickets requesting that zoom be implemented in each app, one ticket per app, then I'd like to start writing the code and enlisting others to help.

Please respond to this email if you have any strong feelings about this either way. If you are a developer and you would like to help with this effort please respond and say so.

Thank you to those that read this long-winded mini-rant of an email.

Other related posts: