LCL, gtk, fix problem on closing popupmenu, issue #10884

git-svn-id: trunk@14266 -
This commit is contained in:
jesus 2008-02-27 00:01:56 +00:00
parent b19cbee0b9
commit 54208be697
2 changed files with 13 additions and 3 deletions

View File

@ -409,7 +409,9 @@ type
TWidgetInfoFlag = ( TWidgetInfoFlag = (
wwiNotOnParentsClientArea wwiNotOnParentsClientArea,
wwiValidQueuedEvent // Mark this widgetinfo as valid queued proc
// see gtkwsmenus.pp: gtkWSPopupMenuDeactivate
); );
TWidgetInfoFlags = set of TWidgetInfoFlag; TWidgetInfoFlags = set of TWidgetInfoFlag;
tGtkStateEnumRange = 0..31; tGtkStateEnumRange = 0..31;

View File

@ -371,14 +371,22 @@ begin
Y^ := Point^.Y; Y^ := Point^.Y;
end; end;
function gtkWSPopupDelayedClose(WidgetInfo: Pointer): gboolean; cdecl; function gtkWSPopupDelayedClose(Data: Pointer): gboolean; cdecl;
var
WidgetInfo: PWidgetInfo absolute Data;
begin begin
TPopupMenu(PWidgetInfo(WidgetInfo)^.LCLObject).Close;
Result := False; Result := False;
if (WidgetInfo<>nil) and (wwiValidQueuedEvent in WidgetInfo^.Flags) then
begin
if WidgetInfo^.LCLObject is TPopupMenu then
TPopupMenu(WidgetInfo^.LCLObject).Close;
end
//else DebugLn('No valid popupDelayedClose event');
end; end;
function gtkWSPopupMenuDeactivate(widget: PGtkWidget; data: gPointer): GBoolean; cdecl; function gtkWSPopupMenuDeactivate(widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
begin begin
Include(PWidgetInfo(Data)^.Flags, wwiValidQueuedEvent);
g_idle_add(@gtkWSPopupDelayedClose, data); g_idle_add(@gtkWSPopupDelayedClose, data);
Result := CallBackDefaultReturn; Result := CallBackDefaultReturn;
end; end;