mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 15:59:15 +02:00
Gtk2: fixed GetDroppedDown result for gtk2 < 2.10. Property "popup-shown" was introduced in gtk2 2.10, so anything below 2.10 doesn't work.
git-svn-id: trunk@35209 -
This commit is contained in:
parent
f4448c54ec
commit
3389d8edaa
@ -1432,15 +1432,21 @@ begin
|
|||||||
LCLSendSetFocusMsg(TControl(WidgetInfo^.LCLObject));
|
LCLSendSetFocusMsg(TControl(WidgetInfo^.LCLObject));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{used only for gtk2 < 2.10 }
|
||||||
procedure GtkPopupShowCB(AMenu: PGtkMenuShell; WidgetInfo: PWidgetInfo); cdecl;
|
procedure GtkPopupShowCB(AMenu: PGtkMenuShell; WidgetInfo: PWidgetInfo); cdecl;
|
||||||
begin
|
begin
|
||||||
|
g_object_set_data(PGObject(WidgetInfo^.CoreWidget),
|
||||||
|
'popup-shown-compat',GPointer(PtrUInt(1)));
|
||||||
LCLSendSetFocusMsg(TControl(WidgetInfo^.LCLObject));
|
LCLSendSetFocusMsg(TControl(WidgetInfo^.LCLObject));
|
||||||
// let the LCL change the items on the fly:
|
// let the LCL change the items on the fly:
|
||||||
LCLSendDropDownMsg(TControl(WidgetInfo^.LCLObject));
|
LCLSendDropDownMsg(TControl(WidgetInfo^.LCLObject));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{used only for gtk2 < 2.10 }
|
||||||
procedure GtkPopupHideCB(AMenu: PGtkMenuShell; WidgetInfo: PWidgetInfo); cdecl;
|
procedure GtkPopupHideCB(AMenu: PGtkMenuShell; WidgetInfo: PWidgetInfo); cdecl;
|
||||||
begin
|
begin
|
||||||
|
g_object_set_data(PGObject(WidgetInfo^.CoreWidget),
|
||||||
|
'popup-shown-compat',GPointer(PtrUInt(0)));
|
||||||
LCLSendCloseUpMsg(TControl(WidgetInfo^.LCLObject));
|
LCLSendCloseUpMsg(TControl(WidgetInfo^.LCLObject));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1588,7 +1594,8 @@ begin
|
|||||||
and (GTK_IS_MENU(APrivate^.popup_window)) then
|
and (GTK_IS_MENU(APrivate^.popup_window)) then
|
||||||
AMenu := GTK_OBJECT(APrivate^.popup_window);
|
AMenu := GTK_OBJECT(APrivate^.popup_window);
|
||||||
|
|
||||||
if Assigned(AMenu) and (gtk_major_version = 2) and (gtk_minor_version < 10) then
|
if Assigned(AMenu) and
|
||||||
|
(gtk_major_version = 2) and (gtk_minor_version < 10) then
|
||||||
begin
|
begin
|
||||||
g_signal_connect(AMenu, 'show', G_CALLBACK(@GtkPopupShowCB), AWidgetInfo);
|
g_signal_connect(AMenu, 'show', G_CALLBACK(@GtkPopupShowCB), AWidgetInfo);
|
||||||
g_signal_connect_after(AMenu, 'selection-done', G_CALLBACK(@GtkPopupHideCB), AWidgetInfo);
|
g_signal_connect_after(AMenu, 'selection-done', G_CALLBACK(@GtkPopupHideCB), AWidgetInfo);
|
||||||
@ -1637,7 +1644,14 @@ begin
|
|||||||
|
|
||||||
FillChar(AValue, SizeOf(AValue), 0);
|
FillChar(AValue, SizeOf(AValue), 0);
|
||||||
g_value_init(@AValue, G_TYPE_BOOLEAN);
|
g_value_init(@AValue, G_TYPE_BOOLEAN);
|
||||||
g_object_get_property(PGObject(Combo), 'popup-shown', @AValue);
|
if (gtk_major_version = 2) and (gtk_minor_version < 10) then
|
||||||
|
begin
|
||||||
|
if g_object_get_data(PGObject(Combo),'popup-shown-compat') <> nil then
|
||||||
|
AValue.data[0].v_int := 1
|
||||||
|
else
|
||||||
|
AValue.data[0].v_int := 0;
|
||||||
|
end else
|
||||||
|
g_object_get_property(PGObject(Combo), 'popup-shown', @AValue);
|
||||||
Result := AValue.data[0].v_int <> 0;
|
Result := AValue.data[0].v_int <> 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user