gtk2 intf: emulating return key down after for gtkentry, because it eats it, but LCL needs the return key

git-svn-id: trunk@10154 -
This commit is contained in:
mattias 2006-11-02 02:05:07 +00:00
parent 329aa53724
commit 6bd238fd52

View File

@ -2316,6 +2316,36 @@ var
end;}
end;
end;
procedure EmulateKeysEatenByGtk;
begin
// some widgets eats keys, but do not do anything useful for the LCL
// emulate the keys
if not BeforeEvent then exit;
//DebugLn(['EmulateKeysEatenByGtk ',GetWidgetDebugReport(TargetWidget),' gdk_event_get_type(Event)=',gdk_event_get_type(Event),' GDK_KEY_PRESS=',GDK_KEY_PRESS,' VKey.VKey=',VKey.VKey]);
{$IFDEF Gtk2}
// the gtk2 gtkentry handles the return key and emits an activate signal
// The LCL does not use that and needs the return key event
// => emulate it
if GtkWidgetIsA(TargetWidget,gtk_type_entry)
and (gdk_event_get_type(Event)=GDK_KEY_PRESS)
and (VKey.VKey=13) then begin
//DebugLn(['EmulateKeysEatenByGtk ']);
FillChar(Msg,SizeOf(Msg),0);
Msg.CharCode := VKey.VKey;
if SysKey then
Msg.msg := LM_SYSKEYDOWN
else
Msg.msg := LM_KEYDOWN;
Msg.KeyData := CommonKeyData or (Flags shl 16) or $0001 {TODO: repeatcount};
// send the (Sys)KeyDown message directly to the LCL
NotifyApplicationUserInput(Msg.Msg);
Result := DeliverMessage(TargetData, Msg) = 0;
end;
{$ENDIF}
end;
begin
Result := CallBackDefaultReturn;
@ -2567,6 +2597,8 @@ begin
end;
end;
EmulateKeysEatenByGtk;
{$IFDEF Gtk1}
Result:=true;
{$ELSE}