Bug 1709606 - Move GfxInfoX11 into gtk and remove X11 from the name, r=stransky

It is only used by the GTK backend, supports Wayland as well and
is highly unlikely to be reused by another backend.

This is also better in line with how this is handled for other
platforms.

While on it, do some small cleanups.

Depends on D114423

Differential Revision: https://phabricator.services.mozilla.com/D114424
This commit is contained in:
Robert Mader 2021-05-07 12:31:27 +00:00
parent 5f126f2b23
commit 56983e3a5b
6 changed files with 25 additions and 34 deletions

View File

@ -5,31 +5,26 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <sys/utsname.h>
#include <string>
#include "GfxInfo.h"
#include <cctype>
#include "nsCRTGlue.h"
#include "nsExceptionHandler.h"
#include "nsUnicharUtils.h"
#include "prenv.h"
#include "nsPrintfCString.h"
#include "nsWhitespaceTokenizer.h"
#include "mozilla/Telemetry.h"
#include <errno.h>
#include <unistd.h>
#include <string>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include "mozilla/gfx/Logging.h"
#include "mozilla/SSE.h"
#include "GfxInfoX11.h"
#include <gdk/gdkx.h>
#ifdef MOZ_WAYLAND
# include "mozilla/WidgetUtilsGtk.h"
# include "mozilla/widget/nsWaylandDisplay.h"
# include "mozilla/widget/DMABufLibWrapper.h"
#endif
#include "mozilla/Telemetry.h"
#include "nsCRTGlue.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#include "nsUnicharUtils.h"
#include "nsWhitespaceTokenizer.h"
#include "prenv.h"
#include "WidgetUtilsGtk.h"
#define EXIT_STATUS_BUFFER_TOO_SMALL 2
#ifdef DEBUG
@ -459,13 +454,11 @@ void GfxInfo::GetData() {
}
mAdapterDescription.Assign(glRenderer);
#ifdef MOZ_WAYLAND
mIsWayland = GdkIsWaylandDisplay();
#endif
// Make a best effort guess at whether or not we are using the XWayland compat
// layer. For all intents and purposes, we should otherwise believe we are
// using X11.
mIsWayland = GdkIsWaylandDisplay();
const char* waylandDisplay = getenv("WAYLAND_DISPLAY");
mIsXWayland = !mIsWayland && waylandDisplay;

View File

@ -5,8 +5,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __GfxInfoX11_h__
#define __GfxInfoX11_h__
#ifndef WIDGET_GTK_GFXINFO_h__
#define WIDGET_GTK_GFXINFO_h__
#include "GfxInfoBase.h"
#include "nsString.h"
@ -119,4 +119,4 @@ class GfxInfo final : public GfxInfoBase {
} // namespace widget
} // namespace mozilla
#endif /* __GfxInfoX11_h__ */
#endif /* WIDGET_GTK_GFXINFO_h__ */

View File

@ -47,7 +47,7 @@ StaticRefPtr<WakeLockListener> WakeLockListener::sSingleton;
MOZ_LOG(gLinuxWakeLockLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
static mozilla::LazyLogModule gLinuxWakeLockLog("LinuxWakeLock");
enum DesktopEnvironment {
enum WakeLockDesktopEnvironment {
FreeDesktop,
GNOME,
# if defined(MOZ_X11)
@ -104,7 +104,7 @@ class WakeLockTopic {
nsCString mTopic;
RefPtr<DBusConnection> mConnection;
DesktopEnvironment mDesktopEnvironment;
WakeLockDesktopEnvironment mDesktopEnvironment;
uint32_t mInhibitRequest;

View File

@ -109,7 +109,7 @@ if defined('MOZ_X11'):
'cid': '{d755a760-9f27-11df-0800-200c9a664242}',
'contract_ids': ['@mozilla.org/gfx/info;1'],
'type': 'mozilla::widget::GfxInfo',
'headers': ['/widget/GfxInfoX11.h'],
'headers': ['/widget/gtk/GfxInfo.h'],
'init_method': 'Init',
'processes': ProcessSelector.ALLOW_IN_GPU_PROCESS,
},

View File

@ -34,6 +34,7 @@ EXPORTS += [
EXPORTS.mozilla += ["WidgetUtilsGtk.h"]
UNIFIED_SOURCES += [
"GfxInfo.cpp",
"IMContextWrapper.cpp",
"MozContainer.cpp",
"MPRISServiceHandler.cpp",

View File

@ -260,9 +260,6 @@ EXPORTS.ipc = ["nsGUIEventIPC.h"]
if CONFIG["MOZ_X11"]:
DIRS += ["x11"]
SOURCES += [
"GfxInfoX11.cpp",
]
if toolkit in ("cocoa", "windows"):
UNIFIED_SOURCES += [