Quick fix to prevent the terminal from crashing in case it got a message
with mouse coordinates outside the window (yeah, it has been written that bad). Need to rewrite the whole mouse handling, though... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15152 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
39b345c7b6
commit
498cd44c3a
@ -103,10 +103,11 @@ TermBuffer::TermBuffer(int rows, int cols)
|
||||
// Allocate buffer
|
||||
mBase = (term_buffer**) malloc (sizeof (term_buffer*) * buffer_size);
|
||||
|
||||
for(int i = 0; i < buffer_size; i++)
|
||||
for (int i = 0; i < buffer_size; i++)
|
||||
mBase[i] = (term_buffer *) calloc (mColSize + 1, sizeof (term_buffer));
|
||||
}
|
||||
|
||||
|
||||
TermBuffer::~TermBuffer()
|
||||
{
|
||||
for(int i = 0; i < buffer_size; i++)
|
||||
@ -115,25 +116,28 @@ TermBuffer::~TermBuffer()
|
||||
free(mBase);
|
||||
}
|
||||
|
||||
// Gets a character from TermBuffer
|
||||
int
|
||||
TermBuffer::GetChar (int row, int col, uchar *buf, ushort *attr)
|
||||
{
|
||||
term_buffer *ptr;
|
||||
|
||||
ptr = (mBase[row % buffer_size] + col);
|
||||
//! Gets a character from TermBuffer
|
||||
int
|
||||
TermBuffer::GetChar(int row, int col, uchar *buf, ushort *attr)
|
||||
{
|
||||
if (row < 0 || col < 0)
|
||||
return -1;
|
||||
|
||||
term_buffer *ptr = (mBase[row % buffer_size] + col);
|
||||
|
||||
if (ptr->status == A_CHAR)
|
||||
memcpy (buf, (char *)(ptr->code), 4);
|
||||
memcpy(buf, (char *)(ptr->code), 4);
|
||||
|
||||
*attr = ptr->attr;
|
||||
|
||||
return ptr->status;
|
||||
}
|
||||
|
||||
// Get a string (length = num) from given position.
|
||||
|
||||
//! Get a string (length = num) from given position.
|
||||
int
|
||||
TermBuffer::GetString (int row, int col, int num, uchar *buf,
|
||||
TermBuffer::GetString(int row, int col, int num, uchar *buf,
|
||||
ushort *attr)
|
||||
{
|
||||
int count = 0, all_count = 0;
|
||||
|
@ -904,6 +904,8 @@ TermView::MouseTracking(void *data)
|
||||
}
|
||||
|
||||
edpos = theObj->BPointToCurPos(edpoint);
|
||||
if (edpos.y < 0)
|
||||
continue;
|
||||
|
||||
if(stpoint == edpoint) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user