dreua / rpms / thunderbird

Forked from rpms/thunderbird 4 years ago
Clone
Blob Blame History Raw
diff -up thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.cpp.1508378 thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.cpp
--- thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.cpp.1508378	2019-04-12 09:23:26.846503741 +0200
+++ thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.cpp	2019-04-12 09:25:45.661937077 +0200
@@ -567,6 +567,23 @@ static void WaylandBufferDelayCommitHand
   }
 }
 
+void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect, int aScale) {
+  if (aRect.x & 0x1) {
+    aRect.width += 1;
+  }
+  aRect.x = aRect.x / aScale;
+
+  if (aRect.y & 0x1) {
+    aRect.height += 1;
+  }
+  aRect.y = aRect.y / aScale;
+
+  aRect.width = (aRect.width & 0x1) ? aRect.width / aScale + 1 :
+                                      aRect.width / aScale;
+  aRect.height = (aRect.height & 0x1) ? aRect.height / aScale + 1 :
+                                        aRect.height / aScale;
+}
+
 void WindowSurfaceWayland::CommitWaylandBuffer() {
   MOZ_ASSERT(mPendingCommit, "Committing empty surface!");
 
@@ -617,11 +634,13 @@ void WindowSurfaceWayland::CommitWayland
     gint scaleFactor = mWindow->GdkScaleFactor();
     for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done();
          iter.Next()) {
-      const mozilla::LayoutDeviceIntRect& r = iter.Get();
+      mozilla::LayoutDeviceIntRect r = iter.Get();
       // We need to remove the scale factor because the wl_surface_damage
       // also multiplies by current  scale factor.
-      wl_surface_damage(waylandSurface, r.x / scaleFactor, r.y / scaleFactor,
-                        r.width / scaleFactor, r.height / scaleFactor);
+      if (scaleFactor > 1) {
+        CalcRectScale(r, scaleFactor);
+      }
+      wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height);
     }
   }
 
diff -up thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.h.1508378 thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.h
--- thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.h.1508378	2019-04-12 09:23:26.817503860 +0200
+++ thunderbird-60.6.1/widget/gtk/WindowSurfaceWayland.h	2019-04-12 09:23:26.846503741 +0200
@@ -101,6 +101,7 @@ class WindowSurfaceWayland : public Wind
       const gfx::IntSize& aLockSize);
   bool CommitImageSurfaceToWaylandBuffer(const LayoutDeviceIntRegion& aRegion);
   void CommitWaylandBuffer();
+  void CalcRectScale(LayoutDeviceIntRect& aRect, int scale);
 
   // TODO: Do we need to hold a reference to nsWindow object?
   nsWindow* mWindow;