diff options
| author | Po Lu | 2023-06-16 12:59:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-16 12:59:44 +0800 |
| commit | 377a3ebbb55a9b944551394e00d24c445e3ff4a1 (patch) | |
| tree | 69ddd4f46e8a4d6549f9d5210870a4fac8864de6 /java | |
| parent | 7f0342a1bd1db835bcdbbb66c8baa97e833e45fc (diff) | |
| download | emacs-377a3ebbb55a9b944551394e00d24c445e3ff4a1.tar.gz emacs-377a3ebbb55a9b944551394e00d24c445e3ff4a1.zip | |
Update Android port
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsApplication.java (findDumpFile):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu)
(addSubmenu, display):
* java/org/gnu/emacs/EmacsDocumentsProvider.java
(getNotificationUri, queryChildDocuments, deleteDocument):
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform):
* java/org/gnu/emacs/EmacsFillRectangle.java (perform):
* java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog)
(checkReadableOrCopy):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java
(EmacsSdk7FontDriver):
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
* java/org/gnu/emacs/EmacsView.java (EmacsView):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow, onKeyUp):
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(EmacsWindowAttachmentManager): Remove various unused arguments
and variables, dead stores, and make minor cleanups and
performance improvements.
* src/androidmenu.c (FIND_METHOD_STATIC, android_menu_show):
Adjust accordingly.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsActivity.java | 2 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsApplication.java | 3 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsContextMenu.java | 9 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsDocumentsProvider.java | 17 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsDrawRectangle.java | 2 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsFillRectangle.java | 2 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsOpenActivity.java | 38 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSdk7FontDriver.java | 4 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSurfaceView.java | 5 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsView.java | 4 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindow.java | 24 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindowAttachmentManager.java | 7 |
12 files changed, 69 insertions, 48 deletions
diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java index 7ba268ba42d..fa9bff39bb0 100644 --- a/java/org/gnu/emacs/EmacsActivity.java +++ b/java/org/gnu/emacs/EmacsActivity.java | |||
| @@ -55,7 +55,7 @@ public class EmacsActivity extends Activity | |||
| 55 | private FrameLayout layout; | 55 | private FrameLayout layout; |
| 56 | 56 | ||
| 57 | /* List of activities with focus. */ | 57 | /* List of activities with focus. */ |
| 58 | public static List<EmacsActivity> focusedActivities; | 58 | public static final List<EmacsActivity> focusedActivities; |
| 59 | 59 | ||
| 60 | /* The last activity to have been focused. */ | 60 | /* The last activity to have been focused. */ |
| 61 | public static EmacsActivity lastFocusedActivity; | 61 | public static EmacsActivity lastFocusedActivity; |
diff --git a/java/org/gnu/emacs/EmacsApplication.java b/java/org/gnu/emacs/EmacsApplication.java index 10099721744..d8b77acdf9e 100644 --- a/java/org/gnu/emacs/EmacsApplication.java +++ b/java/org/gnu/emacs/EmacsApplication.java | |||
| @@ -60,6 +60,9 @@ public final class EmacsApplication extends Application | |||
| 60 | } | 60 | } |
| 61 | }); | 61 | }); |
| 62 | 62 | ||
| 63 | if (allFiles == null) | ||
| 64 | return; | ||
| 65 | |||
| 63 | /* Now try to find the right dump file. */ | 66 | /* Now try to find the right dump file. */ |
| 64 | for (i = 0; i < allFiles.length; ++i) | 67 | for (i = 0; i < allFiles.length; ++i) |
| 65 | { | 68 | { |
diff --git a/java/org/gnu/emacs/EmacsContextMenu.java b/java/org/gnu/emacs/EmacsContextMenu.java index d69d0263b93..eb83016c849 100644 --- a/java/org/gnu/emacs/EmacsContextMenu.java +++ b/java/org/gnu/emacs/EmacsContextMenu.java | |||
| @@ -131,20 +131,18 @@ public final class EmacsContextMenu | |||
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | public List<Item> menuItems; | 133 | public List<Item> menuItems; |
| 134 | public String title; | ||
| 135 | private EmacsContextMenu parent; | 134 | private EmacsContextMenu parent; |
| 136 | 135 | ||
| 137 | /* Create a context menu with no items inside and the title TITLE, | 136 | /* Create a context menu with no items inside and the title TITLE, |
| 138 | which may be NULL. */ | 137 | which may be NULL. */ |
| 139 | 138 | ||
| 140 | public static EmacsContextMenu | 139 | public static EmacsContextMenu |
| 141 | createContextMenu (String title) | 140 | createContextMenu () |
| 142 | { | 141 | { |
| 143 | EmacsContextMenu menu; | 142 | EmacsContextMenu menu; |
| 144 | 143 | ||
| 145 | menu = new EmacsContextMenu (); | 144 | menu = new EmacsContextMenu (); |
| 146 | menu.menuItems = new ArrayList<Item> (); | 145 | menu.menuItems = new ArrayList<Item> (); |
| 147 | menu.title = title; | ||
| 148 | 146 | ||
| 149 | return menu; | 147 | return menu; |
| 150 | } | 148 | } |
| @@ -197,7 +195,7 @@ public final class EmacsContextMenu | |||
| 197 | item name. */ | 195 | item name. */ |
| 198 | 196 | ||
| 199 | public EmacsContextMenu | 197 | public EmacsContextMenu |
| 200 | addSubmenu (String itemName, String title, String tooltip) | 198 | addSubmenu (String itemName, String tooltip) |
| 201 | { | 199 | { |
| 202 | EmacsContextMenu submenu; | 200 | EmacsContextMenu submenu; |
| 203 | Item item; | 201 | Item item; |
| @@ -206,7 +204,7 @@ public final class EmacsContextMenu | |||
| 206 | item.itemID = 0; | 204 | item.itemID = 0; |
| 207 | item.itemName = itemName; | 205 | item.itemName = itemName; |
| 208 | item.tooltip = tooltip; | 206 | item.tooltip = tooltip; |
| 209 | item.subMenu = createContextMenu (title); | 207 | item.subMenu = createContextMenu (); |
| 210 | item.subMenu.parent = this; | 208 | item.subMenu.parent = this; |
| 211 | 209 | ||
| 212 | menuItems.add (item); | 210 | menuItems.add (item); |
| @@ -334,6 +332,7 @@ public final class EmacsContextMenu | |||
| 334 | final EmacsHolder<Boolean> rc; | 332 | final EmacsHolder<Boolean> rc; |
| 335 | 333 | ||
| 336 | rc = new EmacsHolder<Boolean> (); | 334 | rc = new EmacsHolder<Boolean> (); |
| 335 | rc.thing = false; | ||
| 337 | 336 | ||
| 338 | runnable = new Runnable () { | 337 | runnable = new Runnable () { |
| 339 | @Override | 338 | @Override |
diff --git a/java/org/gnu/emacs/EmacsDocumentsProvider.java b/java/org/gnu/emacs/EmacsDocumentsProvider.java index b4ac4624829..96dc2bc6e14 100644 --- a/java/org/gnu/emacs/EmacsDocumentsProvider.java +++ b/java/org/gnu/emacs/EmacsDocumentsProvider.java | |||
| @@ -131,9 +131,7 @@ public final class EmacsDocumentsProvider extends DocumentsProvider | |||
| 131 | getNotificationUri (File file) | 131 | getNotificationUri (File file) |
| 132 | { | 132 | { |
| 133 | Uri updatedUri; | 133 | Uri updatedUri; |
| 134 | Context context; | ||
| 135 | 134 | ||
| 136 | context = getContext (); | ||
| 137 | updatedUri | 135 | updatedUri |
| 138 | = buildChildDocumentsUri ("org.gnu.emacs", | 136 | = buildChildDocumentsUri ("org.gnu.emacs", |
| 139 | file.getAbsolutePath ()); | 137 | file.getAbsolutePath ()); |
| @@ -294,6 +292,7 @@ public final class EmacsDocumentsProvider extends DocumentsProvider | |||
| 294 | { | 292 | { |
| 295 | MatrixCursor result; | 293 | MatrixCursor result; |
| 296 | File directory; | 294 | File directory; |
| 295 | File[] files; | ||
| 297 | Context context; | 296 | Context context; |
| 298 | 297 | ||
| 299 | if (projection == null) | 298 | if (projection == null) |
| @@ -305,9 +304,15 @@ public final class EmacsDocumentsProvider extends DocumentsProvider | |||
| 305 | requested. */ | 304 | requested. */ |
| 306 | directory = new File (parentDocumentId); | 305 | directory = new File (parentDocumentId); |
| 307 | 306 | ||
| 308 | /* Now add each child. */ | 307 | /* Look up each child. */ |
| 309 | for (File child : directory.listFiles ()) | 308 | files = directory.listFiles (); |
| 310 | queryDocument1 (result, child); | 309 | |
| 310 | if (files != null) | ||
| 311 | { | ||
| 312 | /* Now add each child. */ | ||
| 313 | for (File child : files) | ||
| 314 | queryDocument1 (result, child); | ||
| 315 | } | ||
| 311 | 316 | ||
| 312 | context = getContext (); | 317 | context = getContext (); |
| 313 | 318 | ||
| @@ -406,12 +411,10 @@ public final class EmacsDocumentsProvider extends DocumentsProvider | |||
| 406 | { | 411 | { |
| 407 | File file, parent; | 412 | File file, parent; |
| 408 | File[] children; | 413 | File[] children; |
| 409 | Context context; | ||
| 410 | 414 | ||
| 411 | /* Java makes recursively deleting a file hard. File name | 415 | /* Java makes recursively deleting a file hard. File name |
| 412 | encoding issues also prevent easily calling into C... */ | 416 | encoding issues also prevent easily calling into C... */ |
| 413 | 417 | ||
| 414 | context = getContext (); | ||
| 415 | file = new File (documentId); | 418 | file = new File (documentId); |
| 416 | parent = file.getParentFile (); | 419 | parent = file.getParentFile (); |
| 417 | 420 | ||
diff --git a/java/org/gnu/emacs/EmacsDrawRectangle.java b/java/org/gnu/emacs/EmacsDrawRectangle.java index 3bd5779c54e..b54b031b56b 100644 --- a/java/org/gnu/emacs/EmacsDrawRectangle.java +++ b/java/org/gnu/emacs/EmacsDrawRectangle.java | |||
| @@ -36,7 +36,6 @@ public final class EmacsDrawRectangle | |||
| 36 | Paint maskPaint, paint; | 36 | Paint maskPaint, paint; |
| 37 | Canvas maskCanvas; | 37 | Canvas maskCanvas; |
| 38 | Bitmap maskBitmap; | 38 | Bitmap maskBitmap; |
| 39 | Rect rect; | ||
| 40 | Rect maskRect, dstRect; | 39 | Rect maskRect, dstRect; |
| 41 | Canvas canvas; | 40 | Canvas canvas; |
| 42 | Bitmap clipBitmap; | 41 | Bitmap clipBitmap; |
| @@ -52,7 +51,6 @@ public final class EmacsDrawRectangle | |||
| 52 | 51 | ||
| 53 | paint = gc.gcPaint; | 52 | paint = gc.gcPaint; |
| 54 | paint.setStyle (Paint.Style.STROKE); | 53 | paint.setStyle (Paint.Style.STROKE); |
| 55 | rect = new Rect (x, y, x + width, y + height); | ||
| 56 | 54 | ||
| 57 | if (gc.clip_mask == null) | 55 | if (gc.clip_mask == null) |
| 58 | /* Use canvas.drawRect with a RectF. That seems to reliably | 56 | /* Use canvas.drawRect with a RectF. That seems to reliably |
diff --git a/java/org/gnu/emacs/EmacsFillRectangle.java b/java/org/gnu/emacs/EmacsFillRectangle.java index 4a0478b446f..461fd3c639c 100644 --- a/java/org/gnu/emacs/EmacsFillRectangle.java +++ b/java/org/gnu/emacs/EmacsFillRectangle.java | |||
| @@ -61,6 +61,7 @@ public final class EmacsFillRectangle | |||
| 61 | /* Drawing with a clip mask involves calculating the | 61 | /* Drawing with a clip mask involves calculating the |
| 62 | intersection of the clip mask with the dst rect, and | 62 | intersection of the clip mask with the dst rect, and |
| 63 | extrapolating the corresponding part of the src rect. */ | 63 | extrapolating the corresponding part of the src rect. */ |
| 64 | |||
| 64 | clipBitmap = gc.clip_mask.bitmap; | 65 | clipBitmap = gc.clip_mask.bitmap; |
| 65 | dstRect = new Rect (x, y, x + width, y + height); | 66 | dstRect = new Rect (x, y, x + width, y + height); |
| 66 | maskRect = new Rect (gc.clip_x_origin, | 67 | maskRect = new Rect (gc.clip_x_origin, |
| @@ -69,7 +70,6 @@ public final class EmacsFillRectangle | |||
| 69 | + clipBitmap.getWidth ()), | 70 | + clipBitmap.getWidth ()), |
| 70 | (gc.clip_y_origin | 71 | (gc.clip_y_origin |
| 71 | + clipBitmap.getHeight ())); | 72 | + clipBitmap.getHeight ())); |
| 72 | clipBitmap = gc.clip_mask.bitmap; | ||
| 73 | 73 | ||
| 74 | if (!maskRect.setIntersect (dstRect, maskRect)) | 74 | if (!maskRect.setIntersect (dstRect, maskRect)) |
| 75 | /* There is no intersection between the clip mask and the | 75 | /* There is no intersection between the clip mask and the |
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java index 6af2b2d2e94..9411f85d434 100644 --- a/java/org/gnu/emacs/EmacsOpenActivity.java +++ b/java/org/gnu/emacs/EmacsOpenActivity.java | |||
| @@ -146,7 +146,7 @@ public final class EmacsOpenActivity extends Activity | |||
| 146 | FileReader reader; | 146 | FileReader reader; |
| 147 | char[] buffer; | 147 | char[] buffer; |
| 148 | int rc; | 148 | int rc; |
| 149 | String what; | 149 | StringBuilder builder; |
| 150 | 150 | ||
| 151 | /* Because the ProcessBuilder functions necessary to redirect | 151 | /* Because the ProcessBuilder functions necessary to redirect |
| 152 | process output are not implemented on Android 7 and earlier, | 152 | process output are not implemented on Android 7 and earlier, |
| @@ -160,7 +160,8 @@ public final class EmacsOpenActivity extends Activity | |||
| 160 | 160 | ||
| 161 | cache = getCacheDir (); | 161 | cache = getCacheDir (); |
| 162 | file = new File (cache, "emacsclient.log"); | 162 | file = new File (cache, "emacsclient.log"); |
| 163 | what = ""; | 163 | builder = new StringBuilder (); |
| 164 | reader = null; | ||
| 164 | 165 | ||
| 165 | try | 166 | try |
| 166 | { | 167 | { |
| @@ -168,13 +169,25 @@ public final class EmacsOpenActivity extends Activity | |||
| 168 | buffer = new char[2048]; | 169 | buffer = new char[2048]; |
| 169 | 170 | ||
| 170 | while ((rc = reader.read (buffer, 0, 2048)) != -1) | 171 | while ((rc = reader.read (buffer, 0, 2048)) != -1) |
| 171 | what += String.valueOf (buffer, 0, 2048); | 172 | builder.append (buffer, 0, rc); |
| 172 | 173 | ||
| 173 | reader.close (); | 174 | reader.close (); |
| 174 | return what; | 175 | return builder.toString (); |
| 175 | } | 176 | } |
| 176 | catch (IOException exception) | 177 | catch (IOException exception) |
| 177 | { | 178 | { |
| 179 | /* Close the reader if it's already been opened. */ | ||
| 180 | |||
| 181 | try | ||
| 182 | { | ||
| 183 | if (reader != null) | ||
| 184 | reader.close (); | ||
| 185 | } | ||
| 186 | catch (IOException e) | ||
| 187 | { | ||
| 188 | /* Not sure what to do here. */ | ||
| 189 | } | ||
| 190 | |||
| 178 | return ("Couldn't read emacsclient.log: " | 191 | return ("Couldn't read emacsclient.log: " |
| 179 | + exception.toString ()); | 192 | + exception.toString ()); |
| 180 | } | 193 | } |
| @@ -248,11 +261,16 @@ public final class EmacsOpenActivity extends Activity | |||
| 248 | /* inFile is now the file being written to. */ | 261 | /* inFile is now the file being written to. */ |
| 249 | inFile = new File (getCacheDir (), inFile.getName ()); | 262 | inFile = new File (getCacheDir (), inFile.getName ()); |
| 250 | buffer = new byte[4098]; | 263 | buffer = new byte[4098]; |
| 251 | outStream = new FileOutputStream (inFile); | 264 | |
| 252 | stream = new FileInputStream (fd.getFileDescriptor ()); | 265 | /* Initialize both streams to NULL. */ |
| 266 | outStream = null; | ||
| 267 | stream = null; | ||
| 253 | 268 | ||
| 254 | try | 269 | try |
| 255 | { | 270 | { |
| 271 | outStream = new FileOutputStream (inFile); | ||
| 272 | stream = new FileInputStream (fd.getFileDescriptor ()); | ||
| 273 | |||
| 256 | while ((read = stream.read (buffer)) >= 0) | 274 | while ((read = stream.read (buffer)) >= 0) |
| 257 | outStream.write (buffer, 0, read); | 275 | outStream.write (buffer, 0, read); |
| 258 | } | 276 | } |
| @@ -263,8 +281,12 @@ public final class EmacsOpenActivity extends Activity | |||
| 263 | Keep in mind that execution is transferred to ``finally'' | 281 | Keep in mind that execution is transferred to ``finally'' |
| 264 | even if an exception happens inside the while loop | 282 | even if an exception happens inside the while loop |
| 265 | above. */ | 283 | above. */ |
| 266 | stream.close (); | 284 | |
| 267 | outStream.close (); | 285 | if (stream != null) |
| 286 | stream.close (); | ||
| 287 | |||
| 288 | if (outStream != null) | ||
| 289 | outStream.close (); | ||
| 268 | } | 290 | } |
| 269 | 291 | ||
| 270 | return inFile.getCanonicalPath (); | 292 | return inFile.getCanonicalPath (); |
diff --git a/java/org/gnu/emacs/EmacsSdk7FontDriver.java b/java/org/gnu/emacs/EmacsSdk7FontDriver.java index 6df102f18a2..9122b46458a 100644 --- a/java/org/gnu/emacs/EmacsSdk7FontDriver.java +++ b/java/org/gnu/emacs/EmacsSdk7FontDriver.java | |||
| @@ -252,6 +252,10 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver | |||
| 252 | systemFontsDirectory = new File ("/system/fonts"); | 252 | systemFontsDirectory = new File ("/system/fonts"); |
| 253 | 253 | ||
| 254 | fontFamilyList = systemFontsDirectory.list (); | 254 | fontFamilyList = systemFontsDirectory.list (); |
| 255 | |||
| 256 | /* If that returned null, replace it with an empty array. */ | ||
| 257 | fontFamilyList = new String[0]; | ||
| 258 | |||
| 255 | typefaceList = new Sdk7Typeface[fontFamilyList.length + 3]; | 259 | typefaceList = new Sdk7Typeface[fontFamilyList.length + 3]; |
| 256 | 260 | ||
| 257 | /* It would be nice to avoid opening each and every font upon | 261 | /* It would be nice to avoid opening each and every font upon |
diff --git a/java/org/gnu/emacs/EmacsSurfaceView.java b/java/org/gnu/emacs/EmacsSurfaceView.java index 738b1a99eef..5b3e05eb9f4 100644 --- a/java/org/gnu/emacs/EmacsSurfaceView.java +++ b/java/org/gnu/emacs/EmacsSurfaceView.java | |||
| @@ -39,10 +39,6 @@ public final class EmacsSurfaceView extends View | |||
| 39 | { | 39 | { |
| 40 | private static final String TAG = "EmacsSurfaceView"; | 40 | private static final String TAG = "EmacsSurfaceView"; |
| 41 | 41 | ||
| 42 | /* The EmacsView representing the window that this surface is | ||
| 43 | displaying. */ | ||
| 44 | private EmacsView view; | ||
| 45 | |||
| 46 | /* The complete buffer contents at the time of the last draw. */ | 42 | /* The complete buffer contents at the time of the last draw. */ |
| 47 | private Bitmap frontBuffer; | 43 | private Bitmap frontBuffer; |
| 48 | 44 | ||
| @@ -71,7 +67,6 @@ public final class EmacsSurfaceView extends View | |||
| 71 | { | 67 | { |
| 72 | super (view.getContext ()); | 68 | super (view.getContext ()); |
| 73 | 69 | ||
| 74 | this.view = view; | ||
| 75 | this.bitmap = new WeakReference<Bitmap> (null); | 70 | this.bitmap = new WeakReference<Bitmap> (null); |
| 76 | } | 71 | } |
| 77 | 72 | ||
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java index aba1184b0c2..0cabefdf385 100644 --- a/java/org/gnu/emacs/EmacsView.java +++ b/java/org/gnu/emacs/EmacsView.java | |||
| @@ -68,9 +68,6 @@ public final class EmacsView extends ViewGroup | |||
| 68 | /* The damage region. */ | 68 | /* The damage region. */ |
| 69 | public Region damageRegion; | 69 | public Region damageRegion; |
| 70 | 70 | ||
| 71 | /* The paint. */ | ||
| 72 | public Paint paint; | ||
| 73 | |||
| 74 | /* The associated surface view. */ | 71 | /* The associated surface view. */ |
| 75 | private EmacsSurfaceView surfaceView; | 72 | private EmacsSurfaceView surfaceView; |
| 76 | 73 | ||
| @@ -128,7 +125,6 @@ public final class EmacsView extends ViewGroup | |||
| 128 | 125 | ||
| 129 | this.window = window; | 126 | this.window = window; |
| 130 | this.damageRegion = new Region (); | 127 | this.damageRegion = new Region (); |
| 131 | this.paint = new Paint (); | ||
| 132 | 128 | ||
| 133 | setFocusable (true); | 129 | setFocusable (true); |
| 134 | setFocusableInTouchMode (true); | 130 | setFocusableInTouchMode (true); |
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 68a18ec2aa7..739a1f43b7d 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -103,11 +103,10 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 103 | public int lastButtonState, lastModifiers; | 103 | public int lastButtonState, lastModifiers; |
| 104 | 104 | ||
| 105 | /* Whether or not the window is mapped. */ | 105 | /* Whether or not the window is mapped. */ |
| 106 | private boolean isMapped; | 106 | private volatile boolean isMapped; |
| 107 | 107 | ||
| 108 | /* Whether or not to ask for focus upon being mapped, and whether or | 108 | /* Whether or not to ask for focus upon being mapped. */ |
| 109 | not the window should be focusable. */ | 109 | private boolean dontFocusOnMap; |
| 110 | private boolean dontFocusOnMap, dontAcceptFocus; | ||
| 111 | 110 | ||
| 112 | /* Whether or not the window is override-redirect. An | 111 | /* Whether or not the window is override-redirect. An |
| 113 | override-redirect window always has its own system window. */ | 112 | override-redirect window always has its own system window. */ |
| @@ -464,7 +463,7 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 464 | } | 463 | } |
| 465 | } | 464 | } |
| 466 | 465 | ||
| 467 | public void | 466 | public synchronized void |
| 468 | unmapWindow () | 467 | unmapWindow () |
| 469 | { | 468 | { |
| 470 | if (!isMapped) | 469 | if (!isMapped) |
| @@ -618,7 +617,7 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 618 | onKeyUp (int keyCode, KeyEvent event) | 617 | onKeyUp (int keyCode, KeyEvent event) |
| 619 | { | 618 | { |
| 620 | int state, state_1; | 619 | int state, state_1; |
| 621 | long time, serial; | 620 | long time; |
| 622 | 621 | ||
| 623 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) | 622 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) |
| 624 | state = event.getModifiers (); | 623 | state = event.getModifiers (); |
| @@ -645,12 +644,11 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 645 | state_1 | 644 | state_1 |
| 646 | = state & ~(KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK); | 645 | = state & ~(KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK); |
| 647 | 646 | ||
| 648 | serial | 647 | EmacsNative.sendKeyRelease (this.handle, |
| 649 | = EmacsNative.sendKeyRelease (this.handle, | 648 | event.getEventTime (), |
| 650 | event.getEventTime (), | 649 | state, keyCode, |
| 651 | state, keyCode, | 650 | getEventUnicodeChar (event, |
| 652 | getEventUnicodeChar (event, | 651 | state_1)); |
| 653 | state_1)); | ||
| 654 | lastModifiers = state; | 652 | lastModifiers = state; |
| 655 | 653 | ||
| 656 | if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) | 654 | if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) |
| @@ -1155,8 +1153,6 @@ public final class EmacsWindow extends EmacsHandleObject | |||
| 1155 | public synchronized void | 1153 | public synchronized void |
| 1156 | setDontAcceptFocus (final boolean dontAcceptFocus) | 1154 | setDontAcceptFocus (final boolean dontAcceptFocus) |
| 1157 | { | 1155 | { |
| 1158 | this.dontAcceptFocus = dontAcceptFocus; | ||
| 1159 | |||
| 1160 | /* Update the view's focus state. */ | 1156 | /* Update the view's focus state. */ |
| 1161 | EmacsService.SERVICE.runOnUiThread (new Runnable () { | 1157 | EmacsService.SERVICE.runOnUiThread (new Runnable () { |
| 1162 | @Override | 1158 | @Override |
diff --git a/java/org/gnu/emacs/EmacsWindowAttachmentManager.java b/java/org/gnu/emacs/EmacsWindowAttachmentManager.java index 4fda48616f0..bc96de7fe1a 100644 --- a/java/org/gnu/emacs/EmacsWindowAttachmentManager.java +++ b/java/org/gnu/emacs/EmacsWindowAttachmentManager.java | |||
| @@ -53,9 +53,11 @@ import android.util.Log; | |||
| 53 | 53 | ||
| 54 | public final class EmacsWindowAttachmentManager | 54 | public final class EmacsWindowAttachmentManager |
| 55 | { | 55 | { |
| 56 | public static EmacsWindowAttachmentManager MANAGER; | ||
| 57 | private final static String TAG = "EmacsWindowAttachmentManager"; | 56 | private final static String TAG = "EmacsWindowAttachmentManager"; |
| 58 | 57 | ||
| 58 | /* The single window attachment manager ``object''. */ | ||
| 59 | public static final EmacsWindowAttachmentManager MANAGER; | ||
| 60 | |||
| 59 | static | 61 | static |
| 60 | { | 62 | { |
| 61 | MANAGER = new EmacsWindowAttachmentManager (); | 63 | MANAGER = new EmacsWindowAttachmentManager (); |
| @@ -69,7 +71,10 @@ public final class EmacsWindowAttachmentManager | |||
| 69 | public void destroy (); | 71 | public void destroy (); |
| 70 | }; | 72 | }; |
| 71 | 73 | ||
| 74 | /* List of currently attached window consumers. */ | ||
| 72 | public List<WindowConsumer> consumers; | 75 | public List<WindowConsumer> consumers; |
| 76 | |||
| 77 | /* List of currently attached windows. */ | ||
| 73 | public List<EmacsWindow> windows; | 78 | public List<EmacsWindow> windows; |
| 74 | 79 | ||
| 75 | public | 80 | public |