Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1138288 - Refactor nsWindow/nsScreen for multiple screen/window c…
Browse files Browse the repository at this point in the history
…ase. r=mwu
  • Loading branch information
elefant committed Apr 30, 2015
1 parent 32a49e2 commit 28a6ce3
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 64 deletions.
31 changes: 27 additions & 4 deletions widget/gonk/nsScreenManagerGonk.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class nsScreenGonk : public nsBaseScreen
typedef mozilla::hal::ScreenConfiguration ScreenConfiguration;

public:
nsScreenGonk();
nsScreenGonk(uint32_t aId, ANativeWindow* aNativeWindow);

~nsScreenGonk();

NS_IMETHOD GetId(uint32_t* aId);
Expand All @@ -42,9 +43,14 @@ class nsScreenGonk : public nsBaseScreen
NS_IMETHOD GetRotation(uint32_t* aRotation);
NS_IMETHOD SetRotation(uint32_t aRotation);

uint32_t GetId();
nsIntRect GetRect();
float GetDpi();
ANativeWindow* GetNativeWindow();
nsIntRect GetNaturalBounds();
uint32_t EffectiveScreenRotation();
ScreenConfiguration GetConfiguration();
bool IsPrimaryScreen();

void RegisterWindow(nsWindow* aWindow);
void UnregisterWindow(nsWindow* aWindow);
Expand All @@ -56,15 +62,28 @@ class nsScreenGonk : public nsBaseScreen
}

protected:
nsIntRect mScreenBounds;
nsIntRect mVirtualBounds;
uint32_t mId;
int32_t mColorDepth;
android::sp<ANativeWindow> mNativeWindow;
float mDpi;
nsIntRect mNaturalBounds; // Screen bounds w/o rotation taken into account.
nsIntRect mVirtualBounds; // Screen bounds w/ rotation taken into account.
uint32_t mScreenRotation;
uint32_t mPhysicalScreenRotation;
nsTArray<nsWindow*> mTopWindows;
};

class nsScreenManagerGonk final : public nsIScreenManager
{
public:
enum {
// TODO: Bug 1138287 will define more screen/display types.
PRIMARY_SCREEN_TYPE = 0,

// TODO: Maintain a mapping from type to id dynamically.
PRIMARY_SCREEN_ID = 0,
};

public:
nsScreenManagerGonk();

Expand All @@ -77,12 +96,16 @@ class nsScreenManagerGonk final : public nsIScreenManager
void Initialize();
void DisplayEnabled(bool aEnabled);

void AddScreen(uint32_t aDisplayType);
void RemoveScreen(uint32_t aDisplayType);

protected:
~nsScreenManagerGonk();
void VsyncControl(bool aEnabled);
uint32_t GetIdFromType(uint32_t aDisplayType);

bool mInitialized;
nsCOMPtr<nsIScreen> mOneScreen;
nsTArray<nsRefPtr<nsScreenGonk>> mScreens;
nsRefPtr<nsRunnable> mScreenOnEvent;
nsRefPtr<nsRunnable> mScreenOffEvent;
};
Expand Down
Loading

0 comments on commit 28a6ce3

Please sign in to comment.