1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#include "nsISupports.idl"
8
9%{C++
10/**
11 * The display type of nsIScreen belongs to.
12 */
13enum class DisplayType: int32_t {
14  DISPLAY_PRIMARY,  // primary screen
15  DISPLAY_EXTERNAL, // wired displays, such as HDMI, DisplayPort, etc.
16  DISPLAY_VIRTUAL   // wireless displays, such as Chromecast, WiFi-Display, etc.
17};
18%}
19
20[scriptable, uuid(826e80c8-d70f-42e2-8aa9-82c05f2a370a)]
21interface nsIScreen : nsISupports
22{
23  /**
24   * These report screen dimensions in (screen-specific) device pixels
25   */
26  void GetRect(out long left, out long top, out long width, out long height);
27  void GetAvailRect(out long left, out long top, out long width, out long height);
28
29  /**
30   * And these report in desktop pixels
31   */
32  void GetRectDisplayPix(out long left, out long top, out long width, out long height);
33  void GetAvailRectDisplayPix(out long left, out long top, out long width, out long height);
34
35  readonly attribute long pixelDepth;
36  readonly attribute long colorDepth;
37
38  /**
39   * The number of device pixels per desktop pixel for this screen (for
40   * hidpi configurations where there may be multiple device pixels per
41   * desktop px and/or per CSS px).
42   *
43   * This seems poorly named (something like devicePixelsPerDesktopPixel
44   * would be more accurate/explicit), but given that it is exposed to
45   * front-end code and may also be used by add-ons, it's probably not
46   * worth the disruption of changing it.
47   *
48   * Returns 1.0 if HiDPI mode is disabled or unsupported, or if the
49   * host OS uses device pixels as its desktop pixel units (e.g. Windows 7 or
50   * GTK/X11). Per-monitor DPI is available in Windows 8.1+, GTK/Wayland or
51   * macOS.
52   */
53  readonly attribute double contentsScaleFactor;
54
55  /**
56   * The default number of device pixels per unscaled CSS pixel for this
57   * screen. This is probably what contentsScaleFactor originally meant
58   * to be, prior to confusion between CSS pixels and desktop pixel units.
59   */
60  readonly attribute double defaultCSSScaleFactor;
61
62  /**
63   * The DPI of the screen.
64   */
65  readonly attribute float dpi;
66};
67