XWorkstation.st
branchjv
changeset 7137 7a13ed1d9309
parent 7128 e49af1b43177
child 7143 e216536ea990
--- a/XWorkstation.st	Sat Feb 06 07:50:26 2016 +0000
+++ b/XWorkstation.st	Wed Feb 10 10:32:15 2016 +0000
@@ -68,7 +68,7 @@
 
 #ifdef LINUX
 # ifndef __arm__
-#  define SHM
+#  define SHM 
 # endif
 #endif
 
@@ -328,7 +328,6 @@
 # endif
 #endif /* SUPPORT_OPENLOOCK_WM_HINTS */
 
-
 %}
 ! !
 
@@ -346,6 +345,19 @@
 
 #define DPRINTF(x)      if (__debug__) { console_printf x; }
 
+
+/* Some libraries, notably Cairo uses MIT-SHM extension 
+ * that sends back ShmCompletion event. Such event needs
+ * to be silently ignored. 
+ * However, since it comes from an extension, the event type
+ * must be queried. To avoid a query each time we get it, 
+ * cache the value in a variable. 
+ */
+#ifdef SHM
+static int ShmCompletionType = -1;
+#endif
+
+
 %}
 ! !
 
@@ -5438,6 +5450,13 @@
     "ignored for now"
 
     "/ aView resizeRequest
+
+!
+
+shmCompletion: aView
+    "ignored for now"
+
+
 ! !
 
 !XWorkstation methodsFor:'event handling'!
@@ -6248,9 +6267,15 @@
 	    __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
 	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
 	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
-	    break;
+	    break;	   
 
 	default:
+#ifdef SHM
+	    if (ev.type == ShmCompletionType) {
+	        __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(shmCompletion:);
+	        break;
+	    }
+#endif
 	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
 	    break;
     }
@@ -9239,7 +9264,14 @@
 		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
 	    }
 	}
-    }
+
+    }
+#ifdef SHM
+    if (__INST(hasShmExtension) == true) {
+        ShmCompletionType = XShmGetEventBase(dpy) + ShmCompletion;
+    }
+#endif    
+
 %}.
 !
 
@@ -9591,14 +9623,14 @@
 querySHMExtension
 %{  /* NOCONTEXT */
 
-#ifdef xxSHM
+#ifdef SHM
     if (ISCONNECTED) {
 	Display *dpy;
 	int dummy;
 
 	dpy = myDpy;
 
-	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
+	if (XQueryExtension(dpy, "MIT-SHM", &dummy, &dummy, &dummy)) {
 	    RETURN ( true );
 	}
     }