[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109174: * nsterm.m (accessibilityAtt
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109174: * nsterm.m (accessibilityAttributeValue): New function.. |
Date: |
Sat, 21 Jul 2012 12:23:21 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109174
fixes bug: http://debbugs.gnu.org/11134
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-21 12:23:21 +0200
message:
* nsterm.m (accessibilityAttributeValue): New function..
modified:
src/ChangeLog
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-21 06:17:30 +0000
+++ b/src/ChangeLog 2012-07-21 10:23:21 +0000
@@ -1,3 +1,7 @@
+2012-07-21 Jan Djärv <address@hidden>
+
+ * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).
+
2012-07-21 Chong Yidong <address@hidden>
* window.c (decode_any_window): Signal an error if the window is
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2012-07-16 11:02:09 +0000
+++ b/src/nsterm.m 2012-07-21 10:23:21 +0000
@@ -55,7 +55,7 @@
#include "window.h"
#include "keyboard.h"
-
+#include "buffer.h"
#include "font.h"
/* call tracing */
@@ -6038,6 +6038,61 @@
@implementation EmacsWindow
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{
+ Lisp_Object str = Qnil;
+ struct frame *f = SELECTED_FRAME ();
+ struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer);
+
+ if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
+ return NSAccessibilityTextFieldRole;
+
+ if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]
+ && curbuf && ! NILP (BVAR (curbuf, mark_active)))
+ {
+ str = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
+ }
+ else if (curbuf && [attribute isEqualToString:NSAccessibilityValueAttribute])
+ {
+ if (! NILP (BVAR (curbuf, mark_active)))
+ str = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
+
+ if (NILP (str))
+ {
+ ptrdiff_t start_byte = BUF_BEGV_BYTE (curbuf);
+ ptrdiff_t byte_range = BUF_ZV_BYTE (curbuf) - start_byte;
+ ptrdiff_t range = BUF_ZV (curbuf) - BUF_BEGV (curbuf);
+
+ if (! NILP (BVAR (curbuf, enable_multibyte_characters)))
+ str = make_uninit_multibyte_string (range, byte_range);
+ else
+ str = make_uninit_string (range);
+ /* To check: This returns emacs-utf-8, which is a superset of utf-8.
+ Is this a problem? */
+ memcpy (SDATA (str), BYTE_POS_ADDR (start_byte), byte_range);
+ }
+ }
+
+
+ if (! NILP (str))
+ {
+ if (CONSP (str) && SYMBOLP (XCAR (str)))
+ {
+ str = XCDR (str);
+ if (CONSP (str) && NILP (XCDR (str)))
+ str = XCAR (str);
+ }
+ if (STRINGP (str))
+ {
+ const char *utfStr = SSDATA (str);
+ NSString *nsStr = [NSString stringWithUTF8String: utfStr];
+ return nsStr;
+ }
+ }
+
+ return [super accessibilityAttributeValue:attribute];
+}
+
/* If we have multiple monitors, one above the other, we don't want to
restrict the height to just one monitor. So we override this. */
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109174: * nsterm.m (accessibilityAttributeValue): New function..,
Jan D. <=