Changeset 522 in vbox for trunk/src/VBox
- Timestamp:
- Feb 1, 2007 9:30:27 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxSDL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r516 r522 140 140 static int HandleHostKey(const SDL_KeyboardEvent *pEv); 141 141 static Uint32 StartupTimer(Uint32 interval, void *param); 142 static Uint32 ResizeTimer(Uint32 interval, void *param); 142 143 143 144 … … 188 189 static WMcursor *gpCustomOrigWMcursor = NULL; 189 190 static SDL_Cursor *gpOffCursor = NULL; 191 static SDL_TimerID gSdlResizeTimer = NULL; 190 192 191 193 #ifdef __LINUX__ … … 2244 2246 case SDL_ACTIVEEVENT: 2245 2247 { 2246 /**2247 * @todo This is a workaround for synchronization problems between EMT and the2248 * SDL main thread. It can happen that the SDL thread already starts a2249 * new resize operation while the EMT is still busy with the old one2250 * leading to a deadlock. Therefore we call SetVideoModeHint only once2251 * when the mouse button was released.2252 */2253 if (uResizeWidth != ~(uint32_t)0)2254 {2255 /* communicate the resize event to the guest */2256 gDisplay->SetVideoModeHint(uResizeWidth, uResizeHeight, 0);2257 uResizeWidth = ~(uint32_t)0;2258 }2259 2260 2248 /* 2261 2249 * There is a strange behaviour in SDL when running without a window … … 2287 2275 uResizeHeight = event.resize.h; 2288 2276 #endif 2277 if (gSdlResizeTimer) 2278 SDL_RemoveTimer(gSdlResizeTimer); 2279 gSdlResizeTimer = SDL_AddTimer(300, ResizeTimer, NULL); 2289 2280 } 2290 2281 break; … … 2321 2312 #undef DECODEH 2322 2313 break; 2314 } 2315 2316 /* 2317 * User event: Window resize done 2318 */ 2319 case SDL_USER_EVENT_WINDOW_RESIZE_DONE: 2320 { 2321 /** 2322 * @todo This is a workaround for synchronization problems between EMT and the 2323 * SDL main thread. It can happen that the SDL thread already starts a 2324 * new resize operation while the EMT is still busy with the old one 2325 * leading to a deadlock. Therefore we call SetVideoModeHint only once 2326 * when the mouse button was released. 2327 */ 2328 /* communicate the resize event to the guest */ 2329 gDisplay->SetVideoModeHint(uResizeWidth, uResizeHeight, 0); 2330 break; 2331 2323 2332 } 2324 2333 … … 3817 3826 return interval; 3818 3827 } 3828 3829 /** 3830 * Timer callback function to check if resizing is finished 3831 */ 3832 static Uint32 ResizeTimer(Uint32 interval, void *param) 3833 { 3834 /* post message so the window is actually resized */ 3835 SDL_Event event = {0}; 3836 event.type = SDL_USEREVENT; 3837 event.user.type = SDL_USER_EVENT_WINDOW_RESIZE_DONE; 3838 SDL_PushEvent(&event); 3839 /* one-shot */ 3840 return 0; 3841 } -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.h
r1 r522 47 47 /** custom SDL user event for resetting mouse cursor */ 48 48 #define SDL_USER_EVENT_GUEST_CAP_CHANGED (SDL_USEREVENT + 12) 49 /** custom SDL user event for window resize down */ 50 #define SDL_USER_EVENT_WINDOW_RESIZE_DONE (SDL_USEREVENT + 13) 49 51 50 52
Note:
See TracChangeset
for help on using the changeset viewer.