1123
|
1 |
# HG changeset patch
|
|
2 |
# Parent 047fa9d20b78759029e87c48f0d64f819e889e4c
|
|
3 |
|
|
4 |
diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp
|
|
5 |
--- a/widget/gtk/mozcontainer.cpp
|
|
6 |
+++ b/widget/gtk/mozcontainer.cpp
|
|
7 |
@@ -159,23 +159,25 @@ void moz_container_move(MozContainer* co
|
|
8 |
|
|
9 |
// Wayland subsurface is not created yet.
|
|
10 |
if (!container->subsurface) {
|
|
11 |
return;
|
|
12 |
}
|
|
13 |
|
|
14 |
// wl_subsurface_set_position is actually property of parent surface
|
|
15 |
// which is effective when parent surface is commited.
|
|
16 |
- wl_surface* parent_surface =
|
|
17 |
- moz_gtk_widget_get_wl_surface(GTK_WIDGET(container));
|
|
18 |
- if (parent_surface) {
|
|
19 |
- wl_subsurface_set_position(container->subsurface, container->subsurface_dx,
|
|
20 |
- container->subsurface_dy);
|
|
21 |
- wl_surface_commit(parent_surface);
|
|
22 |
- container->surface_position_needs_update = false;
|
|
23 |
+ wl_subsurface_set_position(container->subsurface, container->subsurface_dx,
|
|
24 |
+ container->subsurface_dy);
|
|
25 |
+ container->surface_position_needs_update = false;
|
|
26 |
+
|
|
27 |
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
|
|
28 |
+ if (window) {
|
|
29 |
+ GdkRectangle rect = (GdkRectangle){0, 0, gdk_window_get_width(window),
|
|
30 |
+ gdk_window_get_height(window)};
|
|
31 |
+ gdk_window_invalidate_rect(window, &rect, false);
|
|
32 |
}
|
|
33 |
}
|
|
34 |
|
|
35 |
// This is called from layout/compositor code only with
|
|
36 |
// size equal to GL rendering context. Otherwise there are
|
|
37 |
// rendering artifacts as wl_egl_window size does not match
|
|
38 |
// GL rendering pipeline setup.
|
|
39 |
void moz_container_egl_window_set_size(MozContainer* container, int width,
|
|
40 |
@@ -217,16 +219,17 @@ void moz_container_init(MozContainer* co
|
|
41 |
container->subsurface = nullptr;
|
|
42 |
container->eglwindow = nullptr;
|
|
43 |
container->frame_callback_handler = nullptr;
|
|
44 |
container->frame_callback_handler_surface_id = -1;
|
|
45 |
// We can draw to x11 window any time.
|
|
46 |
container->ready_to_draw = gfxPlatformGtk::GetPlatform()->IsX11Display();
|
|
47 |
container->opaque_region_needs_update = false;
|
|
48 |
container->opaque_region_subtract_corners = false;
|
|
49 |
+ container->opaque_region_fullscreen = false;
|
|
50 |
container->surface_needs_clear = true;
|
|
51 |
container->subsurface_dx = 0;
|
|
52 |
container->subsurface_dy = 0;
|
|
53 |
container->surface_position_needs_update = 0;
|
|
54 |
container->initial_draw_cbs.clear();
|
|
55 |
#endif
|
|
56 |
|
|
57 |
LOG(("%s [%p]\n", __FUNCTION__, (void*)container));
|
|
58 |
@@ -569,22 +572,26 @@ static void moz_container_add(GtkContain
|
|
59 |
moz_container_put(MOZ_CONTAINER(container), widget, 0, 0);
|
|
60 |
}
|
|
61 |
|
|
62 |
#ifdef MOZ_WAYLAND
|
|
63 |
static void moz_container_set_opaque_region(MozContainer* container) {
|
|
64 |
GtkAllocation allocation;
|
|
65 |
gtk_widget_get_allocation(GTK_WIDGET(container), &allocation);
|
|
66 |
|
|
67 |
- // Set region to mozcontainer which does not have any offset
|
|
68 |
- wl_region* region =
|
|
69 |
- CreateOpaqueRegionWayland(0, 0, allocation.width, allocation.height,
|
|
70 |
- container->opaque_region_subtract_corners);
|
|
71 |
- wl_surface_set_opaque_region(container->surface, region);
|
|
72 |
- wl_region_destroy(region);
|
|
73 |
+ // Set region to mozcontainer for normal state only
|
|
74 |
+ if (!container->opaque_region_fullscreen) {
|
|
75 |
+ wl_region* region =
|
|
76 |
+ CreateOpaqueRegionWayland(0, 0, allocation.width, allocation.height,
|
|
77 |
+ container->opaque_region_subtract_corners);
|
|
78 |
+ wl_surface_set_opaque_region(container->surface, region);
|
|
79 |
+ wl_region_destroy(region);
|
|
80 |
+ } else {
|
|
81 |
+ wl_surface_set_opaque_region(container->surface, nullptr);
|
|
82 |
+ }
|
|
83 |
}
|
|
84 |
|
|
85 |
struct wl_surface* moz_container_get_wl_surface(MozContainer* container) {
|
|
86 |
LOGWAYLAND(("%s [%p] surface %p ready_to_draw %d\n", __FUNCTION__,
|
|
87 |
(void*)container, (void*)container->surface,
|
|
88 |
container->ready_to_draw));
|
|
89 |
|
|
90 |
if (!container->surface) {
|
|
91 |
@@ -670,17 +677,19 @@ gboolean moz_container_has_wl_egl_window
|
|
92 |
|
|
93 |
gboolean moz_container_surface_needs_clear(MozContainer* container) {
|
|
94 |
int ret = container->surface_needs_clear;
|
|
95 |
container->surface_needs_clear = false;
|
|
96 |
return ret;
|
|
97 |
}
|
|
98 |
|
|
99 |
void moz_container_update_opaque_region(MozContainer* container,
|
|
100 |
- bool aSubtractCorners) {
|
|
101 |
+ bool aSubtractCorners,
|
|
102 |
+ bool aFullScreen) {
|
|
103 |
container->opaque_region_needs_update = true;
|
|
104 |
container->opaque_region_subtract_corners = aSubtractCorners;
|
|
105 |
+ container->opaque_region_fullscreen = aFullScreen;
|
|
106 |
}
|
|
107 |
#endif
|
|
108 |
|
|
109 |
void moz_container_force_default_visual(MozContainer* container) {
|
|
110 |
container->force_default_visual = true;
|
|
111 |
}
|
|
112 |
diff --git a/widget/gtk/mozcontainer.h b/widget/gtk/mozcontainer.h
|
|
113 |
--- a/widget/gtk/mozcontainer.h
|
|
114 |
+++ b/widget/gtk/mozcontainer.h
|
|
115 |
@@ -77,16 +77,17 @@ struct _MozContainer {
|
|
116 |
struct wl_surface* surface;
|
|
117 |
struct wl_subsurface* subsurface;
|
|
118 |
int subsurface_dx, subsurface_dy;
|
|
119 |
struct wl_egl_window* eglwindow;
|
|
120 |
struct wl_callback* frame_callback_handler;
|
|
121 |
int frame_callback_handler_surface_id;
|
|
122 |
gboolean opaque_region_needs_update;
|
|
123 |
gboolean opaque_region_subtract_corners;
|
|
124 |
+ gboolean opaque_region_fullscreen;
|
|
125 |
gboolean surface_position_needs_update;
|
|
126 |
gboolean surface_needs_clear;
|
|
127 |
gboolean ready_to_draw;
|
|
128 |
std::vector<std::function<void(void)>> initial_draw_cbs;
|
|
129 |
#endif
|
|
130 |
gboolean force_default_visual;
|
|
131 |
};
|
|
132 |
|
|
133 |
@@ -112,12 +113,13 @@ void moz_container_move_resize(MozContai
|
|
134 |
void moz_container_egl_window_set_size(MozContainer* container, int width,
|
|
135 |
int height);
|
|
136 |
void moz_container_scale_changed(MozContainer* container,
|
|
137 |
GtkAllocation* aAllocation);
|
|
138 |
void moz_container_add_initial_draw_callback(
|
|
139 |
MozContainer* container, const std::function<void(void)>& initial_draw_cb);
|
|
140 |
wl_surface* moz_gtk_widget_get_wl_surface(GtkWidget* aWidget);
|
|
141 |
void moz_container_update_opaque_region(MozContainer* container,
|
|
142 |
- bool aSubtractCorners);
|
|
143 |
+ bool aSubtractCorners,
|
|
144 |
+ bool aFullScreen);
|
|
145 |
#endif
|
|
146 |
|
|
147 |
#endif /* __MOZ_CONTAINER_H__ */
|
|
148 |
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|
149 |
--- a/widget/gtk/nsWindow.cpp
|
|
150 |
+++ b/widget/gtk/nsWindow.cpp
|
|
151 |
@@ -4860,27 +4860,34 @@ void nsWindow::UpdateTopLevelOpaqueRegio
|
|
152 |
int width = DevicePixelsToGdkCoordRoundDown(mBounds.width);
|
|
153 |
int height = DevicePixelsToGdkCoordRoundDown(mBounds.height);
|
|
154 |
|
|
155 |
GdkRectangle rect = {x, y, width, height};
|
|
156 |
if (!mToplevelOpaqueRegionState.NeedsUpdate(rect, aSubtractCorners)) {
|
|
157 |
return;
|
|
158 |
}
|
|
159 |
|
|
160 |
- wl_region* region =
|
|
161 |
- CreateOpaqueRegionWayland(x, y, width, height, aSubtractCorners);
|
|
162 |
- wl_surface_set_opaque_region(surface, region);
|
|
163 |
- wl_region_destroy(region);
|
|
164 |
-
|
|
165 |
+ // Set opaque region to toplevel window only in fullscreen mode.
|
|
166 |
+ bool fullScreen = mSizeState != nsSizeMode_Normal && !mIsTiled;
|
|
167 |
+ if (fullScreen) {
|
|
168 |
+ wl_region* region =
|
|
169 |
+ CreateOpaqueRegionWayland(x, y, width, height, aSubtractCorners);
|
|
170 |
+ wl_surface_set_opaque_region(surface, region);
|
|
171 |
+ wl_region_destroy(region);
|
|
172 |
+ } else {
|
|
173 |
+ wl_surface_set_opaque_region(surface, nullptr);
|
|
174 |
+ }
|
|
175 |
+
|
|
176 |
+ // TODO -> create a function for it
|
|
177 |
GdkWindow* window = gtk_widget_get_window(mShell);
|
|
178 |
if (window) {
|
|
179 |
gdk_window_invalidate_rect(window, &rect, false);
|
|
180 |
}
|
|
181 |
|
|
182 |
- moz_container_update_opaque_region(mContainer, aSubtractCorners);
|
|
183 |
+ moz_container_update_opaque_region(mContainer, aSubtractCorners, fullScreen);
|
|
184 |
}
|
|
185 |
#endif
|
|
186 |
|
|
187 |
static void GdkWindowSetOpaqueRegion(GdkWindow* aGdkWindow,
|
|
188 |
cairo_region_t* aRegion) {
|
|
189 |
// Available as of GTK 3.10+
|
|
190 |
static auto sGdkWindowSetOpaqueRegion =
|
|
191 |
(void (*)(GdkWindow*, cairo_region_t*))dlsym(
|