diff --git a/res/menu/activity_canvas.xml b/res/menu/activity_canvas.xml
index a714644..6aa78a8 100644
--- a/res/menu/activity_canvas.xml
+++ b/res/menu/activity_canvas.xml
@@ -5,4 +5,9 @@
android:showAsAction="ifRoom"
android:title="@string/menu_settings" android:onClick="showSettings"/>
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a6a22bc..990abfc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5,5 +5,6 @@
Settings
X.org host
Sense stylus only
+ About
\ No newline at end of file
diff --git a/res/xml/network_preferences.xml b/res/xml/network_preferences.xml
index 4c604e1..306ae20 100644
--- a/res/xml/network_preferences.xml
+++ b/res/xml/network_preferences.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/src/com/gimpusers/xorgtablet/CanvasActivity.java b/src/com/gimpusers/xorgtablet/CanvasActivity.java
index de73e65..c5c9cdc 100644
--- a/src/com/gimpusers/xorgtablet/CanvasActivity.java
+++ b/src/com/gimpusers/xorgtablet/CanvasActivity.java
@@ -1,5 +1,6 @@
package com.gimpusers.xorgtablet;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.app.Activity;
@@ -44,6 +45,10 @@ public class CanvasActivity extends Activity {
return true;
}
+ public void showAbout(MenuItem item) {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(("https://github.com/rfc2822/XorgTablet"))));
+ }
+
public void showSettings(MenuItem item) {
startActivity(new Intent(CanvasActivity.this, SettingsActivity.class));
}
diff --git a/src/com/gimpusers/xorgtablet/XorgClient.java b/src/com/gimpusers/xorgtablet/XorgClient.java
index 6399bcc..6d30edb 100644
--- a/src/com/gimpusers/xorgtablet/XorgClient.java
+++ b/src/com/gimpusers/xorgtablet/XorgClient.java
@@ -2,27 +2,16 @@ package com.gimpusers.xorgtablet;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
-import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.concurrent.LinkedBlockingQueue;
-import android.app.Service;
-import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.Binder;
-import android.os.IBinder;
-import android.preference.PreferenceManager;
-import android.provider.ContactsContract.Contacts.Data;
import android.util.Log;
-import android.view.MotionEvent;
-import android.widget.Toast;
-// see protocol.h in xf86-networktablet driver for details about the protocol
+// see xf86-networktablet on Github for details about the protocol
public class XorgClient implements Runnable {
@@ -39,7 +28,7 @@ public class XorgClient implements Runnable {
boolean configureNetworking() {
try {
- String hostName = preferences.getString(SettingsActivity.KEY_PREF_HOST, "127.0.0.1");
+ String hostName = preferences.getString(SettingsActivity.KEY_PREF_HOST, "unknown.invalid");
destAddress = InetAddress.getByName(hostName);
if (lastConfiguration != null)
@@ -63,13 +52,15 @@ public class XorgClient implements Runnable {
while (true) {
XEvent event = motionQueue.take();
- if (destAddress == null)
- continue;
-
+ // save resolution, even if not sending it
if (event.getClass() == XConfigurationEvent.class)
lastConfiguration = (XConfigurationEvent)event;
+ // graceful shutdown
else if (event.getClass() == XDisconnectEvent.class)
break;
+
+ if (destAddress == null) // no valid destination host
+ continue;
byte[] data = event.toByteArray();
DatagramPacket pkt = new DatagramPacket(data, data.length, destAddress, 40117);