Re: [g-a-devel] generateKeyboardEvent Patch for Java Access Bridge



Hi Matt:

Thanks for the patch. I am a bit confused by it though; why are you using the java-access-bridge to generate keyboard events at all? The registry code in java-access-bridge isn't part of the java-access-bridge.jar package, it's only a proof-of-concept alternative implementation of the AT-SPI at-spi-registryd daemon, to demonstrate that most of it could be written in Java. The patch is welcome, but you should not need it (nor should anyone else, really!).

Instead, your java application should just use the normal CORBA Java stubs to call registry.generateKeyboardEvent on the shared at-spi-registry object, it shouldn't package a Java reimplementation of the registry. You will need to get the registry instance via bonobo-activation (see JNav.java for an example of how a Java application can contact the at-spi registry daemon).

You should not use X keycodes or X keysyms in a Java application; you should use the Java-equivalent codes, or use the 'string' version of the key event APIs.

You haven't indicated what special characters you've found in UnknownImpl.java. I assume they're the ones in the Copyright statement, in which case I'd just replace them with the nearest Latin equivalents and leave them be.

- Bill


Matt Wringe wrote:
Hi,
I am writing an java gnome app that needs to generate keyboard events
and I noticed that the generateKeyboardEvent method in the Java Access
Bridge is left blank. I have written a small patch that enables this
functionality and can be found attached to this email. If you prefer I
can open a bug and post this patch in bugzilla.

I have noticed a couple of other issues. It appears that
java-access-bridge/impl/org/GNOME/Bonobo/UnknownImpl.java is not utf-8
encoded and has special characters in it. This can cause problems with
some jvm's. For me to build the java access bridge, I either have to
remove the special characters or change the encoding to utf-8.

Also, I have noticed that there doesn't seem to be any way to get the
keycodes or keysyms for a specific character in the java access
bridge. I can though get keysyms through java gnome
(org.gnu.gdk.KeySymbol), but I don't can't figure out how to get
keycodes (other than hardcoding then). If I am not missing an obvious
way to do this, I may be willing to help implement this functionality
if you want.

If you have any questions please let me know.

Thanks,

Matt Wringe


------------------------------------------------------------------------

diff -u -r ../cvs/java-access-bridge/registry/Makefile.am java-access-bridge/registry/Makefile.am
--- ../cvs/java-access-bridge/registry/Makefile.am	2003-05-09 03:50:37.000000000 -0400
+++ java-access-bridge/registry/Makefile.am	2005-03-15 23:23:37.000000000 -0500
@@ -1,12 +1,17 @@
 SUBDIRS=org
-JAVA_SRC=$(wildcard *.java)
-CLASSES=$(patsubst %.java,%.class,$(JAVA_SRC))
+JARFILES=../gnome-java-bridge.jar
+CLASSES=$(wildcard org/GNOME/*/*.class)
+JAVA_FILES=$(wildcard org/GNOME/*/*.java)
+DEP_CLASSES=$(JAVA_FILES:.java=.class)
-all-local: $(CLASSES)
+jar-stamp: ../jar-stamp
+	echo
-%.class : %.java
-	CLASSPATH=$(top_srcdir)/idlgen:$(top_srcdir)/impl:$(top_srcdir)/util:$(top_srcdir)/at-client:$(top_srcdir)/registry $(JAVAC) $<
+../gnome-java-bridge.jar : jar-stamp $(JAVA_FILES) $(DEP_CLASSES)
+	touch ../jar-stamp
+	$(JAR) uf ../gnome-java-bridge.jar org/GNOME/*/*.class
-clean-local:
-	$(RM) *.class
+$(DEP_CLASSES) : + @(cd `dirname $ `; $(MAKE) ) +all-local: $(CLASSES) $(JARFILES)
diff -u -r ../cvs/java-access-bridge/registry/org/GNOME/Accessibility/DeviceEventControllerImpl.java java-access-bridge/registry/org/GNOME/Accessibility/DeviceEventControllerImpl.java
--- ../cvs/java-access-bridge/registry/org/GNOME/Accessibility/DeviceEventControllerImpl.java	2002-11-19 17:58:18.000000000 -0500
+++ java-access-bridge/registry/org/GNOME/Accessibility/DeviceEventControllerImpl.java	2005-03-15 23:23:37.000000000 -0500
@@ -57,7 +57,11 @@
public void generateKeyboardEvent (int keycode, String keystring, KeySynthType type) {
-		; // TODO: can this be implemented cleanly?
+		if (keystring == null){
+			keystring="";
+		}
+		DeviceEventController dec=AccessUtil.getRegistryObject().getDeviceEventController();
+		dec.generateKeyboardEvent (keycode, keystring, type);
 	}
public void generateMouseEvent (int x, int y, String eventName) {


------------------------------------------------------------------------

_______________________________________________
Gnome-accessibility-devel mailing list
Gnome-accessibility-devel gnome org
http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel


--
------
Bill Haneman
Gnome Accessibility Project
Sun Microsystems Ireland



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]