Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -762,20 +762,30 @@ long gtk_enter_notify_event (long widget, long event) {
if (imageList != null) {
int index = imageList.indexOf(hotImage);
if (index != -1 && imageHandle != 0) {
if (GTK.GTK4) {
long pixbuf = ImageList.createPixbuf(hotImage);
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
OS.g_object_unref(pixbuf);
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
}
GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
}
}
}
return 0;
}

@Override
void gtk4_enter_event(long controller, double x, double y, long event) {
drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
if (drawHotImage) {
ImageList imageList = parent.imageList;
if (imageList != null) {
int index = imageList.indexOf(hotImage);
if (index != -1 && imageHandle != 0) {
long pixbuf = ImageList.createPixbuf(hotImage);
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
OS.g_object_unref(pixbuf);
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
}
}
}
}

@Override
long gtk_event_after (long widget, long gdkEvent) {
int eventType = GDK.gdk_event_get_event_type(gdkEvent);
Expand Down Expand Up @@ -826,21 +836,33 @@ long gtk_leave_notify_event (long widget, long event) {
if (imageList != null) {
int index = imageList.indexOf(image);
if (index != -1 && imageHandle != 0) {
if (GTK.GTK4) {
long pixbuf = ImageList.createPixbuf(image);
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
OS.g_object_unref(pixbuf);
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
}
GTK3.gtk_image_set_from_surface(imageHandle, imageList.getSurface(index));
}
}
}
}
return 0;
}

@Override
void gtk4_leave_event(long controller, long event) {
if (drawHotImage) {
drawHotImage = false;
if (image != null) {
ImageList imageList = parent.imageList;
if (imageList != null) {
int index = imageList.indexOf(image);
if (index != -1 && imageHandle != 0) {
long pixbuf = ImageList.createPixbuf(image);
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
OS.g_object_unref(pixbuf);
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
}
}
}
}
}

@Override
long gtk_map (long widget) {
parent.fixZOrder ();
Expand Down
Loading