зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1411018 - Rename shellHasCSD to drawToContainer and mark our rendering widget by gtk_widget_set_app_paintable(), r=jhorak
Rename shellHasCSD to drawToContainer for better understanding and always mark our rendering widget by gtk_widget_set_app_paintable() to make sure Gtk+ does not draw default background for it. MozReview-Commit-ID: 4mhxrG7C34i --HG-- extra : rebase_source : 312e956e317c85196d27213dd86bd30b73a25b02
This commit is contained in:
Родитель
9fbd8cf669
Коммит
fcfeac2a70
|
@ -3601,7 +3601,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||
GtkWindow *topLevelParent = nullptr;
|
||||
nsWindow *parentnsWindow = nullptr;
|
||||
GtkWidget *eventWidget = nullptr;
|
||||
bool shellHasCSD = false;
|
||||
bool drawToContainer = false;
|
||||
|
||||
if (aParent) {
|
||||
parentnsWindow = static_cast<nsWindow*>(aParent);
|
||||
|
@ -3777,21 +3777,29 @@ nsWindow::Create(nsIWidget* aParent,
|
|||
// it explicitly now.
|
||||
gtk_widget_realize(mShell);
|
||||
|
||||
// We can't draw directly to top-level window when client side
|
||||
// decorations are enabled. We use container with GdkWindow instead.
|
||||
/* There are two cases here:
|
||||
*
|
||||
* 1) We're running on Gtk+ without client side decorations.
|
||||
* Content is rendered to mShell window and we listen
|
||||
* to the Gtk+ events on mShell
|
||||
* 2) We're running on Gtk+ > 3.20 and client side decorations
|
||||
* are drawn by Gtk+ to mShell. Content is rendered to mContainer
|
||||
* and we listen to the Gtk+ events on mContainer.
|
||||
*/
|
||||
GtkStyleContext* style = gtk_widget_get_style_context(mShell);
|
||||
shellHasCSD = gtk_style_context_has_class(style, "csd");
|
||||
drawToContainer = gtk_style_context_has_class(style, "csd");
|
||||
#endif
|
||||
if (!shellHasCSD) {
|
||||
// Use mShell's window for drawing and events.
|
||||
gtk_widget_set_has_window(container, FALSE);
|
||||
// Prevent GtkWindow from painting a background to flicker.
|
||||
gtk_widget_set_app_paintable(mShell, TRUE);
|
||||
}
|
||||
// Set up event widget
|
||||
eventWidget = shellHasCSD ? container : mShell;
|
||||
eventWidget = (drawToContainer) ? container : mShell;
|
||||
|
||||
gtk_widget_add_events(eventWidget, kEvents);
|
||||
|
||||
// Prevent GtkWindow from painting a background to avoid flickering.
|
||||
gtk_widget_set_app_paintable(eventWidget, TRUE);
|
||||
|
||||
// If we draw to mContainer window then configure it now because
|
||||
// gtk_container_add() realizes the child widget.
|
||||
gtk_widget_set_has_window(container, drawToContainer);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mShell), container);
|
||||
gtk_widget_realize(container);
|
||||
|
||||
|
@ -3960,7 +3968,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||
G_CALLBACK(drag_data_received_event_cb), nullptr);
|
||||
|
||||
GtkWidget *widgets[] = { GTK_WIDGET(mContainer),
|
||||
!shellHasCSD ? mShell : nullptr };
|
||||
!drawToContainer ? mShell : nullptr };
|
||||
for (size_t i = 0; i < ArrayLength(widgets) && widgets[i]; ++i) {
|
||||
// Visibility events are sent to the owning widget of the relevant
|
||||
// window but do not propagate to parent widgets so connect on
|
||||
|
|
Загрузка…
Ссылка в новой задаче