diff options
| author | Rasmus | 2017-09-29 10:41:51 +0200 |
|---|---|---|
| committer | Rasmus | 2017-09-29 10:41:51 +0200 |
| commit | d4b2bbdc73ace5cb0971a32a75941486489d1cc5 (patch) | |
| tree | dc92eb83d4a66f112e3688ad10632e14ca6601ff /src | |
| parent | eaefbc26d5c6cffbe4a22d3a9f4c7e6209a7b5a7 (diff) | |
| parent | af130f900fc499f71ea22f10ba055a75ce35ed4e (diff) | |
| download | emacs-d4b2bbdc73ace5cb0971a32a75941486489d1cc5.tar.gz emacs-d4b2bbdc73ace5cb0971a32a75941486489d1cc5.zip | |
Merge branch 'emacs-26' into scratch/org-mode-merge
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 2 | ||||
| -rw-r--r-- | src/callint.c | 7 | ||||
| -rw-r--r-- | src/data.c | 12 | ||||
| -rw-r--r-- | src/dbusbind.c | 3 | ||||
| -rw-r--r-- | src/editfns.c | 49 | ||||
| -rw-r--r-- | src/emacs.c | 8 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/gtkutil.c | 5 | ||||
| -rw-r--r-- | src/keyboard.c | 5 | ||||
| -rw-r--r-- | src/lcms.c | 111 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/nsterm.m | 173 | ||||
| -rw-r--r-- | src/term.c | 12 | ||||
| -rw-r--r-- | src/termhooks.h | 4 | ||||
| -rw-r--r-- | src/w32term.c | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 8 |
16 files changed, 322 insertions, 86 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 0e55ad4bb29..9a8c9c85f04 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -280,7 +280,7 @@ GNU_OBJC_CFLAGS=$(patsubst -specs=%-hardened-cc1,,@GNU_OBJC_CFLAGS@) | |||
| 280 | ## w32xfns.o w32select.o image.o w32uniscribe.o if HAVE_W32, else | 280 | ## w32xfns.o w32select.o image.o w32uniscribe.o if HAVE_W32, else |
| 281 | ## empty. | 281 | ## empty. |
| 282 | W32_OBJ=@W32_OBJ@ | 282 | W32_OBJ=@W32_OBJ@ |
| 283 | ## -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32 lusp10 -lcomctl32 | 283 | ## -lkernel32 -luser32 -lusp10 -lgdi32 -lole32 -lcomdlg32 -lcomctl32 |
| 284 | ## --lwinspool if HAVE_W32, else empty. | 284 | ## --lwinspool if HAVE_W32, else empty. |
| 285 | W32_LIBS=@W32_LIBS@ | 285 | W32_LIBS=@W32_LIBS@ |
| 286 | 286 | ||
diff --git a/src/callint.c b/src/callint.c index 105ec071d07..469205cc380 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -272,7 +272,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 272 | { | 272 | { |
| 273 | /* `args' will contain the array of arguments to pass to the function. | 273 | /* `args' will contain the array of arguments to pass to the function. |
| 274 | `visargs' will contain the same list but in a nicer form, so that if we | 274 | `visargs' will contain the same list but in a nicer form, so that if we |
| 275 | pass it to `Fformat_message' it will be understandable to a human. */ | 275 | pass it to styled_format it will be understandable to a human. */ |
| 276 | Lisp_Object *args, *visargs; | 276 | Lisp_Object *args, *visargs; |
| 277 | Lisp_Object specs; | 277 | Lisp_Object specs; |
| 278 | Lisp_Object filter_specs; | 278 | Lisp_Object filter_specs; |
| @@ -502,10 +502,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 502 | for (i = 2; *tem; i++) | 502 | for (i = 2; *tem; i++) |
| 503 | { | 503 | { |
| 504 | visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); | 504 | visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); |
| 505 | if (strchr (SSDATA (visargs[1]), '%')) | 505 | callint_message = styled_format (i - 1, visargs + 1, true, false); |
| 506 | callint_message = Fformat_message (i - 1, visargs + 1); | ||
| 507 | else | ||
| 508 | callint_message = visargs[1]; | ||
| 509 | 506 | ||
| 510 | switch (*tem) | 507 | switch (*tem) |
| 511 | { | 508 | { |
diff --git a/src/data.c b/src/data.c index 95bf06e5102..e070be6c208 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -3010,16 +3010,16 @@ static Lisp_Object | |||
| 3010 | minmax_driver (ptrdiff_t nargs, Lisp_Object *args, | 3010 | minmax_driver (ptrdiff_t nargs, Lisp_Object *args, |
| 3011 | enum Arith_Comparison comparison) | 3011 | enum Arith_Comparison comparison) |
| 3012 | { | 3012 | { |
| 3013 | eassume (0 < nargs); | 3013 | Lisp_Object accum = args[0]; |
| 3014 | Lisp_Object accum = args[0]; /* pacify GCC */ | 3014 | CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (accum); |
| 3015 | for (ptrdiff_t argnum = 0; argnum < nargs; argnum++) | 3015 | for (ptrdiff_t argnum = 1; argnum < nargs; argnum++) |
| 3016 | { | 3016 | { |
| 3017 | Lisp_Object val = args[argnum]; | 3017 | Lisp_Object val = args[argnum]; |
| 3018 | CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val); | 3018 | CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val); |
| 3019 | if (argnum == 0 || !NILP (arithcompare (val, accum, comparison))) | 3019 | if (!NILP (arithcompare (val, accum, comparison))) |
| 3020 | accum = val; | 3020 | accum = val; |
| 3021 | else if (FLOATP (accum) && isnan (XFLOAT_DATA (accum))) | 3021 | else if (FLOATP (val) && isnan (XFLOAT_DATA (val))) |
| 3022 | return accum; | 3022 | return val; |
| 3023 | } | 3023 | } |
| 3024 | return accum; | 3024 | return accum; |
| 3025 | } | 3025 | } |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 4a7068416fe..789aa008611 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -237,7 +237,8 @@ static char * | |||
| 237 | XD_OBJECT_TO_STRING (Lisp_Object object) | 237 | XD_OBJECT_TO_STRING (Lisp_Object object) |
| 238 | { | 238 | { |
| 239 | AUTO_STRING (format, "%s"); | 239 | AUTO_STRING (format, "%s"); |
| 240 | return SSDATA (CALLN (Fformat, format, object)); | 240 | Lisp_Object args[] = { format, object }; |
| 241 | return SSDATA (styled_format (ARRAYELTS (args), args, false, false)); | ||
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ | 244 | #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ |
diff --git a/src/editfns.c b/src/editfns.c index b03eb947dec..e326604467c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -74,7 +74,6 @@ static Lisp_Object format_time_string (char const *, ptrdiff_t, struct timespec, | |||
| 74 | static long int tm_gmtoff (struct tm *); | 74 | static long int tm_gmtoff (struct tm *); |
| 75 | static int tm_diff (struct tm *, struct tm *); | 75 | static int tm_diff (struct tm *, struct tm *); |
| 76 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); | 76 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); |
| 77 | static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); | ||
| 78 | 77 | ||
| 79 | #ifndef HAVE_TM_GMTOFF | 78 | #ifndef HAVE_TM_GMTOFF |
| 80 | # define HAVE_TM_GMTOFF false | 79 | # define HAVE_TM_GMTOFF false |
| @@ -187,7 +186,8 @@ tzlookup (Lisp_Object zone, bool settz) | |||
| 187 | if (sec != 0) | 186 | if (sec != 0) |
| 188 | prec += 2, numzone = 100 * numzone + sec; | 187 | prec += 2, numzone = 100 * numzone + sec; |
| 189 | } | 188 | } |
| 190 | sprintf (tzbuf, tzbuf_format, prec, numzone, | 189 | sprintf (tzbuf, tzbuf_format, prec, |
| 190 | XINT (zone) < 0 ? -numzone : numzone, | ||
| 191 | &"-"[XINT (zone) < 0], hour, min, sec); | 191 | &"-"[XINT (zone) < 0], hour, min, sec); |
| 192 | zone_string = tzbuf; | 192 | zone_string = tzbuf; |
| 193 | } | 193 | } |
| @@ -3958,7 +3958,7 @@ usage: (message FORMAT-STRING &rest ARGS) */) | |||
| 3958 | } | 3958 | } |
| 3959 | else | 3959 | else |
| 3960 | { | 3960 | { |
| 3961 | Lisp_Object val = Fformat_message (nargs, args); | 3961 | Lisp_Object val = styled_format (nargs, args, true, false); |
| 3962 | message3 (val); | 3962 | message3 (val); |
| 3963 | return val; | 3963 | return val; |
| 3964 | } | 3964 | } |
| @@ -3984,7 +3984,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */) | |||
| 3984 | } | 3984 | } |
| 3985 | else | 3985 | else |
| 3986 | { | 3986 | { |
| 3987 | Lisp_Object val = Fformat_message (nargs, args); | 3987 | Lisp_Object val = styled_format (nargs, args, true, false); |
| 3988 | Lisp_Object pane, menu; | 3988 | Lisp_Object pane, menu; |
| 3989 | 3989 | ||
| 3990 | pane = list1 (Fcons (build_string ("OK"), Qt)); | 3990 | pane = list1 (Fcons (build_string ("OK"), Qt)); |
| @@ -4140,7 +4140,7 @@ produced text. | |||
| 4140 | usage: (format STRING &rest OBJECTS) */) | 4140 | usage: (format STRING &rest OBJECTS) */) |
| 4141 | (ptrdiff_t nargs, Lisp_Object *args) | 4141 | (ptrdiff_t nargs, Lisp_Object *args) |
| 4142 | { | 4142 | { |
| 4143 | return styled_format (nargs, args, false); | 4143 | return styled_format (nargs, args, false, true); |
| 4144 | } | 4144 | } |
| 4145 | 4145 | ||
| 4146 | DEFUN ("format-message", Fformat_message, Sformat_message, 1, MANY, 0, | 4146 | DEFUN ("format-message", Fformat_message, Sformat_message, 1, MANY, 0, |
| @@ -4156,13 +4156,16 @@ and right quote replacement characters are specified by | |||
| 4156 | usage: (format-message STRING &rest OBJECTS) */) | 4156 | usage: (format-message STRING &rest OBJECTS) */) |
| 4157 | (ptrdiff_t nargs, Lisp_Object *args) | 4157 | (ptrdiff_t nargs, Lisp_Object *args) |
| 4158 | { | 4158 | { |
| 4159 | return styled_format (nargs, args, true); | 4159 | return styled_format (nargs, args, true, true); |
| 4160 | } | 4160 | } |
| 4161 | 4161 | ||
| 4162 | /* Implement ‘format-message’ if MESSAGE is true, ‘format’ otherwise. */ | 4162 | /* Implement ‘format-message’ if MESSAGE is true, ‘format’ otherwise. |
| 4163 | If NEW_RESULT, the result is a new string; otherwise, the result | ||
| 4164 | may be one of the arguments. */ | ||
| 4163 | 4165 | ||
| 4164 | static Lisp_Object | 4166 | Lisp_Object |
| 4165 | styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | 4167 | styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message, |
| 4168 | bool new_result) | ||
| 4166 | { | 4169 | { |
| 4167 | ptrdiff_t n; /* The number of the next arg to substitute. */ | 4170 | ptrdiff_t n; /* The number of the next arg to substitute. */ |
| 4168 | char initial_buffer[4000]; | 4171 | char initial_buffer[4000]; |
| @@ -4192,6 +4195,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4192 | /* The start and end bytepos in the output string. */ | 4195 | /* The start and end bytepos in the output string. */ |
| 4193 | ptrdiff_t start, end; | 4196 | ptrdiff_t start, end; |
| 4194 | 4197 | ||
| 4198 | /* Whether the argument is a newly created string. */ | ||
| 4199 | bool_bf new_string : 1; | ||
| 4200 | |||
| 4195 | /* Whether the argument is a string with intervals. */ | 4201 | /* Whether the argument is a string with intervals. */ |
| 4196 | bool_bf intervals : 1; | 4202 | bool_bf intervals : 1; |
| 4197 | } *info; | 4203 | } *info; |
| @@ -4341,7 +4347,10 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4341 | memset (&discarded[format0 - format_start], 1, | 4347 | memset (&discarded[format0 - format_start], 1, |
| 4342 | format - format0 - (conversion == '%')); | 4348 | format - format0 - (conversion == '%')); |
| 4343 | if (conversion == '%') | 4349 | if (conversion == '%') |
| 4344 | goto copy_char; | 4350 | { |
| 4351 | new_result = true; | ||
| 4352 | goto copy_char; | ||
| 4353 | } | ||
| 4345 | 4354 | ||
| 4346 | ++n; | 4355 | ++n; |
| 4347 | if (! (n < nargs)) | 4356 | if (! (n < nargs)) |
| @@ -4351,6 +4360,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4351 | if (nspec < ispec) | 4360 | if (nspec < ispec) |
| 4352 | { | 4361 | { |
| 4353 | spec->argument = args[n]; | 4362 | spec->argument = args[n]; |
| 4363 | spec->new_string = false; | ||
| 4354 | spec->intervals = false; | 4364 | spec->intervals = false; |
| 4355 | nspec = ispec; | 4365 | nspec = ispec; |
| 4356 | } | 4366 | } |
| @@ -4368,6 +4378,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4368 | { | 4378 | { |
| 4369 | Lisp_Object noescape = conversion == 'S' ? Qnil : Qt; | 4379 | Lisp_Object noescape = conversion == 'S' ? Qnil : Qt; |
| 4370 | spec->argument = arg = Fprin1_to_string (arg, noescape); | 4380 | spec->argument = arg = Fprin1_to_string (arg, noescape); |
| 4381 | spec->new_string = true; | ||
| 4371 | if (STRING_MULTIBYTE (arg) && ! multibyte) | 4382 | if (STRING_MULTIBYTE (arg) && ! multibyte) |
| 4372 | { | 4383 | { |
| 4373 | multibyte = true; | 4384 | multibyte = true; |
| @@ -4386,6 +4397,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4386 | goto retry; | 4397 | goto retry; |
| 4387 | } | 4398 | } |
| 4388 | spec->argument = arg = Fchar_to_string (arg); | 4399 | spec->argument = arg = Fchar_to_string (arg); |
| 4400 | spec->new_string = true; | ||
| 4389 | } | 4401 | } |
| 4390 | 4402 | ||
| 4391 | if (!EQ (arg, args[n])) | 4403 | if (!EQ (arg, args[n])) |
| @@ -4408,6 +4420,11 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4408 | 4420 | ||
| 4409 | if (conversion == 's') | 4421 | if (conversion == 's') |
| 4410 | { | 4422 | { |
| 4423 | if (format == end && format - format_start == 2 | ||
| 4424 | && (!new_result || spec->new_string) | ||
| 4425 | && ! string_intervals (args[0])) | ||
| 4426 | return arg; | ||
| 4427 | |||
| 4411 | /* handle case (precision[n] >= 0) */ | 4428 | /* handle case (precision[n] >= 0) */ |
| 4412 | 4429 | ||
| 4413 | ptrdiff_t prec = -1; | 4430 | ptrdiff_t prec = -1; |
| @@ -4486,6 +4503,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4486 | if (string_intervals (arg)) | 4503 | if (string_intervals (arg)) |
| 4487 | spec->intervals = arg_intervals = true; | 4504 | spec->intervals = arg_intervals = true; |
| 4488 | 4505 | ||
| 4506 | new_result = true; | ||
| 4489 | continue; | 4507 | continue; |
| 4490 | } | 4508 | } |
| 4491 | } | 4509 | } |
| @@ -4753,6 +4771,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4753 | } | 4771 | } |
| 4754 | spec->end = nchars; | 4772 | spec->end = nchars; |
| 4755 | 4773 | ||
| 4774 | new_result = true; | ||
| 4756 | continue; | 4775 | continue; |
| 4757 | } | 4776 | } |
| 4758 | } | 4777 | } |
| @@ -4771,9 +4790,13 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4771 | } | 4790 | } |
| 4772 | convsrc = format_char == '`' ? uLSQM : uRSQM; | 4791 | convsrc = format_char == '`' ? uLSQM : uRSQM; |
| 4773 | convbytes = 3; | 4792 | convbytes = 3; |
| 4793 | new_result = true; | ||
| 4774 | } | 4794 | } |
| 4775 | else if (format_char == '`' && quoting_style == STRAIGHT_QUOTING_STYLE) | 4795 | else if (format_char == '`' && quoting_style == STRAIGHT_QUOTING_STYLE) |
| 4776 | convsrc = "'"; | 4796 | { |
| 4797 | convsrc = "'"; | ||
| 4798 | new_result = true; | ||
| 4799 | } | ||
| 4777 | else | 4800 | else |
| 4778 | { | 4801 | { |
| 4779 | /* Copy a single character from format to buf. */ | 4802 | /* Copy a single character from format to buf. */ |
| @@ -4797,6 +4820,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4797 | int c = BYTE8_TO_CHAR (format_char); | 4820 | int c = BYTE8_TO_CHAR (format_char); |
| 4798 | convbytes = CHAR_STRING (c, str); | 4821 | convbytes = CHAR_STRING (c, str); |
| 4799 | convsrc = (char *) str; | 4822 | convsrc = (char *) str; |
| 4823 | new_result = true; | ||
| 4800 | } | 4824 | } |
| 4801 | } | 4825 | } |
| 4802 | 4826 | ||
| @@ -4843,6 +4867,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4843 | if (bufsize < p - buf) | 4867 | if (bufsize < p - buf) |
| 4844 | emacs_abort (); | 4868 | emacs_abort (); |
| 4845 | 4869 | ||
| 4870 | if (! new_result) | ||
| 4871 | return args[0]; | ||
| 4872 | |||
| 4846 | if (maybe_combine_byte) | 4873 | if (maybe_combine_byte) |
| 4847 | nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); | 4874 | nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); |
| 4848 | Lisp_Object val = make_specified_string (buf, nchars, p - buf, multibyte); | 4875 | Lisp_Object val = make_specified_string (buf, nchars, p - buf, multibyte); |
diff --git a/src/emacs.c b/src/emacs.c index 1ad8af70a74..0fe7d9113b4 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -252,7 +252,7 @@ Initialization options:\n\ | |||
| 252 | "\ | 252 | "\ |
| 253 | Action options:\n\ | 253 | Action options:\n\ |
| 254 | \n\ | 254 | \n\ |
| 255 | FILE visit FILE using find-file\n\ | 255 | FILE visit FILE\n\ |
| 256 | +LINE go to line LINE in next FILE\n\ | 256 | +LINE go to line LINE in next FILE\n\ |
| 257 | +LINE:COLUMN go to line LINE, column COLUMN, in next FILE\n\ | 257 | +LINE:COLUMN go to line LINE, column COLUMN, in next FILE\n\ |
| 258 | --directory, -L DIR prepend DIR to load-path (with :DIR, append DIR)\n\ | 258 | --directory, -L DIR prepend DIR to load-path (with :DIR, append DIR)\n\ |
| @@ -260,13 +260,13 @@ FILE visit FILE using find-file\n\ | |||
| 260 | --execute EXPR evaluate Emacs Lisp expression EXPR\n\ | 260 | --execute EXPR evaluate Emacs Lisp expression EXPR\n\ |
| 261 | ", | 261 | ", |
| 262 | "\ | 262 | "\ |
| 263 | --file FILE visit FILE using find-file\n\ | 263 | --file FILE visit FILE\n\ |
| 264 | --find-file FILE visit FILE using find-file\n\ | 264 | --find-file FILE visit FILE\n\ |
| 265 | --funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\ | 265 | --funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\ |
| 266 | --insert FILE insert contents of FILE into current buffer\n\ | 266 | --insert FILE insert contents of FILE into current buffer\n\ |
| 267 | --kill exit without asking for confirmation\n\ | 267 | --kill exit without asking for confirmation\n\ |
| 268 | --load, -l FILE load Emacs Lisp FILE using the load function\n\ | 268 | --load, -l FILE load Emacs Lisp FILE using the load function\n\ |
| 269 | --visit FILE visit FILE using find-file\n\ | 269 | --visit FILE visit FILE\n\ |
| 270 | \n\ | 270 | \n\ |
| 271 | ", | 271 | ", |
| 272 | "\ | 272 | "\ |
diff --git a/src/eval.c b/src/eval.c index 62e219631db..39d78364d5f 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1428,7 +1428,7 @@ push_handler (Lisp_Object tag_ch_val, enum handlertype handlertype) | |||
| 1428 | struct handler * | 1428 | struct handler * |
| 1429 | push_handler_nosignal (Lisp_Object tag_ch_val, enum handlertype handlertype) | 1429 | push_handler_nosignal (Lisp_Object tag_ch_val, enum handlertype handlertype) |
| 1430 | { | 1430 | { |
| 1431 | struct handler *c = handlerlist->nextfree; | 1431 | struct handler *CACHEABLE c = handlerlist->nextfree; |
| 1432 | if (!c) | 1432 | if (!c) |
| 1433 | { | 1433 | { |
| 1434 | c = malloc (sizeof *c); | 1434 | c = malloc (sizeof *c); |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 0203a5d5c1a..0da70399193 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1217,7 +1217,10 @@ xg_create_frame_widgets (struct frame *f) | |||
| 1217 | with regular X drawing primitives, so from a GTK/GDK point of | 1217 | with regular X drawing primitives, so from a GTK/GDK point of |
| 1218 | view, the widget is totally blank. When an expose comes, this | 1218 | view, the widget is totally blank. When an expose comes, this |
| 1219 | will make the widget blank, and then Emacs redraws it. This flickers | 1219 | will make the widget blank, and then Emacs redraws it. This flickers |
| 1220 | a lot, so we turn off double buffering. */ | 1220 | a lot, so we turn off double buffering. |
| 1221 | FIXME: gtk_widget_set_double_buffered is deprecated and might stop | ||
| 1222 | working in the future. We need to migrate away from combining | ||
| 1223 | X and GTK+ drawing to a pure GTK+ build. */ | ||
| 1221 | gtk_widget_set_double_buffered (wfixed, FALSE); | 1224 | gtk_widget_set_double_buffered (wfixed, FALSE); |
| 1222 | 1225 | ||
| 1223 | gtk_window_set_wmclass (GTK_WINDOW (wtop), | 1226 | gtk_window_set_wmclass (GTK_WINDOW (wtop), |
diff --git a/src/keyboard.c b/src/keyboard.c index 4db50be855c..e8701b88708 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5925,7 +5925,10 @@ make_lispy_event (struct input_event *event) | |||
| 5925 | ASIZE (wheel_syms)); | 5925 | ASIZE (wheel_syms)); |
| 5926 | } | 5926 | } |
| 5927 | 5927 | ||
| 5928 | if (event->modifiers & (double_modifier | triple_modifier)) | 5928 | if (NUMBERP (event->arg)) |
| 5929 | return list4 (head, position, make_number (double_click_count), | ||
| 5930 | event->arg); | ||
| 5931 | else if (event->modifiers & (double_modifier | triple_modifier)) | ||
| 5929 | return list3 (head, position, make_number (double_click_count)); | 5932 | return list3 (head, position, make_number (double_click_count)); |
| 5930 | else | 5933 | else |
| 5931 | return list2 (head, position); | 5934 | return list2 (head, position); |
diff --git a/src/lcms.c b/src/lcms.c index cdfbc0ecf99..a5e527911ef 100644 --- a/src/lcms.c +++ b/src/lcms.c | |||
| @@ -102,7 +102,7 @@ DEFUN ("lcms-cie-de2000", Flcms_cie_de2000, Slcms_cie_de2000, 2, 5, 0, | |||
| 102 | Each color is a list of L*a*b* coordinates, where the L* channel ranges from | 102 | Each color is a list of L*a*b* coordinates, where the L* channel ranges from |
| 103 | 0 to 100, and the a* and b* channels range from -128 to 128. | 103 | 0 to 100, and the a* and b* channels range from -128 to 128. |
| 104 | Optional arguments KL, KC, KH are weighting parameters for lightness, | 104 | Optional arguments KL, KC, KH are weighting parameters for lightness, |
| 105 | chroma, and hue, respectively. The parameters each default to 1. */) | 105 | chroma, and hue, respectively. The parameters each default to 1. */) |
| 106 | (Lisp_Object color1, Lisp_Object color2, | 106 | (Lisp_Object color1, Lisp_Object color2, |
| 107 | Lisp_Object kL, Lisp_Object kC, Lisp_Object kH) | 107 | Lisp_Object kL, Lisp_Object kC, Lisp_Object kH) |
| 108 | { | 108 | { |
| @@ -139,6 +139,26 @@ chroma, and hue, respectively. The parameters each default to 1. */) | |||
| 139 | return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh)); | 139 | return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh)); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static double | ||
| 143 | deg2rad (double degrees) | ||
| 144 | { | ||
| 145 | return M_PI * degrees / 180.0; | ||
| 146 | } | ||
| 147 | |||
| 148 | static cmsCIEXYZ illuminant_d65 = { .X = 95.0455, .Y = 100.0, .Z = 108.8753 }; | ||
| 149 | |||
| 150 | static void | ||
| 151 | default_viewing_conditions (const cmsCIEXYZ *wp, cmsViewingConditions *vc) | ||
| 152 | { | ||
| 153 | vc->whitePoint.X = wp->X; | ||
| 154 | vc->whitePoint.Y = wp->Y; | ||
| 155 | vc->whitePoint.Z = wp->Z; | ||
| 156 | vc->Yb = 20; | ||
| 157 | vc->La = 100; | ||
| 158 | vc->surround = AVG_SURROUND; | ||
| 159 | vc->D_value = 1.0; | ||
| 160 | } | ||
| 161 | |||
| 142 | /* FIXME: code duplication */ | 162 | /* FIXME: code duplication */ |
| 143 | 163 | ||
| 144 | static bool | 164 | static bool |
| @@ -160,11 +180,62 @@ parse_xyz_list (Lisp_Object xyz_list, cmsCIEXYZ *color) | |||
| 160 | return true; | 180 | return true; |
| 161 | } | 181 | } |
| 162 | 182 | ||
| 163 | DEFUN ("lcms-cam02-ucs", Flcms_cam02_ucs, Slcms_cam02_ucs, 2, 3, 0, | 183 | static bool |
| 184 | parse_viewing_conditions (Lisp_Object view, const cmsCIEXYZ *wp, | ||
| 185 | cmsViewingConditions *vc) | ||
| 186 | { | ||
| 187 | #define PARSE_VIEW_CONDITION_FLOAT(field) \ | ||
| 188 | if (CONSP (view) && NUMBERP (XCAR (view))) \ | ||
| 189 | { \ | ||
| 190 | vc->field = XFLOATINT (XCAR (view)); \ | ||
| 191 | view = XCDR (view); \ | ||
| 192 | } \ | ||
| 193 | else \ | ||
| 194 | return false; | ||
| 195 | #define PARSE_VIEW_CONDITION_INT(field) \ | ||
| 196 | if (CONSP (view) && NATNUMP (XCAR (view))) \ | ||
| 197 | { \ | ||
| 198 | CHECK_RANGED_INTEGER (XCAR (view), 1, 4); \ | ||
| 199 | vc->field = XINT (XCAR (view)); \ | ||
| 200 | view = XCDR (view); \ | ||
| 201 | } \ | ||
| 202 | else \ | ||
| 203 | return false; | ||
| 204 | |||
| 205 | PARSE_VIEW_CONDITION_FLOAT (Yb); | ||
| 206 | PARSE_VIEW_CONDITION_FLOAT (La); | ||
| 207 | PARSE_VIEW_CONDITION_INT (surround); | ||
| 208 | PARSE_VIEW_CONDITION_FLOAT (D_value); | ||
| 209 | |||
| 210 | if (! NILP (view)) | ||
| 211 | return false; | ||
| 212 | |||
| 213 | vc->whitePoint.X = wp->X; | ||
| 214 | vc->whitePoint.Y = wp->Y; | ||
| 215 | vc->whitePoint.Z = wp->Z; | ||
| 216 | return true; | ||
| 217 | } | ||
| 218 | |||
| 219 | /* References: | ||
| 220 | Li, Luo et al. "The CRI-CAM02UCS colour rendering index." COLOR research | ||
| 221 | and application, 37 No.3, 2012. | ||
| 222 | Luo et al. "Uniform colour spaces based on CIECAM02 colour appearance | ||
| 223 | model." COLOR research and application, 31 No.4, 2006. */ | ||
| 224 | |||
| 225 | DEFUN ("lcms-cam02-ucs", Flcms_cam02_ucs, Slcms_cam02_ucs, 2, 4, 0, | ||
| 164 | doc: /* Compute CAM02-UCS metric distance between COLOR1 and COLOR2. | 226 | doc: /* Compute CAM02-UCS metric distance between COLOR1 and COLOR2. |
| 165 | Each color is a list of XYZ coordinates, with Y scaled about unity. | 227 | Each color is a list of XYZ tristimulus values, with Y scaled about unity. |
| 166 | Optional argument is the XYZ white point, which defaults to illuminant D65. */) | 228 | Optional argument WHITEPOINT is the XYZ white point, which defaults to |
| 167 | (Lisp_Object color1, Lisp_Object color2, Lisp_Object whitepoint) | 229 | illuminant D65. |
| 230 | Optional argument VIEW is a list containing the viewing conditions, and | ||
| 231 | is of the form (YB LA SURROUND DVALUE) where SURROUND corresponds to | ||
| 232 | 1 AVG_SURROUND | ||
| 233 | 2 DIM_SURROUND | ||
| 234 | 3 DARK_SURROUND | ||
| 235 | 4 CUTSHEET_SURROUND | ||
| 236 | The default viewing conditions are (20 100 1 1). */) | ||
| 237 | (Lisp_Object color1, Lisp_Object color2, Lisp_Object whitepoint, | ||
| 238 | Lisp_Object view) | ||
| 168 | { | 239 | { |
| 169 | cmsViewingConditions vc; | 240 | cmsViewingConditions vc; |
| 170 | cmsJCh jch1, jch2; | 241 | cmsJCh jch1, jch2; |
| @@ -188,17 +259,13 @@ Optional argument is the XYZ white point, which defaults to illuminant D65. */) | |||
| 188 | if (!(CONSP (color2) && parse_xyz_list (color2, &xyz2))) | 259 | if (!(CONSP (color2) && parse_xyz_list (color2, &xyz2))) |
| 189 | signal_error ("Invalid color", color2); | 260 | signal_error ("Invalid color", color2); |
| 190 | if (NILP (whitepoint)) | 261 | if (NILP (whitepoint)) |
| 191 | parse_xyz_list (Vlcms_d65_xyz, &xyzw); | 262 | xyzw = illuminant_d65; |
| 192 | else if (!(CONSP (whitepoint) && parse_xyz_list (whitepoint, &xyzw))) | 263 | else if (!(CONSP (whitepoint) && parse_xyz_list (whitepoint, &xyzw))) |
| 193 | signal_error ("Invalid white point", whitepoint); | 264 | signal_error ("Invalid white point", whitepoint); |
| 194 | 265 | if (NILP (view)) | |
| 195 | vc.whitePoint.X = xyzw.X; | 266 | default_viewing_conditions (&xyzw, &vc); |
| 196 | vc.whitePoint.Y = xyzw.Y; | 267 | else if (!(CONSP (view) && parse_viewing_conditions (view, &xyzw, &vc))) |
| 197 | vc.whitePoint.Z = xyzw.Z; | 268 | signal_error ("Invalid view conditions", view); |
| 198 | vc.Yb = 20; | ||
| 199 | vc.La = 100; | ||
| 200 | vc.surround = AVG_SURROUND; | ||
| 201 | vc.D_value = 1.0; | ||
| 202 | 269 | ||
| 203 | h1 = cmsCIECAM02Init (0, &vc); | 270 | h1 = cmsCIECAM02Init (0, &vc); |
| 204 | h2 = cmsCIECAM02Init (0, &vc); | 271 | h2 = cmsCIECAM02Init (0, &vc); |
| @@ -227,10 +294,10 @@ Optional argument is the XYZ white point, which defaults to illuminant D65. */) | |||
| 227 | Mp2 = 43.86 * log (1.0 + 0.0228 * (jch2.C * sqrt (sqrt (FL)))); | 294 | Mp2 = 43.86 * log (1.0 + 0.0228 * (jch2.C * sqrt (sqrt (FL)))); |
| 228 | Jp1 = 1.7 * jch1.J / (1.0 + (0.007 * jch1.J)); | 295 | Jp1 = 1.7 * jch1.J / (1.0 + (0.007 * jch1.J)); |
| 229 | Jp2 = 1.7 * jch2.J / (1.0 + (0.007 * jch2.J)); | 296 | Jp2 = 1.7 * jch2.J / (1.0 + (0.007 * jch2.J)); |
| 230 | ap1 = Mp1 * cos (jch1.h); | 297 | ap1 = Mp1 * cos (deg2rad (jch1.h)); |
| 231 | ap2 = Mp2 * cos (jch2.h); | 298 | ap2 = Mp2 * cos (deg2rad (jch2.h)); |
| 232 | bp1 = Mp1 * sin (jch1.h); | 299 | bp1 = Mp1 * sin (deg2rad (jch1.h)); |
| 233 | bp2 = Mp2 * sin (jch2.h); | 300 | bp2 = Mp2 * sin (deg2rad (jch2.h)); |
| 234 | 301 | ||
| 235 | return make_float (sqrt ((Jp2 - Jp1) * (Jp2 - Jp1) + | 302 | return make_float (sqrt ((Jp2 - Jp1) * (Jp2 - Jp1) + |
| 236 | (ap2 - ap1) * (ap2 - ap1) + | 303 | (ap2 - ap1) * (ap2 - ap1) + |
| @@ -239,7 +306,7 @@ Optional argument is the XYZ white point, which defaults to illuminant D65. */) | |||
| 239 | 306 | ||
| 240 | DEFUN ("lcms-temp->white-point", Flcms_temp_to_white_point, Slcms_temp_to_white_point, 1, 1, 0, | 307 | DEFUN ("lcms-temp->white-point", Flcms_temp_to_white_point, Slcms_temp_to_white_point, 1, 1, 0, |
| 241 | doc: /* Return XYZ black body chromaticity from TEMPERATURE given in K. | 308 | doc: /* Return XYZ black body chromaticity from TEMPERATURE given in K. |
| 242 | Valid range of TEMPERATURE is from 4000K to 25000K. */) | 309 | Valid range of TEMPERATURE is from 4000K to 25000K. */) |
| 243 | (Lisp_Object temperature) | 310 | (Lisp_Object temperature) |
| 244 | { | 311 | { |
| 245 | cmsFloat64Number tempK; | 312 | cmsFloat64Number tempK; |
| @@ -291,12 +358,6 @@ DEFUN ("lcms2-available-p", Flcms2_available_p, Slcms2_available_p, 0, 0, 0, | |||
| 291 | void | 358 | void |
| 292 | syms_of_lcms2 (void) | 359 | syms_of_lcms2 (void) |
| 293 | { | 360 | { |
| 294 | DEFVAR_LISP ("lcms-d65-xyz", Vlcms_d65_xyz, | ||
| 295 | doc: /* D65 illuminant as a CIE XYZ triple. */); | ||
| 296 | Vlcms_d65_xyz = list3 (make_float (0.950455), | ||
| 297 | make_float (1.0), | ||
| 298 | make_float (1.088753)); | ||
| 299 | |||
| 300 | defsubr (&Slcms_cie_de2000); | 361 | defsubr (&Slcms_cie_de2000); |
| 301 | defsubr (&Slcms_cam02_ucs); | 362 | defsubr (&Slcms_cam02_ucs); |
| 302 | defsubr (&Slcms2_available_p); | 363 | defsubr (&Slcms2_available_p); |
diff --git a/src/lisp.h b/src/lisp.h index c5030824427..0c3ca3ae06b 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3969,6 +3969,7 @@ extern _Noreturn void time_overflow (void); | |||
| 3969 | extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); | 3969 | extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); |
| 3970 | extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, | 3970 | extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 3971 | ptrdiff_t, bool); | 3971 | ptrdiff_t, bool); |
| 3972 | extern Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool, bool); | ||
| 3972 | extern void init_editfns (bool); | 3973 | extern void init_editfns (bool); |
| 3973 | extern void syms_of_editfns (void); | 3974 | extern void syms_of_editfns (void); |
| 3974 | 3975 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index 27515335332..f0b6a70dae3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1820,8 +1820,8 @@ x_set_window_size (struct frame *f, | |||
| 1820 | 1820 | ||
| 1821 | if (pixelwise) | 1821 | if (pixelwise) |
| 1822 | { | 1822 | { |
| 1823 | pixelwidth = width; | 1823 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); |
| 1824 | pixelheight = height; | 1824 | pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); |
| 1825 | } | 1825 | } |
| 1826 | else | 1826 | else |
| 1827 | { | 1827 | { |
| @@ -6498,24 +6498,139 @@ not_in_argv (NSString *arg) | |||
| 6498 | 6498 | ||
| 6499 | if ([theEvent type] == NSEventTypeScrollWheel) | 6499 | if ([theEvent type] == NSEventTypeScrollWheel) |
| 6500 | { | 6500 | { |
| 6501 | CGFloat delta = [theEvent deltaY]; | 6501 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 |
| 6502 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ | 6502 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 |
| 6503 | if (delta == 0) | 6503 | if ([theEvent respondsToSelector:@selector(hasPreciseScrollingDeltas)]) |
| 6504 | { | 6504 | { |
| 6505 | delta = [theEvent deltaX]; | 6505 | #endif |
| 6506 | if (delta == 0) | 6506 | /* If the input device is a touchpad or similar, use precise |
| 6507 | * scrolling deltas. These are measured in pixels, so we | ||
| 6508 | * have to add them up until they exceed one line height, | ||
| 6509 | * then we can send a scroll wheel event. | ||
| 6510 | * | ||
| 6511 | * If the device only has coarse scrolling deltas, like a | ||
| 6512 | * real mousewheel, the deltas represent a ratio of whole | ||
| 6513 | * lines, so round up the number of lines. This means we | ||
| 6514 | * always send one scroll event per click, but can still | ||
| 6515 | * scroll more than one line if the OS tells us to. | ||
| 6516 | */ | ||
| 6517 | bool horizontal; | ||
| 6518 | int lines = 0; | ||
| 6519 | int scrollUp = NO; | ||
| 6520 | |||
| 6521 | /* FIXME: At the top or bottom of the buffer we should | ||
| 6522 | * ignore momentum-phase events. */ | ||
| 6523 | if (! ns_use_mwheel_momentum | ||
| 6524 | && [theEvent momentumPhase] != NSEventPhaseNone) | ||
| 6525 | return; | ||
| 6526 | |||
| 6527 | if ([theEvent hasPreciseScrollingDeltas]) | ||
| 6507 | { | 6528 | { |
| 6508 | NSTRACE_MSG ("deltaIsZero"); | 6529 | static int totalDeltaX, totalDeltaY; |
| 6509 | return; | 6530 | int lineHeight; |
| 6531 | |||
| 6532 | if (NUMBERP (ns_mwheel_line_height)) | ||
| 6533 | lineHeight = XINT (ns_mwheel_line_height); | ||
| 6534 | else | ||
| 6535 | { | ||
| 6536 | /* FIXME: Use actual line height instead of the default. */ | ||
| 6537 | lineHeight = default_line_pixel_height | ||
| 6538 | (XWINDOW (FRAME_SELECTED_WINDOW (emacsframe))); | ||
| 6539 | } | ||
| 6540 | |||
| 6541 | if ([theEvent phase] == NSEventPhaseBegan) | ||
| 6542 | { | ||
| 6543 | totalDeltaX = 0; | ||
| 6544 | totalDeltaY = 0; | ||
| 6545 | } | ||
| 6546 | |||
| 6547 | totalDeltaX += [theEvent scrollingDeltaX]; | ||
| 6548 | totalDeltaY += [theEvent scrollingDeltaY]; | ||
| 6549 | |||
| 6550 | /* Calculate the number of lines, if any, to scroll, and | ||
| 6551 | * reset the total delta for the direction we're NOT | ||
| 6552 | * scrolling so that small movements don't add up. */ | ||
| 6553 | if (abs (totalDeltaX) > abs (totalDeltaY) | ||
| 6554 | && abs (totalDeltaX) > lineHeight) | ||
| 6555 | { | ||
| 6556 | horizontal = YES; | ||
| 6557 | scrollUp = totalDeltaX > 0; | ||
| 6558 | |||
| 6559 | lines = abs (totalDeltaX / lineHeight); | ||
| 6560 | totalDeltaX = totalDeltaX % lineHeight; | ||
| 6561 | totalDeltaY = 0; | ||
| 6562 | } | ||
| 6563 | else if (abs (totalDeltaY) >= abs (totalDeltaX) | ||
| 6564 | && abs (totalDeltaY) > lineHeight) | ||
| 6565 | { | ||
| 6566 | horizontal = NO; | ||
| 6567 | scrollUp = totalDeltaY > 0; | ||
| 6568 | |||
| 6569 | lines = abs (totalDeltaY / lineHeight); | ||
| 6570 | totalDeltaY = totalDeltaY % lineHeight; | ||
| 6571 | totalDeltaX = 0; | ||
| 6572 | } | ||
| 6573 | |||
| 6574 | if (lines > 1 && ! ns_use_mwheel_acceleration) | ||
| 6575 | lines = 1; | ||
| 6510 | } | 6576 | } |
| 6511 | emacs_event->kind = HORIZ_WHEEL_EVENT; | 6577 | else |
| 6578 | { | ||
| 6579 | CGFloat delta; | ||
| 6580 | |||
| 6581 | if ([theEvent scrollingDeltaY] == 0) | ||
| 6582 | { | ||
| 6583 | horizontal = YES; | ||
| 6584 | delta = [theEvent scrollingDeltaX]; | ||
| 6585 | } | ||
| 6586 | else | ||
| 6587 | { | ||
| 6588 | horizontal = NO; | ||
| 6589 | delta = [theEvent scrollingDeltaY]; | ||
| 6590 | } | ||
| 6591 | |||
| 6592 | lines = (ns_use_mwheel_acceleration) | ||
| 6593 | ? ceil (fabs (delta)) : 1; | ||
| 6594 | |||
| 6595 | scrollUp = delta > 0; | ||
| 6596 | } | ||
| 6597 | |||
| 6598 | if (lines == 0) | ||
| 6599 | return; | ||
| 6600 | |||
| 6601 | emacs_event->kind = horizontal ? HORIZ_WHEEL_EVENT : WHEEL_EVENT; | ||
| 6602 | emacs_event->arg = (make_number (lines)); | ||
| 6603 | |||
| 6604 | emacs_event->code = 0; | ||
| 6605 | emacs_event->modifiers = EV_MODIFIERS (theEvent) | | ||
| 6606 | (scrollUp ? up_modifier : down_modifier); | ||
| 6607 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | ||
| 6512 | } | 6608 | } |
| 6513 | else | 6609 | else |
| 6514 | emacs_event->kind = WHEEL_EVENT; | 6610 | #endif |
| 6611 | #endif /* defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */ | ||
| 6612 | #if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | ||
| 6613 | { | ||
| 6614 | CGFloat delta = [theEvent deltaY]; | ||
| 6615 | /* Mac notebooks send wheel events w/delta =0 when trackpad scrolling */ | ||
| 6616 | if (delta == 0) | ||
| 6617 | { | ||
| 6618 | delta = [theEvent deltaX]; | ||
| 6619 | if (delta == 0) | ||
| 6620 | { | ||
| 6621 | NSTRACE_MSG ("deltaIsZero"); | ||
| 6622 | return; | ||
| 6623 | } | ||
| 6624 | emacs_event->kind = HORIZ_WHEEL_EVENT; | ||
| 6625 | } | ||
| 6626 | else | ||
| 6627 | emacs_event->kind = WHEEL_EVENT; | ||
| 6515 | 6628 | ||
| 6516 | emacs_event->code = 0; | 6629 | emacs_event->code = 0; |
| 6517 | emacs_event->modifiers = EV_MODIFIERS (theEvent) | | 6630 | emacs_event->modifiers = EV_MODIFIERS (theEvent) | |
| 6518 | ((delta > 0) ? up_modifier : down_modifier); | 6631 | ((delta > 0) ? up_modifier : down_modifier); |
| 6632 | } | ||
| 6633 | #endif | ||
| 6519 | } | 6634 | } |
| 6520 | else | 6635 | else |
| 6521 | { | 6636 | { |
| @@ -6524,9 +6639,11 @@ not_in_argv (NSString *arg) | |||
| 6524 | emacs_event->modifiers = EV_MODIFIERS (theEvent) | 6639 | emacs_event->modifiers = EV_MODIFIERS (theEvent) |
| 6525 | | EV_UDMODIFIERS (theEvent); | 6640 | | EV_UDMODIFIERS (theEvent); |
| 6526 | } | 6641 | } |
| 6642 | |||
| 6527 | XSETINT (emacs_event->x, lrint (p.x)); | 6643 | XSETINT (emacs_event->x, lrint (p.x)); |
| 6528 | XSETINT (emacs_event->y, lrint (p.y)); | 6644 | XSETINT (emacs_event->y, lrint (p.y)); |
| 6529 | EV_TRAILER (theEvent); | 6645 | EV_TRAILER (theEvent); |
| 6646 | return; | ||
| 6530 | } | 6647 | } |
| 6531 | 6648 | ||
| 6532 | 6649 | ||
| @@ -6707,9 +6824,10 @@ not_in_argv (NSString *arg) | |||
| 6707 | 6824 | ||
| 6708 | if (wait_for_tool_bar) | 6825 | if (wait_for_tool_bar) |
| 6709 | { | 6826 | { |
| 6710 | /* The toolbar height is always 0 in fullscreen, so don't wait | 6827 | /* The toolbar height is always 0 in fullscreen and undecorated |
| 6711 | for it to become available. */ | 6828 | frames, so don't wait for it to become available. */ |
| 6712 | if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0 | 6829 | if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0 |
| 6830 | && FRAME_UNDECORATED (emacsframe) == false | ||
| 6713 | && ! [self isFullscreen]) | 6831 | && ! [self isFullscreen]) |
| 6714 | { | 6832 | { |
| 6715 | NSTRACE_MSG ("Waiting for toolbar"); | 6833 | NSTRACE_MSG ("Waiting for toolbar"); |
| @@ -7090,9 +7208,9 @@ not_in_argv (NSString *arg) | |||
| 7090 | 7208 | ||
| 7091 | win = [[EmacsWindow alloc] | 7209 | win = [[EmacsWindow alloc] |
| 7092 | initWithContentRect: r | 7210 | initWithContentRect: r |
| 7093 | styleMask: (FRAME_UNDECORATED (f) | 7211 | styleMask: ((FRAME_UNDECORATED (f) |
| 7094 | ? FRAME_UNDECORATED_FLAGS | 7212 | ? FRAME_UNDECORATED_FLAGS |
| 7095 | : FRAME_DECORATED_FLAGS | 7213 | : FRAME_DECORATED_FLAGS) |
| 7096 | #ifdef NS_IMPL_COCOA | 7214 | #ifdef NS_IMPL_COCOA |
| 7097 | | NSWindowStyleMaskResizable | 7215 | | NSWindowStyleMaskResizable |
| 7098 | | NSWindowStyleMaskMiniaturizable | 7216 | | NSWindowStyleMaskMiniaturizable |
| @@ -9166,6 +9284,23 @@ Note that this does not apply to images. | |||
| 9166 | This variable is ignored on Mac OS X < 10.7 and GNUstep. */); | 9284 | This variable is ignored on Mac OS X < 10.7 and GNUstep. */); |
| 9167 | ns_use_srgb_colorspace = YES; | 9285 | ns_use_srgb_colorspace = YES; |
| 9168 | 9286 | ||
| 9287 | DEFVAR_BOOL ("ns-use-mwheel-acceleration", | ||
| 9288 | ns_use_mwheel_acceleration, | ||
| 9289 | doc: /*Non-nil means use macOS's standard mouse wheel acceleration. | ||
| 9290 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | ||
| 9291 | ns_use_mwheel_acceleration = YES; | ||
| 9292 | |||
| 9293 | DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height, | ||
| 9294 | doc: /*The number of pixels touchpad scrolling considers one line. | ||
| 9295 | Nil or a non-number means use the default frame line height. | ||
| 9296 | This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. */); | ||
| 9297 | ns_mwheel_line_height = Qnil; | ||
| 9298 | |||
| 9299 | DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum, | ||
| 9300 | doc: /*Non-nil means mouse wheel scrolling uses momentum. | ||
| 9301 | This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */); | ||
| 9302 | ns_use_mwheel_momentum = YES; | ||
| 9303 | |||
| 9169 | /* TODO: move to common code */ | 9304 | /* TODO: move to common code */ |
| 9170 | DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, | 9305 | DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, |
| 9171 | doc: /* Which toolkit scroll bars Emacs uses, if any. | 9306 | doc: /* Which toolkit scroll bars Emacs uses, if any. |
diff --git a/src/term.c b/src/term.c index a2ae8c2c6f0..065bce45d3c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -155,12 +155,16 @@ tty_ring_bell (struct frame *f) | |||
| 155 | static void | 155 | static void |
| 156 | tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym) | 156 | tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym) |
| 157 | { | 157 | { |
| 158 | Lisp_Object lisp_terminal; | 158 | /* Use only accessors like CDR_SAFE and assq_no_quit to avoid any |
| 159 | Lisp_Object extra_codes; | 159 | form of quitting or signaling an error, since this function can |
| 160 | run as part of the "emergency escape" procedure invoked in the | ||
| 161 | middle of GC, where quitting means crashing (Bug#17406). */ | ||
| 162 | if (! terminal->name) | ||
| 163 | return; | ||
| 160 | struct tty_display_info *tty = terminal->display_info.tty; | 164 | struct tty_display_info *tty = terminal->display_info.tty; |
| 161 | 165 | ||
| 162 | XSETTERMINAL (lisp_terminal, terminal); | 166 | for (Lisp_Object extra_codes |
| 163 | for (extra_codes = Fterminal_parameter (lisp_terminal, sym); | 167 | = CDR_SAFE (assq_no_quit (sym, terminal->param_alist)); |
| 164 | CONSP (extra_codes); | 168 | CONSP (extra_codes); |
| 165 | extra_codes = XCDR (extra_codes)) | 169 | extra_codes = XCDR (extra_codes)) |
| 166 | { | 170 | { |
diff --git a/src/termhooks.h b/src/termhooks.h index 97c128ba4e2..b5171bf1229 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -116,7 +116,9 @@ enum event_kind | |||
| 116 | .frame_or_window gives the frame | 116 | .frame_or_window gives the frame |
| 117 | the wheel event occurred in. | 117 | the wheel event occurred in. |
| 118 | .timestamp gives a timestamp (in | 118 | .timestamp gives a timestamp (in |
| 119 | milliseconds) for the event. */ | 119 | milliseconds) for the event. |
| 120 | .arg may contain the number of | ||
| 121 | lines to scroll. */ | ||
| 120 | HORIZ_WHEEL_EVENT, /* A wheel event generated by a second | 122 | HORIZ_WHEEL_EVENT, /* A wheel event generated by a second |
| 121 | horizontal wheel that is present on some | 123 | horizontal wheel that is present on some |
| 122 | mice. See WHEEL_EVENT. */ | 124 | mice. See WHEEL_EVENT. */ |
diff --git a/src/w32term.c b/src/w32term.c index a7a510b9ecb..d7ec40118f3 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -6252,7 +6252,8 @@ w32fullscreen_hook (struct frame *f) | |||
| 6252 | 6252 | ||
| 6253 | if (FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH) | 6253 | if (FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH) |
| 6254 | { | 6254 | { |
| 6255 | SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); | 6255 | if (!FRAME_UNDECORATED (f)) |
| 6256 | SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); | ||
| 6256 | SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f)); | 6257 | SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f)); |
| 6257 | } | 6258 | } |
| 6258 | else if (FRAME_PREV_FSMODE (f) == FULLSCREEN_HEIGHT | 6259 | else if (FRAME_PREV_FSMODE (f) == FULLSCREEN_HEIGHT |
| @@ -6278,7 +6279,8 @@ w32fullscreen_hook (struct frame *f) | |||
| 6278 | 6279 | ||
| 6279 | w32_fullscreen_rect (hwnd, f->want_fullscreen, | 6280 | w32_fullscreen_rect (hwnd, f->want_fullscreen, |
| 6280 | FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); | 6281 | FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); |
| 6281 | SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); | 6282 | if (!FRAME_UNDECORATED (f)) |
| 6283 | SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); | ||
| 6282 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, | 6284 | SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, |
| 6283 | rect.right - rect.left, rect.bottom - rect.top, | 6285 | rect.right - rect.left, rect.bottom - rect.top, |
| 6284 | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); | 6286 | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); |
diff --git a/src/xdisp.c b/src/xdisp.c index dc5dbb05762..86164eb9f6f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10194,7 +10194,7 @@ vadd_to_log (char const *format, va_list ap) | |||
| 10194 | for (ptrdiff_t i = 1; i <= nargs; i++) | 10194 | for (ptrdiff_t i = 1; i <= nargs; i++) |
| 10195 | args[i] = va_arg (ap, Lisp_Object); | 10195 | args[i] = va_arg (ap, Lisp_Object); |
| 10196 | Lisp_Object msg = Qnil; | 10196 | Lisp_Object msg = Qnil; |
| 10197 | msg = Fformat_message (nargs, args); | 10197 | msg = styled_format (nargs, args, true, false); |
| 10198 | 10198 | ||
| 10199 | ptrdiff_t len = SBYTES (msg) + 1; | 10199 | ptrdiff_t len = SBYTES (msg) + 1; |
| 10200 | USE_SAFE_ALLOCA; | 10200 | USE_SAFE_ALLOCA; |
| @@ -19525,7 +19525,7 @@ DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "", | |||
| 19525 | usage: (trace-to-stderr STRING &rest OBJECTS) */) | 19525 | usage: (trace-to-stderr STRING &rest OBJECTS) */) |
| 19526 | (ptrdiff_t nargs, Lisp_Object *args) | 19526 | (ptrdiff_t nargs, Lisp_Object *args) |
| 19527 | { | 19527 | { |
| 19528 | Lisp_Object s = Fformat (nargs, args); | 19528 | Lisp_Object s = styled_format (nargs, args, false, false); |
| 19529 | fwrite (SDATA (s), 1, SBYTES (s), stderr); | 19529 | fwrite (SDATA (s), 1, SBYTES (s), stderr); |
| 19530 | return Qnil; | 19530 | return Qnil; |
| 19531 | } | 19531 | } |
| @@ -22395,8 +22395,8 @@ Value is the new character position of point. */) | |||
| 22395 | row += dir; | 22395 | row += dir; |
| 22396 | else | 22396 | else |
| 22397 | row -= dir; | 22397 | row -= dir; |
| 22398 | if (row < MATRIX_FIRST_TEXT_ROW (w->current_matrix) | 22398 | if (!(MATRIX_FIRST_TEXT_ROW (w->current_matrix) <= row |
| 22399 | || row > MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)) | 22399 | && row < MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w))) |
| 22400 | goto simulate_display; | 22400 | goto simulate_display; |
| 22401 | 22401 | ||
| 22402 | if (dir > 0) | 22402 | if (dir > 0) |