[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105034: Fix services menu empty on O
From: |
Jan D. |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105034: Fix services menu empty on OSX 1.6+. |
Date: |
Fri, 08 Jul 2011 10:11:35 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105034
fixes bug(s): http://debbugs.gnu.org/8842
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Fri 2011-07-08 10:11:35 +0200
message:
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.
modified:
src/ChangeLog
src/nsfns.m
src/nsmenu.m
src/nsselect.m
src/nsterm.h
src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-07-07 17:19:10 +0000
+++ b/src/ChangeLog 2011-07-08 08:11:35 +0000
@@ -1,3 +1,26 @@
+2011-07-08 Jan Djärv <address@hidden>
+
+ * 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 <address@hidden>
* keymap.c (describe_map_tree): Don't insert a double newline at
=== modified file 'src/nsfns.m'
--- a/src/nsfns.m 2011-05-05 04:00:38 +0000
+++ b/src/nsfns.m 2011-07-08 08:11:35 +0000
@@ -1728,8 +1728,8 @@
/* 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 @@
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 @@
ret = interpret_services_menu (svcs, Qnil, ret);
return ret;
+#endif
}
=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m 2011-06-25 18:21:00 +0000
+++ b/src/nsmenu.m 2011-07-08 08:11:35 +0000
@@ -457,7 +457,6 @@
{
/* but we need to make sure it will update on demand */
[svcsMenu setFrame: f];
- [svcsMenu setDelegate: svcsMenu];
}
else
#endif
=== modified file 'src/nsselect.m'
--- a/src/nsselect.m 2011-02-08 21:42:56 +0000
+++ b/src/nsselect.m 2011-07-08 08:11:35 +0000
@@ -175,7 +175,7 @@
}
-static Lisp_Object
+Lisp_Object
ns_get_local_selection (Lisp_Object selection_name,
Lisp_Object target_type)
{
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2011-06-22 06:16:16 +0000
+++ b/src/nsterm.h 2011-07-08 08:11:35 +0000
@@ -25,6 +25,12 @@
#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 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);
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2011-05-28 16:56:53 +0000
+++ b/src/nsterm.m 2011-07-08 08:11:35 +0000
@@ -134,11 +134,12 @@
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 @@
[self allocateGState];
+ [NSApp registerServicesMenuSendTypes: ns_send_types
+ returnTypes: ns_return_types];
+
ns_window_num++;
return self;
}
@@ -5735,13 +5739,17 @@
}
-- 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) 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 @@
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));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105034: Fix services menu empty on OSX 1.6+.,
Jan D. <=