Changeset 18994 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Apr 17, 2009 2:24:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/autoresize.cpp
r18938 r18994 65 65 } 66 66 67 /** This thread just runs a dummy X11 event loop to be sure that we get 68 * terminated should the X server exit. */ 69 static int x11ConnectionMonitor(RTTHREAD, void *) 70 { 71 XEvent ev; 72 Display *pDisplay = XOpenDisplay(NULL); 73 while (true) 74 XNextEvent(pDisplay, &ev); 75 } 76 67 77 /** 68 78 * Display change request monitor thread function. … … 75 85 { 76 86 LogFlowFunc(("\n")); 77 /* Keep an open display so that we terminate if X11 does. */78 Display *pDisplay = XOpenDisplay(NULL);79 87 uint32_t cx0 = 0, cy0 = 0, cBits0 = 0, iDisplay0 = 0; 80 int rc = VbglR3GetLastDisplayChangeRequest(&cx0, &cy0, &cBits0, &iDisplay0); 88 int rc = RTThreadCreate(NULL, x11ConnectionMonitor, NULL, 0, 89 RTTHREADTYPE_INFREQUENT_POLLER, 0, "X11 monitor"); 90 if (RT_FAILURE(rc)) 91 return rc; 92 VbglR3GetLastDisplayChangeRequest(&cx0, &cy0, &cBits0, &iDisplay0); 81 93 while (true) 82 94 { 83 95 uint32_t cx = 0, cy = 0, cBits = 0, iDisplay = 0; 84 96 rc = VbglR3DisplayChangeWaitEvent(&cx, &cy, &cBits, &iDisplay); 85 /* Make sure we are still connected to X. If the X server has86 * terminated then we should get a resize event above. */87 XPending(pDisplay);88 97 /* Ignore the request if it is stale */ 89 if ((cx != cx0) || (cy != cy0) )98 if ((cx != cx0) || (cy != cy0) || RT_FAILURE(rc)) 90 99 { 91 100 /* If we are not stopping, sleep for a bit to avoid using up too … … 100 109 cy0 = 0; 101 110 } 102 XCloseDisplay(pDisplay);103 111 LogFlowFunc(("returning VINF_SUCCESS\n")); 104 112 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.