Bug 714416 - Add API for rotating screens, sr=roc
authorChris Jones <jones.chris.g@gmail.com>
Mon, 06 Feb 2012 14:33:04 -0800
changeset 86762 7f89c92dea5171d19c165c6efafbf924220761f3
parent 86761 3202141e00fb7e0313f779805317446728d8f3f8
child 86763 84725e191d218995f8caf2d0f447b9029d153d84
push id533
push usertim.taubert@gmx.de
push dateWed, 15 Feb 2012 10:16:04 +0000
treeherderfx-team@81f6b9cbb2a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs714416
milestone13.0a1
Bug 714416 - Add API for rotating screens, sr=roc
widget/nsIScreen.idl
widget/xpwidgets/nsBaseScreen.h
--- a/widget/nsIScreen.idl
+++ b/widget/nsIScreen.idl
@@ -33,28 +33,39 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(498dcd6c-94a2-4c32-8c77-531b583dff37)]
+[scriptable, uuid(d961f76e-8437-4bc6-9ada-a1c98ace9560)]
 interface nsIScreen : nsISupports
 {
   /**
    * Levels of brightness for the screen, from off to full brightness.
    */
   const unsigned long BRIGHTNESS_DIM = 0;
   const unsigned long BRIGHTNESS_FULL = 1;
 
   /* The number of different brightness levels */
   const unsigned long BRIGHTNESS_LEVELS = 2;
 
+  /**
+   * Allowable screen rotations, when the underlying widget toolkit
+   * supports rotating the screen.
+   *
+   * ROTATION_0_DEG is the default, unrotated configuration.
+   */
+  const unsigned long   ROTATION_0_DEG = 0;
+  const unsigned long  ROTATION_90_DEG = 1;
+  const unsigned long ROTATION_180_DEG = 2;
+  const unsigned long ROTATION_270_DEG = 3;
+
   void GetRect(out long left, out long top, out long width, out long height);
   void GetAvailRect(out long left, out long top, out long width, out long height);
 
   /**
    * Locks the minimum brightness of the screen, forcing it to be at
    * least as bright as a certain brightness level. Each call to this
    * function must eventually be followed by a corresponding call to
    * unlockMinimumBrightness, with the same brightness level.
@@ -67,10 +78,15 @@ interface nsIScreen : nsISupports
    * Releases a lock on the screen brightness. This must be called
    * (eventually) after a corresponding call to lockMinimumBrightness.
    *
    * @param brightness A brightness level, one of the above constants.
    */
   void unlockMinimumBrightness(in unsigned long brightness);
   
   readonly attribute long pixelDepth;
-  readonly attribute long colorDepth;  
+  readonly attribute long colorDepth;
+  /**
+   * Get/set the screen rotation, on platforms that support changing
+   * screen rotation.
+   */
+  attribute unsigned long rotation;
 };
--- a/widget/xpwidgets/nsBaseScreen.h
+++ b/widget/xpwidgets/nsBaseScreen.h
@@ -56,16 +56,22 @@ public:
 
   /**
    * Simple management of screen brightness locks. This abstract base class
    * allows all widget implementations to share brightness locking code.
    */
   NS_IMETHOD LockMinimumBrightness(PRUint32 aBrightness);
   NS_IMETHOD UnlockMinimumBrightness(PRUint32 aBrightness);
 
+  NS_IMETHOD GetRotation(PRUint32* aRotation) {
+    *aRotation = nsIScreen::ROTATION_0_DEG;
+    return NS_OK;
+  }
+  NS_IMETHOD SetRotation(PRUint32 aRotation) { return NS_ERROR_NOT_AVAILABLE; }
+
 protected:
   /**
    * Manually set the current level of brightness locking. This is called after
    * we determine, based on the current active locks, what the strongest
    * lock is. You should normally not call this function - it will be
    * called automatically by this class.
    *
    * Each widget implementation should implement this in a way that