nsISupports
Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10)Use nsIScreenManager
to obtain references to screens.
Implemented by: @mozilla.org/gfx/screenmanager;1
as a service:
var screen = Components.classes["@mozilla.org/gfx/screenmanager;1"] .getService(Components.interfaces.nsIScreen);
void GetAvailRect(out long left, out long top, out long width, out long height); |
void GetRect(out long left, out long top, out long width, out long height); |
void lockMinimumBrightness(in unsigned long brightness); |
void unlockMinimumBrightness(in unsigned long brightness); |
Attribute | Type | Description |
colorDepth |
long |
The screen's color depth; this is the number of bits used to represent a color. Read only. |
pixelDepth |
long |
The screen's pixel depth; this is the number of bits used to represent a pixel. Read only. |
rotation |
unsigned long |
The screen's current rotation; you may set this to any of the values listed in Screen rotation constants. This will only have an effect on platforms that support screen rotation. |
Constant | Value | Description |
BRIGHTNESS_DIM |
0 | The screen is fully dimmed (that is, off). |
BRIGHTNESS_FULL |
1 | The screen is at full brightness. |
BRIGHTNESS_LEVELS |
2 | The number of different brightness levels. |
Constant | Value | Description |
ROTATION_0_DEG |
0 | 0° of rotation (that is, no rotation, or default orientation). |
ROTATION_90_DEG |
1 | 90° of rotation. |
ROTATION_180_DEG |
2 | 180° of rotation. |
ROTATION_270_DEG |
3 | 270° of rotation. |
Returns a rectangle indicating the portion of the screen that is available for use.
void GetAvailRect( out long left, out long top, out long width, out long height );
left
top
width
height
Returns a rectangle indicating the entire screen's coordinate space.
void GetRect( out long left, out long top, out long width, out long height );
left
top
width
height
Locks the minimum brightness of the screen, preventing it from becoming any dimmer than that brightness level. Each call to this method must eventually be followed by a corresponding call to unlockMinimumBrightness()
with the same value for the brightness
parameter.
void lockMinimumBrightness( in unsigned long brightness );
brightness
Releases a lock on the minimum brightness of the screen, which was previously established through a corresponding call to lockMinimumBrightness()
.
void unlockMinimumBrightness( in unsigned long brightness );
brightness
var screenMan = Components.classes["@mozilla.org/gfx/screenmanager;1"] .getService(Components.interfaces.nsIScreenManager); var left = {}, top = {}, width = {}, height = {}; screenMan.primaryScreen.GetRect(left, top, width, height); print([left.value, top.value, width.value, height.value]);