mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 04:12:36 +02:00
lcl: gtk2: GTKAPIWidget_FocusIn: check if client widget can be focused
git-svn-id: trunk@52558 -
This commit is contained in:
parent
4c9d5e70ca
commit
03e749be43
@ -4500,6 +4500,7 @@ procedure TCustomGrid.WMKillFocus(var message: TLMKillFocus);
|
||||
begin
|
||||
if csDestroying in ComponentState then
|
||||
exit;
|
||||
debugln(['TCustomGrid.WMKillFocus BBB1 ',DbgSName(Self)]);
|
||||
{$ifdef dbgGrid}
|
||||
DbgOut('*** grid.WMKillFocus, FocusedWnd=%x WillFocus=',[Message.FocusedWnd]);
|
||||
if EditorMode and (Message.FocusedWnd = FEditor.Handle) then
|
||||
@ -4518,6 +4519,7 @@ end;
|
||||
|
||||
procedure TCustomGrid.WMSetFocus(var message: TLMSetFocus);
|
||||
begin
|
||||
debugln(['TCustomGrid.WMSetFocus BBB2 ',DbgSName(Self)]);
|
||||
{$ifdef dbgGrid}
|
||||
DbgOut('*** grid.WMSetFocus, FocusedWnd=', dbgs(Message.FocusedWnd),'[',dbgs(pointer(Message.FocusedWnd)),'] ');
|
||||
if EditorMode and (Message.FocusedWnd = FEditor.Handle) then
|
||||
|
@ -954,12 +954,24 @@ end;
|
||||
function GTKAPIWidget_FocusIn(Widget: PGTKWidget;
|
||||
{%H-}Event: PGdkEventFocus): GTKEventResult; cdecl;
|
||||
var
|
||||
TopLevel: PGTKWidget;
|
||||
TopLevel, FocusWidget: PGTKWidget;
|
||||
begin
|
||||
TopLevel := gtk_widget_get_toplevel(Widget);
|
||||
if gtk_type_is_a(gtk_object_type(PGTKObject(TopLevel)), gtk_window_get_type)
|
||||
then gtk_window_set_focus(PGTKWindow(TopLevel), PGTKAPIWidget(Widget)^.Client);
|
||||
|
||||
then begin
|
||||
if GTK_WIDGET_CAN_FOCUS(PGTKAPIWidget(Widget)^.Client) then
|
||||
FocusWidget:=PGTKAPIWidget(Widget)^.Client
|
||||
else
|
||||
FocusWidget:=Widget;
|
||||
{debugln(['GTKAPIWidget_FocusIn ',
|
||||
' Widget=',GetWidgetDebugReport(Widget),
|
||||
' Client=',GetWidgetDebugReport(PGTKAPIWidget(Widget)^.Client),
|
||||
' GTK_WIDGET_CAN_FOCUS(Widget)=',GTK_WIDGET_CAN_FOCUS(Widget),
|
||||
' GTK_WIDGET_CAN_FOCUS(Client)=',GTK_WIDGET_CAN_FOCUS(PGTKAPIWidget(Widget)^.Client),
|
||||
'']);}
|
||||
gtk_window_set_focus(PGTKWindow(TopLevel), FocusWidget);
|
||||
end;
|
||||
|
||||
Result := gtk_True;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user