@@ -762,20 +762,30 @@ long gtk_enter_notify_event (long widget, long event) {
762762 if (imageList != null ) {
763763 int index = imageList .indexOf (hotImage );
764764 if (index != -1 && imageHandle != 0 ) {
765- if (GTK .GTK4 ) {
766- long pixbuf = ImageList .createPixbuf (hotImage );
767- long texture = GDK .gdk_texture_new_for_pixbuf (pixbuf );
768- OS .g_object_unref (pixbuf );
769- GTK4 .gtk_image_set_from_paintable (imageHandle , texture );
770- } else {
771- GTK3 .gtk_image_set_from_surface (imageHandle , imageList .getSurface (index ));
772- }
765+ GTK3 .gtk_image_set_from_surface (imageHandle , imageList .getSurface (index ));
773766 }
774767 }
775768 }
776769 return 0 ;
777770}
778771
772+ @ Override
773+ void gtk4_enter_event (long controller , double x , double y , long event ) {
774+ drawHotImage = (parent .style & SWT .FLAT ) != 0 && hotImage != null ;
775+ if (drawHotImage ) {
776+ ImageList imageList = parent .imageList ;
777+ if (imageList != null ) {
778+ int index = imageList .indexOf (hotImage );
779+ if (index != -1 && imageHandle != 0 ) {
780+ long pixbuf = ImageList .createPixbuf (hotImage );
781+ long texture = GDK .gdk_texture_new_for_pixbuf (pixbuf );
782+ OS .g_object_unref (pixbuf );
783+ GTK4 .gtk_image_set_from_paintable (imageHandle , texture );
784+ }
785+ }
786+ }
787+ }
788+
779789@ Override
780790long gtk_event_after (long widget , long gdkEvent ) {
781791 int eventType = GDK .gdk_event_get_event_type (gdkEvent );
@@ -826,21 +836,33 @@ long gtk_leave_notify_event (long widget, long event) {
826836 if (imageList != null ) {
827837 int index = imageList .indexOf (image );
828838 if (index != -1 && imageHandle != 0 ) {
829- if (GTK .GTK4 ) {
830- long pixbuf = ImageList .createPixbuf (image );
831- long texture = GDK .gdk_texture_new_for_pixbuf (pixbuf );
832- OS .g_object_unref (pixbuf );
833- GTK4 .gtk_image_set_from_paintable (imageHandle , texture );
834- } else {
835- GTK3 .gtk_image_set_from_surface (imageHandle , imageList .getSurface (index ));
836- }
839+ GTK3 .gtk_image_set_from_surface (imageHandle , imageList .getSurface (index ));
837840 }
838841 }
839842 }
840843 }
841844 return 0 ;
842845}
843846
847+ @ Override
848+ void gtk4_leave_event (long controller , long event ) {
849+ if (drawHotImage ) {
850+ drawHotImage = false ;
851+ if (image != null ) {
852+ ImageList imageList = parent .imageList ;
853+ if (imageList != null ) {
854+ int index = imageList .indexOf (image );
855+ if (index != -1 && imageHandle != 0 ) {
856+ long pixbuf = ImageList .createPixbuf (image );
857+ long texture = GDK .gdk_texture_new_for_pixbuf (pixbuf );
858+ OS .g_object_unref (pixbuf );
859+ GTK4 .gtk_image_set_from_paintable (imageHandle , texture );
860+ }
861+ }
862+ }
863+ }
864+ }
865+
844866@ Override
845867long gtk_map (long widget ) {
846868 parent .fixZOrder ();
0 commit comments