gtk2 intf: when a window gets focus, send the LM_SETFOCUS message to the ActiveControl to follow the LCL logic

git-svn-id: trunk@26563 -
This commit is contained in:
mattias 2010-07-10 06:51:28 +00:00
parent d41950e381
commit 152fbbfa9c

View File

@ -864,14 +864,16 @@ begin
// a form became active
// it does not mean: the control focus is switch to the form
AForm:=TCustomForm(LCLObject);
if AForm.Active then begin
// it is already active
// do not send this message to the LCL
// to prevent setting AForm.ActiveControl:=nil
//debugln(['GTKFocusCBAfter ',DbgSName(LCLObject),' send=',event^.send_event,' window=',dbgs(event^.window),' in=',event^._in,' type=',event^._type]);
exit(true);
//debugln(['GTKFocusCBAfter ',DbgSName(AForm),' ',DbgSName(AForm.ActiveControl)]);
// the PGtkWindow(Data)^.focus_widget shows the last focus call for this
// window. If there is a sub window (e.g. docking), then the focus_widget
// of the parent window was not updated, so it can not be used.
// The gtk will use, if we let it, which will not follow the LCL focus logic.
// Follow the LCL logic:
if AForm.ActiveControl<>nil then begin
Data:=AForm.ActiveControl;
//debugln(['GTKFocusCBAfter ',DbgSName(LCLObject),' send=',event^.send_event,' window=',dbgs(event^.window),' in=',event^._in,' type=',event^._type,' Data=',dbgsname(TObject(Data))]);
end;
// MG: maybe better send a LM_ACTIVATE instead of a LM_SETFOCUS message?
end;
ResetDefaultIMContext;