mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 15:16:04 +02:00
gtk2: move focus-in after handler to focus-in handler. This cause interface to handle focus switches inside the focus events properly (fixes bug #17801)
git-svn-id: trunk@28104 -
This commit is contained in:
parent
513c9f2f1d
commit
d5c63f7aad
@ -761,54 +761,7 @@ begin
|
||||
Result := HandleGtkKeyUpDown(Widget,Event,Data,false,False,'key-release-event');
|
||||
end;
|
||||
|
||||
function GTKFocusCB( widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer) : GBoolean; cdecl;
|
||||
{$IFDEF VerboseFocus}
|
||||
var
|
||||
LCLObject: TObject;
|
||||
CurFocusWidget: PGtkWidget;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF EventTrace}
|
||||
EventTrace('focus', data);
|
||||
{$ENDIF}
|
||||
if (Widget=nil) or (Event=nil) then ;
|
||||
//DebugLn('GTKFocusCB ',DbgSName(TObject(Data)),' ',GetWidgetDebugReport(Widget));
|
||||
{$IFDEF VerboseFocus}
|
||||
write('GTKFocusCB Widget=',DbgS(Widget),' Event^.theIn=',Event^._in);
|
||||
LCLObject:=TObject(data);
|
||||
if LCLObject<>nil then begin
|
||||
if LCLObject is TComponent then begin
|
||||
write(' LCLObject=',TComponent(LCLObject).Name,':',LCLObject.ClassName)
|
||||
end else begin
|
||||
write(' LCLObject=',LCLObject.ClassName)
|
||||
end;
|
||||
end else
|
||||
write(' LCLObject=nil');
|
||||
DebugLn(''); DbgOut(' ');
|
||||
CurFocusWidget:=PGtkWidget(GetFocus);
|
||||
if CurFocusWidget<>nil then begin
|
||||
write(' GetFocus=',DbgS(CurFocusWidget));
|
||||
LCLObject:=GetNearestLCLObject(CurFocusWidget);
|
||||
if LCLObject<>nil then begin
|
||||
if LCLObject is TComponent then begin
|
||||
write(' ParentLCLFocus=',TComponent(LCLObject).Name,':',LCLObject.ClassName)
|
||||
end else begin
|
||||
write(' ParentLCLFocus=',LCLObject.ClassName)
|
||||
end;
|
||||
end else
|
||||
write(' LCLObject=nil');
|
||||
end else begin
|
||||
write(' GetFocus=nil');
|
||||
end;
|
||||
DebugLn('');
|
||||
{$ENDIF}
|
||||
|
||||
Result:=CallBackDefaultReturn;
|
||||
end;
|
||||
|
||||
function GTKFocusCBAfter(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer) : GBoolean; cdecl;
|
||||
function GTKFocusCB(widget: PGtkWidget; event: PGdkEventFocus; data: gPointer): GBoolean; cdecl;
|
||||
var
|
||||
Mess : TLMessage;
|
||||
LCLObject: TObject;
|
||||
@ -880,10 +833,11 @@ begin
|
||||
UpdateMouseCaptureControl;
|
||||
|
||||
//TODO: fill in old focus
|
||||
FillChar(Mess,SizeOf(Mess),0);
|
||||
FillChar(Mess, SizeOf(Mess), 0);
|
||||
Mess.msg := LM_SETFOCUS;
|
||||
DeliverMessage(Data, Mess);
|
||||
Result:=true;
|
||||
|
||||
Result := CallBackDefaultReturn;
|
||||
end;
|
||||
|
||||
function GTKKillFocusCB(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
|
@ -128,8 +128,6 @@ function GTKKeyReleaseAfter(Widget: PGtkWidget; Event: pgdkeventkey;
|
||||
|
||||
function GTKFocusCB(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer): GBoolean; cdecl;
|
||||
function GTKFocusCBAfter(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer): GBoolean; cdecl;
|
||||
function GTKKillFocusCB(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer): GBoolean; cdecl;
|
||||
function GTKKillFocusCBAfter(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
|
@ -65,19 +65,6 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function GTK2FocusCBAfter(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer) : GBoolean; cdecl;
|
||||
var
|
||||
Status : gBoolean;
|
||||
begin
|
||||
Status := GTKFocusCBAfter(Widget, Event, Data);
|
||||
|
||||
if GtkWidgetIsA(Widget,GTK_APIWIDGETCLIENT_TYPE) then
|
||||
Result := Status
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function gtk2HideCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
|
||||
var
|
||||
Status : GBoolean;
|
||||
@ -397,7 +384,6 @@ procedure TGtk2WidgetSet._SetCallbackEx(const AMsg: LongInt;
|
||||
procedure ConnectFocusEvents(const AnObject: PGTKObject);
|
||||
begin
|
||||
ConnectSenderSignal(AnObject, 'focus-in-event', @gtkFocusCB);
|
||||
ConnectSenderSignalAfter(AnObject, 'focus-in-event', @gtkFocusCBAfter);
|
||||
ConnectSenderSignal(AnObject, 'focus-out-event', @gtkKillFocusCB);
|
||||
ConnectSenderSignalAfter(AnObject, 'focus-out-event', @gtkKillFocusCBAfter);
|
||||
end;
|
||||
@ -855,7 +841,6 @@ procedure TGTK2WidgetSet.SetCallbackEx(const AMsg: LongInt;
|
||||
begin
|
||||
//DebugLn(['ConnectFocusEvents ',GetWidgetDebugReport(PGtkWidget(AnObject))]);
|
||||
ConnectSenderSignal(AnObject, 'focus-in-event', @gtk2FocusCB);
|
||||
ConnectSenderSignalAfter(AnObject, 'focus-in-event', @gtk2FocusCBAfter);
|
||||
ConnectSenderSignal(AnObject, 'focus-out-event', @gtk2KillFocusCB);
|
||||
ConnectSenderSignalAfter(AnObject, 'focus-out-event', @gtk2KillFocusCBAfter);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user