Revision: 201029 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 13:39:03 +0300
branchRCL_3
changeset 186 1bc91eb0b8ae
parent 177 183e23d95fab
child 209 5c40347c6f16
Revision: 201029 Kit: 201036
fbs/fontandbitmapserver/sfbs/FBSBMP.CPP
fbs/fontandbitmapserver/sfbs/SESSION.CPP
fbs/fontandbitmapserver/utils/fbsbitmap_memory.pl
fbs/fontandbitmapserver/utils/fbsresource_count.pl
windowing/windowserver/nga/SERVER/EVENT.CPP
windowing/windowserver/tauto/TEVENT.H
windowing/windowserver/tauto/TEvent.CPP
--- a/fbs/fontandbitmapserver/sfbs/FBSBMP.CPP	Tue Sep 14 23:50:05 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSBMP.CPP	Wed Sep 15 13:39:03 2010 +0300
@@ -537,7 +537,7 @@
 	{
     FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD_ENTRY, "> this=0x%08x; file=%S, id=0x%08x; share=%d", (TUint)this, aFileName, aId, aShareIfLoaded);)
 	TInt err = Load(aFileName,aId,aShareIfLoaded,0);
-    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err; 
 	}
 
@@ -592,7 +592,7 @@
                 }
             }
 	    }
-    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD2_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD2_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err;
 	}
 
@@ -612,7 +612,7 @@
     {	
     FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, aFileName, aId, aShareIfLoaded);)
     TInt ret = LoadAndCompress(aFileName, aId, aShareIfLoaded, 0);
-    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS_EXIT, "< this=0x%08x; err=%d", (TUint)this, ret);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, ret, iHandle, iServerHandle);)
     return ret;
 	}
 
@@ -638,7 +638,7 @@
 		err = !(iFlags & EIsRomBitmap) ? Compress() : KErrAccessDenied;
 		FBS_OST_IF(err!=KErrNone, OstTraceExt3( TRACE_ERROR, CFBSBITMAP_LOADANDCOMPRESS2_ERROR, "! this=0x%08x; iFlags=0x%08x; err=%d", (TUint)this, (TUint)iFlags, err);)
 		}
-	FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS2_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
+	FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS2_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err;
 	}
 
@@ -1832,7 +1832,7 @@
     FBS_OST(aFile.FullName(fileName);)
     FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD3_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, fileName, aId, aShareIfLoaded);)
 	TInt ret = Load(aFile,aId,aShareIfLoaded,0);
-    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD3_EXIT, "< this=0x%08x, ret=%d", (TUint)this, ret);) 
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD3_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, ret, iHandle, iServerHandle);) 
 	return ret;
 	}
 
@@ -1871,7 +1871,7 @@
             FBS_OST_IF(err!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOAD4_ERROR2, "! this=0x%08x; DoLoad() returned %d", (TUint)this, err);)
             }
 	    }
-	FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD4_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
+	FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD4_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err;
 	}
 
@@ -1893,7 +1893,7 @@
     FBS_OST(aFile.FullName(fileName);)
     FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS3_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, fileName, aId, aShareIfLoaded);)      
 	TInt ret = LoadAndCompress(aFile,aId,aShareIfLoaded,0);
-    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS3_EXIT, "< this=0x%08x; ret=%d", (TUint)this, ret);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS3_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, ret, iHandle, iServerHandle);)
     return ret;
 	}
 
--- a/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Tue Sep 14 23:50:05 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Wed Sep 15 13:39:03 2010 +0300
@@ -179,7 +179,7 @@
     FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_DISCONNECT_ENTRY, "> this=0x%08x;", (TUint)thisptr);)
 	if(thisptr)
 	    {
-        TInt tempServerSessionHandle = thisptr->ServerSessionHandle();
+        FBS_OST(TInt tempServerSessionHandle = (thisptr->iHelper) ? thisptr->iHelper->iServerSessionHandle : 0;)
         if(thisptr->iConnections>0)
             {
             thisptr->iCallBack.iPtr=NULL;
@@ -193,6 +193,7 @@
                 }
             thisptr->iConnections--;
             }
+        FBS_OST(TInt tempConnectionCount = thisptr->iConnections;)
         if(thisptr->iConnections==0)
             {
             thisptr->iSharedChunk.Close();
@@ -208,7 +209,7 @@
             delete thisptr;
             Dll::FreeTls();	
             }
-        FBS_OST(OstTraceExt3(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_DISCONNECT_INFO, "# Disconnected from session; this=0x%08x; iConnections=%d; iSSH=0x%08x", (TInt)thisptr, thisptr->iConnections, tempServerSessionHandle);)
+        FBS_OST(OstTraceExt3(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_DISCONNECT_INFO, "# Disconnected from session; this=0x%08x; iConnections=%d; iSSH=0x%08x", (TInt)thisptr, tempConnectionCount, tempServerSessionHandle);)
 	    }
 	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_DISCONNECT_EXIT2, "< this=0x%08x;", (TUint)thisptr);)
 	}
--- a/fbs/fontandbitmapserver/utils/fbsbitmap_memory.pl	Tue Sep 14 23:50:05 2010 +0300
+++ b/fbs/fontandbitmapserver/utils/fbsbitmap_memory.pl	Wed Sep 15 13:39:03 2010 +0300
@@ -26,9 +26,6 @@
 #  and run this script against it. The resulting file can then be imported into
 #  a spreadsheet application to be visually processed.
 #  
-#  KNOWN DEFECTS:
-#  Once the log time goes beyond midnight, snapshots will stop being taken.
-#
 
 use strict;
 
@@ -38,6 +35,7 @@
    print "\nusage: $0 filename [-h]\n";
    print "where\n";
    print " -h : Specifies the heartbeat in millisecs (default=10000)\n";
+   print " -d : Ignore duplicated handles\n";
    exit;
 }
 
@@ -57,6 +55,7 @@
 ##
 my $heartBeatCount = 0;
 my $nextHeartBeatMS = -1;
+my $logLastLineTimeMS = 0;
 
 # A hash of thread names to the amount of bitmap memory they 
 # have used since the start of the trace.
@@ -73,6 +72,9 @@
 # Array of the above hashes, one hash per heartbeat.
 my @arrayOfSnapshots;
 
+# Count duplicated handles as memory used by a thread/process. 
+my $countDuplicates = 1;
+
 # Hashes of thread and process names to IDs.
 my %ThreadNames;
 my %ProcessNames;
@@ -89,6 +91,10 @@
    {
       $heartBeatMS = $1;
    }
+   elsif ($cma =~ m/-d/)
+   {
+      $countDuplicates = 0;
+   }
    else
    {
       print "Unrecognised parameter: $cma , ignoring...\n";
@@ -98,14 +104,13 @@
 ## Read from the file.
 ## Read the log into an array line by line.
 my $TRACE_FILENAME = $ARGV[0];
-open(INPUT_FILE, $TRACE_FILENAME) or die $!;
-my @traceLines = <INPUT_FILE>;
-
+open(INPUT_FILE, '<', $TRACE_FILENAME) or die $!;
+binmode(INPUT_FILE);
 
 ##
 ## Parse each line sequentially...
 ##
-foreach my $line (@traceLines)
+while ( my $line = <INPUT_FILE> )
 {
    my $timeFromMidnightMS;
 
@@ -144,26 +149,35 @@
    if ($line =~ /^(\d\d):(\d\d):(\d\d)\.(\d{3})/)
    {
       $timeFromMidnightMS = ((($1 * 3600) + ($2 * 60) + $3) * 1000) + $4;
-      # Set up the time for the first snapshot.
       if ($nextHeartBeatMS == -1) 
       {
-         $nextHeartBeatMS = $timeFromMidnightMS + $firstHeartBeatTimeMS;
+         $nextHeartBeatMS = $firstHeartBeatTimeMS;
+         $logLastLineTimeMS = $timeFromMidnightMS;
       }
-   }
+      ## We have wrapped around midnight!
+      ## Add a 1000ms cushion to the comparison to avoid wrapping around 
+      ## midnight if a trace is buffered too slowly.
+      if (($timeFromMidnightMS+1000) < $logLastLineTimeMS)
+      {
+         $timeFromMidnightMS += 86400000;
+      }
+      $nextHeartBeatMS -= ($timeFromMidnightMS - $logLastLineTimeMS);
+      $logLastLineTimeMS = $timeFromMidnightMS;
 
-   ##
-   ## If heartbeat reached, take snapshot of bmp memory per thread
-   ## and set next heartbeat time.
-   ##
-   while ($timeFromMidnightMS >= $nextHeartBeatMS)
-   {
-      $nextHeartBeatMS += $heartBeatMS;
-      # take a snapshot of the current bitmap memory usage per thread
-      while ((my $thread, my $bmpMemory) = each(%bmpMemoryPerThread))
+      ##
+      ## If heartbeat reached, take snapshot of bmp memory per thread
+      ## and set next heartbeat time.
+      ##
+      while ($nextHeartBeatMS <= 0)
       {
-           $arrayOfSnapshots[$heartBeatCount]{$thread} = $bmpMemory;
+         $nextHeartBeatMS += $heartBeatMS;
+         # take a snapshot of the current bitmap memory usage per thread
+         while ((my $thread, my $bmpMemory) = each(%bmpMemoryPerThread))
+         {
+              $arrayOfSnapshots[$heartBeatCount]{$thread} = $bmpMemory;
+         }
+         $heartBeatCount++;
       }
-      $heartBeatCount++;
    }
 
    ## FBS Client-side traces.
@@ -240,10 +254,21 @@
                $bmpMemoryByServerHandle{$newBmpIdentifier} = $bytes;
             }
          }
+         elsif ($line =~ m/# Server bitmap duplicated.*iH=(\w*);.*bytes=(\d+);/)
+         {
+            if ($countDuplicates == 1)
+            {
+               # When a bitmap is duplicated, the memory is 'owned' by all
+               # threads that duplicate it.
+               my $bmpHandle = $1;
+               my $bmpBytes = $2;
+               my $bmpIdentifier = "$FbsSessionHandle:$bmpHandle";
+               $bmpMemoryPerThread{$thread} += $bmpBytes;
+               $bmpMemoryByServerHandle{$bmpIdentifier} = $bmpBytes;
+            }
+         }
          elsif ($line =~ m/#.*iH=(\w*);.*bytes=(\d+);/)
          {
-            # Duplication of a bitmap typically. When a bitmap is duplicated,
-            # the memory is 'owned' by all threads that duplicate it.
             my $bmpHandle = $1;
             my $bmpBytes = $2;
             my $bmpIdentifier = "$FbsSessionHandle:$bmpHandle";
--- a/fbs/fontandbitmapserver/utils/fbsresource_count.pl	Tue Sep 14 23:50:05 2010 +0300
+++ b/fbs/fontandbitmapserver/utils/fbsresource_count.pl	Wed Sep 15 13:39:03 2010 +0300
@@ -25,9 +25,6 @@
 #  FBSCLI OST dictionary. Once tracing is gathered, save trace output as ascii 
 #  and run this script against it. The resulting file can then be imported into
 #  a spreadsheet application to be visually processed.
-#  
-#  KNOWN DEFECTS:
-#  Once the log time goes beyond midnight, snapshots will stop being taken.
 #
 
 use strict;
@@ -57,6 +54,7 @@
 ##
 my $heartBeatCount = 0;
 my $nextHeartBeatMS = -1;
+my $logLastLineTimeMS = 0;
 
 # Hash of FbsSessions to thread IDs.
 my %SessionThreadMap = ();
@@ -92,14 +90,13 @@
 ## Read from the file.
 ## Read the log into an array line by line.
 my $TRACE_FILENAME = $ARGV[0];
-open(INPUT_FILE, $TRACE_FILENAME) or die $!;
-my @traceLines = <INPUT_FILE>;
-
+open(INPUT_FILE, '<', $TRACE_FILENAME) or die $!;
+binmode(INPUT_FILE);
 
 ##
 ## Parse each line sequentially...
 ##
-foreach my $line (@traceLines)
+while ( my $line = <INPUT_FILE> )
 {
    my $timeFromMidnightMS;
 
@@ -138,26 +135,35 @@
    if ($line =~ /^(\d\d):(\d\d):(\d\d)\.(\d{3})/)
    {
       $timeFromMidnightMS = ((($1 * 3600) + ($2 * 60) + $3) * 1000) + $4;
-      # Set up the time for the first snapshot.
       if ($nextHeartBeatMS == -1) 
       {
-         $nextHeartBeatMS = $timeFromMidnightMS + $firstHeartBeatTimeMS;
+         $nextHeartBeatMS = $firstHeartBeatTimeMS;
+         $logLastLineTimeMS = $timeFromMidnightMS;
       }
-   }
+      ## We have wrapped around midnight!
+      ## Add a 1000ms cushion to the comparison to avoid wrapping around 
+      ## midnight if a trace is buffered too slowly.
+      if (($timeFromMidnightMS+1000) < $logLastLineTimeMS)
+      {
+         $timeFromMidnightMS += 86400000;
+      }
+      $nextHeartBeatMS -= ($timeFromMidnightMS - $logLastLineTimeMS);
+      $logLastLineTimeMS = $timeFromMidnightMS;
 
-   ##
-   ## If heartbeat reached, take snapshot of bmp memory per thread
-   ## and set next heartbeat time.
-   ##
-   while ($timeFromMidnightMS >= $nextHeartBeatMS)
-   {
-      $nextHeartBeatMS += $heartBeatMS;
-      # take a snapshot of the current bitmap memory usage per thread
-      while ((my $thread, my $fbsResourceCount) = each(%fbsResourcesPerThread))
+      ##
+      ## If heartbeat reached, take snapshot of bmp memory per thread
+      ## and set next heartbeat time.
+      ##
+      while ($nextHeartBeatMS <= 0)
       {
-           $arrayOfSnapshots[$heartBeatCount]{$thread} = $fbsResourceCount;
+         $nextHeartBeatMS += $heartBeatMS;
+         # take a snapshot of the current bitmap memory usage per thread
+         while ((my $thread, my $fbsResourceCount) = each(%fbsResourcesPerThread))
+         {
+            $arrayOfSnapshots[$heartBeatCount]{$thread} = $fbsResourceCount;
+         }
+         $heartBeatCount++;
       }
-      $heartBeatCount++;
    }
 
    ## FBS Client-side traces.
--- a/windowing/windowserver/nga/SERVER/EVENT.CPP	Tue Sep 14 23:50:05 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVENT.CPP	Wed Sep 15 13:39:03 2010 +0300
@@ -970,6 +970,9 @@
 // Event has completed.
 //
 	{
+    TRawEvent::TType eventType = aRawEvent.Type();
+    TBool isPointerEvent = TWsPointer::IsPointerEventType(eventType);
+   
     TBool pauseProcessEvents = EFalse;
     //Check if the pause in processing all raw pointer and key events was set.
     if(iPauseInterval.Int64() > 0)
@@ -986,7 +989,7 @@
             {
             // Set flag ignore of processing all raw events (except processing by anim's dll plug-ins)
             // All events will be ignored except for anim's dll plug-ins.
-            pauseProcessEvents = ETrue;
+            pauseProcessEvents = isPointerEvent;
             }
         }
 
@@ -997,8 +1000,6 @@
         RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Processing of Raw Event - ENABLED");
 #endif
     
-	TRawEvent::TType eventType = aRawEvent.Type();
-	TBool isPointerEvent = TWsPointer::IsPointerEventType(eventType);
 	if (isPointerEvent)
 		{
 #ifdef LOG_WSERV_EVENTS
--- a/windowing/windowserver/tauto/TEVENT.H	Tue Sep 14 23:50:05 2010 +0300
+++ b/windowing/windowserver/tauto/TEVENT.H	Wed Sep 15 13:39:03 2010 +0300
@@ -334,6 +334,7 @@
 	inline void SimulatePointerWin(TRawEvent::TType aType, TInt aX, TInt aY);
 	inline void SimulatePointerDownUpWin(TInt aX, TInt aY);
 	inline void SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY);
+	inline void SimulatePointer(TRawEvent::TType aType, TPoint aPoint);
 	void doSendEvent(TWsEvent &aEvent);
 	void SendKey(TInt aEventCode, TInt aScanCode, TInt aCode=0, TInt iRepeats=0);
 	void SendEvent(TInt aEventCode);
--- a/windowing/windowserver/tauto/TEvent.CPP	Tue Sep 14 23:50:05 2010 +0300
+++ b/windowing/windowserver/tauto/TEvent.CPP	Wed Sep 15 13:39:03 2010 +0300
@@ -1061,6 +1061,11 @@
     iTest->SimulatePointer(aType,aX,aY+iYOffset);
     }
 
+void CTEventTest::SimulatePointer(TRawEvent::TType aType, TPoint aPoint)
+    {
+    SimulatePointer(aType,aPoint.iX,aPoint.iY);
+    }
+
 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
 void CTEventTest::SimulateButton1DownWithSimulatedMove(TInt aX, TInt aY)
 	{
@@ -1832,44 +1837,79 @@
 
 void CTEventTest::InvisibleWindow_NextSetOfEvents()
 	{
+    const TPoint winpos(EWinPositionX, EWinPositionY);    
+    
 	switch(iEventSet++)
 		{
 		case 0:
-			SimulatePointer(TRawEvent::EButton1Down,45,30);
-			SimulatePointer(TRawEvent::EButton1Up,45,30);
-			SimulatePointer(TRawEvent::EButton1Down,20,10);
-			SimulatePointer(TRawEvent::EButton1Up,20,10);
+		    {
+		    TPoint p1(45,30);
+		    TPoint p2(20,10);
+		    TPoint p3(46,31);
+		    
+			SimulatePointer(TRawEvent::EButton1Down, p1);
+			SimulatePointer(TRawEvent::EButton1Up, p1);
+			SimulatePointer(TRawEvent::EButton1Down, p2);
+			SimulatePointer(TRawEvent::EButton1Up, p2);
 			TheClient->iWs.Flush();
 			iQueueClient->iChildWin->BaseWin()->SetVisible(EFalse);
 			iQueueClient->iChildWin->BaseWin()->SetVisible(ETrue);
 			iQueueClient->iWs.Flush();
-			SimulatePointer(TRawEvent::EButton1Down,46,31);
-			SimulatePointer(TRawEvent::EButton1Up,46,31);
+			SimulatePointer(TRawEvent::EButton1Down, p3);
+			SimulatePointer(TRawEvent::EButton1Up, p3);
 			AddExpectedEvent(EEventFocusGained);
-			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY));
+			
+			// adjust expected pointer coordinates for window position			
+			p1-=winpos;
+			p2-=winpos;
+			p3-=winpos;
+			
+			// p1 expected post ou1cimx1#460496, previously queued events were deleted when a window was made invisible.
+			AddExpectedPointer(TPointerEvent::EButton1Down, p1);
+            AddExpectedPointer(TPointerEvent::EButton1Up, p1);			
+			AddExpectedPointer(TPointerEvent::EButton1Down, p2);
+			AddExpectedPointer(TPointerEvent::EButton1Up, p2);
+			AddExpectedPointer(TPointerEvent::EButton1Down, p3);
+			AddExpectedPointer(TPointerEvent::EButton1Up, p3);
+		    }
 			break;
 		case 1:
-			SimulatePointer(TRawEvent::EButton1Down,21,11);
-			SimulatePointer(TRawEvent::EButton1Up,21,11);
-			SimulatePointer(TRawEvent::EButton1Down,44,30);
-			SimulatePointer(TRawEvent::EButton1Up,44,30);
+		    {
+		    TPoint p1(21,11);
+		    TPoint p2(44,30);
+		    TPoint p3(19,12);
+		    TPoint p4(47,32);
+		    
+			SimulatePointer(TRawEvent::EButton1Down, p1);
+			SimulatePointer(TRawEvent::EButton1Up, p1);
+			SimulatePointer(TRawEvent::EButton1Down, p2);
+			SimulatePointer(TRawEvent::EButton1Up, p2);
 			TheClient->iWs.Flush();
 			iQueueClient->iWin->BaseWin()->SetVisible(EFalse);
 			iQueueClient->iWin->BaseWin()->SetVisible(ETrue);
 			iQueueClient->iWs.Flush();
-			SimulatePointer(TRawEvent::EButton1Down,19,12);
-			SimulatePointer(TRawEvent::EButton1Up,19,12);
-			SimulatePointer(TRawEvent::EButton1Down,47,32);
-			SimulatePointer(TRawEvent::EButton1Up,47,32);
-			/*AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(44-EWinPositionX,30-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(44-EWinPositionX,30-EWinPositionY));*/
-			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(19-EWinPositionX,12-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(19-EWinPositionX,12-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY));
-			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY));
+			SimulatePointer(TRawEvent::EButton1Down, p3);
+			SimulatePointer(TRawEvent::EButton1Up, p3);
+			SimulatePointer(TRawEvent::EButton1Down, p4);
+			SimulatePointer(TRawEvent::EButton1Up, p4);
+			
+            // adjust expected pointer coordinates for window position          
+            p1-=winpos;
+            p2-=winpos;
+            p3-=winpos;
+            p4-=winpos;
+			
+            // p1 expected post ou1cimx1#460496, previously queued events were deleted when a window was made invisible.            
+            AddExpectedPointer(TPointerEvent::EButton1Down, p1);
+            AddExpectedPointer(TPointerEvent::EButton1Up, p1);
+            // p2 expected post ou1cimx1#460496, previously queued events were deleted when a window was made invisible.
+			AddExpectedPointer(TPointerEvent::EButton1Down, p2);
+			AddExpectedPointer(TPointerEvent::EButton1Up, p2);
+			AddExpectedPointer(TPointerEvent::EButton1Down, p3);
+			AddExpectedPointer(TPointerEvent::EButton1Up, p3);
+			AddExpectedPointer(TPointerEvent::EButton1Down, p4);
+			AddExpectedPointer(TPointerEvent::EButton1Up, p4);
+		    }
 			break;
 		default:
 			CActiveScheduler::Stop();