widget/public/nsIScreenManager.idlScriptable
This interface lets you get information about the display screen (or screens) attached to the user's computer.
66
Introduced
Gecko 0.9.5
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Implemented by: @mozilla.org/gfx/screenmanager;1 as a service:

var screenManager = Components.classes["@mozilla.org/gfx/screenmanager;1"]
                    .getService(Components.interfaces.nsIScreenManager);

Method overview

nsIScreen screenForNativeWidget( in voidPtr nativeWidget ); Native code only!
nsIScreen screenForRect( in long left, in long top, in long width, in long height );

Attributes

Attribute Type Description
numberOfScreens unsigned long The number of screens on the user's computer. Read only.
primaryScreen nsIScreen The primary display screen; this is the screen with the menu bar (on the Mac) or taskbar or equivalent on Windows or Linux. Read only.

Methods

Native code only!

screenForNativeWidget

Returns the nsIScreen instance for the native widget pointer. This pointer's definition is specific to the platform's native widget implementation, and is typically of the same type as NS_NATIVE_WINDOW.

nsIScreen screenForNativeWidget(
  in voidPtr nativeWidget
);
Parameters
nativeWidget
The native widget for which to obtain an nsIScreen instance.
Return value

The nsIScreen instance for the native widget pointer.

screenForRect()

Returns the nsIScreen containing the specified rectangle. If the rectangle overlaps multiple screens, the screen containing the majority of the rectangle's area is selected and returned.

The coordinates must be specified using global (screen) coordinates, and are in pixels.

nsIScreen screenForRect(
  in long left,
  in long top,
  in long width,
  in long height
);
Parameters
left
The left edge of the rectangle.
top
The top edge of the rectangle.
width
The width of the rectangle.
height
The height of the rectangle.
Return value

The nsIScreen containing the majority of the rectangle's area.

See also