windowing/windowserver/nga/CLIENT/RWINDOW.CPP
changeset 194 18f84489a694
parent 152 9f1c3fea0f87
equal deleted inserted replaced
183:6a1564a2f3e6 194:18f84489a694
  1007 a pointer grab of this pointer, terminated by the next corresponding up event for this
  1007 a pointer grab of this pointer, terminated by the next corresponding up event for this
  1008 pointer. All pointer events, for the grabbed pointer, up to and including the next up event will
  1008 pointer. All pointer events, for the grabbed pointer, up to and including the next up event will
  1009 be sent to that window.
  1009 be sent to that window.
  1010 
  1010 
  1011 Please note that the pointer grab works separately for each pointer present in the system
  1011 Please note that the pointer grab works separately for each pointer present in the system
  1012 (for example, separately for each finger touching the multi-touch screen).
  1012 (for example, separately for each finger touching the multipointer screen).
  1013 
  1013 
  1014 Pointer grab can be used for drag-and-drop or other situations when you want 
  1014 Pointer grab can be used for drag-and-drop or other situations when you want 
  1015 the events delivered to the same window even though the pen will be dragged 
  1015 the events delivered to the same window even though the pen will be dragged 
  1016 outside that window. This function is typically called during window construction 
  1016 outside that window. This function is typically called during window construction 
  1017 so that pointer grab is enabled for the lifetime of the window.
  1017 so that pointer grab is enabled for the lifetime of the window.
  1085 	{
  1085 	{
  1086 	TUint grabControlFlags = aSendUpEvent ? TWsWinCmdGrabControl::ESendUpEvent : TWsWinCmdGrabControl::ENone;
  1086 	TUint grabControlFlags = aSendUpEvent ? TWsWinCmdGrabControl::ESendUpEvent : TWsWinCmdGrabControl::ENone;
  1087 	// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1087 	// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1088 	// overload needs to return an error code.
  1088 	// overload needs to return an error code.
  1089 	// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1089 	// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1090 	// so this cannot be done for the older non-multitouch API as it would be a compatibility break;
  1090 	// so this cannot be done for the older non-multipointer API as it would be a compatibility break;
  1091 	grabControlFlags |= TWsWinCmdGrabControl::ESendReply;
  1091 	grabControlFlags |= TWsWinCmdGrabControl::ESendReply;
  1092 	TWsWinCmdGrabControl params(aPointerNumber, grabControlFlags);
  1092 	TWsWinCmdGrabControl params(aPointerNumber, grabControlFlags);
  1093 	return(WriteReply(&params,sizeof(params),EWsWinOpClaimPointerGrab));	
  1093 	return(WriteReply(&params,sizeof(params),EWsWinOpClaimPointerGrab));	
  1094 	}
  1094 	}
  1095 
  1095 
  1182 	__ASSERT_DEBUG(!aRegion.CheckError(),Panic(EW32PanicInvalidRegion));
  1182 	__ASSERT_DEBUG(!aRegion.CheckError(),Panic(EW32PanicInvalidRegion));
  1183 	const TInt regionCount=aRegion.Count();
  1183 	const TInt regionCount=aRegion.Count();
  1184 	TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
  1184 	TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
  1185 	return(WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpSetShape));
  1185 	return(WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpSetShape));
  1186 	}
  1186 	}
       
  1187 
       
  1188 /** Sets a region of a window that can receive pointer events.
       
  1189 
       
  1190 Once this region is set, pointer events must be within both this region and the window's base area to be received. 
       
  1191 If an empty pointer acceptance region is set, then no pointer events will be received by this window.
       
  1192 Pointer events that fall outside of this region will be processed for any windows underneath.
       
  1193 Prior to calling this API the whole base area of the window can receive pointer events.
       
  1194 
       
  1195 If a window is moved, the pointer acceptance region will move with it.
       
  1196 
       
  1197 If a window is re-sized, the pointer region will NOT change shape/size automatically ( though it
       
  1198 will still be clipped by the window's base area ).
       
  1199 The new size/shape must be set explicitly from the client/application side using this API. 
       
  1200  
       
  1201 This function always causes a flush of the window server buffer.
       
  1202 
       
  1203 @param aRegion Region defining the pointer acceptance region shape in window relative coordinates. 
       
  1204 @return KErrNone if successful, otherwise one of the system-wide error codes. 
       
  1205 */
       
  1206 EXPORT_C TInt RWindowBase::SetPointerAcceptanceRegion(const TRegion &aRegion)
       
  1207     {
       
  1208     __ASSERT_DEBUG(!aRegion.CheckError(),Panic(EW32PanicInvalidRegion));
       
  1209     const TInt regionCount=aRegion.Count();
       
  1210     TPtrC8 ptrRect(reinterpret_cast<const TUint8*>(aRegion.RectangleList()),regionCount*sizeof(TRect));
       
  1211     return(WriteReplyByProvidingRemoteReadAccess(&regionCount,sizeof(regionCount),&ptrRect,EWsWinOpSetPointerAcceptanceRegion));    
       
  1212     }
  1187 
  1213 
  1188 /** 
  1214 /** 
  1189 This method has been deprecated. Windows can no longer be associated with a display
  1215 This method has been deprecated. Windows can no longer be associated with a display
  1190 mode other than the system display mode. This method no longer has any effect and will 
  1216 mode other than the system display mode. This method no longer has any effect and will 
  1191 always return the system display mode.
  1217 always return the system display mode.
  1320 @prototype To become released with WSERV NGA APIs */
  1346 @prototype To become released with WSERV NGA APIs */
  1321 	{
  1347 	{
  1322 	// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1348 	// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1323 	// overload needs to return an error code.
  1349 	// overload needs to return an error code.
  1324 	// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1350 	// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1325 	// so this cannot be done for the older non-multitouch API as it would be a compatibility break;
  1351 	// so this cannot be done for the older non-multipointer API as it would be a compatibility break;
  1326 	TWsWinCmdRequestPointerRepeatEvent params(aTime,aRect,aPointerNumber,TWsWinCmdRequestPointerRepeatEvent::ERepeatFlagsSendReply);
  1352 	TWsWinCmdRequestPointerRepeatEvent params(aTime,aRect,aPointerNumber,TWsWinCmdRequestPointerRepeatEvent::ERepeatFlagsSendReply);
  1327 	return WriteReply(&params,sizeof(params),EWsWinOpRequestPointerRepeatEvent);
  1353 	return WriteReply(&params,sizeof(params),EWsWinOpRequestPointerRepeatEvent);
  1328 	}
  1354 	}
  1329 
  1355 
  1330 EXPORT_C TInt RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber)
  1356 EXPORT_C TInt RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber)
  1343 	if (iWsHandle)
  1369 	if (iWsHandle)
  1344 		{
  1370 		{
  1345 		// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1371 		// Due to the inclusion of the pointer number, which could be out of range or similar, this ClaimPointerGrab
  1346 		// overload needs to return an error code.
  1372 		// overload needs to return an error code.
  1347 		// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1373 		// Returning this error code requires a flush of the command buffer (to avoid deadlocking the client/server)
  1348 		// so this cannot be done for the older non-multitouch API as it would be a compatibility break;		
  1374 		// so this cannot be done for the older non-multipointer API as it would be a compatibility break;		
  1349 		TWsWinCmdCancelPointerRepeatEventRequest params(aPointerNumber, TWsWinCmdCancelPointerRepeatEventRequest::ECancelRepeatFlagsSendReply);
  1375 		TWsWinCmdCancelPointerRepeatEventRequest params(aPointerNumber, TWsWinCmdCancelPointerRepeatEventRequest::ECancelRepeatFlagsSendReply);
  1350 		errNo = WriteReply(&params,sizeof(params),EWsWinOpCancelPointerRepeatEventRequest);		
  1376 		errNo = WriteReply(&params,sizeof(params),EWsWinOpCancelPointerRepeatEventRequest);		
  1351 		}
  1377 		}
  1352 	return errNo;
  1378 	return errNo;
  1353 	}
  1379 	}
  1408 the previous pointer event. If the pointer move buffer is used, the window 
  1434 the previous pointer event. If the pointer move buffer is used, the window 
  1409 server stores all pointer events coming from a single pointer in a pointer buffer, 
  1435 server stores all pointer events coming from a single pointer in a pointer buffer, 
  1410 and then delivers the entire buffer when it is full.
  1436 and then delivers the entire buffer when it is full.
  1411 
  1437 
  1412 If there are multiple pointers available in the system (for example there is
  1438 If there are multiple pointers available in the system (for example there is
  1413 a multi-touch screen present), for compatibility reasons only events coming from the 
  1439 a multipointer screen present), for compatibility reasons only events coming from the 
  1414 single emulated pointer will be stored in a pointer buffer. For more information about 
  1440 single emulated pointer will be stored in a pointer buffer. For more information about 
  1415 emulated pointer please refer to the comment of RWindowBase::EnableAdvancedPointers() 
  1441 emulated pointer please refer to the comment of RWindowBase::EnableAdvancedPointers() 
  1416 method.
  1442 method.
  1417 
  1443 
  1418 AllocPointerMoveBuffer() must be called before the pointer move buffer can 
  1444 AllocPointerMoveBuffer() must be called before the pointer move buffer can