Fix services menu empty on OSX 1.6+.
* nsfns.m (Fx_open_connection): Remove NSStringPboardType from ns_return_types. (Fns_list_services): Just return Qnil on 10.6, code not working there. * nsmenu.m (ns_update_menubar): Remove useless setDelegate call on svcsMenu. * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842). * nsterm.h (MAC_OS_X_VERSION_10_6): Define here instead of nsterm.m. (ns_get_local_selection): Declare. * nsterm.m (QUTF8_STRING): Declare. (initFrameFromEmacs): Call registerServicesMenuSendTypes. (validRequestorForSendType): Return type is (id). Change indexOfObjectIdenticalTo to indexOfObject. Check if we have local selection before returning self (Bug#8842). (writeSelectionToPasteboard): Put local selection into paste board if we have a local selection (Bug#8842). (syms_of_nsterm): DEFSYM QUTF8_STRING.
This commit is contained in:
parent
d760b73104
commit
699c10bd69
6 changed files with 77 additions and 12 deletions
|
@ -1,3 +1,26 @@
|
|||
2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* nsselect.m (ns_get_local_selection): Change to extern (Bug#8842).
|
||||
|
||||
* nsmenu.m (ns_update_menubar): Remove useless setDelegate call
|
||||
on svcsMenu (Bug#8842).
|
||||
|
||||
* nsfns.m (Fx_open_connection): Remove NSStringPboardType from
|
||||
ns_return_types.
|
||||
(Fns_list_services): Just return Qnil on 10.6, code not working there.
|
||||
|
||||
* nsterm.m (QUTF8_STRING): Declare.
|
||||
(initFrameFromEmacs): Call registerServicesMenuSendTypes.
|
||||
(validRequestorForSendType): Return type is (id).
|
||||
Change indexOfObjectIdenticalTo to indexOfObject.
|
||||
Check if we have local selection before returning self (Bug#8842).
|
||||
(writeSelectionToPasteboard): Put local selection into paste board
|
||||
if we have a local selection (Bug#8842).
|
||||
(syms_of_nsterm): DEFSYM QUTF8_STRING.
|
||||
|
||||
* nsterm.h (MAC_OS_X_VERSION_10_6): Define here instead of nsterm.m.
|
||||
(ns_get_local_selection): Declare.
|
||||
|
||||
2011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* keymap.c (describe_map_tree): Don't insert a double newline at
|
||||
|
|
|
@ -1728,8 +1728,8 @@ and GNUstep implementations ("distributor-specific release
|
|||
|
||||
/* Register our external input/output types, used for determining
|
||||
applicable services and also drag/drop eligibility. */
|
||||
ns_send_types = [[NSArray arrayWithObject: NSStringPboardType] retain];
|
||||
ns_return_types = [[NSArray arrayWithObject: NSStringPboardType] retain];
|
||||
ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
|
||||
ns_return_types = [[NSArray arrayWithObjects: nil] retain];
|
||||
ns_drag_types = [[NSArray arrayWithObjects:
|
||||
NSStringPboardType,
|
||||
NSTabularTextPboardType,
|
||||
|
@ -1876,6 +1876,10 @@ and GNUstep implementations ("distributor-specific release
|
|||
doc: /* List available Nextstep services by querying NSApp. */)
|
||||
(void)
|
||||
{
|
||||
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
/* You can't get services like this in 10.6+. */
|
||||
return Qnil;
|
||||
#else
|
||||
Lisp_Object ret = Qnil;
|
||||
NSMenu *svcs;
|
||||
id delegate;
|
||||
|
@ -1919,6 +1923,7 @@ and GNUstep implementations ("distributor-specific release
|
|||
|
||||
ret = interpret_services_menu (svcs, Qnil, ret);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -457,7 +457,6 @@
|
|||
{
|
||||
/* but we need to make sure it will update on demand */
|
||||
[svcsMenu setFrame: f];
|
||||
[svcsMenu setDelegate: svcsMenu];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -175,7 +175,7 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
}
|
||||
|
||||
|
||||
static Lisp_Object
|
||||
Lisp_Object
|
||||
ns_get_local_selection (Lisp_Object selection_name,
|
||||
Lisp_Object target_type)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#ifdef HAVE_NS
|
||||
|
||||
#ifdef NS_IMPL_COCOA
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
/* ==========================================================================
|
||||
|
@ -700,6 +706,8 @@ extern void check_ns (void);
|
|||
extern Lisp_Object ns_map_event_to_object ();
|
||||
extern Lisp_Object ns_string_from_pasteboard ();
|
||||
extern void ns_string_to_pasteboard ();
|
||||
extern Lisp_Object ns_get_local_selection (Lisp_Object selection_name,
|
||||
Lisp_Object target_type);
|
||||
extern void nxatoms_of_nsselect ();
|
||||
extern int ns_lisp_to_cursor_type ();
|
||||
extern Lisp_Object ns_cursor_type_to_lisp (int arg);
|
||||
|
|
46
src/nsterm.m
46
src/nsterm.m
|
@ -134,11 +134,12 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
0x1B, 0x1B /* escape */
|
||||
};
|
||||
|
||||
|
||||
static Lisp_Object Qmodifier_value;
|
||||
Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone;
|
||||
extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft;
|
||||
|
||||
static Lisp_Object QUTF8_STRING;
|
||||
|
||||
/* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold,
|
||||
the maximum font size to NOT antialias. On GNUstep there is currently
|
||||
no way to control this behavior. */
|
||||
|
@ -5364,6 +5365,9 @@ - (BOOL)isOpaque
|
|||
|
||||
[self allocateGState];
|
||||
|
||||
[NSApp registerServicesMenuSendTypes: ns_send_types
|
||||
returnTypes: ns_return_types];
|
||||
|
||||
ns_window_num++;
|
||||
return self;
|
||||
}
|
||||
|
@ -5735,13 +5739,17 @@ -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
|
|||
}
|
||||
|
||||
|
||||
- validRequestorForSendType: (NSString *)typeSent
|
||||
returnType: (NSString *)typeReturned
|
||||
- (id) validRequestorForSendType: (NSString *)typeSent
|
||||
returnType: (NSString *)typeReturned
|
||||
{
|
||||
NSTRACE (validRequestorForSendType);
|
||||
if ([ns_send_types indexOfObjectIdenticalTo: typeSent] != NSNotFound &&
|
||||
[ns_return_types indexOfObjectIdenticalTo: typeSent] != NSNotFound)
|
||||
return self;
|
||||
if (typeSent != nil && [ns_send_types indexOfObject: typeSent] != NSNotFound
|
||||
&& (typeReturned == nil
|
||||
|| [ns_return_types indexOfObject: typeSent] != NSNotFound))
|
||||
{
|
||||
if (! NILP (ns_get_local_selection (QPRIMARY, QUTF8_STRING)))
|
||||
return self;
|
||||
}
|
||||
|
||||
return [super validRequestorForSendType: typeSent
|
||||
returnType: typeReturned];
|
||||
|
@ -5765,8 +5773,28 @@ - (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pb
|
|||
|
||||
- (BOOL) writeSelectionToPasteboard: (NSPasteboard *)pb types: (NSArray *)types
|
||||
{
|
||||
/* supposed to write for as many of types as we are able */
|
||||
return NO;
|
||||
NSArray *typesDeclared;
|
||||
Lisp_Object val;
|
||||
|
||||
/* We only support NSStringPboardType */
|
||||
if ([types containsObject:NSStringPboardType] == NO) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
val = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
|
||||
if (CONSP (val) && SYMBOLP (XCAR (val)))
|
||||
{
|
||||
val = XCDR (val);
|
||||
if (CONSP (val) && NILP (XCDR (val)))
|
||||
val = XCAR (val);
|
||||
}
|
||||
if (! STRINGP (val))
|
||||
return NO;
|
||||
|
||||
typesDeclared = [NSArray arrayWithObject:NSStringPboardType];
|
||||
[pb declareTypes:typesDeclared owner:nil];
|
||||
ns_string_to_pasteboard (pb, val);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6390,6 +6418,8 @@ Convert an X font name (XLFD) to an NS font name.
|
|||
DEFSYM (Qsuper, "super");
|
||||
DEFSYM (Qcontrol, "control");
|
||||
DEFSYM (Qnone, "none");
|
||||
DEFSYM (QUTF8_STRING, "UTF8_STRING");
|
||||
|
||||
Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
|
||||
Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
|
||||
Fput (Qmeta, Qmodifier_value, make_number (meta_modifier));
|
||||
|
|
Loading…
Add table
Reference in a new issue