author | Martin Stransky <stransky@redhat.com> |
Mon, 23 Oct 2017 21:44:02 +0200 | |
changeset 389423 | 5ce1b76adab54f3690221d6a9ecd059c27ffcc87 |
parent 389422 | db01a5ff278cf4f00f6bcd50b89756fd77bba9f8 |
child 389424 | 5d2d20eb0bd523f82384d12b408e667409c23e8f |
push id | 96855 |
push user | archaeopteryx@coole-files.de |
push date | Tue, 31 Oct 2017 23:40:37 +0000 |
treeherder | mozilla-inbound@285362745f60 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jhorak |
bugs | 1411018 |
milestone | 58.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -3596,17 +3596,17 @@ nsWindow::Create(nsIWidget* aParent, // figure out our parent window GtkWidget *parentMozContainer = nullptr; GtkContainer *parentGtkContainer = nullptr; GdkWindow *parentGdkWindow = nullptr; GtkWindow *topLevelParent = nullptr; nsWindow *parentnsWindow = nullptr; GtkWidget *eventWidget = nullptr; - bool shellHasCSD = false; + bool drawToContainer = false; if (aParent) { parentnsWindow = static_cast<nsWindow*>(aParent); parentGdkWindow = parentnsWindow->mGdkWindow; } else if (aNativeParent && GDK_IS_WINDOW(aNativeParent)) { parentGdkWindow = GDK_WINDOW(aNativeParent); parentnsWindow = get_window_for_gdk_window(parentGdkWindow); if (!parentnsWindow) @@ -3772,31 +3772,39 @@ nsWindow::Create(nsIWidget* aParent, GtkWidget *container = moz_container_new(); mContainer = MOZ_CONTAINER(container); #if (MOZ_WIDGET_GTK == 3) // "csd" style is set when widget is realized so we need to call // 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); // make sure this is the focus widget in the container gtk_widget_show(container); gtk_widget_grab_focus(container); // the drawing window @@ -3955,17 +3963,17 @@ nsWindow::Create(nsIWidget* aParent, g_signal_connect(mContainer, "drag_leave", G_CALLBACK(drag_leave_event_cb), nullptr); g_signal_connect(mContainer, "drag_drop", G_CALLBACK(drag_drop_event_cb), nullptr); g_signal_connect(mContainer, "drag_data_received", 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 // mShell (if it exists) as well as mContainer. g_signal_connect(widgets[i], "visibility-notify-event", G_CALLBACK(visibility_notify_event_cb), nullptr); // Similarly double buffering is controlled by the window's owning // widget. Disable double buffering for painting directly to the