windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp
changeset 194 18f84489a694
parent 152 9f1c3fea0f87
equal deleted inserted replaced
183:6a1564a2f3e6 194:18f84489a694
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   509 		{
   509 		{
   510 		iRel.Move(offset);
   510 		iRel.Move(offset);
   511 		RecalcChildAbs(&offset);      // Also calls UpdateElementExtent(offset)
   511 		RecalcChildAbs(&offset);      // Also calls UpdateElementExtent(offset)
   512 		TWalkWindowTreeOffsetTransparentRegions offsetTransparent(offset);
   512 		TWalkWindowTreeOffsetTransparentRegions offsetTransparent(offset);
   513 		WalkWindowTree(offsetTransparent, EWalkChildren);
   513 		WalkWindowTree(offsetTransparent, EWalkChildren);
       
   514 		
       
   515 		// move the pointer region
       
   516 		if(iPointerRegion)
       
   517 		    iPointerRegion->Offset(offset);
   514 		}
   518 		}
   515 
   519 
   516 	if (sizeChanged)
   520 	if (sizeChanged)
   517 		{
   521 		{
   518 		iRel.SetSize(newSize);
   522 		iRel.SetSize(newSize);
   642 	if (iParent)				// In case window wasn't fully constructed
   646 	if (iParent)				// In case window wasn't fully constructed
   643 		ResetHiddenFlags();
   647 		ResetHiddenFlags();
   644 //
   648 //
   645 	CWsWindow::Shutdown();
   649 	CWsWindow::Shutdown();
   646 	DeleteBaseArea();
   650 	DeleteBaseArea();
       
   651 	DeletePointerRegion();
   647 	CWsPointerBuffer::Disconnect(this);
   652 	CWsPointerBuffer::Disconnect(this);
   648 	iFlags&=~EFlagShutDownInProgress;
   653 	iFlags&=~EFlagShutDownInProgress;
   649 	}
   654 	}
   650 
   655 
   651 void CWsClientWindow::Activate()
   656 void CWsClientWindow::Activate()
  1026 				if (windowTreeObserver)
  1031 				if (windowTreeObserver)
  1027 					{
  1032 					{
  1028 					windowTreeObserver->FlagChanged(*this, MWsWindowTreeObserver::EAlphaChannelTransparencyEnabled, ETrue);
  1033 					windowTreeObserver->FlagChanged(*this, MWsWindowTreeObserver::EAlphaChannelTransparencyEnabled, ETrue);
  1029 					}
  1034 					}
  1030 				break;
  1035 				break;
  1031 				}			
  1036 			case EWsWinOpSetPointerAcceptanceRegion:
       
  1037 			    {
       
  1038                 TInt recs=*pData.Int;
       
  1039                 
       
  1040                 // Use cases
       
  1041                 // No Region => normal behaviour using window rect ( but how can we delete an existing region? )
       
  1042                 // Empty Region => no pointer events will hit                
       
  1043                 // Non-Empty region => pointer events must hit the defined region
       
  1044                                
       
  1045                 // allow for 0 rects, empty region implies no pointer events will hit
       
  1046                 RWsRegion* region=recs>0 ? GetRegionFromClientL(iWsOwner,recs) : new(ELeave) RWsRegion;			    
       
  1047                 
       
  1048                 // CWsClientWindow takes ownership of returned region
       
  1049                 SetPointerAcceptanceRegion(region);
       
  1050 			    }
       
  1051                 break;
  1032 			default:
  1052 			default:
  1033 				if (iRedraw->CommandL(aOpcode,pData)==EFalse)
  1053 				if (iRedraw->CommandL(aOpcode,pData)==EFalse)
  1034 					{
  1054 					{
  1035 					OwnerPanic(EWservPanicOpcode);
  1055 					OwnerPanic(EWservPanicOpcode);
  1036 					}
  1056 					}
  1392 
  1412 
  1393 TRect CWsClientWindow::GetOriginalSrcElementRect() const
  1413 TRect CWsClientWindow::GetOriginalSrcElementRect() const
  1394     {
  1414     {
  1395     return iOriginalSrcElementRect;
  1415     return iOriginalSrcElementRect;
  1396     }
  1416     }
       
  1417 
  1397 TRect CWsClientWindow::GetOriginalDestElementRect() const
  1418 TRect CWsClientWindow::GetOriginalDestElementRect() const
  1398     {
  1419     {
  1399     return iOriginalDestElementRect;
  1420     return iOriginalDestElementRect;
  1400     }
  1421     }
       
  1422 
       
  1423 /** Sets a region of a window that can receive pointer events.
       
  1424 
       
  1425 Once this region is set, pointer events must be within both this region and the window's base area to be received. 
       
  1426 If an empty pointer acceptance region is set, then no pointer events will be received.
       
  1427 Prior to calling this API the whole base area of the window can receive pointer events.
       
  1428 
       
  1429 If a window is moved, the pointer acceptance region will move with it.
       
  1430 
       
  1431 If a window changes shape, and the pointer acceptance region should also change shape with it,
       
  1432 then the client must use this API to re-set the pointer acceptance region.
       
  1433  
       
  1434 This function always causes a flush of the window server buffer.
       
  1435 
       
  1436 @param aRegion Region defining the pointer acceptance region shape in window relative coordinates, CWsClientWindow takes ownership of this.   
       
  1437 */
       
  1438 void CWsClientWindow::SetPointerAcceptanceRegion(RWsRegion* aRegion)
       
  1439     {
       
  1440 #ifdef LOG_WSERV_EVENTS
       
  1441     if(aRegion)
       
  1442         {
       
  1443         TRect boundingRect = aRegion->BoundingRect();
       
  1444         RDebug::Printf("_WSEVENT: CWsClientWindow::SetPointerRegion Rect Count=%d, bounding rect (%d,%d),(%d,%d)",
       
  1445                 aRegion->Count(),
       
  1446                 boundingRect.iTl.iX, boundingRect.iTl.iY,
       
  1447                 boundingRect.iBr.iX, boundingRect.iBr.iY);
       
  1448         }
       
  1449     else
       
  1450         {
       
  1451         // This should probably NEVER be seen because the client side RWindowBase API takes a reference.
       
  1452         RDebug::Printf("_WSEVENT: CWsClientWindow::SetPointerRegion aRegion is NULL");        
       
  1453         }
       
  1454 #endif    
       
  1455     DeletePointerRegion();
       
  1456             
       
  1457     // take ownership
       
  1458     iPointerRegion = aRegion;
       
  1459     // move it to the same absolute origin as the window
       
  1460     if(iPointerRegion)
       
  1461         iPointerRegion->Offset(Origin());
       
  1462     // N.B. Does NOT need to be clipped while iBaseArea is also used.    
       
  1463     }
       
  1464 
       
  1465 void CWsClientWindow::DeletePointerRegion()
       
  1466     {
       
  1467     if (iPointerRegion)
       
  1468         {
       
  1469         iPointerRegion->Destroy();
       
  1470         iPointerRegion = NULL;
       
  1471         }
       
  1472     }
       
  1473 
       
  1474 /* Checks if a point is should be considered to be within this window or not.
       
  1475 
       
  1476 For a hit Point must be within the window's base area, and also within the pointer acceptance region if it exists.
       
  1477 
       
  1478 @param aPoint The coordinates to test for a hit
       
  1479 @return ETrue for a hit, EFalse for a miss
       
  1480 */
       
  1481 TBool CWsClientWindow::PointerHit(const TPoint& aPoint) const
       
  1482     {
       
  1483     TBool isHit = EFalse;
       
  1484       
       
  1485     if(iBaseArea->Contains(aPoint))
       
  1486         {
       
  1487         if(iPointerRegion)
       
  1488             {
       
  1489             isHit =  iPointerRegion->TRegion::Contains(aPoint);
       
  1490             }
       
  1491         else
       
  1492             {
       
  1493             // there is no pointer region, so default to using the base area only
       
  1494             isHit = ETrue;
       
  1495             }
       
  1496         }
  1401     
  1497     
       
  1498     return isHit;
       
  1499     }
       
  1500 
  1402 //
  1501 //
  1403 // Code for CWsTopClientWindow, a client window that connects to a group window //
  1502 // Code for CWsTopClientWindow, a client window that connects to a group window //
  1404 //
  1503 //
  1405 
  1504 
  1406 CWsTopClientWindow::CWsTopClientWindow(CWsClient* aOwner, CScreen* aScreen) : CWsClientWindow(aOwner, aScreen)
  1505 CWsTopClientWindow::CWsTopClientWindow(CWsClient* aOwner, CScreen* aScreen) : CWsClientWindow(aOwner, aScreen)