Skip to content

Commit 56e6a0f

Browse files
Missing GTK4 methods.
1 parent 4e83dd1 commit 56e6a0f

File tree

3 files changed

+81
-3
lines changed
  • bundles/org.eclipse.swt

3 files changed

+81
-3
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,26 @@ JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1box_1prepend)
319319
}
320320
#endif
321321

322+
#ifndef NO_gtk_1box_1remove
323+
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1box_1remove)
324+
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
325+
{
326+
GTK4_NATIVE_ENTER(env, that, gtk_1box_1remove_FUNC);
327+
gtk_box_remove((GtkBox *)arg0, (GtkWidget *)arg1);
328+
GTK4_NATIVE_EXIT(env, that, gtk_1box_1remove_FUNC);
329+
}
330+
#endif
331+
332+
#ifndef NO_gtk_1box_1reorder_1child_1after
333+
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1box_1reorder_1child_1after)
334+
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2)
335+
{
336+
GTK4_NATIVE_ENTER(env, that, gtk_1box_1reorder_1child_1after_FUNC);
337+
gtk_box_reorder_child_after((GtkBox *)arg0, (GtkWidget *)arg1, (GtkWidget *)arg2);
338+
GTK4_NATIVE_EXIT(env, that, gtk_1box_1reorder_1child_1after_FUNC);
339+
}
340+
#endif
341+
322342
#ifndef NO_gtk_1button_1new_1from_1icon_1name
323343
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1button_1new_1from_1icon_1name)
324344
(JNIEnv *env, jclass that, jbyteArray arg0)
@@ -707,6 +727,18 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1delegate)
707727
}
708728
#endif
709729

730+
#ifndef NO_gtk_1editable_1get_1max_1width_1chars
731+
JNIEXPORT jint JNICALL GTK4_NATIVE(gtk_1editable_1get_1max_1width_1chars)
732+
(JNIEnv *env, jclass that, jlong arg0)
733+
{
734+
jint rc = 0;
735+
GTK4_NATIVE_ENTER(env, that, gtk_1editable_1get_1max_1width_1chars_FUNC);
736+
rc = (jint)gtk_editable_get_max_width_chars((GtkEditable *)arg0);
737+
GTK4_NATIVE_EXIT(env, that, gtk_1editable_1get_1max_1width_1chars_FUNC);
738+
return rc;
739+
}
740+
#endif
741+
710742
#ifndef NO_gtk_1editable_1get_1text
711743
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1text)
712744
(JNIEnv *env, jclass that, jlong arg0)
@@ -719,6 +751,16 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1text)
719751
}
720752
#endif
721753

754+
#ifndef NO_gtk_1editable_1set_1max_1width_1chars
755+
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1editable_1set_1max_1width_1chars)
756+
(JNIEnv *env, jclass that, jlong arg0, jint arg1)
757+
{
758+
GTK4_NATIVE_ENTER(env, that, gtk_1editable_1set_1max_1width_1chars_FUNC);
759+
gtk_editable_set_max_width_chars((GtkEditable *)arg0, (int)arg1);
760+
GTK4_NATIVE_EXIT(env, that, gtk_1editable_1set_1max_1width_1chars_FUNC);
761+
}
762+
#endif
763+
722764
#ifndef NO_gtk_1entry_1buffer_1get_1text
723765
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1entry_1buffer_1get_1text)
724766
(JNIEnv *env, jclass that, jlong arg0)
@@ -1517,6 +1559,18 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1image_1new_1from_1icon_1name)
15171559
}
15181560
#endif
15191561

1562+
#ifndef NO_gtk_1image_1new_1from_1paintable
1563+
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1image_1new_1from_1paintable)
1564+
(JNIEnv *env, jclass that, jlong arg0)
1565+
{
1566+
jlong rc = 0;
1567+
GTK4_NATIVE_ENTER(env, that, gtk_1image_1new_1from_1paintable_FUNC);
1568+
rc = (jlong)gtk_image_new_from_paintable((GdkPaintable *)arg0);
1569+
GTK4_NATIVE_EXIT(env, that, gtk_1image_1new_1from_1paintable_FUNC);
1570+
return rc;
1571+
}
1572+
#endif
1573+
15201574
#ifndef NO_gtk_1image_1set_1from_1icon_1name
15211575
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1image_1set_1from_1icon_1name)
15221576
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ public class GTK4 {
7070
* @param child cast=(GtkWidget *)
7171
*/
7272
public static final native void gtk_box_prepend(long box, long child);
73+
/**
74+
* @param box cast=(GtkBox *)
75+
* @param child cast=(GtkWidget *)
76+
* @param sibling cast=(GtkWidget *)
77+
*/
78+
public static final native void gtk_box_reorder_child_after(long box, long child, long sibling);
79+
/**
80+
* @param box cast=(GtkBox *)
81+
* @param child cast=(GtkWidget *)
82+
*/
83+
public static final native void gtk_box_remove(long box, long child);
7384
/**
7485
* @param box cast=(GtkBox *)
7586
* @param child cast=(GtkWidget *)
@@ -120,6 +131,15 @@ public class GTK4 {
120131
public static final native long gtk_editable_get_text(long editable);
121132
/** @param editable cast=(GtkEditable *) */
122133
public static final native long gtk_editable_get_delegate(long editable);
134+
/**
135+
* @param editable cast=(GtkEditable *)
136+
*/
137+
public static final native int gtk_editable_get_max_width_chars(long editable);
138+
/**
139+
* @param editable cast=(GtkEditable *)
140+
* @param chars cast=(int)
141+
*/
142+
public static final native void gtk_editable_set_max_width_chars(long editable, int chars);
123143

124144
/* GtkPicture */
125145
public static final native long gtk_picture_new();
@@ -702,6 +722,8 @@ public class GTK4 {
702722
public static final native void gtk_image_set_from_paintable(long image, long paintable);
703723
/** @param icon_name cast=(const char *) */
704724
public static final native long gtk_image_new_from_icon_name(byte[] icon_name);
725+
/** @param paintable cast=(GdkPaintable *) */
726+
public static final native long gtk_image_new_from_paintable(long paintable);
705727
/**
706728
* @param image cast=(GtkImage *)
707729
* @param icon_name cast=(const gchar *)
@@ -860,5 +882,4 @@ public class GTK4 {
860882
* @param gesture cast=(GtkGesture *)
861883
*/
862884
public static final native long gtk_gesture_get_last_updated_sequence(long gesture);
863-
864885
}

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,11 +1057,14 @@ private void _setImage (Image image) {
10571057
GTK4.gtk_image_set_from_paintable(imageHandle, texture);
10581058
} else {
10591059
if (imageHandle == 0) {
1060-
GTK4.gtk_image_set_from_paintable(imageHandle, surface);
1060+
long pixbuf = ImageList.createPixbuf(image);
1061+
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);
1062+
OS.g_object_unref(pixbuf);
1063+
GTK4.gtk_image_new_from_paintable(texture);
10611064
if (imageHandle == 0) error(SWT.ERROR_NO_HANDLES);
10621065

10631066
GTK4.gtk_box_append(boxHandle, imageHandle);
1064-
GTK4.gtk_reorder_child_after(boxHandle, imageHandle, 0);
1067+
GTK4.gtk_box_reorder_child_after(boxHandle, imageHandle, 0);
10651068
} else {
10661069
long pixbuf = ImageList.createPixbuf(image);
10671070
long texture = GDK.gdk_texture_new_for_pixbuf(pixbuf);

0 commit comments

Comments
 (0)