[nspluginwrapper: 1/2] added patch from rhbz#544992 - embed standalone npplayer in another program by Wade Brainerd.

Martin Stransky stransky at fedoraproject.org
Thu Jan 6 13:16:10 UTC 2011


commit 328c8cd5530df2194c73275cbb5c63142408c515
Author: Martin Stransky <stransky at anakreon.cz>
Date:   Thu Jan 6 14:11:21 2011 +0100

    added patch from rhbz#544992 - embed standalone npplayer in another program by Wade Brainerd.

 npplayer-xid.patch   |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 nspluginwrapper.spec |    8 ++++-
 2 files changed, 95 insertions(+), 1 deletions(-)
---
diff --git a/npplayer-xid.patch b/npplayer-xid.patch
new file mode 100644
index 0000000..c757e42
--- /dev/null
+++ b/npplayer-xid.patch
@@ -0,0 +1,88 @@
+diff -ur nspluginwrapper-1.3.0-clean/src/npw-player.c nspluginwrapper-1.3.0-xid/src/npw-player.c
+--- nspluginwrapper-1.3.0-clean/src/npw-player.c	2009-12-05 00:02:45.540599262 -0500
++++ nspluginwrapper-1.3.0-xid/src/npw-player.c	2009-12-05 00:32:05.814668671 -0500
+@@ -53,6 +53,7 @@
+ 
+ static gboolean g_verbose     = FALSE;
+ static guint g_backend        = BACKEND_GTK;
++static guint g_xid            = 0;
+ static guint g_n_plugins      = 0;
+ 
+ typedef struct _Plugin		Plugin;
+@@ -511,7 +512,7 @@
+ static inline NPIdentifier
+ pack_int_identifier (int32_t value)
+ {
+-  
++
+   return GUINT_TO_POINTER ((((uint32_t)value) << 1) | NP_IDENTIFIER_INT);
+ }
+ 
+@@ -1638,7 +1639,7 @@
+ 	continue;
+ 
+       StreamInstance *pstream;
+-      
++
+       CURL *handle = msg->easy_handle;
+       if (curl_easy_getinfo (handle, CURLINFO_PRIVATE, &pstream) == CURLE_OK)
+ 	{
+@@ -2213,6 +2214,7 @@
+   g_print ("Options:\n");
+   g_print ("  -v|--verbose            enable verbose mode\n");
+   g_print ("  -f|--fullscreen         start in fullscreen mode\n");
++  g_print ("  --xid N                 embed in window with xid N\n");
+   g_print ("\n");
+ 
+   g_print ("Common attributes include:\n");
+@@ -2490,6 +2492,14 @@
+ 	is_fullscreen = FALSE;
+       else if (strcmp (arg, "--fullscreen") == 0)
+ 	is_fullscreen = TRUE;
++      else if (strcmp (arg, "--xid") == 0)
++        {
++    	  if (++i < argc)
++    	    {
++    	      g_xid = atoi(argv[i]);
++    	      npw_printf ("attaching to xid %d\n", g_xid);
++    	    }
++        }
+       else if (strcmp (arg, "--plugin") == 0)
+ 	{
+ 	  if (plugin_desc)
+@@ -2581,7 +2591,34 @@
+ 
+       g_timeout_add (100, (GSourceFunc)player_app_run, app);
+ 
+-      if (TRUE)
++      if (g_xid)
++        {
++	  GtkWidget *window = gtk_plug_new ((GdkNativeWindow)g_xid);
++	  if ((app->window = window) == NULL)
++	    g_error ("could not create plug widget - bad xid?");
++
++	  gtk_widget_set_size_request (window, display_width, display_height);
++	  gtk_widget_show (window);
++
++	  /* Ensure focus window is this window not gtk's proxy for non XEMBED case */
++	  XWindowAttributes xattrs;
++	  XGetWindowAttributes (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (window->window), &xattrs);
++	  XSelectInput (GDK_DISPLAY (),
++			GDK_WINDOW_XWINDOW (window->window),
++			xattrs.your_event_mask | SubstructureNotifyMask);
++	  gdk_window_add_filter (window->window, on_window_filter_cb, app);
++	  XSync (GDK_DISPLAY (), False);
++
++	  g_signal_connect (window, "destroy",
++			    G_CALLBACK (on_window_destroy_cb), NULL);
++	  g_signal_connect (window, "key-press-event",
++			    G_CALLBACK (on_key_press_event_cb), app);
++	  g_signal_connect (window, "configure-event",
++			    G_CALLBACK (on_configure_event_cb), app);
++	  g_signal_connect (window, "window-state-event",
++			    G_CALLBACK (on_window_state_event_cb), app);
++        }
++      else
+ 	{
+ 	  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ 	  if ((app->window = window) == NULL)
diff --git a/nspluginwrapper.spec b/nspluginwrapper.spec
index 6fc17b9..6a59875 100644
--- a/nspluginwrapper.spec
+++ b/nspluginwrapper.spec
@@ -73,7 +73,7 @@
 Summary:	A compatibility layer for Netscape 4 plugins
 Name:		nspluginwrapper
 Version:	1.3.0
-Release:	14%{?dist}
+Release:	15%{?dist}
 Source0:	http://gwenole.beauchesne.info/projects/nspluginwrapper/files/%{name}-%{version}%{?svndate:-%{svndate}}.tar.bz2
 Source1:	%{plugin_config_name}.tar.gz
 Source2:	plugin-config.sh.in
@@ -87,6 +87,7 @@ Patch6:		nspluginwrapper-1.3.0-compiz.patch
 Patch7:		nspluginwrapper-1.3.0-comp.patch
 Patch8:		nspluginwrapper-1.3.0-silent.patch
 Patch9:		nspluginwrapper-1.3.0-timeout.patch
+Patch10:	npplayer-xid.patch
 Patch100:	plugin-config-setuid.patch
 Patch101:	plugin-config-umask.patch
 Patch102:	plugin-config-print.patch
@@ -126,6 +127,7 @@ This package consists in:
 %patch7 -p1 -b .comp
 %patch8 -p1 -b .silent
 %patch9 -p1 -b .timeout
+%patch10 -p1 -b .xid
 
 # Plugin-config patches
 pushd %plugin_config_name
@@ -258,6 +260,10 @@ fi;
 
 
 %changelog
+* Thu Jan 6 2011 Martin Stransky <stransky at redhat.com> 1.3.0-15
+- added patch from rhbz#544992 - embed standalone npplayer 
+  in another program by Wade Brainerd.
+
 * Wed Jun 30 2010 Martin Stransky <stransky at redhat.com> 1.3.0-14
 - fixed patch for rhbz#523273
 


More information about the scm-commits mailing list