2017-03-14 13:44:54 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_widget_Screen_h
|
|
|
|
#define mozilla_widget_Screen_h
|
|
|
|
|
|
|
|
#include "nsIScreen.h"
|
|
|
|
|
|
|
|
#include "Units.h"
|
2022-02-15 23:22:54 +03:00
|
|
|
#include "mozilla/HalScreenConfiguration.h" // For hal::ScreenOrientation
|
2017-03-14 13:44:54 +03:00
|
|
|
|
2017-03-09 14:30:26 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class ScreenDetails;
|
|
|
|
} // namespace dom
|
|
|
|
|
2017-03-14 13:44:54 +03:00
|
|
|
namespace widget {
|
|
|
|
|
|
|
|
class Screen final : public nsIScreen {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISCREEN
|
|
|
|
|
2022-02-15 23:22:54 +03:00
|
|
|
using OrientationAngle = uint16_t;
|
2022-05-07 02:37:25 +03:00
|
|
|
enum class IsPseudoDisplay : bool { No, Yes };
|
2024-03-22 03:55:46 +03:00
|
|
|
enum class IsHDR : bool { No, Yes };
|
2022-02-15 23:22:54 +03:00
|
|
|
|
2017-03-14 13:44:54 +03:00
|
|
|
Screen(LayoutDeviceIntRect aRect, LayoutDeviceIntRect aAvailRect,
|
2022-05-07 02:37:25 +03:00
|
|
|
uint32_t aPixelDepth, uint32_t aColorDepth, uint32_t aRefreshRate,
|
2017-03-14 13:44:54 +03:00
|
|
|
DesktopToLayoutDeviceScale aContentsScale,
|
2022-05-07 02:37:25 +03:00
|
|
|
CSSToLayoutDeviceScale aDefaultCssScale, float aDpi, IsPseudoDisplay,
|
2024-03-22 03:55:46 +03:00
|
|
|
IsHDR, hal::ScreenOrientation = hal::ScreenOrientation::None,
|
2022-02-15 23:22:54 +03:00
|
|
|
OrientationAngle = 0);
|
|
|
|
explicit Screen(const dom::ScreenDetails& aScreenDetails);
|
2017-03-14 13:44:54 +03:00
|
|
|
Screen(const Screen& aOther);
|
|
|
|
|
2022-02-15 23:22:54 +03:00
|
|
|
dom::ScreenDetails ToScreenDetails() const;
|
2017-03-09 14:30:26 +03:00
|
|
|
|
2022-02-15 23:22:54 +03:00
|
|
|
OrientationAngle GetOrientationAngle() const { return mOrientationAngle; }
|
|
|
|
hal::ScreenOrientation GetOrientationType() const {
|
|
|
|
return mScreenOrientation;
|
|
|
|
}
|
2021-12-30 08:09:40 +03:00
|
|
|
|
2022-11-24 18:10:15 +03:00
|
|
|
/**
|
|
|
|
* Return default orientation type that angle is 0.
|
|
|
|
* This returns LandscapePrimary or PortraitPrimary.
|
|
|
|
*/
|
|
|
|
hal::ScreenOrientation GetDefaultOrientationType() const;
|
|
|
|
|
2022-02-17 00:13:58 +03:00
|
|
|
float GetDPI() const { return mDPI; }
|
|
|
|
|
2022-05-07 02:37:25 +03:00
|
|
|
const LayoutDeviceIntRect& GetRect() const { return mRect; }
|
|
|
|
const LayoutDeviceIntRect& GetAvailRect() const { return mAvailRect; }
|
|
|
|
const DesktopToLayoutDeviceScale& GetContentsScaleFactor() const {
|
|
|
|
return mContentsScale;
|
|
|
|
}
|
|
|
|
|
2022-11-16 18:52:07 +03:00
|
|
|
enum class IncludeOSZoom : bool { No, Yes };
|
|
|
|
CSSToLayoutDeviceScale GetCSSToLayoutDeviceScale(IncludeOSZoom) const;
|
|
|
|
|
2024-03-22 03:55:46 +03:00
|
|
|
bool GetIsHDR() const { return mIsHDR; }
|
|
|
|
|
2017-03-14 13:44:54 +03:00
|
|
|
private:
|
2020-03-16 13:56:57 +03:00
|
|
|
virtual ~Screen() = default;
|
2017-03-14 13:44:54 +03:00
|
|
|
|
2022-02-15 23:22:54 +03:00
|
|
|
const LayoutDeviceIntRect mRect;
|
|
|
|
const LayoutDeviceIntRect mAvailRect;
|
|
|
|
const DesktopIntRect mRectDisplayPix;
|
|
|
|
const DesktopIntRect mAvailRectDisplayPix;
|
|
|
|
const uint32_t mPixelDepth;
|
|
|
|
const uint32_t mColorDepth;
|
2022-05-07 02:37:25 +03:00
|
|
|
const uint32_t mRefreshRate;
|
2022-02-15 23:22:54 +03:00
|
|
|
const DesktopToLayoutDeviceScale mContentsScale;
|
|
|
|
const CSSToLayoutDeviceScale mDefaultCssScale;
|
|
|
|
const float mDPI;
|
|
|
|
const hal::ScreenOrientation mScreenOrientation;
|
|
|
|
const OrientationAngle mOrientationAngle;
|
2022-05-07 02:37:25 +03:00
|
|
|
const bool mIsPseudoDisplay;
|
2024-03-22 03:55:46 +03:00
|
|
|
const bool mIsHDR;
|
2017-03-14 13:44:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|