Redrawing issue when XSHM is not available

Hi Jules,

 

There is a redrawing issue (gui no more repainted) when , for some reason, isShmAvailable returns false. Here is a patch that fixes that:

 

 

            if (XShmQueryVersion (display, &major, &minor, &pixmaps))
@@ -1327,7 +1337,7 @@ public:

             default:
                #if JUCE_USE_XSHM
-                {
+               if (XSHMHelpers::isShmAvailable()) {
                     ScopedXLock xlock;
                     if (event.xany.type == XShmGetEventBase (display))
                         repainter->notifyPaintCompleted();
@@ -1902,7 +1912,7 @@ private:
                 for (const Rectangle<int>* i = originalRepaintRegion.begin(), * const e = originalRepaintRegion.end(); i != e; ++i)
                 {
                    #if JUCE_USE_XSHM
-                    ++shmPaintsPending;
+                      if (XSHMHelpers::isShmAvailable()) ++shmPaintsPending;
                    #endif

                     static_cast<XBitmapImage*> (image.getPixelData())
@@ -1912,12 +1922,13 @@ private:
                 }
             }

+^M
             lastTimeImageUsed = Time::getApproximateMillisecondCounter();
             startTimer (repaintTimerPeriod);
         }

        #if JUCE_USE_XSHM
-        void notifyPaintCompleted() noexcept        { --shmPaintsPending; }
+        void notifyPaintCompleted() noexcept        { if (XSHMHelpers::isShmAvailable()) --shmPaintsPending; }
        #endif

 

Thanks, I'll sort that out!