Resolves: mozbz#1192243 - Fix crash reported layout under GTK3

This commit is contained in:
Petr Jašíček 2015-08-20 10:09:30 +02:00
parent fa428ed035
commit f52bc4497c
2 changed files with 121 additions and 1 deletions

View File

@ -84,7 +84,7 @@
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 40.0
Release: 5%{?pre_tag}%{?dist}
Release: 6%{?pre_tag}%{?dist}
URL: http://www.mozilla.org/projects/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
@ -130,6 +130,7 @@ Patch421: mozilla-1169233.patch
Patch422: mozilla-1169232.patch
Patch423: mozilla-1129873-apppicker.patch
Patch424: mozilla-entry-padding.patch
Patch425: mozilla-1192243.patch
# Fix Skia Neon stuff on AArch64
Patch500: aarch64-fix-skia.patch
@ -276,6 +277,7 @@ cd %{tarballdir}
%patch422 -p1 -b .1169232
%patch423 -p1 -b .1129873-apppicker
%patch424 -p2 -b .entry-padding
%patch425 -p1 -b .1192243
%endif
%patch500 -p1
@ -768,6 +770,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
* Thu Aug 20 2015 Petr Jasicek <pjasicek@redhat.com> - 40.0-6
- Fix crash reporter layout under GTK3 - mozbz#1192243
* Wed Aug 19 2015 Martin Stransky <stransky@redhat.com> - 40.0-5
- Disable async addons init - mozbz#1196000

115
mozilla-1192243.patch Normal file
View File

@ -0,0 +1,115 @@
# HG changeset patch
# Parent 8cba870a352ca71b53cebee7688847756eb3f5f7
# User Petr Jasicek <pjasicek@redhat.com>
Bug 1192243 - Fix Gtk3 crash reporter's ScrolledWindow and width. r=karlt
diff --git a/toolkit/crashreporter/client/crashreporter_linux.cpp b/toolkit/crashreporter/client/crashreporter_linux.cpp
--- a/toolkit/crashreporter/client/crashreporter_linux.cpp
+++ b/toolkit/crashreporter/client/crashreporter_linux.cpp
@@ -9,16 +9,18 @@
#include <gtk/gtk.h>
#include <string.h>
#include <cctype>
#include "crashreporter.h"
#include "crashreporter_gtk_common.h"
+#define LABEL_MAX_CHAR_WIDTH 48
+
using std::string;
using std::vector;
using namespace CrashReporter;
static GtkWidget* gViewReportButton = 0;
static GtkWidget* gCommentTextLabel = 0;
static GtkWidget* gCommentText = 0;
@@ -178,19 +180,22 @@ static void ViewReportClicked(GtkButton*
GTK_DIALOG_MODAL,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
nullptr));
GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(dialog)), scrolled);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
- GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
GTK_SHADOW_IN);
+#if (MOZ_WIDGET_GTK >= 3)
+ gtk_widget_set_vexpand(scrolled, TRUE);
+#endif
GtkWidget* viewReportTextView = gtk_text_view_new();
gtk_container_add(GTK_CONTAINER(scrolled), viewReportTextView);
gtk_text_view_set_editable(GTK_TEXT_VIEW(viewReportTextView), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(viewReportTextView),
GTK_WRAP_WORD);
gtk_widget_set_size_request(GTK_WIDGET(viewReportTextView), -1, 100);
@@ -407,17 +412,21 @@ bool UIShowCrashUI(const StringTable& fi
gStrings[ST_CRASHREPORTERHEADER].c_str());
gtk_label_set_markup(GTK_LABEL(titleLabel), markup);
g_free(markup);
GtkWidget* descriptionLabel =
gtk_label_new(gStrings[ST_CRASHREPORTERDESCRIPTION].c_str());
gtk_box_pack_start(GTK_BOX(vbox), descriptionLabel, TRUE, TRUE, 0);
// force the label to line wrap
+#if (MOZ_WIDGET_GTK == 2)
gtk_widget_set_size_request(descriptionLabel, 400, -1);
+#else
+ gtk_label_set_max_width_chars(GTK_LABEL(descriptionLabel), LABEL_MAX_CHAR_WIDTH);
+#endif
gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE);
gtk_label_set_selectable(GTK_LABEL(descriptionLabel), TRUE);
gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0, 0.5);
// this is honestly how they suggest you indent a section
GtkWidget* indentBox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), indentBox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(indentBox), gtk_label_new(""), FALSE, FALSE, 6);
@@ -451,16 +460,19 @@ bool UIShowCrashUI(const StringTable& fi
g_signal_connect(gViewReportButton, "clicked", G_CALLBACK(ViewReportClicked), 0);
GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
gtk_container_add(GTK_CONTAINER(innerVBox), scrolled);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
GTK_SHADOW_IN);
+#if (MOZ_WIDGET_GTK >= 3)
+ gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), 100);
+#endif
gCommentTextLabel = gtk_label_new(gStrings[ST_COMMENTGRAYTEXT].c_str());
gCommentText = gtk_text_view_new();
gtk_label_set_mnemonic_widget(GTK_LABEL(gCommentTextLabel), gCommentText);
gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(gCommentText), FALSE);
g_signal_connect(gCommentText, "focus-in-event", G_CALLBACK(CommentFocusChange), 0);
g_signal_connect(gCommentText, "focus-out-event", G_CALLBACK(CommentFocusChange), 0);
@@ -509,17 +521,21 @@ bool UIShowCrashUI(const StringTable& fi
g_free(dir);
gThrobber = gtk_image_new_from_file(path);
gtk_box_pack_start(GTK_BOX(progressBox), gThrobber, FALSE, FALSE, 0);
gProgressLabel =
gtk_label_new(gStrings[ST_REPORTPRESUBMIT].c_str());
gtk_box_pack_start(GTK_BOX(progressBox), gProgressLabel, TRUE, TRUE, 0);
// force the label to line wrap
+#if (MOZ_WIDGET_GTK == 2)
gtk_widget_set_size_request(gProgressLabel, 400, -1);
+#else
+ gtk_label_set_max_width_chars(GTK_LABEL(gProgressLabel), LABEL_MAX_CHAR_WIDTH);
+#endif
gtk_label_set_line_wrap(GTK_LABEL(gProgressLabel), TRUE);
GtkWidget* buttonBox = gtk_hbutton_box_new();
gtk_box_pack_end(GTK_BOX(vbox), buttonBox, FALSE, FALSE, 0);
gtk_box_set_spacing(GTK_BOX(buttonBox), 6);
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
gCloseButton =