Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv22726
Modified Files:
console_win.cpp
Log Message:
Functions which could be called from different threads now use PostMessage instead of SendMessage to ensure ThreadSafety.
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** console_win.cpp 13 Sep 2003 15:37:06 -0000 1.8
--- console_win.cpp 13 Sep 2003 15:47:01 -0000 1.9
***************
*** 404,408 ****
// Check for the caret
! SendMessage( logWindow, EM_SETSEL, ctrlLength, ctrlLength );
// Delete lines from the beginning if we exceed the maximum limit.
--- 404,408 ----
// Check for the caret
! PostMessage( logWindow, EM_SETSEL, ctrlLength, ctrlLength );
// Delete lines from the beginning if we exceed the maximum limit.
***************
*** 416,425 ****
char buffer[1024] = { 0, };
((short*)buffer)[0] = 1024;
! textcount += SendMessage( logWindow, EM_GETLINE, linecount++, (WPARAM)buffer );
}
while( textcount < ( ctrlLength + textLength ) - logLimit );
! SendMessage( logWindow, EM_SETSEL, 0, textcount );
! SendMessage( logWindow, EM_REPLACESEL, FALSE, (LPARAM)"" );
}
--- 416,425 ----
char buffer[1024] = { 0, };
((short*)buffer)[0] = 1024;
! textcount += PostMessage( logWindow, EM_GETLINE, linecount++, (WPARAM)buffer );
}
while( textcount < ( ctrlLength + textLength ) - logLimit );
! PostMessage( logWindow, EM_SETSEL, 0, textcount );
! PostMessage( logWindow, EM_REPLACESEL, FALSE, (LPARAM)"" );
}
***************
*** 437,444 ****
{
CHARRANGE range;
! SendMessage( logWindow, EM_EXGETSEL, 0, (LPARAM)&range );
range.cpMin -= 1;
! SendMessage( logWindow, EM_EXSETSEL, 0, (LPARAM)&range );
! SendMessage( logWindow, EM_REPLACESEL, FALSE, 0 );
send( sMessage.left( sMessage.length() - 1 ) );
return;
--- 437,444 ----
{
CHARRANGE range;
! PostMessage( logWindow, EM_EXGETSEL, 0, (LPARAM)&range );
range.cpMin -= 1;
! PostMessage( logWindow, EM_EXSETSEL, 0, (LPARAM)&range );
! PostMessage( logWindow, EM_REPLACESEL, FALSE, 0 );
send( sMessage.left( sMessage.length() - 1 ) );
return;
***************
*** 447,458 ****
unsigned int tLength = GetWindowTextLength( logWindow );
! SendMessage( logWindow, EM_SETSEL, tLength, tLength );
// Now it will get right, even if the user had selected sth.
! SendMessage( logWindow, EM_REPLACESEL, FALSE, (LPARAM)sMessage.latin1() );
// And ofcourse if not some control is currently capturing the input
if( !GetCapture() )
! SendMessage( logWindow, WM_VSCROLL, SB_BOTTOM, 0 );
}
--- 447,458 ----
unsigned int tLength = GetWindowTextLength( logWindow );
! PostMessage( logWindow, EM_SETSEL, tLength, tLength );
// Now it will get right, even if the user had selected sth.
! PostMessage( logWindow, EM_REPLACESEL, FALSE, (LPARAM)sMessage.latin1() );
// And ofcourse if not some control is currently capturing the input
if( !GetCapture() )
! PostMessage( logWindow, WM_VSCROLL, SB_BOTTOM, 0 );
}
***************
*** 488,492 ****
};
! SendMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
--- 488,492 ----
};
! PostMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
***************
*** 503,507 ****
cf.cbSize = sizeof( CHARFORMAT );
! SendMessage( logWindow, EM_GETCHARFORMAT, SCF_SELECTION, (WPARAM)&cf );
if( bold )
--- 503,507 ----
cf.cbSize = sizeof( CHARFORMAT );
! PostMessage( logWindow, EM_GETCHARFORMAT, SCF_SELECTION, (WPARAM)&cf );
if( bold )
***************
*** 549,553 ****
}
! SendMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
--- 549,553 ----
}
! PostMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
|