Skip to content

Commit 17856ec

Browse files
committed
Stop using GDK_*_* macros
There are functions for that available since long time so it's best to consistently use single and more reliable way.
1 parent fdd99a8 commit 17856ec

8 files changed

Lines changed: 12 additions & 42 deletions

File tree

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others. All rights reserved.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others. All rights reserved.
33
* The contents of this file are made available under the terms
44
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
55
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -29,30 +29,6 @@
2929
#pragma warning (disable: 4100)
3030
#endif
3131

32-
#ifndef NO_GDK_1EVENT_1TYPE
33-
JNIEXPORT jint JNICALL GDK_NATIVE(GDK_1EVENT_1TYPE)
34-
(JNIEnv *env, jclass that, jlong arg0)
35-
{
36-
jint rc = 0;
37-
GDK_NATIVE_ENTER(env, that, GDK_1EVENT_1TYPE_FUNC);
38-
rc = (jint)GDK_EVENT_TYPE((GdkEvent *)arg0);
39-
GDK_NATIVE_EXIT(env, that, GDK_1EVENT_1TYPE_FUNC);
40-
return rc;
41-
}
42-
#endif
43-
44-
#ifndef NO_GDK_1EVENT_1WINDOW
45-
JNIEXPORT jlong JNICALL GDK_NATIVE(GDK_1EVENT_1WINDOW)
46-
(JNIEnv *env, jclass that, jlong arg0)
47-
{
48-
jlong rc = 0;
49-
GDK_NATIVE_ENTER(env, that, GDK_1EVENT_1WINDOW_FUNC);
50-
rc = (jlong)GDK_EVENT_WINDOW((GdkEventAny *)arg0);
51-
GDK_NATIVE_EXIT(env, that, GDK_1EVENT_1WINDOW_FUNC);
52-
return rc;
53-
}
54-
#endif
55-
5632
#ifndef NO_GDK_1IS_1WAYLAND_1DISPLAY
5733
JNIEXPORT jboolean JNICALL GDK_NATIVE(GDK_1IS_1WAYLAND_1DISPLAY)
5834
(JNIEnv *env, jclass that, jlong arg0)

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others. All rights reserved.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others. All rights reserved.
33
* The contents of this file are made available under the terms
44
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
55
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -24,8 +24,6 @@
2424
#endif
2525

2626
typedef enum {
27-
GDK_1EVENT_1TYPE_FUNC,
28-
GDK_1EVENT_1WINDOW_FUNC,
2927
GDK_1IS_1WAYLAND_1DISPLAY_FUNC,
3028
GDK_1IS_1X11_1DISPLAY_FUNC,
3129
GDK_1TYPE_1PIXBUF_FUNC,

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2020 Red Hat Inc. and others. All rights reserved.
2+
* Copyright (c) 2018, 2026 Red Hat Inc. and others. All rights reserved.
33
* The contents of this file are made available under the terms
44
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
55
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -242,10 +242,6 @@ public class GDK extends OS {
242242
public static final native int GdkRectangle_sizeof();
243243

244244
/** Macros */
245-
/** @param event cast=(GdkEvent *) */
246-
public static final native int GDK_EVENT_TYPE(long event);
247-
/** @param event cast=(GdkEventAny *) */
248-
public static final native long GDK_EVENT_WINDOW(long event);
249245
/** @param display cast=(GdkDisplay *) */
250246
public static final native boolean GDK_IS_WAYLAND_DISPLAY(long display);
251247
/** @param display cast=(GdkDisplay *) */

bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static long JSDOMEventProc (long arg0, long event, long user_data) {
386386
final Browser browser = FindBrowser (arg0);
387387
if (browser != null && user_data == WIDGET_EVENT){
388388
/* this instance does need to use the GDK event to create an SWT event to send */
389-
switch (GDK.GDK_EVENT_TYPE (event)) {
389+
switch (GDK.gdk_event_get_event_type (event)) {
390390
case GDK.GDK_KEY_PRESS: {
391391
if (browser.isFocusControl ()) {
392392
int [] key = new int [1];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3527,7 +3527,7 @@ long gtk_button_press_event (long widget, long event, boolean sendMouseDown) {
35273527
display.clickCount = 1;
35283528
long nextEvent = GDK.gdk_event_peek();
35293529
if (nextEvent != 0) {
3530-
int peekedEventType = GDK.GDK_EVENT_TYPE (nextEvent);
3530+
int peekedEventType = GDK.gdk_event_get_event_type (nextEvent);
35313531
if (peekedEventType == GDK.GDK_2BUTTON_PRESS) display.clickCount = 2;
35323532
if (peekedEventType == GDK.GDK_3BUTTON_PRESS) display.clickCount = 3;
35333533
gdk_event_free (nextEvent);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -2332,7 +2332,7 @@ long gtk_motion_notify_event (long widget, long event) {
23322332
long surface = GDK.gdk_event_get_surface(event);
23332333
if (surface != gtk_widget_get_surface(handle)) return 0;
23342334
} else {
2335-
long window = GDK.GDK_EVENT_WINDOW (event);
2335+
long window = GDK.gdk_event_get_window (event);
23362336
if (window != GTK3.gtk_tree_view_get_bin_window (handle)) return 0;
23372337
}
23382338
return super.gtk_motion_notify_event (widget, event);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -250,11 +250,11 @@ long gtk_activate (long widget) {
250250
*/
251251
long nextEvent = GDK.gdk_event_peek();
252252
if (nextEvent != 0) {
253-
int nextEventType = GDK.GDK_EVENT_TYPE (nextEvent);
253+
int nextEventType = GDK.gdk_event_get_event_type (nextEvent);
254254
long currEvent = GTK3.gtk_get_current_event ();
255255
int currEventType = 0;
256256
if (currEvent != 0) {
257-
currEventType = GDK.GDK_EVENT_TYPE (currEvent);
257+
currEventType = GDK.gdk_event_get_event_type (currEvent);
258258
gdk_event_free(currEvent);
259259
}
260260
gdk_event_free (nextEvent);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -2502,7 +2502,7 @@ long gtk_motion_notify_event (long widget, long event) {
25022502
long surface = GDK.gdk_event_get_surface(event);
25032503
if (surface != gtk_widget_get_surface(handle)) return 0;
25042504
} else {
2505-
long window = GDK.GDK_EVENT_WINDOW (event);
2505+
long window = GDK.gdk_event_get_window (event);
25062506
if (window != GTK3.gtk_tree_view_get_bin_window (handle)) return 0;
25072507
}
25082508
return super.gtk_motion_notify_event (widget, event);

0 commit comments

Comments
 (0)