@@ -762,20 +762,30 @@ long gtk_enter_notify_event (long widget, long event) {
762
762
if (imageList != null ) {
763
763
int index = imageList .indexOf (hotImage );
764
764
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 ));
773
766
}
774
767
}
775
768
}
776
769
return 0 ;
777
770
}
778
771
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
+
779
789
@ Override
780
790
long gtk_event_after (long widget , long gdkEvent ) {
781
791
int eventType = GDK .gdk_event_get_event_type (gdkEvent );
@@ -826,21 +836,33 @@ long gtk_leave_notify_event (long widget, long event) {
826
836
if (imageList != null ) {
827
837
int index = imageList .indexOf (image );
828
838
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 ));
837
840
}
838
841
}
839
842
}
840
843
}
841
844
return 0 ;
842
845
}
843
846
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
+
844
866
@ Override
845
867
long gtk_map (long widget ) {
846
868
parent .fixZOrder ();
0 commit comments