parent
b2354eba7a
commit
a887309eb7
92
evince-3.21.4-NPNVToolKit.patch
Normal file
92
evince-3.21.4-NPNVToolKit.patch
Normal file
@ -0,0 +1,92 @@
|
||||
From 5b026932b70c9b9ea5575c395fc7bc2aa0c0b299 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Kasik <mkasik@redhat.com>
|
||||
Date: Thu, 12 Mar 2015 11:28:15 +0100
|
||||
Subject: [PATCH] browser-plugin: Check supported Gtk+ version
|
||||
|
||||
Check version of Gtk+ supported by browser in NP_Initialize() and in NPP_New().
|
||||
Return error if version supported by browser is 1 or 2.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=738270
|
||||
---
|
||||
browser-plugin/EvBrowserPluginMain.cpp | 46 +++++++++++++++++++++++++---------
|
||||
1 file changed, 34 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/browser-plugin/EvBrowserPluginMain.cpp b/browser-plugin/EvBrowserPluginMain.cpp
|
||||
index fb749f4..e529c87 100644
|
||||
--- a/browser-plugin/EvBrowserPluginMain.cpp
|
||||
+++ b/browser-plugin/EvBrowserPluginMain.cpp
|
||||
@@ -34,11 +34,40 @@ static EvBrowserPlugin *pluginForInstance(NPP instance)
|
||||
return static_cast<EvBrowserPlugin *>(instance->pdata);
|
||||
}
|
||||
|
||||
+static gboolean gtkToolkitIsCompatible(NPP instance)
|
||||
+{
|
||||
+ NPNToolkitType toolkit_type = NPNVGtk12;
|
||||
+ NPError error;
|
||||
+
|
||||
+ error = browser->getvalue(instance, NPNVToolkit, &toolkit_type);
|
||||
+
|
||||
+ if (error == NPERR_NO_ERROR &&
|
||||
+ (toolkit_type == NPNVGtk12 ||
|
||||
+ toolkit_type == NPNVGtk2))
|
||||
+ return FALSE;
|
||||
+ else
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *savedData)
|
||||
{
|
||||
if (!instance)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
|
||||
+ if (!gtkToolkitIsCompatible(instance))
|
||||
+ return NPERR_GENERIC_ERROR;
|
||||
+
|
||||
+ GBytes *resourceData = g_resources_lookup_data("/org/gnome/evince/browser/ui/evince-browser.css", G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr);
|
||||
+ if (resourceData) {
|
||||
+ GtkCssProvider *cssProvider = gtk_css_provider_new();
|
||||
+
|
||||
+ gtk_css_provider_load_from_data(cssProvider, static_cast<const gchar *>(g_bytes_get_data(resourceData, nullptr)), g_bytes_get_size(resourceData), nullptr);
|
||||
+ g_bytes_unref(resourceData);
|
||||
+
|
||||
+ gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(cssProvider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
+ g_object_unref(cssProvider);
|
||||
+ }
|
||||
+
|
||||
return EvBrowserPlugin::create(instance)->initialize(pluginType, mode, argc, argn, argv, savedData);
|
||||
}
|
||||
|
||||
@@ -193,25 +222,18 @@ NPError NP_Initialize(NPNetscapeFuncs *browserFuncs, NPPluginFuncs *pluginFuncs)
|
||||
if ((browserFuncs->version >> 8) > NP_VERSION_MAJOR)
|
||||
return NPERR_INCOMPATIBLE_VERSION_ERROR;
|
||||
|
||||
+ browser = browserFuncs;
|
||||
+
|
||||
+ if (!gtkToolkitIsCompatible(NULL))
|
||||
+ return NPERR_GENERIC_ERROR;
|
||||
+
|
||||
if (!ev_init())
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
gtk_init(nullptr, nullptr);
|
||||
|
||||
- browser = browserFuncs;
|
||||
initializePluginFuncs(pluginFuncs);
|
||||
|
||||
- GBytes *resourceData = g_resources_lookup_data("/org/gnome/evince/browser/ui/evince-browser.css", G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr);
|
||||
- if (resourceData) {
|
||||
- GtkCssProvider *cssProvider = gtk_css_provider_new();
|
||||
-
|
||||
- gtk_css_provider_load_from_data(cssProvider, static_cast<const gchar *>(g_bytes_get_data(resourceData, nullptr)), g_bytes_get_size(resourceData), nullptr);
|
||||
- g_bytes_unref(resourceData);
|
||||
-
|
||||
- gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(cssProvider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
- g_object_unref(cssProvider);
|
||||
- }
|
||||
-
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
--
|
||||
2.1.0
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
Name: evince
|
||||
Version: 3.21.4
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Document viewer
|
||||
|
||||
License: GPLv2+ and GPLv3+ and LGPLv2+ and MIT and Afmparse
|
||||
@ -13,6 +13,8 @@ Group: Applications/Publishing
|
||||
URL: https://wiki.gnome.org/Apps/Evince
|
||||
Source0: http://download.gnome.org/sources/%{name}/3.21/%{name}-%{version}.tar.xz
|
||||
|
||||
Patch0: evince-3.21.4-NPNVToolKit.patch
|
||||
|
||||
BuildRequires: pkgconfig(adwaita-icon-theme)
|
||||
BuildRequires: pkgconfig(gio-unix-2.0) >= %{glib2_version}
|
||||
BuildRequires: pkgconfig(gnome-desktop-3.0)
|
||||
@ -260,6 +262,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas >&/dev/null ||:
|
||||
%{_libdir}/mozilla/plugins/libevbrowserplugin.so
|
||||
|
||||
%changelog
|
||||
* Mon Aug 15 2016 Marek Kasik <mkasik@redhat.com> - 3.21.4-2
|
||||
- Check version of NPNVToolkit provided by browser
|
||||
- Resolves: #1198229
|
||||
|
||||
* Wed Jul 20 2016 Richard Hughes <rhughes@redhat.com> - 3.21.4-1
|
||||
- Update to 3.21.4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user