summaryrefslogtreecommitdiff
path: root/www/nspluginwrapper-devel/files/patch-ignore-flash-button3
blob: 1788efb06ed545b12c4d640f76cebb05c8da44db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- src/npw-wrapper.c.orig	2009-01-02 09:22:29.000000000 -0500
+++ src/npw-wrapper.c	2011-03-31 12:34:33.000000000 -0400
@@ -2560,6 +2561,35 @@
   return ret;
 }
 
+#define	NPW_ADOBE_FLASH_PLUGIN	"Shockwave Flash"
+
+struct flash_version {
+  unsigned int	major;
+  unsigned int	minor;
+};
+
+// Detect Adobe Flash plugin version
+static void adobe_flash_version(struct flash_version *vers)
+{
+  static struct flash_version fv = { 0, 0 };
+  static bool tested = false;
+
+  if (!tested) {
+	if (g_plugin.name != NULL && g_plugin.description != NULL &&
+	    strcmp(g_plugin.name, NPW_ADOBE_FLASH_PLUGIN) == 0 &&
+	    strncmp(g_plugin.description, NPW_ADOBE_FLASH_PLUGIN,
+	    strlen(NPW_ADOBE_FLASH_PLUGIN)) == 0) {
+		char *ptr, *endp;
+		ptr = g_plugin.description + strlen(NPW_ADOBE_FLASH_PLUGIN);
+		fv.major = strtol(ptr, &endp, 10);
+		if (*endp == '.')
+			fv.minor = strtol(endp + 1, NULL, 10);
+	}
+	tested = true;
+  }
+  *vers = fv;
+}
+
 static int16 g_NPP_HandleEvent(NPP instance, void *event)
 {
   if (instance == NULL)
@@ -2569,6 +2599,16 @@
   if (plugin == NULL)
 	return NPERR_INVALID_INSTANCE_ERROR;
 
+  if (((NPEvent *)event)->type == ButtonPress && ((XButtonEvent *)event)->button == Button3) {
+	static struct flash_version vers;
+	adobe_flash_version(&vers);
+	/* XXX: work around "right click" hang with Flash plugin 10.1 and later */
+	if ((vers.major == 10 && vers.minor >= 1) || vers.major > 10) {
+		D(bug("NPP_HandleEvent instance=%p, ignoring ButtonPress event for "
+		    NPW_ADOBE_FLASH_PLUGIN " %u.%u\n", instance, vers.major, vers.minor));
+		return false;
+	}
+  }
   if (((NPEvent *)event)->type == GraphicsExpose) {
 	/* XXX: flush the X output buffer so that the call to
 	   gdk_pixmap_foreign_new() in the viewer can work */