[java-atk-wrapper] JNI-Wrapper: remove get_size and get_position
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI-Wrapper: remove get_size and get_position
- Date: Fri, 27 Feb 2015 21:22:40 +0000 (UTC)
commit 399eb9b886f2f3603abf307dbfd3ac7614d88212
Author: Magdalen Berns <m berns thismagpie com>
Date: Fri Feb 27 21:20:57 2015 +0000
JNI-Wrapper: remove get_size and get_position
Also, implement get_extents properly.
Bug:https://bugzilla.gnome.org/show_bug.cgi?id=740597
jni/src/jawcomponent.c | 96 ++++++---------------
wrapper/org/GNOME/Accessibility/AtkComponent.java | 10 ++-
2 files changed, 31 insertions(+), 75 deletions(-)
---
diff --git a/jni/src/jawcomponent.c b/jni/src/jawcomponent.c
index bf1697f..8a9fb04 100644
--- a/jni/src/jawcomponent.c
+++ b/jni/src/jawcomponent.c
@@ -51,15 +51,6 @@ static gboolean jaw_component_set_extents(AtkComponent *component,
gint height,
AtkCoordType coord_type);
-static void jaw_component_get_position(AtkComponent *component,
- gint *x,
- gint *y,
- AtkCoordType coord_type);
-
-static void jaw_component_get_size(AtkComponent *component,
- gint *width,
- gint *height);
-
static gboolean jaw_component_grab_focus(AtkComponent *component);
static AtkLayer jaw_component_get_layer(AtkComponent *component);
/*static gint jaw_component_get_mdi_zorder (AtkComponent *component);
@@ -75,8 +66,6 @@ jaw_component_interface_init (AtkComponentIface *iface)
iface->contains = jaw_component_contains;
iface->ref_accessible_at_point = jaw_component_ref_accessible_at_point;
iface->get_extents = jaw_component_get_extents;
- iface->get_position = jaw_component_get_position;
- iface->get_size = jaw_component_get_size;
iface->grab_focus = jaw_component_grab_focus;
iface->add_focus_handler = NULL;
iface->remove_focus_handler = NULL;
@@ -210,20 +199,11 @@ jaw_component_get_extents (AtkComponent *component,
gint *height,
AtkCoordType coord_type)
{
- jaw_component_get_position (component, x, y, coord_type);
- jaw_component_get_size (component, width, height);
-}
+ if (x == NULL || y == NULL || width == NULL || height == NULL)
+ return;
-static void
-jaw_component_get_position (AtkComponent *component,
- gint *x,
- gint *y,
- AtkCoordType coord_type)
-{
- if (x == NULL || y == NULL)
- {
+ if (component == NULL)
return;
- }
JawObject *jaw_obj = JAW_OBJECT(component);
ComponentData *data = jaw_object_get_interface_data(jaw_obj,
@@ -235,62 +215,29 @@ jaw_component_get_position (AtkComponent *component,
"org/GNOME/Accessibility/AtkComponent");
jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
classAtkComponent,
- "get_position",
- "(I)Ljava/awt/Point;");
- jobject jpoint = (*jniEnv)->CallObjectMethod(jniEnv,
- atk_component,
- jmid, (jint)coord_type);
+ "get_extents",
+ "()Ljava/awt/Rectangle;");
+
+ jobject jrectangle = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid);
- if (jpoint == NULL)
+ if (jrectangle == NULL)
{
(*x) = 0;
(*y) = 0;
- return;
- }
-
- jclass classPoint = (*jniEnv)->FindClass(jniEnv, "java/awt/Point");
- jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classPoint, "x", "I");
- jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classPoint, "y", "I");
- jint jx = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidX);
- jint jy = (*jniEnv)->GetIntField(jniEnv, jpoint, jfidY);
-
- (*x) = (gint)jx;
- (*y) = (gint)jy;
-}
-
-static void
-jaw_component_get_size (AtkComponent *component, gint *width, gint *height)
-{
- JawObject *jaw_obj = JAW_OBJECT(component);
- ComponentData *data = jaw_object_get_interface_data(jaw_obj, INTERFACE_COMPONENT);
- jobject atk_component = data->atk_component;
-
- JNIEnv *jniEnv = jaw_util_get_jni_env();
- jclass classAtkComponent = (*jniEnv)->FindClass(jniEnv,
- "org/GNOME/Accessibility/AtkComponent");
-
- jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAtkComponent,
- "get_size",
- "()Ljava/awt/Dimension;");
-
- jobject jdimension = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid);
-
- if (jdimension == NULL)
- {
(*width) = 0;
(*height) = 0;
return;
}
- jclass classDimension = (*jniEnv)->FindClass(jniEnv, "java/awt/Dimension");
- jfieldID jfidWidth = (*jniEnv)->GetFieldID(jniEnv, classDimension, "width", "I");
- jfieldID jfidHeight = (*jniEnv)->GetFieldID(jniEnv, classDimension, "height", "I");
- jint jwidth = (*jniEnv)->GetIntField(jniEnv, jdimension, jfidWidth);
- jint jheight = (*jniEnv)->GetIntField(jniEnv, jdimension, jfidHeight);
-
- (*width) = (gint)jwidth;
- (*height) = (gint)jheight;
+ jclass classRectangle = (*jniEnv)->FindClass(jniEnv, "java/awt/Rectangle");
+ jfieldID jfidX = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "x", "I");
+ jfieldID jfidY = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "y", "I");
+ jfieldID jfidW = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "width", "I");
+ jfieldID jfidH = (*jniEnv)->GetFieldID(jniEnv, classRectangle, "height", "I");
+ (*x) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidX);
+ (*y) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidY);
+ (*width) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidW);
+ (*height) = (gint)(*jniEnv)->GetIntField(jniEnv, jrectangle, jfidH);
}
static gboolean
@@ -315,7 +262,14 @@ jaw_component_set_extents (AtkComponent *component,
"set_extents",
"()Ljava/awt/Rectangle;");
- jobject jcomponent = (*jniEnv)->CallObjectMethod(jniEnv, atk_component, jmid);
+ jobject jcomponent = (*jniEnv)->CallObjectMethod(jniEnv,
+ atk_component,
+ jmid,
+ (jint)x,
+ (jint)y,
+ (jint)width,
+ (jint)height,
+ (jint)coord_type);
if (jcomponent == NULL)
{
diff --git a/wrapper/org/GNOME/Accessibility/AtkComponent.java
b/wrapper/org/GNOME/Accessibility/AtkComponent.java
index 97e0ce8..202635f 100644
--- a/wrapper/org/GNOME/Accessibility/AtkComponent.java
+++ b/wrapper/org/GNOME/Accessibility/AtkComponent.java
@@ -78,11 +78,8 @@ public class AtkComponent {
return acc_component.getLocation();
}
- public Dimension get_size () {
- return acc_component.getSize();
- }
-
public Rectangle set_extents(int x, int y, int width, int height, int coord_type) {
+
this.width = (int)acc_component.getSize().getWidth();
this.height = (int)acc_component.getSize().getHeight();
@@ -93,9 +90,14 @@ public class AtkComponent {
this.x -= p.x;
this.y -= p.y;
}
+ acc_component.setBounds(new Rectangle(x, y, width, height));
return new Rectangle(x, y, width, height);
}
+ public Rectangle get_extents() {
+ return acc_component.getBounds();
+ }
+
public int get_layer () {
AccessibleRole role = ac.getAccessibleRole();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]