windowing/windowserver/nga/SERVER/PRIKEY.CPP
changeset 0 5d03bc08d59c
child 116 171fae344dd4
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Window server priority key queue handling
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "PRIKEY.H"
       
    19 
       
    20 
       
    21 CPriorityKey::CPriorityKey(CWsClient *aOwner) : CEventBase(aOwner)
       
    22 	{
       
    23 	__DECLARE_NAME(_S("CPriorityKey"));
       
    24 	}
       
    25 
       
    26 void CPriorityKey::PriorityKey(TInt aHandle, const TKeyData &aKey, TInt aScanCode)
       
    27 //
       
    28 // Called when a priority key is pressed
       
    29 //
       
    30 	{
       
    31 	if (!iEventMsg.IsNull())
       
    32 		{
       
    33 		iPriorityKeyHandle=aHandle;
       
    34 		iPriorityKey=aKey;
       
    35 		iScanCode=aScanCode;
       
    36 		SignalEvent();
       
    37 		}
       
    38 	}
       
    39 
       
    40 void CPriorityKey::GetData()
       
    41 //
       
    42 // If there is an outstanding abort event in the queue, reply with it's data, else send a null abort event
       
    43 //
       
    44 	{
       
    45 	TWsPriorityKeyEvent event;
       
    46 	TKeyEvent *key=event.Key();
       
    47 	key->iScanCode=iScanCode;
       
    48 	key->iCode=iPriorityKey.iKeyCode;
       
    49 	key->iModifiers=iPriorityKey.iModifiers;
       
    50 	key->iRepeats=0;
       
    51 	event.SetHandle(iPriorityKeyHandle);
       
    52 	CEventBase::GetData(&event,sizeof(event));
       
    53 	iPriorityKeyHandle=0;
       
    54 	}
       
    55 
       
    56 TPriorityKey::TPriorityKey(TUint aKeycode,TUint aModifierMask,TUint aModifiers,TPriorityKey *aPriorityKeys) :
       
    57 	iNext(aPriorityKeys),
       
    58 	iKeyCode(aKeycode),
       
    59 	iModifiers(aModifiers),
       
    60 	iModifierMask(aModifierMask)
       
    61 	{}
       
    62 
       
    63 TInt TPriorityKey::Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers)
       
    64 	{
       
    65 	return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers);
       
    66 	}
       
    67 
       
    68 TInt TPriorityKey::KeyMatches(const TKeyData &aKey)
       
    69 	{
       
    70 	return(iKeyCode==aKey.iKeyCode && (iModifierMask&aKey.iModifiers)==iModifiers);
       
    71 	}