diff options
| author | Jan Djärv | 2012-07-21 12:23:21 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-07-21 12:23:21 +0200 |
| commit | c4328746b51eb870cdf0b17a97b08a5eb0798fd2 (patch) | |
| tree | b6e4fde08cd1d2cdb369418babd37ec0f2e31262 /src | |
| parent | 6e5d1c12ff599a1c42cf6f72fd22c2b000d67d6d (diff) | |
| download | emacs-c4328746b51eb870cdf0b17a97b08a5eb0798fd2.tar.gz emacs-c4328746b51eb870cdf0b17a97b08a5eb0798fd2.zip | |
* nsterm.m (accessibilityAttributeValue): New function..
Fixes: debbugs:11134
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/nsterm.m | 57 |
2 files changed, 60 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e5a0736cddc..f5c8b2093e1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-07-21 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). | ||
| 4 | |||
| 1 | 2012-07-21 Chong Yidong <cyd@gnu.org> | 5 | 2012-07-21 Chong Yidong <cyd@gnu.org> |
| 2 | 6 | ||
| 3 | * window.c (decode_any_window): Signal an error if the window is | 7 | * window.c (decode_any_window): Signal an error if the window is |
diff --git a/src/nsterm.m b/src/nsterm.m index c13fb6623f5..e4c9147dd0e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -55,7 +55,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 55 | 55 | ||
| 56 | #include "window.h" | 56 | #include "window.h" |
| 57 | #include "keyboard.h" | 57 | #include "keyboard.h" |
| 58 | 58 | #include "buffer.h" | |
| 59 | #include "font.h" | 59 | #include "font.h" |
| 60 | 60 | ||
| 61 | /* call tracing */ | 61 | /* call tracing */ |
| @@ -6038,6 +6038,61 @@ ns_term_shutdown (int sig) | |||
| 6038 | 6038 | ||
| 6039 | @implementation EmacsWindow | 6039 | @implementation EmacsWindow |
| 6040 | 6040 | ||
| 6041 | - (id)accessibilityAttributeValue:(NSString *)attribute | ||
| 6042 | { | ||
| 6043 | Lisp_Object str = Qnil; | ||
| 6044 | struct frame *f = SELECTED_FRAME (); | ||
| 6045 | struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer); | ||
| 6046 | |||
| 6047 | if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) | ||
| 6048 | return NSAccessibilityTextFieldRole; | ||
| 6049 | |||
| 6050 | if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] | ||
| 6051 | && curbuf && ! NILP (BVAR (curbuf, mark_active))) | ||
| 6052 | { | ||
| 6053 | str = ns_get_local_selection (QPRIMARY, QUTF8_STRING); | ||
| 6054 | } | ||
| 6055 | else if (curbuf && [attribute isEqualToString:NSAccessibilityValueAttribute]) | ||
| 6056 | { | ||
| 6057 | if (! NILP (BVAR (curbuf, mark_active))) | ||
| 6058 | str = ns_get_local_selection (QPRIMARY, QUTF8_STRING); | ||
| 6059 | |||
| 6060 | if (NILP (str)) | ||
| 6061 | { | ||
| 6062 | ptrdiff_t start_byte = BUF_BEGV_BYTE (curbuf); | ||
| 6063 | ptrdiff_t byte_range = BUF_ZV_BYTE (curbuf) - start_byte; | ||
| 6064 | ptrdiff_t range = BUF_ZV (curbuf) - BUF_BEGV (curbuf); | ||
| 6065 | |||
| 6066 | if (! NILP (BVAR (curbuf, enable_multibyte_characters))) | ||
| 6067 | str = make_uninit_multibyte_string (range, byte_range); | ||
| 6068 | else | ||
| 6069 | str = make_uninit_string (range); | ||
| 6070 | /* To check: This returns emacs-utf-8, which is a superset of utf-8. | ||
| 6071 | Is this a problem? */ | ||
| 6072 | memcpy (SDATA (str), BYTE_POS_ADDR (start_byte), byte_range); | ||
| 6073 | } | ||
| 6074 | } | ||
| 6075 | |||
| 6076 | |||
| 6077 | if (! NILP (str)) | ||
| 6078 | { | ||
| 6079 | if (CONSP (str) && SYMBOLP (XCAR (str))) | ||
| 6080 | { | ||
| 6081 | str = XCDR (str); | ||
| 6082 | if (CONSP (str) && NILP (XCDR (str))) | ||
| 6083 | str = XCAR (str); | ||
| 6084 | } | ||
| 6085 | if (STRINGP (str)) | ||
| 6086 | { | ||
| 6087 | const char *utfStr = SSDATA (str); | ||
| 6088 | NSString *nsStr = [NSString stringWithUTF8String: utfStr]; | ||
| 6089 | return nsStr; | ||
| 6090 | } | ||
| 6091 | } | ||
| 6092 | |||
| 6093 | return [super accessibilityAttributeValue:attribute]; | ||
| 6094 | } | ||
| 6095 | |||
| 6041 | /* If we have multiple monitors, one above the other, we don't want to | 6096 | /* If we have multiple monitors, one above the other, we don't want to |
| 6042 | restrict the height to just one monitor. So we override this. */ | 6097 | restrict the height to just one monitor. So we override this. */ |
| 6043 | - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen | 6098 | - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen |