windowing/windowserver/nga/SERVER/PRIKEY.CPP
changeset 121 d72fc2aace31
parent 0 5d03bc08d59c
child 164 25ffed67c7ef
equal deleted inserted replaced
103:2717213c588a 121:d72fc2aace31
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1996-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".
    21 CPriorityKey::CPriorityKey(CWsClient *aOwner) : CEventBase(aOwner)
    21 CPriorityKey::CPriorityKey(CWsClient *aOwner) : CEventBase(aOwner)
    22 	{
    22 	{
    23 	__DECLARE_NAME(_S("CPriorityKey"));
    23 	__DECLARE_NAME(_S("CPriorityKey"));
    24 	}
    24 	}
    25 
    25 
    26 void CPriorityKey::PriorityKey(TInt aHandle, const TKeyData &aKey, TInt aScanCode)
    26 void CPriorityKey::PriorityKey(TInt aHandle, const TKeyEvent &aKeyEvent)
    27 //
    27 //
    28 // Called when a priority key is pressed
    28 // Called when a priority key is pressed
    29 //
    29 //
    30 	{
    30 	{
    31 	if (!iEventMsg.IsNull())
    31 	if (!iEventMsg.IsNull())
    32 		{
    32 		{
    33 		iPriorityKeyHandle=aHandle;
    33 		iPriorityKeyHandle=aHandle;
    34 		iPriorityKey=aKey;
    34 		iPriorityKey = aKeyEvent;
    35 		iScanCode=aScanCode;
       
    36 		SignalEvent();
    35 		SignalEvent();
    37 		}
    36 		}
    38 	}
    37 	}
    39 
    38 
    40 void CPriorityKey::GetData()
    39 void CPriorityKey::GetData()
    41 //
    40 //
    42 // If there is an outstanding abort event in the queue, reply with it's data, else send a null abort event
    41 // If there is an outstanding abort event in the queue, reply with it's data, else send a null abort event
    43 //
    42 //
    44 	{
    43 	{
    45 	TWsPriorityKeyEvent event;
    44 	TWsPriorityKeyEvent event;
    46 	TKeyEvent *key=event.Key();
    45 	*event.Key() = iPriorityKey;
    47 	key->iScanCode=iScanCode;
    46 	event.Key()->iRepeats = 0;
    48 	key->iCode=iPriorityKey.iKeyCode;
       
    49 	key->iModifiers=iPriorityKey.iModifiers;
       
    50 	key->iRepeats=0;
       
    51 	event.SetHandle(iPriorityKeyHandle);
    47 	event.SetHandle(iPriorityKeyHandle);
    52 	CEventBase::GetData(&event,sizeof(event));
    48 	CEventBase::GetData(&event,sizeof(event));
    53 	iPriorityKeyHandle=0;
    49 	iPriorityKeyHandle=0;
    54 	}
    50 	}
    55 
    51 
    63 TInt TPriorityKey::Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers)
    59 TInt TPriorityKey::Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers)
    64 	{
    60 	{
    65 	return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers);
    61 	return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers);
    66 	}
    62 	}
    67 
    63 
    68 TInt TPriorityKey::KeyMatches(const TKeyData &aKey)
    64 TInt TPriorityKey::KeyMatches(const TKeyEvent &aKeyEvent)
    69 	{
    65 	{
    70 	return(iKeyCode==aKey.iKeyCode && (iModifierMask&aKey.iModifiers)==iModifiers);
    66 	return(iKeyCode == aKeyEvent.iCode && (iModifierMask & aKeyEvent.iModifiers) == iModifiers);
    71 	}
    67 	}