1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsScreenManagerOS2.h"
7 #include "nsScreenOS2.h"
10 nsScreenManagerOS2 :: nsScreenManagerOS2 ( )
12 // nothing else to do. I guess we could cache a bunch of information
13 // here, but we want to ask the device at runtime in case anything
18 nsScreenManagerOS2 :: ~nsScreenManagerOS2()
20 // nothing to see here.
24 // addref, release, QI
25 NS_IMPL_ISUPPORTS1(nsScreenManagerOS2
, nsIScreenManager
)
29 // CreateNewScreenObject
31 // Utility routine. Creates a new screen object from the given device handle
33 // NOTE: For this "single-monitor" impl, we just always return the cached primary
34 // screen. This should change when a multi-monitor impl is done.
37 nsScreenManagerOS2 :: CreateNewScreenObject ( )
39 nsIScreen
* retval
= nullptr;
40 if ( !mCachedMainScreen
)
41 mCachedMainScreen
= new nsScreenOS2 ( );
42 NS_IF_ADDREF(retval
= mCachedMainScreen
.get());
51 // Returns the screen that contains the rectangle. If the rect overlaps
52 // multiple screens, it picks the screen with the greatest area of intersection.
54 // The coordinates are in pixels (not twips) and in screen coordinates.
57 nsScreenManagerOS2 :: ScreenForRect ( int32_t /*inLeft*/, int32_t /*inTop*/, int32_t /*inWidth*/,
58 int32_t /*inHeight*/, nsIScreen
**outScreen
)
60 GetPrimaryScreen ( outScreen
);
69 // The screen with the menubar/taskbar. This shouldn't be needed very
73 nsScreenManagerOS2 :: GetPrimaryScreen(nsIScreen
* *aPrimaryScreen
)
75 *aPrimaryScreen
= CreateNewScreenObject(); // addrefs
84 // Returns how many physical screens are available.
87 nsScreenManagerOS2 :: GetNumberOfScreens(uint32_t *aNumberOfScreens
)
89 *aNumberOfScreens
= 1;
92 } // GetNumberOfScreens
95 nsScreenManagerOS2::GetSystemDefaultScale(float *aDefaultScale
)
97 *aDefaultScale
= 1.0f
;
102 nsScreenManagerOS2 :: ScreenForNativeWidget(void *nativeWidget
, nsIScreen
**aScreen
)
104 *aScreen
= CreateNewScreenObject(); // addrefs