Changeset 33963 in vbox for trunk/src/VBox/Frontends/VBoxSDL
- Timestamp:
- Nov 11, 2010 10:23:42 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r33916 r33963 233 233 * Event handler for VirtualBox events 234 234 */ 235 class VBoxSDLEventListener : 236 VBOX_SCRIPTABLE_IMPL(IEventListener) 235 class VBoxSDLEventListener 237 236 { 238 237 public: 239 238 VBoxSDLEventListener() 240 239 { 241 #if defined(RT_OS_WINDOWS)242 refcnt = 0;243 #endif244 240 } 245 241 … … 248 244 } 249 245 250 #ifdef RT_OS_WINDOWS 251 STDMETHOD_(ULONG, AddRef)() 252 { 253 return ::InterlockedIncrement(&refcnt); 254 } 255 STDMETHOD_(ULONG, Release)() 256 { 257 long cnt = ::InterlockedDecrement(&refcnt); 258 if (cnt == 0) 259 delete this; 260 return cnt; 261 } 262 #endif 263 VBOX_SCRIPTABLE_DISPATCH_IMPL(IEventListener) 264 265 NS_DECL_ISUPPORTS 266 267 268 STDMETHOD(HandleEvent)(IEvent * aEvent) 269 { 270 VBoxEventType_T aType = VBoxEventType_Invalid; 271 272 aEvent->COMGETTER(Type)(&aType); 246 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent * aEvent) 247 { 273 248 switch (aType) 274 249 { … … 312 287 return S_OK; 313 288 } 314 315 private:316 #ifdef RT_OS_WINDOWS317 long refcnt;318 #endif319 320 289 }; 321 290 … … 323 292 * Event handler for machine events 324 293 */ 325 class VBoxSDLConsoleEventListener : 326 VBOX_SCRIPTABLE_IMPL(IEventListener) 294 class VBoxSDLConsoleEventListener 327 295 { 328 296 public: 329 297 VBoxSDLConsoleEventListener() : m_fIgnorePowerOffEvents(false) 330 298 { 331 #if defined(RT_OS_WINDOWS)332 refcnt = 0;333 #endif334 299 } 335 300 … … 338 303 } 339 304 340 #ifdef RT_OS_WINDOWS 341 STDMETHOD_(ULONG, AddRef)() 342 { 343 return ::InterlockedIncrement(&refcnt); 344 } 345 STDMETHOD_(ULONG, Release)() 346 { 347 long cnt = ::InterlockedDecrement(&refcnt); 348 if (cnt == 0) 349 delete this; 350 return cnt; 351 } 352 #endif 353 VBOX_SCRIPTABLE_DISPATCH_IMPL(IEventListener) 354 355 NS_DECL_ISUPPORTS 356 357 STDMETHOD(HandleEvent)(IEvent * aEvent) 358 { 359 VBoxEventType_T aType = VBoxEventType_Invalid; 360 361 aEvent->COMGETTER(Type)(&aType); 305 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent * aEvent) 306 { 362 307 // likely all this double copy is now excessive, and we can just use existing event object 363 308 // @todo: eliminate it … … 567 512 568 513 private: 569 #ifdef RT_OS_WINDOWS570 long refcnt;571 #endif572 514 bool m_fIgnorePowerOffEvents; 573 515 }; 574 516 575 #ifdef VBOX_WITH_XPCOM576 NS_DECL_CLASSINFO(VBoxSDLEventListener)577 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VBoxSDLEventListener, IEventListener)578 NS_DECL_CLASSINFO(VBoxSDLConsoleEventListener)579 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VBoxSDLConsoleEventListener, IEventListener)580 #endif /* VBOX_WITH_XPCOM */581 517 582 518 static void show_usage()
Note:
See TracChangeset
for help on using the changeset viewer.