Bug 539392: [GTK3] Replace deprecated GdkScreen monitor functions with
GdkDisplay ones
Fix crash in gdk_monitor_get_geometry().
Change-Id: I049692e6c0e4074412ccce1243d81be331d829cb
Signed-off-by: Eric Williams <ericwill@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 1fb1299..bbc08cb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -1228,12 +1228,12 @@
GDK_NATIVE_ENTER(env, that, _1gdk_1monitor_1get_1geometry_FUNC);
if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
/*
- gdk_monitor_get_geometry(arg0, lparg1);
+ gdk_monitor_get_geometry((GdkMonitor *)arg0, lparg1);
*/
{
GDK_LOAD_FUNCTION(fp, gdk_monitor_get_geometry)
if (fp) {
- ((void (CALLING_CONVENTION*)(jintLong, GdkRectangle *))fp)(arg0, lparg1);
+ ((void (CALLING_CONVENTION*)(GdkMonitor *, GdkRectangle *))fp)((GdkMonitor *)arg0, lparg1);
}
}
fail:
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index e38f1e2..2fb8553 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -1527,6 +1527,7 @@
}
/**
* @method flags=dynamic
+ * @param monitor cast=(GdkMonitor *)
* @param dest flags=no_in
*/
public static final native void _gdk_monitor_get_geometry (long /*int*/ monitor, GdkRectangle dest);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 2204dd4..bd1990c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1548,7 +1548,8 @@
if (monitorCount > 0) {
GdkRectangle dest = new GdkRectangle ();
for (int i = 0; i < monitorCount; i++) {
- GDK.gdk_monitor_get_geometry (i, dest);
+ long /*int*/ monitor = GDK.gdk_display_get_monitor(display, i);
+ GDK.gdk_monitor_get_geometry (monitor, dest);
if (i == 0) {
bounds.width = dest.width;
bounds.height = dest.height;