[maemo-developers] Howto enable portrait mode support on Fremantle

From: Andrew Flegg andrew at bleb.org
Date: Fri Aug 21 16:26:33 EEST 2009
On Fri, Aug 21, 2009 at 14:15, Graham Cobb<g+770 at cobb.uk.net> wrote:
> On Friday 21 August 2009 13:53:01 Cornelius Hald wrote:
>> Sorry for being so slow, but I really don't get it :(
>
> You're not the only one!  Doesn't make any sense to me either.

My interpretation:

  * You set HILDON_PORTRAIT_MODE_SUPPORT _if_ the device is portrait
    _before_ you open a window.

  * You pick up events (DBus or size-changed depending on whether
    you need orientation or just aspect) and then explicitly
    set HILDON_PORTRAIT_MODE_REQUEST.

Presumably your code, once you refactor common stuff will be something like:

  -------->8--------
  function void startApplication() {
    setPortraitFlagsIfAppropriate(window);
    window.addListener('size-change') {
      setPortraitFlagsIfAppropriate(window)
    }

    open(window);
  }

  function void setPortraitFlagsIfAppropriate(window) {
    if (isPortrait())
      window.set(HILDON_PORTRAIT_SUPPORT | HILDON_PORTRAIT_REQUEST)
    else
      window.unset(HILDON_PORTRAIT_SUPPORT | HILDON_PORTRAIT_REQUEST)
  }
  --------8<--------

Hope that helps,

Andrew

-- 
Andrew Flegg -- mailto:andrew at bleb.org  |  http://www.bleb.org/
Maemo Community Council chair
More information about the maemo-developers mailing list