Backed out 2 changesets (bug 1587008) for build bustage on src/widget/gtk/GtkCompositorWidget.cpp. CLOSED TREE

Backed out changeset 9e610c4628e1 (bug 1587008)
Backed out changeset afc6499c8f1f (bug 1587008)

--HG--
extra : rebase_source : 3c3cc17ada4079f279809cae1ece2e226fde5acf
extra : histedit_source : c7f61dbede0eda8ea3b0a1dfa5c67f8650f4ca81
This commit is contained in:
Dorel Luca 2019-10-15 19:10:32 +03:00
Родитель b38d835041
Коммит 518c1a81eb
7 изменённых файлов: 53 добавлений и 96 удалений

Просмотреть файл

@ -53,9 +53,7 @@
#include "HeapCopyOfStackArray.h"
#include "GLBlitHelper.h"
#include "mozilla/gfx/Swizzle.h"
#ifdef MOZ_WAYLAND
# include "mozilla/widget/GtkCompositorWidget.h"
#endif
#if MOZ_WIDGET_ANDROID
# include "GeneratedJNIWrappers.h"
#endif
@ -992,11 +990,6 @@ Maybe<IntRect> CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
MakeCurrent(ForceMakeCurrent);
mWidgetSize = LayoutDeviceIntSize::FromUnknownSize(rect.Size());
#ifdef MOZ_WAYLAND
if (mWidget && mWidget->AsX11()) {
mWidget->AsX11()->SetEGLNativeWindowSize(mWidgetSize);
}
#endif
} else {
MakeCurrent();
}

Просмотреть файл

@ -107,12 +107,5 @@ EGLNativeWindowType GtkCompositorWidget::GetEGLNativeWindow() {
return (EGLNativeWindowType)mWidget->GetNativeData(NS_NATIVE_EGL_WINDOW);
}
void GtkCompositorWidget::SetEGLNativeWindowSize(
const LayoutDeviceIntSize& aEGLWindowSize) {
if (mWidget) {
mWidget->SetEGLNativeWindowSize(aEGLWindowSize);
}
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -65,7 +65,6 @@ class GtkCompositorWidget : public CompositorWidget,
Window XWindow() const { return mXWindow; }
EGLNativeWindowType GetEGLNativeWindow();
void SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
// PlatformCompositorWidgetDelegate Overrides

Просмотреть файл

@ -141,43 +141,6 @@ void moz_container_put(MozContainer* container, GtkWidget* child_widget, gint x,
}
/* static methods */
#if defined(MOZ_WAYLAND)
static gint moz_container_get_scale(MozContainer* container) {
static auto sGdkWindowGetScaleFactorPtr =
(gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor");
if (sGdkWindowGetScaleFactorPtr) {
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
return (*sGdkWindowGetScaleFactorPtr)(window);
}
return 1;
}
void moz_container_move(MozContainer* container, int dx, int dy) {
if (container->subsurface) {
wl_subsurface_set_position(container->subsurface, dx, dy);
}
}
void moz_container_scale_update(MozContainer* container) {
if (container->surface) {
gint scale = moz_container_get_scale(container);
wl_surface_set_buffer_scale(container->surface, scale);
}
}
// This is called from layout/compositor code only with
// size equal to GL rendering context. Otherwise there are
// rendering artifacts as wl_egl_window size does not match
// GL rendering pipeline setup.
void moz_container_egl_window_set_size(MozContainer* container, int width,
int height) {
if (container->eglwindow) {
wl_egl_window_resize(container->eglwindow, width, height, 0, 0);
}
}
#endif
void moz_container_class_init(MozContainerClass* klass) {
/*GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@ -327,17 +290,43 @@ static void moz_container_unmap_wayland(MozContainer* container) {
LOGWAYLAND(("%s [%p]\n", __FUNCTION__, (void*)container));
}
static gint moz_container_get_scale(MozContainer* container) {
static auto sGdkWindowGetScaleFactorPtr =
(gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor");
if (sGdkWindowGetScaleFactorPtr) {
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
return (*sGdkWindowGetScaleFactorPtr)(window);
}
return 1;
}
void moz_container_scale_changed(MozContainer* container,
GtkAllocation* aAllocation) {
LOG(("moz_container_scale_changed [%p] surface %p eglwindow %p\n",
(void*)container, (void*)container->surface,
(void*)container->eglwindow));
LOGWAYLAND(("%s [%p] surface %p eglwindow %p\n", __FUNCTION__,
(void*)container, (void*)container->surface,
(void*)container->eglwindow));
if (!container->surface) {
return;
}
moz_container_scale_update(container);
// Set correct scaled/unscaled mozcontainer offset
// especially when wl_egl is used but we don't recreate it as Gtk+ does.
gint x, y;
gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(container)), &x, &y);
wl_subsurface_set_position(container->subsurface, x, y);
// Try to only resize wl_egl_window on scale factor change.
// It's a bit risky as Gtk+ recreates it at that event.
if (container->eglwindow) {
gint scale = moz_container_get_scale(container);
wl_surface_set_buffer_scale(container->surface,
moz_container_get_scale(container));
wl_egl_window_resize(container->eglwindow, aAllocation->width * scale,
aAllocation->height * scale, 0, 0);
}
}
#endif
@ -432,8 +421,8 @@ void moz_container_size_allocate(GtkWidget* widget, GtkAllocation* allocation) {
g_return_if_fail(IS_MOZ_CONTAINER(widget));
LOG(("moz_container_size_allocate [%p] %d,%d -> %d x %d\n", (void*)widget,
allocation->x, allocation->y, allocation->width, allocation->height));
LOG(("%s [%p] %d %d %d %d\n", __FUNCTION__, (void*)widget, allocation->x,
allocation->y, allocation->width, allocation->height));
/* short circuit if you can */
container = MOZ_CONTAINER(widget);
@ -461,14 +450,23 @@ void moz_container_size_allocate(GtkWidget* widget, GtkAllocation* allocation) {
gdk_window_move_resize(gtk_widget_get_window(widget), allocation->x,
allocation->y, allocation->width,
allocation->height);
#if defined(MOZ_WAYLAND)
// We need to position our subsurface according to GdkWindow
// when offset changes (GdkWindow is maximized for instance).
// see gtk-clutter-embed.c for reference.
moz_container_move(MOZ_CONTAINER(widget), allocation->x, allocation->y);
moz_container_scale_update(MOZ_CONTAINER(widget));
#endif
}
#if defined(MOZ_WAYLAND)
// We need to position our subsurface according to GdkWindow
// when offset changes (GdkWindow is maximized for instance).
// see gtk-clutter-embed.c for reference.
if (container->subsurface) {
gint x, y;
gdk_window_get_position(gtk_widget_get_window(widget), &x, &y);
wl_subsurface_set_position(container->subsurface, x, y);
}
if (container->eglwindow) {
gint scale = moz_container_get_scale(container);
wl_egl_window_resize(container->eglwindow, allocation->width * scale,
allocation->height * scale, 0, 0);
}
#endif
}
void moz_container_remove(GtkContainer* container, GtkWidget* child_widget) {

Просмотреть файл

@ -105,10 +105,6 @@ void moz_container_scale_changed(MozContainer* container,
GtkAllocation* aAllocation);
void moz_container_set_initial_draw_callback(
MozContainer* container, std::function<void(void)> inital_draw_cb);
void moz_container_move_resize(MozContainer* container, int dx, int dy,
int width, int height);
void moz_container_egl_window_set_size(MozContainer* container, int width,
int height);
#endif
#endif /* __MOZ_CONTAINER_H__ */

Просмотреть файл

@ -1088,9 +1088,6 @@ void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) {
void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
bool aRepaint) {
LOG(("nsWindow::Resize [%p] %f %f repaint %d\n", (void*)this, aWidth, aHeight,
aRepaint));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
int32_t width = NSToIntRound(scale * aWidth);
@ -1647,12 +1644,8 @@ LayoutDeviceIntRect nsWindow::GetScreenBounds() {
// frame bounds, but mBounds.Size() is returned here for consistency
// with Resize.
rect.SizeTo(mBounds.Size());
#if MOZ_LOGGING
gint scale = GdkScaleFactor();
LOG(("GetScreenBounds %d,%d -> %d x %d, unscaled %d,%d -> %d x %d\n", rect.x,
rect.y, rect.width, rect.height, rect.x / scale, rect.y / scale,
rect.width / scale, rect.height / scale));
#endif
LOG(("GetScreenBounds %d,%d | %dx%d\n", rect.x, rect.y, rect.width,
rect.height));
return rect;
}
@ -2518,9 +2511,8 @@ void nsWindow::OnContainerUnrealize() {
}
void nsWindow::OnSizeAllocate(GtkAllocation* aAllocation) {
LOG(("nsWindow::OnSizeAllocate [%p] %d,%d -> %d x %d\n", (void*)this,
aAllocation->x, aAllocation->y, aAllocation->width,
aAllocation->height));
LOG(("size_allocate [%p] %d %d %d %d\n", (void*)this, aAllocation->x,
aAllocation->y, aAllocation->width, aAllocation->height));
LayoutDeviceIntSize size = GdkRectToDevicePixels(*aAllocation).Size();
@ -7378,13 +7370,3 @@ void nsWindow::LockAspectRatio(bool aShouldLock) {
(void*)this));
}
}
#ifdef MOZ_WAYLAND
void nsWindow::SetEGLNativeWindowSize(
const LayoutDeviceIntSize& aEGLWindowSize) {
if (mContainer && !mIsX11Display) {
moz_container_egl_window_set_size(mContainer, aEGLWindowSize.width,
aEGLWindowSize.height);
}
}
#endif

Просмотреть файл

@ -226,10 +226,6 @@ class nsWindow final : public nsBaseWidget {
void SetProgress(unsigned long progressPercent);
#ifdef MOZ_WAYLAND
void SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
#endif
private:
void UpdateAlpha(mozilla::gfx::SourceSurface* aSourceSurface,
nsIntRect aBoundsRect);