diff options
| author | Stefan Monnier | 2008-07-17 03:33:59 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-07-17 03:33:59 +0000 |
| commit | facfbbbdad272decb23553d827fbc2c0fabaf078 (patch) | |
| tree | 14d37d409d30bdec0cbfc0ed79593021e1e88ab2 /src/nsselect.m | |
| parent | d377ef4a3f6c77c451b647305436d1e8bf914b07 (diff) | |
| download | emacs-facfbbbdad272decb23553d827fbc2c0fabaf078.tar.gz emacs-facfbbbdad272decb23553d827fbc2c0fabaf078.zip | |
* 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.m | 49 |
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) | |||
| 108 | if (VECTORP (obj)) | 108 | if (VECTORP (obj)) |
| 109 | { | 109 | { |
| 110 | int i; | 110 | int i; |
| 111 | int size = XVECTOR (obj)->size; | 111 | int size = ASIZE (obj); |
| 112 | Lisp_Object copy; | 112 | Lisp_Object copy; |
| 113 | 113 | ||
| 114 | if (size == 1) | 114 | if (size == 1) |
| 115 | return clean_local_selection_data (XVECTOR (obj)->contents [0]); | 115 | return clean_local_selection_data (AREF (obj, 0)); |
| 116 | copy = Fmake_vector (size, Qnil); | 116 | copy = Fmake_vector (make_number (size), Qnil); |
| 117 | for (i = 0; i < size; i++) | 117 | for (i = 0; i < size; i++) |
| 118 | XVECTOR (copy)->contents [i] | 118 | AREF (copy, i) = clean_local_selection_data (AREF (obj, i)); |
| 119 | = clean_local_selection_data (XVECTOR (obj)->contents [i]); | ||
| 120 | return copy; | 119 | return copy; |
| 121 | } | 120 | } |
| 122 | 121 | ||
| @@ -188,13 +187,13 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 188 | CHECK_SYMBOL (target_type); | 187 | CHECK_SYMBOL (target_type); |
| 189 | handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); | 188 | handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); |
| 190 | if (!NILP (handler_fn)) | 189 | if (!NILP (handler_fn)) |
| 191 | value =call3 (handler_fn, selection_name, target_type, | 190 | value = call3 (handler_fn, selection_name, target_type, |
| 192 | XCAR (XCDR (local_value))); | 191 | XCAR (XCDR (local_value))); |
| 193 | else | 192 | else |
| 194 | value =Qnil; | 193 | value = Qnil; |
| 195 | unbind_to (count, Qnil); | 194 | unbind_to (count, Qnil); |
| 196 | 195 | ||
| 197 | check =value; | 196 | check = value; |
| 198 | if (CONSP (value) && SYMBOLP (XCAR (value))) | 197 | if (CONSP (value) && SYMBOLP (XCAR (value))) |
| 199 | { | 198 | { |
| 200 | type = XCAR (value); | 199 | type = XCAR (value); |
| @@ -213,9 +212,12 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 213 | && NILP (XCDR (XCDR (check)))))) | 212 | && NILP (XCDR (XCDR (check)))))) |
| 214 | return value; | 213 | return value; |
| 215 | 214 | ||
| 215 | // FIXME: Why `quit' rather than `error'? | ||
| 216 | Fsignal (Qquit, Fcons (build_string ( | 216 | Fsignal (Qquit, Fcons (build_string ( |
| 217 | "invalid data returned by selection-conversion function"), | 217 | "invalid data returned by selection-conversion function"), |
| 218 | Fcons (handler_fn, Fcons (value, Qnil)))); | 218 | Fcons (handler_fn, Fcons (value, Qnil)))); |
| 219 | // FIXME: Beware, `quit' can return!! | ||
| 220 | return Qnil; | ||
| 219 | } | 221 | } |
| 220 | 222 | ||
| 221 | 223 | ||
| @@ -231,15 +233,16 @@ ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target) | |||
| 231 | static void | 233 | static void |
| 232 | ns_handle_selection_request (struct input_event *event) | 234 | ns_handle_selection_request (struct input_event *event) |
| 233 | { | 235 | { |
| 234 | id pb =(id)event->x; | 236 | // FIXME: BIG UGLY HACK!!! |
| 235 | NSString *type =(NSString *)event->y; | 237 | id pb = (id)*(EMACS_INT*)&(event->x); |
| 238 | NSString *type = (NSString *)*(EMACS_INT*)&(event->y); | ||
| 236 | Lisp_Object selection_name, selection_data, target_symbol, data; | 239 | Lisp_Object selection_name, selection_data, target_symbol, data; |
| 237 | Lisp_Object successful_p, rest; | 240 | Lisp_Object successful_p, rest; |
| 238 | 241 | ||
| 239 | selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); | 242 | selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
| 240 | target_symbol =ns_string_to_symbol (type); | 243 | target_symbol = ns_string_to_symbol (type); |
| 241 | selection_data = assq_no_quit (selection_name, Vselection_alist); | 244 | selection_data = assq_no_quit (selection_name, Vselection_alist); |
| 242 | successful_p =Qnil; | 245 | successful_p = Qnil; |
| 243 | 246 | ||
| 244 | if (!NILP (selection_data)) | 247 | if (!NILP (selection_data)) |
| 245 | { | 248 | { |
| @@ -248,13 +251,13 @@ ns_handle_selection_request (struct input_event *event) | |||
| 248 | { | 251 | { |
| 249 | if (STRINGP (data)) | 252 | if (STRINGP (data)) |
| 250 | ns_string_to_pasteboard_internal (pb, data, type); | 253 | ns_string_to_pasteboard_internal (pb, data, type); |
| 251 | successful_p =Qt; | 254 | successful_p = Qt; |
| 252 | } | 255 | } |
| 253 | } | 256 | } |
| 254 | 257 | ||
| 255 | if (!EQ (Vns_sent_selection_hooks, Qunbound)) | 258 | if (!EQ (Vns_sent_selection_hooks, Qunbound)) |
| 256 | { | 259 | { |
| 257 | for (rest =Vns_sent_selection_hooks;CONSP (rest); rest =Fcdr (rest)) | 260 | for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest)) |
| 258 | call3 (Fcar (rest), selection_name, target_symbol, successful_p); | 261 | call3 (Fcar (rest), selection_name, target_symbol, successful_p); |
| 259 | } | 262 | } |
| 260 | } | 263 | } |
| @@ -263,11 +266,11 @@ ns_handle_selection_request (struct input_event *event) | |||
| 263 | static void | 266 | static void |
| 264 | ns_handle_selection_clear (struct input_event *event) | 267 | ns_handle_selection_clear (struct input_event *event) |
| 265 | { | 268 | { |
| 266 | id pb = (id)event->x; | 269 | id pb = (id)*(EMACS_INT*)&(event->x); |
| 267 | Lisp_Object selection_name, selection_data, rest; | 270 | Lisp_Object selection_name, selection_data, rest; |
| 268 | 271 | ||
| 269 | selection_name =ns_string_to_symbol ([(NSPasteboard *)pb name]); | 272 | selection_name = ns_string_to_symbol ([(NSPasteboard *)pb name]); |
| 270 | selection_data =assq_no_quit (selection_name, Vselection_alist); | 273 | selection_data = assq_no_quit (selection_name, Vselection_alist); |
| 271 | if (NILP (selection_data)) return; | 274 | if (NILP (selection_data)) return; |
| 272 | 275 | ||
| 273 | if (EQ (selection_data, Fcar (Vselection_alist))) | 276 | if (EQ (selection_data, Fcar (Vselection_alist))) |
| @@ -281,7 +284,7 @@ ns_handle_selection_clear (struct input_event *event) | |||
| 281 | 284 | ||
| 282 | if (!EQ (Vns_lost_selection_hooks, Qunbound)) | 285 | if (!EQ (Vns_lost_selection_hooks, Qunbound)) |
| 283 | { | 286 | { |
| 284 | for (rest =Vns_lost_selection_hooks;CONSP (rest); rest =Fcdr (rest)) | 287 | for (rest = Vns_lost_selection_hooks;CONSP (rest); rest = Fcdr (rest)) |
| 285 | call1 (Fcar (rest), selection_name); | 288 | call1 (Fcar (rest), selection_name); |
| 286 | } | 289 | } |
| 287 | } | 290 | } |
| @@ -384,10 +387,10 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, | |||
| 384 | error ("selection-value may not be nil."); | 387 | error ("selection-value may not be nil."); |
| 385 | pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; | 388 | pb =[NSPasteboard pasteboardWithName: symbol_to_nsstring (selection_name)]; |
| 386 | ns_declare_pasteboard (pb); | 389 | ns_declare_pasteboard (pb); |
| 387 | old_value =assq_no_quit (selection_name, Vselection_alist); | 390 | old_value = assq_no_quit (selection_name, Vselection_alist); |
| 388 | new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); | 391 | new_value = Fcons (selection_name, Fcons (selection_value, Qnil)); |
| 389 | if (NILP (old_value)) | 392 | if (NILP (old_value)) |
| 390 | Vselection_alist =Fcons (new_value, Vselection_alist); | 393 | Vselection_alist = Fcons (new_value, Vselection_alist); |
| 391 | else | 394 | else |
| 392 | Fsetcdr (old_value, Fcdr (new_value)); | 395 | Fsetcdr (old_value, Fcdr (new_value)); |
| 393 | /* XXX An evil hack, but a necessary one I fear XXX */ | 396 | /* XXX An evil hack, but a necessary one I fear XXX */ |
| @@ -396,8 +399,8 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal, | |||
| 396 | ev.kind = SELECTION_REQUEST_EVENT; | 399 | ev.kind = SELECTION_REQUEST_EVENT; |
| 397 | ev.modifiers = 0; | 400 | ev.modifiers = 0; |
| 398 | ev.code = 0; | 401 | ev.code = 0; |
| 399 | ev.x = (int)pb; | 402 | *(EMACS_INT*)(&(ev.x)) = (EMACS_INT)pb; // FIXME: BIG UGLY HACK!! |
| 400 | ev.y = (int)NSStringPboardType; | 403 | *(EMACS_INT*)(&(ev.y)) = (EMACS_INT)NSStringPboardType; |
| 401 | ns_handle_selection_request (&ev); | 404 | ns_handle_selection_request (&ev); |
| 402 | } | 405 | } |
| 403 | return selection_value; | 406 | return selection_value; |