Ismael's blog

Aller au contenu | Aller au menu | Aller à la recherche

Monday 26 March 2007

Aqua: utility windows

In my work to have aqua windows which respect better the AHIG (see my previous post), i encountered a very annoying bug: utility windows were in front of all windows, including windows of another activated application.


On this screenshot XCode is the activated window and OpenOffice is behind it but the OOo Style Window is in front of XCode.
(The transparency is just for fun and to see what is behind the utility window)


But now the bug is fixed, utility windows are only visible when their parent document window is activated. When another application is activated or another OpenOffice.org document window, utility windows disappear. They also disappear when Exposé (a MacOS X feature which shows all the windows opened in the same view) is launched (which is the correct behavior as Exposé only shows document windows and main windows but not dialogs).
I don't put a screenshot of the working solution because when another application is the top most window, the utility window disappears and so there's nothing to see. ;-)

Monday 5 March 2007

Aqua: native windows and dialogs following AHIG

Few days ago, as i was reading another time the Apple Human Interface Guidelines (AHIG), (the chapter concerning Windows and Dialogs), i thought it could be great for the OpenOffice.org aqua port to have dialogs and windows which respect better the AHIG.
Here's how windows looked before:

As we can see, the windows and dialogs don't look really mac/aqua. So i investigated and i discovered how windows and dialogs were implemented in VCL (Visual Class Library), and how worked the actual aqua implementation of them. In the native implementation, the function which creates windows and dialogs, receives a flag to know what type of window it will create. But this flags, which can take many values, has only one value to describe dialogs although the dialog can be a simple message box or a complex settings dialog (SAL_FRAME_STYLE_DIALOG).
I read also the platform independent ("general") code of VCL which then calls native function to draw native controls like windows, buttons, images.... And what i discovered was a good surprise. Indeed, when a dialog is created the different types of dialogs have different values ( WINDOW_MODALDIALOG, WINDOW_MODELESSDIALOG, WINDOW_MESSBOX, WINDOW_ERRORBOX ...) but after, when it has to create the window, all these different types of dialogs are created using the same flag: SAL_FRAME_STYLE_DIALOG, surely because windows and unix implementation don't care about all these different types but MacOS does. So i added flags for MacOS in this part; these flags shouldn't bother non-MacOS implementations as they are ORed (|) to the old flag. Thanks to these modifications, the dialog usage in aqua port of OOo follows better the AHIG, but there are still some problems.

I also noticed incomplete use of flags in the platform independent part: for example the error box (that we can see in the upper image), is defined as WINDOW_MESSBOX and not as WINDOW_ERRORBOX which would be better.

Here's a screenshot of my work (which has to continued):