1
0
forked from pool/boinc-client

Accepting request 525934 from network

- Add 0001-MGR-support-wxWidgets-without-webview.patch
replace plaintext widget with mini-html widget (forwarded request 522296 from jengelh)

OBS-URL: https://build.opensuse.org/request/show/525934
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/boinc-client?expand=0&rev=37
This commit is contained in:
Dominique Leuenberger 2017-09-14 19:15:29 +00:00 committed by Git OBS Bridge
commit 636d88bf95
3 changed files with 118 additions and 1 deletions

View File

@ -0,0 +1,111 @@
From 84c17bc232a7721ab0687228af5b3acfba12ad75 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Fri, 8 Sep 2017 01:55:57 +0200
Subject: [PATCH] MGR: support wxWidgets without webview
If wxWidgets is built without support for the webview widget, make do
with a wxHtmlWindow instead.
---
clientgui/NoticeListCtrl.cpp | 25 +++++++++++++++++++++++++
clientgui/NoticeListCtrl.h | 8 ++++++++
2 files changed, 33 insertions(+)
Index: boinc-client_release-7.6-7.6.33/clientgui/NoticeListCtrl.cpp
===================================================================
--- boinc-client_release-7.6-7.6.33.orig/clientgui/NoticeListCtrl.cpp
+++ boinc-client_release-7.6-7.6.33/clientgui/NoticeListCtrl.cpp
@@ -49,10 +49,14 @@ IMPLEMENT_DYNAMIC_CLASS( CNoticeListCtrl
BEGIN_EVENT_TABLE( CNoticeListCtrl, wxWindow )
+#if wxUSE_WEBVIEW
////@begin CNoticeListCtrl event table entries
EVT_WEBVIEW_NAVIGATING(ID_LIST_NOTIFICATIONSVIEW, CNoticeListCtrl::OnLinkClicked)
EVT_WEBVIEW_ERROR(ID_LIST_NOTIFICATIONSVIEW, CNoticeListCtrl::OnWebViewError)
////@end CNoticeListCtrl event table entries
+#else
+ EVT_HTML_LINK_CLICKED(ID_LIST_NOTIFICATIONSVIEW, CNoticeListCtrl::OnLinkClicked)
+#endif
END_EVENT_TABLE()
@@ -84,7 +88,11 @@ bool CNoticeListCtrl::Create( wxWindow*
wxWindow::Create( parent, ID_LIST_NOTIFICATIONSVIEW, wxDefaultPosition, wxDefaultSize,
wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
+#if wxUSE_WEBVIEW
m_browser = wxWebView::New( this, ID_LIST_NOTIFICATIONSVIEW );
+#else
+ m_browser = new wxHtmlWindow(this, ID_LIST_NOTIFICATIONSVIEW);
+#endif
////@end CNoticeListCtrl creation
wxBoxSizer *topsizer;
@@ -236,7 +244,11 @@ void CNoticeListCtrl::SetItemCount(int n
m_noticesBody += strBuffer;
}
m_noticesBody += wxT("</font></body></html>");
+#if wxUSE_WEBVIEW
m_browser->SetPage(m_noticesBody, wxT("http://"));
+#else
+ m_browser->SetPage(m_noticesBody);
+#endif
}
@@ -246,6 +258,7 @@ void CNoticeListCtrl::Clear() {
}
+#if wxUSE_WEBVIEW
void CNoticeListCtrl::OnLinkClicked( wxWebViewEvent& event ) {
if (event.GetURL().StartsWith(wxT("http://")) || event.GetURL().StartsWith(wxT("https://"))) {
event.Veto(); // Tell wxWebView not to follow link
@@ -262,6 +275,18 @@ void CNoticeListCtrl::OnWebViewError( wx
event.Skip();
}
+#else
+void CNoticeListCtrl::OnLinkClicked(wxHtmlLinkEvent &event)
+{
+ wxString url = event.GetLinkInfo().GetHref();
+ if (!url.StartsWith(wxT("http://")) && !url.StartsWith(wxT("https://"))) {
+ event.Skip();
+ return;
+ }
+ event.Skip(); // Tell element not to follow link
+ wxLaunchDefaultBrowser(url);
+}
+#endif
/*!
Index: boinc-client_release-7.6-7.6.33/clientgui/NoticeListCtrl.h
===================================================================
--- boinc-client_release-7.6-7.6.33.orig/clientgui/NoticeListCtrl.h
+++ boinc-client_release-7.6-7.6.33/clientgui/NoticeListCtrl.h
@@ -45,8 +45,12 @@ public:
////@begin CNoticeListCtrl event handler declarations
+#if defined(wxUSE_WEBVIEW) && wxUSE_WEBVIEW
void OnLinkClicked( wxWebViewEvent& event );
void OnWebViewError( wxWebViewEvent& event );
+#else
+ void OnLinkClicked(wxHtmlLinkEvent &);
+#endif
////@end CNoticeListCtrl event handler declarations
@@ -56,7 +60,11 @@ public:
bool m_bDisplayFetchingNotices;
bool m_bDisplayEmptyNotice;
private:
+#if wxUSE_WEBVIEW
wxWebView* m_browser;
+#else
+ wxHtmlWindow *m_browser;
+#endif
bool m_bNeedsReloading;
int m_itemCount;
wxString m_noticesBody;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Sep 8 09:38:10 UTC 2017 - jengelh@inai.de
- Add 0001-MGR-support-wxWidgets-without-webview.patch
-------------------------------------------------------------------
Sat Sep 2 22:12:09 UTC 2017 - jengelh@inai.de

View File

@ -51,6 +51,7 @@ Patch1: boinc-guirpcauth.patch
Patch2: boinc-docbook2x.patch
Patch3: 0001-Fix-1530-null-pointer-dereference.patch
Patch4: xlocale.patch
Patch5: 0001-MGR-support-wxWidgets-without-webview.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
BuildRequires: Mesa-devel
@ -161,7 +162,7 @@ This package contains documentation files for the BOINC client.
%prep
%setup -q -n %{name}_release-7.6-%{version} -D -a 1
%patch -P 1 -P 2 -P 3 -P 4 -p1
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -p1
%build
# Install user hints