Bug 1772721 [Linux] Add dummy call to mozgtk to prevent its removal r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D148496
This commit is contained in:
stransky 2022-06-21 06:52:02 +00:00
parent 14fe89a8ed
commit 7d83b25b74
3 changed files with 15 additions and 4 deletions

View File

@ -11,6 +11,7 @@ SOURCES += [
]
CFLAGS += CONFIG["MOZ_X11_CFLAGS"]
CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
# If LDFLAGS contains -Wl,--as-needed or if it's the default for the toolchain,
# we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the

View File

@ -6,6 +6,13 @@
#include "mozilla/Types.h"
#include <gdk/gdk.h>
// Dummy call to gtk3 library to prevent the linker from removing
// the gtk3 dependency with --as-needed.
// see toolkit/library/moz.build for details.
MOZ_EXPORT void mozgtk_linker_holder() { gdk_display_get_default(); }
#ifdef MOZ_X11
# include <X11/Xlib.h>
// Bug 1271100

View File

@ -268,6 +268,9 @@ static SystemTimeConverter<guint32>& TimeConverter() {
bool nsWindow::sTransparentMainWindow = false;
// forward declare from mozgtk
extern "C" MOZ_EXPORT void mozgtk_linker_holder();
namespace mozilla {
#ifdef MOZ_X11
@ -428,6 +431,10 @@ nsWindow::nsWindow()
}
#endif
}
// Dummy call to mozgtk to prevent the linker from removing
// the dependency with --as-needed.
// see toolkit/library/moz.build for details.
mozgtk_linker_holder();
}
nsWindow::~nsWindow() {
@ -5311,10 +5318,6 @@ void nsWindow::ConfigureGdkWindow() {
// tearing because Gecko does not align its framebuffer updates with
// vblank.
SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
// Dummy call to a function in mozgtk to prevent the linker from removing
// the dependency with --as-needed.
XShmQueryExtension(DefaultXDisplay());
}
#endif
#ifdef MOZ_WAYLAND