gtk intf: fixed sending keypress event twice

git-svn-id: trunk@10737 -
This commit is contained in:
mattias 2007-03-10 22:38:35 +00:00
parent ef80d70936
commit 769478772a
3 changed files with 13 additions and 13 deletions

View File

@ -628,6 +628,7 @@ begin
canvas.brush.color := color;
canvas.Rectangle(0, 0, Width, Height);
{$ENDIF}
//DebugLn(['TSynBaseCompletionForm.Paint NbLinesInWindow=',NbLinesInWindow,' ItemList.Count=',ItemList.Count]);
for i := 0 to min(NbLinesInWindow - 1, ItemList.Count - 1) do begin
if i + Scroll.Position = Position then begin
Canvas.Brush.Color := clSelect;
@ -652,7 +653,8 @@ begin
Canvas.Font.Color := clBlack;
{$ENDIF}
end;
//DebugLn(['TSynBaseCompletionForm.Paint ',i,' ',ItemList[Scroll.Position + i]]);
if not Assigned(OnPaintItem)
or not OnPaintItem(ItemList[Scroll.Position + i], Canvas,
{$IFDEF SYN_LAZARUS}

View File

@ -257,6 +257,7 @@ begin
if MeasureOnly then
Inc(Result.X, 1+ACanvas.TextWidth(s))
else begin
//DebugLn(['PaintCompletionItem ',x,',',y,' ',s]);
ACanvas.TextOut(x+1,y,s);
inc(x,ACanvas.TextWidth(s));
if x>MaxX then exit;

View File

@ -2282,8 +2282,7 @@ begin
end;
// send keypresses
if not EventStopped and AHandleDown
then begin
if not EventStopped and AHandleDown and ABeforeEvent then begin
// send the UTF8 keypress
// try to get the UTF8 representation of the key
@ -2302,17 +2301,15 @@ begin
debugln('[HandleGTKKeyUpDown] GDK_KEY_PRESS UTF8="',DbgStr(Character),'"');
{$ENDIF}
if not ABeforeEvent then begin
if Character <> ''
if Character <> ''
then begin
LCLObject := GetNearestLCLObject(TargetWidget);
if LCLObject is TWinControl
then begin
LCLObject := GetNearestLCLObject(TargetWidget);
if LCLObject is TWinControl
then begin
// send the key after navigation keys were handled
Result := TWinControl(LCLObject).IntfUTF8KeyPress(Character, 1, SysKey);
if Result or (Character = '')
then StopKeyEvent('key_press_event');
end;
// send the key after navigation keys were handled
Result := TWinControl(LCLObject).IntfUTF8KeyPress(Character, 1, SysKey);
if Result or (Character = '')
then StopKeyEvent('key_press_event');
end;
end;