mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-04 06:31:54 +00:00 
			
		
		
		
	[client] x11: don't allow window manager events to skew cal timing
This commit is contained in:
		@@ -674,6 +674,8 @@ static int x11EventThread(void * unused)
 | 
			
		||||
 | 
			
		||||
      case ConfigureNotify:
 | 
			
		||||
      {
 | 
			
		||||
        atomic_store(&x11.lastWMEvent, microtime());
 | 
			
		||||
 | 
			
		||||
        int x, y;
 | 
			
		||||
 | 
			
		||||
        /* the window may have been re-parented so we need to translate to
 | 
			
		||||
@@ -707,6 +709,7 @@ static int x11EventThread(void * unused)
 | 
			
		||||
 | 
			
		||||
      case Expose:
 | 
			
		||||
      {
 | 
			
		||||
        atomic_store(&x11.lastWMEvent, microtime());
 | 
			
		||||
        app_invalidateWindow(false);
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
@@ -1227,7 +1230,9 @@ static bool x11WaitFrame(void)
 | 
			
		||||
  lastmsc = msc;
 | 
			
		||||
 | 
			
		||||
  /* adjustments if we are still seeing odd skips */
 | 
			
		||||
  if (delay > 0 && deltamsc > 1)
 | 
			
		||||
  const uint64_t lastWMEvent = atomic_load(&x11.lastWMEvent);
 | 
			
		||||
  const uint64_t eventDelta = ust > lastWMEvent ? ust - lastWMEvent : 0;
 | 
			
		||||
  if (delay > 0 && deltamsc > 1 && eventDelta > 1000000UL)
 | 
			
		||||
  {
 | 
			
		||||
    /* only adjust if the last skip was less then 1s ago */
 | 
			
		||||
    static uint64_t lastSkip = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,8 @@ struct X11DSState
 | 
			
		||||
  Window        window;
 | 
			
		||||
  XVisualInfo * visual;
 | 
			
		||||
 | 
			
		||||
  _Atomic(uint64_t) lastWMEvent;
 | 
			
		||||
 | 
			
		||||
  int               xpresentOp;
 | 
			
		||||
  bool              jitRender;
 | 
			
		||||
  _Atomic(uint64_t) presentMsc, presentUst;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user