bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp
branchRCL_3
changeset 16 b23265fb36da
parent 0 f63038272f30
child 39 5a89845f78e2
--- a/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp	Wed Apr 14 16:09:00 2010 +0300
+++ b/bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp	Tue Apr 27 16:49:44 2010 +0300
@@ -96,9 +96,6 @@
     User::LeaveIfError(iWsSession.Connect());
     }
 
-
-
-
 CHidMouseDriver::~CHidMouseDriver()
     {
     DBG(RDebug::Print(_L("[HID]\t~CHidMouseDriver() 0x%08x"), this));
@@ -107,7 +104,7 @@
 
     if (iDriverState == EInitialised || iDriverState == EDisabled )
         {
-        RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorHide );
+        RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
         }
 
     iWsSession.Close();
@@ -176,7 +173,7 @@
 void CHidMouseDriver::Stop()
     {
     iDriverState = EDisabled;
-    RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorHide );
+    RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
     }
 
 //----------------------------------------------------------------------------
@@ -225,10 +222,18 @@
             {
             TInt mouseStatus;
             TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
-            if ( !err && (static_cast<THidMouseCursorState>(mouseStatus) == ECursorHide) )
+            if ( !err &&
+                ((static_cast<THidMouseCursorState>(mouseStatus) == ECursorRedraw)|| 
+                 (static_cast<THidMouseCursorState>(mouseStatus) == ECursorReset)) )
                 {
                 err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
+                DBG(RDebug::Print(
+                         _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
                 }
+
+
+            CursorRedraw();
+
             InterruptData(aPayload);
             }
         break;
@@ -381,6 +386,7 @@
             iButton2Down = ETrue;
             TRawEvent rawEvent;
             rawEvent.Set(TRawEvent::EKeyDown, EStdKeyApplication0);
+            CursorRedraw();
             UserSvr::AddEvent(rawEvent);
             }
         }
@@ -391,6 +397,7 @@
             iButton2Down = EFalse;
             TRawEvent rawEvent;
             rawEvent.Set(TRawEvent::EKeyUp, EStdKeyApplication0);
+            CursorRedraw();
             UserSvr::AddEvent(rawEvent);
             }
         }
@@ -476,4 +483,17 @@
     {
     iInputHandlingReg = aHandlingReg;
     }
+
+void CHidMouseDriver::CursorRedraw()
+    {
+    TInt mouseStatus;
+
+    TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
+    if ( !err )
+        {
+        err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorRedraw );
+        DBG(RDebug::Print(
+             _L("[BTHID]\tCHidMouseDriver::ForegroundEventL() X->ECursorRedraw") ) );
+        }
+    }
 // ----------------------------------------------------------------------