view src/main/symbian/EKA2/vectorbuffer.cpp @ 4170:092c0bc69155 SDL-1.2

Fixed bug #618 Description From Tim Angus 2008-08-30 12:23:56 (-) [reply] As we all know SDL 1.2 doesn't handle dead keys well since one key press potentially equals two (or more) characters. For example, on many layouts, keying <backquote>,<space> results in <no character>,<backquote><space>. Since the unicode member of the SDL_keysym struct only has room for one character, only one can be returned. On Linux, the first character is returned. On Windows however, unless the exact number of characters generated by the keypress is 1, nothing is returned. The following patch addresses this inconsistency. Updated patch which includes a further fix to the handling of the numpad when numlock is on. This further fix is courtesy Amanieu d'Antras.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Apr 2009 08:42:09 +0000
parents e85e65aec22f
children
line wrap: on
line source

/*
    vectorbuffer.cpp
    yet another circle buffer

    Markus Mertama
*/

#include"vectorbuffer.h"



void VectorPanic(TInt aErr, TInt aLine)
    {
    TBuf<64> b;
    b.Format(_L("vector buffer at % d "), aLine);
    User::Panic(b, aErr);
    }

void TNodeBuffer::TNode::Terminator(TNodeBuffer::TNode* aNode)
    {
    Mem::Copy(iSucc, &aNode, sizeof(TNode*));
    }

TInt TNodeBuffer::TNode::Size() const
    {
    return reinterpret_cast<const TUint8*>(iSucc) - Ptr();
    }

const TUint8*  TNodeBuffer::TNode::Ptr() const
    {
    return reinterpret_cast<const TUint8*>(this) + sizeof(TNode);
    }

TNodeBuffer::TNode*  TNodeBuffer::TNode::Empty(TUint8* aBuffer)
    {
    TNode* node = reinterpret_cast<TNode*>(aBuffer);
    node->iSucc = node + 1;
    return node;
    }

 TNodeBuffer::TNode*  TNodeBuffer::TNode::New(TNode* aPred, const TDesC8& aData)
    {
    TNode* node = aPred->Size() == 0 ? aPred : aPred->iSucc;

    
    TUint8* start = reinterpret_cast<TUint8*>(node) + sizeof(TNode);
    node->iSucc = reinterpret_cast<TNode*>(start + aData.Size());
    node->iSucc->iSucc = NULL; //terminator

    __ASSERT_DEBUG(node->Size() == aData.Size(), VECPANIC(KErrCorrupt));

    Mem::Copy(start, aData.Ptr(), aData.Size());
    return node;
    }