mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 08:07:34 +01:00
Modifyed patch from Boris Glavin to update the icon in gtk2 TTrayIcon.InternalUpdate
git-svn-id: trunk@15568 -
This commit is contained in:
parent
adcc5ef47e
commit
6ba52ea68e
@ -18,6 +18,7 @@ Benito van der Zander
|
||||
Bob Wingard
|
||||
Boguslaw Brandys
|
||||
Boris Arko
|
||||
Boris Glavin
|
||||
Chris Rorden
|
||||
Christian Iversen
|
||||
Christian Ulrich
|
||||
|
||||
@ -298,6 +298,8 @@ begin
|
||||
|
||||
Tips := nil;
|
||||
|
||||
ATrayIcon.Handle := PtrInt(0);
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
@ -372,6 +374,13 @@ begin
|
||||
*******************************************************************}
|
||||
|
||||
gtk_widget_show(GtkForm);
|
||||
|
||||
{*******************************************************************
|
||||
* We don't use the GtkPlug for anything, but we reuse the image
|
||||
* to update it in InternalUpdate, so we save the image
|
||||
* as the handle
|
||||
*******************************************************************}
|
||||
ATrayIcon.Handle := PtrInt(AImage);
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
@ -388,8 +397,30 @@ end;
|
||||
*
|
||||
*******************************************************************}
|
||||
class procedure TGtk2WSCustomTrayIcon.InternalUpdate(const ATrayIcon: TCustomTrayIcon);
|
||||
var
|
||||
AImage: PGtkWidget;
|
||||
AMask: PGdkBitmap;
|
||||
GDIObject: PgdiObject;
|
||||
begin
|
||||
// Updates the tooltips
|
||||
if Assigned(Tips) then gtk_tooltips_set_tip(GTK_TOOLTIPS(Tips), GtkForm, PChar(ATrayIcon.Hint), '');
|
||||
|
||||
// Updates the icon
|
||||
|
||||
AImage := PGtkWidget(ATrayIcon.Handle);
|
||||
|
||||
if AImage <> nil then
|
||||
begin
|
||||
GDIObject := PgdiObject(ATrayIcon.Icon.Handle);
|
||||
|
||||
AMask := CreateGdkMaskBitmap(
|
||||
GDIObject^.GDIPixmapObject.Mask,
|
||||
GDIObject^.GDIBitmapObject);
|
||||
|
||||
gtk_image_set_from_pixmap(GTK_IMAGE(AImage),GDIObject^.GDIPixmapObject.Image, AMask);
|
||||
|
||||
g_object_unref(AMask);
|
||||
end;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
|
||||
Loading…
Reference in New Issue
Block a user