Browse Source

Fix X11 flicker when window is being resized (#2203)

kingscallop 5 years ago
parent
commit
988077804f
1 changed files with 4 additions and 13 deletions
  1. 4 13
      examples/common/entry/entry_x11.cpp

+ 4 - 13
examples/common/entry/entry_x11.cpp

@@ -354,8 +354,9 @@ namespace entry
 			m_root   = RootWindow(m_display, screen);
 			m_root   = RootWindow(m_display, screen);
 
 
 			bx::memSet(&m_windowAttrs, 0, sizeof(m_windowAttrs) );
 			bx::memSet(&m_windowAttrs, 0, sizeof(m_windowAttrs) );
-			m_windowAttrs.background_pixmap = 0;
+			m_windowAttrs.background_pixel = 0;
 			m_windowAttrs.border_pixel = 0;
 			m_windowAttrs.border_pixel = 0;
+			m_windowAttrs.bit_gravity = StaticGravity;
 			m_windowAttrs.event_mask = 0
 			m_windowAttrs.event_mask = 0
 					| ButtonPressMask
 					| ButtonPressMask
 					| ButtonReleaseMask
 					| ButtonReleaseMask
@@ -374,15 +375,10 @@ namespace entry
 									, m_depth
 									, m_depth
 									, InputOutput
 									, InputOutput
 									, m_visual
 									, m_visual
-									, CWBorderPixel|CWEventMask
+									, CWBorderPixel|CWEventMask|CWBackPixel|CWBitGravity
 									, &m_windowAttrs
 									, &m_windowAttrs
 									);
 									);
 
 
-			// Clear window to black.
-			XSetWindowAttributes attr;
-			bx::memSet(&attr, 0, sizeof(attr) );
-			XChangeWindowAttributes(m_display, m_window[0], CWBackPixel, &attr);
-
 			const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
 			const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
 			Atom wmDeleteWindow;
 			Atom wmDeleteWindow;
 			XInternAtoms(m_display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow);
 			XInternAtoms(m_display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow);
@@ -599,16 +595,11 @@ namespace entry
 									, m_depth
 									, m_depth
 									, InputOutput
 									, InputOutput
 									, m_visual
 									, m_visual
-									, CWBorderPixel|CWEventMask
+									, CWBorderPixel|CWEventMask|CWBackPixel|CWBitGravity
 									, &m_windowAttrs
 									, &m_windowAttrs
 									);
 									);
 			m_window[_handle.idx] = window;
 			m_window[_handle.idx] = window;
 
 
-			// Clear window to black.
-			XSetWindowAttributes attr;
-			bx::memSet(&attr, 0, sizeof(attr) );
-			XChangeWindowAttributes(m_display, window, CWBackPixel, &attr);
-
 			const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
 			const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
 			Atom wmDeleteWindow;
 			Atom wmDeleteWindow;
 			XInternAtoms(m_display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow);
 			XInternAtoms(m_display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow);