зеркало из https://github.com/mozilla/pjs.git
Bug 445765. In GTK screen manager, for the common case of just one screen don't make potentially expensive system calls to try to determine which screen we are on. r=dbaron
This commit is contained in:
Родитель
18e41b38be
Коммит
7884bf9f28
|
@ -342,13 +342,26 @@ nsScreenManagerGtk :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
|
|||
NS_IMETHODIMP
|
||||
nsScreenManagerGtk :: ScreenForNativeWidget (void *aWidget, nsIScreen **outScreen)
|
||||
{
|
||||
// I don't know how to go from GtkWindow to nsIScreen, especially
|
||||
// given xinerama and stuff, so let's just do this
|
||||
gint x, y, width, height, depth;
|
||||
x = y = width = height = 0;
|
||||
nsresult rv;
|
||||
rv = EnsureInit();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForNativeWidget\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height,
|
||||
&depth);
|
||||
gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y);
|
||||
return ScreenForRect(x, y, width, height, outScreen);
|
||||
if (mCachedScreenArray.Count() > 1) {
|
||||
// I don't know how to go from GtkWindow to nsIScreen, especially
|
||||
// given xinerama and stuff, so let's just do this
|
||||
gint x, y, width, height, depth;
|
||||
x = y = width = height = 0;
|
||||
|
||||
gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height,
|
||||
&depth);
|
||||
gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y);
|
||||
rv = ScreenForRect(x, y, width, height, outScreen);
|
||||
} else {
|
||||
rv = GetPrimaryScreen(outScreen);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче