mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 17:19:19 +02:00
lcl: gtk2: fixed regression app deactivate on popup menu
This commit is contained in:
parent
efa401b8d6
commit
e8fc8fb0ca
@ -14076,13 +14076,16 @@ var
|
||||
CurFocusControl: TWinControl;
|
||||
ActiveSourceEditor: TSourceEditor;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
H: HWND;
|
||||
begin
|
||||
CurFocusControl:=Nil;
|
||||
ActiveSourceEditor:=Nil;
|
||||
// check if focus is on MainIDEBar or on SourceEditor
|
||||
if CheckFocus then
|
||||
begin
|
||||
CurFocusControl:=FindOwnerControl(GetFocus);
|
||||
H:=GetFocus;
|
||||
CurFocusControl:=FindOwnerControl(H);
|
||||
//debugln(['TMainIDE.DoSourceEditorCommand ',H<>0,' ',DbgSName(CurFocusControl)]);
|
||||
while (CurFocusControl<>nil) and (CurFocusControl<>MainIDEBar)
|
||||
and not (CurFocusControl is TCustomForm) do
|
||||
CurFocusControl:=CurFocusControl.Parent;
|
||||
|
@ -2475,13 +2475,13 @@ Begin
|
||||
FicPopUpMenuItems[A].RadioItem:=true;
|
||||
FicPopUpMenuItems[A].GroupIndex:=ord(A);
|
||||
FicPopUpMenuItems[A].OnClick:=@ICPopUpMenuItemClick;
|
||||
case ord(A) of
|
||||
0: FicPopUpMenuItems[A].Caption:=lisSortOrderScopedAlphabetic;
|
||||
1: FicPopUpMenuItems[A].Caption:=lisSortOrderAlphabetic;
|
||||
2: FicPopUpMenuItems[A].Caption:=lisSortOrderDefinition;
|
||||
else
|
||||
FicPopUpMenuItems[A].Caption:='Method'+(ord(A)).ToString;
|
||||
case A of
|
||||
icsScopedAlphabetic: NewStr:=lisSortOrderScopedAlphabetic;
|
||||
icsAlphabetic: NewStr:=lisSortOrderAlphabetic;
|
||||
icsScopedDeclaration: NewStr:=lisSortOrderDefinition;
|
||||
else NewStr:='Method'+(ord(A)).ToString;
|
||||
end;
|
||||
FicPopUpMenuItems[A].Caption:=NewStr;
|
||||
FicPopUpMenu.Items.Insert(ord(A),FicPopUpMenuItems[A]);
|
||||
FicPopUpMenuItems[A].Checked:=
|
||||
CodeToolBoss.IdentifierList.SortMethodForCompletion=A;
|
||||
@ -7458,12 +7458,11 @@ begin
|
||||
SrcEditSubMenuDebug.AddLast(SrcEditMenuViewCallStack);
|
||||
end;
|
||||
|
||||
|
||||
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
|
||||
RemoveUserDefinedMenuItems;
|
||||
RemoveContextMenuItems;
|
||||
|
||||
ASrcEdit:=FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
|
||||
ASrcEdit:=FindSourceEditorWithEditorComponent(SrcPopupMenu.PopupComponent);
|
||||
Assert(Assigned(ASrcEdit), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit=nil');
|
||||
Assert((ASrcEdit=GetActiveSE), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit<>GetActiveSE');
|
||||
EditorComp:=ASrcEdit.EditorComponent;
|
||||
|
@ -282,9 +282,16 @@ begin
|
||||
// Switching to another workspace does not generate a focus out event <sigh>.
|
||||
if PGdkEventFocus(event)^._in = 0 then
|
||||
begin
|
||||
// focus out
|
||||
//debugln(['Gtk2FormEvent focus out ',DbgSName(ACtl)]);
|
||||
//if ACtl.Parent<>nil then
|
||||
// debugln(['Gtk2FormEvent ACtl.Parent=',DbgSName(ACtl.Parent)]);
|
||||
|
||||
// Test switch to another app via mouse, Alt-Tab, workspace. And test open popup menu click GetFocus.
|
||||
|
||||
{$IFDEF HASX}
|
||||
if ACtl.Parent<>nil then
|
||||
begin
|
||||
//if ACtl.Parent<>nil then
|
||||
//begin
|
||||
XDisplay := gdk_display;
|
||||
XGetInputFocus(XDisplay, @Window, @RevertStatus);
|
||||
// Window - 1 is our frame !
|
||||
@ -292,11 +299,10 @@ begin
|
||||
(GDK_WINDOW_XID(Widget^.Window) = Window - 1) then
|
||||
begin
|
||||
// Note: on LinuxMint switching via Alt-Tab to another window
|
||||
// generates RevertToParent. The above
|
||||
//
|
||||
exit(True);
|
||||
// generates RevertToParent.
|
||||
exit(True); // stop
|
||||
end;
|
||||
end;
|
||||
//end;
|
||||
{$ENDIF}
|
||||
with Gtk2WidgetSet do
|
||||
begin
|
||||
@ -306,6 +312,7 @@ begin
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
//debugln(['Gtk2FormEvent focus in ',DbgSName(ACtl)]);
|
||||
with Gtk2WidgetSet do
|
||||
begin
|
||||
StopAppFocusTimer;
|
||||
|
Loading…
Reference in New Issue
Block a user