Skip to content

Commit dd88f1f

Browse files
committed
Use gtk_widget_set_visible instead of gtk_widget_hide/show
Use the old native method as a wrapper that redirects to GTK3/4
1 parent 0e0d38c commit dd88f1f

File tree

9 files changed

+51
-38
lines changed

9 files changed

+51
-38
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -2275,6 +2272,16 @@ JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1widget_1get_1window)
22752272
}
22762273
#endif
22772274

2275+
#ifndef NO_gtk_1widget_1hide
2276+
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1hide)
2277+
(JNIEnv *env, jclass that, jlong arg0)
2278+
{
2279+
GTK3_NATIVE_ENTER(env, that, gtk_1widget_1hide_FUNC);
2280+
gtk_widget_hide((GtkWidget *)arg0);
2281+
GTK3_NATIVE_EXIT(env, that, gtk_1widget_1hide_FUNC);
2282+
}
2283+
#endif
2284+
22782285
#ifndef NO_gtk_1widget_1input_1shape_1combine_1region
22792286
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1input_1shape_1combine_1region)
22802287
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
@@ -2408,6 +2415,16 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1shape_1combine_1region)
24082415
}
24092416
#endif
24102417

2418+
#ifndef NO_gtk_1widget_1show
2419+
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1show)
2420+
(JNIEnv *env, jclass that, jlong arg0)
2421+
{
2422+
GTK3_NATIVE_ENTER(env, that, gtk_1widget_1show_FUNC);
2423+
gtk_widget_show((GtkWidget *)arg0);
2424+
GTK3_NATIVE_EXIT(env, that, gtk_1widget_1show_FUNC);
2425+
}
2426+
#endif
2427+
24112428
#ifndef NO_gtk_1widget_1size_1allocate
24122429
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1size_1allocate)
24132430
(JNIEnv *env, jclass that, jlong arg0, jobject arg1)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -209,6 +206,7 @@ typedef enum {
209206
gtk_1widget_1get_1screen_FUNC,
210207
gtk_1widget_1get_1toplevel_FUNC,
211208
gtk_1widget_1get_1window_FUNC,
209+
gtk_1widget_1hide_FUNC,
212210
gtk_1widget_1input_1shape_1combine_1region_FUNC,
213211
gtk_1widget_1override_1font_FUNC,
214212
gtk_1widget_1remove_1accelerator_FUNC,
@@ -221,6 +219,7 @@ typedef enum {
221219
gtk_1widget_1set_1parent_1window_FUNC,
222220
gtk_1widget_1set_1redraw_1on_1allocate_FUNC,
223221
gtk_1widget_1shape_1combine_1region_FUNC,
222+
gtk_1widget_1show_FUNC,
224223
gtk_1widget_1size_1allocate_FUNC,
225224
gtk_1widget_1style_1get__J_3B_3IJ_FUNC,
226225
gtk_1widget_1style_1get__J_3B_3JJ_FUNC,

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -2222,6 +2219,16 @@ JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1widget_1set_1focusable)
22222219
}
22232220
#endif
22242221

2222+
#ifndef NO_gtk_1widget_1set_1visible
2223+
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1widget_1set_1visible)
2224+
(JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
2225+
{
2226+
GTK4_NATIVE_ENTER(env, that, gtk_1widget_1set_1visible_FUNC);
2227+
gtk_widget_set_visible(arg0, arg1);
2228+
GTK4_NATIVE_EXIT(env, that, gtk_1widget_1set_1visible_FUNC);
2229+
}
2230+
#endif
2231+
22252232
#ifndef NO_gtk_1widget_1size_1allocate
22262233
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1widget_1size_1allocate)
22272234
(JNIEnv *env, jclass that, jlong arg0, jobject arg1, jint arg2)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* https://www.eclipse.org/legal/epl-2.0/
88
*
99
* SPDX-License-Identifier: EPL-2.0
10-
*
11-
* Contributors:
12-
* IBM Corporation - initial API and implementation
1310
*******************************************************************************/
1411

1512
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -184,6 +181,7 @@ typedef enum {
184181
gtk_1widget_1pick_FUNC,
185182
gtk_1widget_1set_1cursor_FUNC,
186183
gtk_1widget_1set_1focusable_FUNC,
184+
gtk_1widget_1set_1visible_FUNC,
187185
gtk_1widget_1size_1allocate_FUNC,
188186
gtk_1widget_1snapshot_1child_FUNC,
189187
gtk_1widget_1translate_1coordinates_FUNC,

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9352,16 +9352,6 @@ JNIEXPORT jboolean JNICALL GTK_NATIVE(gtk_1widget_1has_1focus)
93529352
}
93539353
#endif
93549354

9355-
#ifndef NO_gtk_1widget_1hide
9356-
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1hide)
9357-
(JNIEnv *env, jclass that, jlong arg0)
9358-
{
9359-
GTK_NATIVE_ENTER(env, that, gtk_1widget_1hide_FUNC);
9360-
gtk_widget_hide((GtkWidget *)arg0);
9361-
GTK_NATIVE_EXIT(env, that, gtk_1widget_1hide_FUNC);
9362-
}
9363-
#endif
9364-
93659355
#ifndef NO_gtk_1widget_1insert_1action_1group
93669356
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1insert_1action_1group)
93679357
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1, jlong arg2)
@@ -9680,16 +9670,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1set_1visible)
96809670
}
96819671
#endif
96829672

9683-
#ifndef NO_gtk_1widget_1show
9684-
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1show)
9685-
(JNIEnv *env, jclass that, jlong arg0)
9686-
{
9687-
GTK_NATIVE_ENTER(env, that, gtk_1widget_1show_FUNC);
9688-
gtk_widget_show((GtkWidget *)arg0);
9689-
GTK_NATIVE_EXIT(env, that, gtk_1widget_1show_FUNC);
9690-
}
9691-
#endif
9692-
96939673
#ifndef NO_gtk_1widget_1unparent
96949674
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1unparent)
96959675
(JNIEnv *env, jclass that, jlong arg0)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ typedef enum {
748748
gtk_1widget_1grab_1focus_FUNC,
749749
gtk_1widget_1has_1default_FUNC,
750750
gtk_1widget_1has_1focus_FUNC,
751-
gtk_1widget_1hide_FUNC,
752751
gtk_1widget_1insert_1action_1group_FUNC,
753752
gtk_1widget_1is_1focus_FUNC,
754753
gtk_1widget_1mnemonic_1activate_FUNC,
@@ -774,7 +773,6 @@ typedef enum {
774773
gtk_1widget_1set_1valign_FUNC,
775774
gtk_1widget_1set_1vexpand_FUNC,
776775
gtk_1widget_1set_1visible_FUNC,
777-
gtk_1widget_1show_FUNC,
778776
gtk_1widget_1unparent_FUNC,
779777
gtk_1window_1fullscreen_FUNC,
780778
gtk_1window_1get_1default_1size_FUNC,

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*******************************************************************************/
1515
package org.eclipse.swt.internal.gtk;
1616

17+
import org.eclipse.swt.internal.gtk3.*;
18+
1719
/**
1820
* This class contains GTK specific native functions.
1921
*
@@ -2340,8 +2342,11 @@ public class GTK extends OS {
23402342
public static final native void gtk_widget_grab_focus(long widget);
23412343
/** @param widget cast=(GtkWidget *) */
23422344
public static final native boolean gtk_widget_has_focus(long widget);
2343-
/** @param widget cast=(GtkWidget *) */
2344-
public static final native void gtk_widget_hide(long widget);
2345+
2346+
public static final void gtk_widget_hide(long widget) {
2347+
if (GTK4) org.eclipse.swt.internal.gtk4.GTK4.gtk_widget_set_visible(widget, false);
2348+
else GTK3.gtk_widget_hide(widget);
2349+
}
23452350
/** @param widget cast=(GtkWidget *) */
23462351
public static final native boolean gtk_widget_is_focus(long widget);
23472352
/** @param widget cast=(GtkWidget *) */
@@ -2399,8 +2404,11 @@ public class GTK extends OS {
23992404
* @param height cast=(gint)
24002405
*/
24012406
public static final native void gtk_widget_set_size_request(long widget, int width, int height);
2402-
/** @param widget cast=(GtkWidget *) */
2403-
public static final native void gtk_widget_show(long widget);
2407+
2408+
public static final void gtk_widget_show(long widget) {
2409+
if (GTK4) org.eclipse.swt.internal.gtk4.GTK4.gtk_widget_set_visible(widget, true);
2410+
else GTK3.gtk_widget_show(widget);
2411+
}
24042412
/** @param widget cast=(GtkWidget *) */
24052413
public static final native boolean gtk_widget_activate(long widget);
24062414
/** @param widget cast=(GtkWidget *) */

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,5 +1089,9 @@ public class GTK3 {
10891089
public static final native int GdkEventWindowState_sizeof();
10901090
public static final native int GdkGeometry_sizeof();
10911091
public static final native int GdkWindowAttr_sizeof();
1092+
/** @param widget cast=(GtkWidget *) */
1093+
public static final native void gtk_widget_show(long widget);
1094+
/** @param widget cast=(GtkWidget *) */
1095+
public static final native void gtk_widget_hide(long widget);
10921096

10931097
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ public class GTK4 {
658658
public static final native void gtk_widget_set_focusable(long widget, boolean focusable);
659659
/** @param widget cast=(GtkWidget *) */
660660
public static final native long gtk_widget_get_clipboard(long widget);
661+
662+
public static final native void gtk_widget_set_visible(long widget, boolean v);
661663
/**
662664
* @param widget cast=(GtkWidget *)
663665
* @param allocation cast=(GtkAllocation *),flags=no_out

0 commit comments

Comments
 (0)