mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Add nsIGfxInfo::GetMonitor support for Linux. (bug 1175005 part 4, r=nical)
This commit is contained in:
parent
44b1489c4e
commit
42f85ae201
@ -14,6 +14,7 @@
|
||||
#include "prenv.h"
|
||||
|
||||
#include "GfxInfoX11.h"
|
||||
#include "mozilla/X11Util.h"
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsExceptionHandler.h"
|
||||
@ -534,6 +535,34 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GfxInfo::FindMonitors(JSContext* aCx, JS::HandleObject aOutArray)
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// No display in xpcshell mode.
|
||||
if (!gdk_display_get_default()) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Note: this doesn't support Xinerama. Two physical displays will be
|
||||
// reported as one monitor covering the entire virtual screen.
|
||||
Display* display = DefaultXDisplay();
|
||||
Screen* screen = DefaultScreenOfDisplay(display);
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
|
||||
JS::Rooted<JS::Value> screenWidth(aCx, JS::Int32Value(WidthOfScreen(screen)));
|
||||
JS_SetProperty(aCx, obj, "screenWidth", screenWidth);
|
||||
|
||||
JS::Rooted<JS::Value> screenHeight(aCx, JS::Int32Value(HeightOfScreen(screen)));
|
||||
JS_SetProperty(aCx, obj, "screenHeight", screenHeight);
|
||||
|
||||
JS::Rooted<JS::Value> element(aCx, JS::ObjectValue(*obj));
|
||||
JS_SetElement(aCx, aOutArray, 0, element);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
// Implement nsIGfxInfoDebug
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
|
||||
NS_IMETHOD_(void) GetData() override;
|
||||
|
||||
nsresult FindMonitors(JSContext* cx, JS::HandleObject array) override;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIGFXINFODEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user