aboutsummaryrefslogtreecommitdiffstats
path: root/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'java/org')
-rw-r--r--java/org/gnu/emacs/EmacsContextMenu.java22
-rw-r--r--java/org/gnu/emacs/EmacsCopyArea.java6
2 files changed, 25 insertions, 3 deletions
diff --git a/java/org/gnu/emacs/EmacsContextMenu.java b/java/org/gnu/emacs/EmacsContextMenu.java
index 056d8fb692c..92429410d03 100644
--- a/java/org/gnu/emacs/EmacsContextMenu.java
+++ b/java/org/gnu/emacs/EmacsContextMenu.java
@@ -56,7 +56,7 @@ public class EmacsContextMenu
56 public int itemID; 56 public int itemID;
57 public String itemName; 57 public String itemName;
58 public EmacsContextMenu subMenu; 58 public EmacsContextMenu subMenu;
59 public boolean isEnabled; 59 public boolean isEnabled, isCheckable, isChecked;
60 60
61 @Override 61 @Override
62 public boolean 62 public boolean
@@ -108,10 +108,15 @@ public class EmacsContextMenu
108 108
109 /* Add a normal menu item to the context menu with the id ITEMID and 109 /* Add a normal menu item to the context menu with the id ITEMID and
110 the name ITEMNAME. Enable it if ISENABLED, else keep it 110 the name ITEMNAME. Enable it if ISENABLED, else keep it
111 disabled. */ 111 disabled.
112
113 If this is not a submenu and ISCHECKABLE is set, make the item
114 checkable. Likewise, if ISCHECKED is set, make the item
115 checked. */
112 116
113 public void 117 public void
114 addItem (int itemID, String itemName, boolean isEnabled) 118 addItem (int itemID, String itemName, boolean isEnabled,
119 boolean isCheckable, boolean isChecked)
115 { 120 {
116 Item item; 121 Item item;
117 122
@@ -119,6 +124,8 @@ public class EmacsContextMenu
119 item.itemID = itemID; 124 item.itemID = itemID;
120 item.itemName = itemName; 125 item.itemName = itemName;
121 item.isEnabled = isEnabled; 126 item.isEnabled = isEnabled;
127 item.isCheckable = isCheckable;
128 item.isChecked = isChecked;
122 129
123 menuItems.add (item); 130 menuItems.add (item);
124 } 131 }
@@ -198,6 +205,15 @@ public class EmacsContextMenu
198 /* If the item ID is zero, then disable the item. */ 205 /* If the item ID is zero, then disable the item. */
199 if (item.itemID == 0 || !item.isEnabled) 206 if (item.itemID == 0 || !item.isEnabled)
200 menuItem.setEnabled (false); 207 menuItem.setEnabled (false);
208
209 /* Now make the menu item display a checkmark as
210 appropriate. */
211
212 if (item.isCheckable)
213 menuItem.setCheckable (true);
214
215 if (item.isChecked)
216 menuItem.setChecked (true);
201 } 217 }
202 } 218 }
203 } 219 }
diff --git a/java/org/gnu/emacs/EmacsCopyArea.java b/java/org/gnu/emacs/EmacsCopyArea.java
index 7a97d706794..f8974e17c2e 100644
--- a/java/org/gnu/emacs/EmacsCopyArea.java
+++ b/java/org/gnu/emacs/EmacsCopyArea.java
@@ -99,6 +99,12 @@ public class EmacsCopyArea
99 if (src_y + height > srcBitmap.getHeight ()) 99 if (src_y + height > srcBitmap.getHeight ())
100 height = srcBitmap.getHeight () - src_y; 100 height = srcBitmap.getHeight () - src_y;
101 101
102 /* If width and height are empty or negative, then skip the entire
103 CopyArea operation lest createBitmap throw an exception. */
104
105 if (width <= 0 || height <= 0)
106 return;
107
102 rect = new Rect (dest_x, dest_y, dest_x + width, 108 rect = new Rect (dest_x, dest_y, dest_x + width,
103 dest_y + height); 109 dest_y + height);
104 110