1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
diff -up firefox-82.0/layout/xul/nsMenuPopupFrame.cpp.1669495 firefox-82.0/layout/xul/nsMenuPopupFrame.cpp
--- firefox-82.0/layout/xul/nsMenuPopupFrame.cpp.1669495 2020-10-15 16:13:12.304471453 +0200
+++ firefox-82.0/layout/xul/nsMenuPopupFrame.cpp 2020-10-15 16:13:12.308471463 +0200
@@ -533,6 +533,26 @@ void nsMenuPopupFrame::LayoutPopup(nsBox
}
prefSize = XULBoundsCheck(minSize, prefSize, maxSize);
+#ifdef MOZ_WAYLAND
+ static bool inWayland = gdk_display_get_default() &&
+ !GDK_IS_X11_DISPLAY(gdk_display_get_default());
+#else
+ static bool inWayland = false;
+#endif
+ if (inWayland) {
+ // If prefSize it is not a whole number in css pixels we need round it up
+ // to avoid reflow of the tooltips/popups and putting the text on two lines
+ // (usually happens with 200% scale factor and font scale factor <> 1)
+ // because GTK thrown away the decimals.
+ int32_t appPerCSS = AppUnitsPerCSSPixel();
+ if (prefSize.width % appPerCSS > 0) {
+ prefSize.width += appPerCSS;
+ }
+ if (prefSize.height % appPerCSS > 0) {
+ prefSize.height += appPerCSS;
+ }
+ }
+
bool sizeChanged = (mPrefSize != prefSize);
// if the size changed then set the bounds to be the preferred size
if (sizeChanged) {
diff -up firefox-82.0/widget/gtk/nsWindow.cpp.1669495 firefox-82.0/widget/gtk/nsWindow.cpp
--- firefox-82.0/widget/gtk/nsWindow.cpp.1669495 2020-10-15 16:13:12.307471461 +0200
+++ firefox-82.0/widget/gtk/nsWindow.cpp 2020-10-15 16:15:49.243882006 +0200
@@ -1092,11 +1092,13 @@ void nsWindow::Show(bool aState) {
void nsWindow::ResizeInt(int aX, int aY, int aWidth, int aHeight, bool aMove,
bool aRepaint) {
- LOG(("nsWindow::ResizeInt [%p] %d %d -> %d %d repaint %d\n", (void*)this, aX,
- aY, aWidth, aHeight, aRepaint));
+ LOG(("nsWindow::ResizeInt [%p] x:%d y:%d -> w:%d h:%d repaint %d aMove %d\n",
+ (void*)this, aX, aY, aWidth, aHeight, aRepaint, aMove));
ConstrainSize(&aWidth, &aHeight);
+ LOG((" ConstrainSize: w:%d h;%d\n", aWidth, aHeight));
+
// If we used to have insane bounds, we may have skipped actually positioning
// the widget in NativeMoveResizeWaylandPopup, in which case we need to
// actually position it now as well.
@@ -1141,8 +1143,7 @@ void nsWindow::ResizeInt(int aX, int aY,
}
void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) {
- LOG(("nsWindow::Resize [%p] %d %d\n", (void*)this, (int)aWidth,
- (int)aHeight));
+ LOG(("nsWindow::Resize [%p] %f %f\n", (void*)this, aWidth, aHeight));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
@@ -1154,8 +1155,8 @@ void nsWindow::Resize(double aWidth, dou
void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
bool aRepaint) {
- LOG(("nsWindow::Resize [%p] %d %d repaint %d\n", (void*)this, (int)aWidth,
- (int)aHeight, aRepaint));
+ LOG(("nsWindow::Resize [%p] %f %f repaint %d\n", (void*)this, aWidth, aHeight,
+ aRepaint));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
@@ -1478,14 +1479,15 @@ void nsWindow::NativeMoveResizeWaylandPo
newBounds.x = GdkCoordToDevicePixels(newBounds.x);
newBounds.y = GdkCoordToDevicePixels(newBounds.y);
- LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x,
- newBounds.y, newBounds.width, newBounds.height));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
int32_t newWidth = NSToIntRound(scale * newBounds.width);
int32_t newHeight = NSToIntRound(scale * newBounds.height);
+ LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x,
+ newBounds.y, newWidth, newHeight));
+
bool needsPositionUpdate =
(newBounds.x != mBounds.x || newBounds.y != mBounds.y);
bool needsSizeUpdate =
@@ -1493,6 +1495,7 @@ void nsWindow::NativeMoveResizeWaylandPo
// Update view
if (needsSizeUpdate) {
+ LOG((" needSizeUpdate\n"));
int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
mPreferredPopupRect = nsRect(NSIntPixelsToAppUnits(newBounds.x, p2a),
NSIntPixelsToAppUnits(newBounds.y, p2a),
@@ -1511,6 +1514,7 @@ void nsWindow::NativeMoveResizeWaylandPo
}
if (needsPositionUpdate) {
+ LOG((" needPositionUpdate\n"));
// The newBounds are in coordinates relative to the parent window/popup.
// The NotifyWindowMoved requires the coordinates relative to the toplevel.
// We use the gdk_window_get_origin to get correct coordinates.
@@ -4245,6 +4249,8 @@ nsresult nsWindow::Create(nsIWidget* aPa
// save our bounds
mBounds = aRect;
+ LOG((" mBounds: x:%d y:%d w:%d h:%d\n", mBounds.x, mBounds.y, mBounds.width,
+ mBounds.height));
mPreferredPopupRectFlushed = false;
@@ -5083,13 +5089,16 @@ void nsWindow::NativeShow(bool aAction)
}
}
+ LOG((" calling gtk_widget_show(mShell)\n"));
gtk_widget_show(mShell);
if (!mIsX11Display) {
WaylandStartVsync();
}
} else if (mContainer) {
+ LOG((" calling gtk_widget_show(mContainer)\n"));
gtk_widget_show(GTK_WIDGET(mContainer));
} else if (mGdkWindow) {
+ LOG((" calling gdk_window_show_unraised\n"));
gdk_window_show_unraised(mGdkWindow);
}
} else {
|