summaryrefslogtreecommitdiff
path: root/src/nsselect.m
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-07-17 03:33:59 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-07-17 03:33:59 +0000
commitb5f940a57cb3f37503698b697ee8942cc70652c4 (patch)
tree82f668266218603b7e7dc2e51823b5c4a9fd0843 /src/nsselect.m
parent9011d68b80ff95e8118ceb7d774f8c7e91e0df8a (diff)
downloademacs-b5f940a57cb3f37503698b697ee8942cc70652c4.tar.gz
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
in case it was defined already. USE @GNUSTEP_MAKEFILES@ rather than envvars. * nsterm.m (ns_term_init): Pass Qt and Qnil rather than YES/NO to ns_default. (applicationShouldTerminate, setValuesFromPanel): Use EQ to compare Lisp_Objects. * nsterm.h (Fx_display_grayscale_p, Fx_display_planes) (ns_defined_color, ns_color_to_lisp): Declare. * nsselect.m (ns_handle_selection_request, ns_handle_selection_clear) (Fns_own_selection_internal): Make the big ugly hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. * nsmenu.m (ns_update_menubar): Use EQ to compare Lisp_Objects. (update_frame_tool_bar): Remove apparently obsolete tests for non-integerness of f->tool_bar_lines. (windowShouldClose, addButton, clicked, runDialogAt): Make the big ugly hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE. * nsfont.m (nsfont_driver): Use just 0 rather than an invalid cast. (nsfont_open): Don't confuse NULL for Qnil. * nsfns.m (ns_implicitly_set_icon_type): Use EQ to compare Lisp_Objects. * menu.h (find_and_call_menu_selection): * menu.c (find_and_call_menu_selection): Use just int for vector size. (find_and_return_menu_selection): Always return something. * frame.h: Include dispextern.h for Display_Info. (display_x_get_resource): Declare. * configure.in: Extract and substitute GNUSTEP_MAKEFILES.
Diffstat (limited to 'src/nsselect.m')
-rw-r--r--src/nsselect.m49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/nsselect.m b/src/nsselect.m
index 0b9927dbb52..4a7729d12d5 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -108,15 +108,14 @@ clean_local_selection_data (Lisp_Object obj)
if (VECTORP (obj))
{
int i;
- int size = XVECTOR (obj)->size;
+ int size = ASIZE (obj);
Lisp_Object copy;
if (size == 1)
- return clean_local_selection_data (XVECTOR (obj)->contents [0]);
- copy = Fmake_vector (size, Qnil);
+ return clean_local_selection_data (AREF (obj, 0));
+ copy = Fmake_vector (make_number (size), Qnil);
for (i = 0; i < size; i++)
- XVECTOR (copy)->contents [i]
- = clean_local_selection_data (XVECTOR (obj)->contents [i]);
+ AREF (copy, i) = clean_local_selection_data (AREF (obj, i));
return copy;
}
@@ -188,13 +187,13 @@ ns_get_local_selection (Lisp_Object selection_name,
CHECK_SYMBOL (target_type);
handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
if (!NILP (handler_fn))
- value =call3 (handler_fn, selection_name, target_type,
+ value = call3 (handler_fn, selection_name, target_type,
XCAR (XCDR (local_value)));
else
- value =Qnil;
+ value = Qnil;
unbind_to (count, Qnil);
- check =value;
+ check = value;
if (CONSP (value) && SYMBOLP (XCAR (value)))
{
type = XCAR (value);
@@ -213,9 +212,12 @@ ns_get_local_selection (Lisp_Object selection_name,
&& NILP (XCDR (XCDR (check))))))
return value;
+ // FIXME: Why `quit' rather than `error'?
Fsignal (Qquit, Fcons (build_string (
"invalid data returned by selection-conversion function"),
Fcons (handler_fn, Fcons (value, Qnil))));
+ // FIXME: Beware, `quit' can return!!
+ return Qnil;
}
@@ -231,15 +233,16 @@ ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target)
static void
ns_handle_selection_request (struct input_event *event)
{
- id pb =(id)event->x;
- NSString *type =(NSString *)event->y;
+ // FIXME: BIG UGLY HACK!!!
+ id pb = (id)*(EMACS_INT*)&(event->x);
+ NSString *type = (NSString *)*(EMACS_INT*)&(event->y);
Lisp_Object selection_name, selection_data, target_symbol, data;
Lisp_Object successful_p, rest;
- selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]);
- target_symbol =ns_string_to_symbol (type);
+ selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]);
+ target_symbol = ns_string_to_symbol (type);
selection_data = assq_no_quit (selection_name, Vselection_alist);
- successful_p =Qnil;
+ successful_p = Qnil;
if (!NILP (selection_data))
{
@@ -248,13 +251,13 @@ ns_handle_selection_request (struct input_event *event)
{
if (STRINGP (data))
ns_string_to_pasteboard_internal (pb, data, type);
- successful_p =Qt;
+ successful_p = Qt;
}
}
if (!EQ (Vns_sent_selection_hooks, Qunbound))
{
- for (rest =Vns_sent_selection_hooks;CONSP (rest); rest =Fcdr (rest))
+ for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
call3 (Fcar (rest), selection_name, target_symbol, successful_p);
}
}
@@ -263,11 +266,11 @@ ns_handle_selection_request (struct input_event *event)
static void
ns_handle_selection_clear (struct input_event *event)
{
- id pb = (id)event->x;
+ id pb = (id)*(EMACS_INT*)&(event->x);
Lisp_Object selection_name, selection_data, rest;
- selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]);
- selection_data =assq_no_quit (selection_name, Vselection_alist);
+ selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]);
+ selection_data = assq_no_quit (selection_name, Vselection_alist);
if (NILP (selection_data)) return;
if (EQ (selection_data, Fcar (Vselection_alist)))
@@ -281,7 +284,7 @@ ns_handle_selection_clear (struct input_event *event)
if (!EQ (Vns_lost_selection_hooks, Qunbound))
{
- for (rest =Vns_lost_selection_hooks;CONSP (rest); rest =Fcdr (rest))
+ for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest))
call1 (Fcar (rest), selection_name);
}
}
@@ -384,10 +387,10 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
error ("selection-value may not be nil.");
pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)];
ns_declare_pasteboard (pb);
- old_value =assq_no_quit (selection_name, Vselection_alist);
+ old_value = assq_no_quit (selection_name, Vselection_alist);
new_value = Fcons (selection_name, Fcons (selection_value, Qnil));
if (NILP (old_value))
- Vselection_alist =Fcons (new_value, Vselection_alist);
+ Vselection_alist = Fcons (new_value, Vselection_alist);
else
Fsetcdr (old_value, Fcdr (new_value));
/* XXX An evil hack, but a necessary one I fear XXX */
@@ -396,8 +399,8 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
ev.kind = SELECTION_REQUEST_EVENT;
ev.modifiers = 0;
ev.code = 0;
- ev.x = (int)pb;
- ev.y = (int)NSStringPboardType;
+ *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!!
+ *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType;
ns_handle_selection_request (&ev);
}
return selection_value;