aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2021-05-19 22:02:06 +0900
committerYuuki Harano2021-05-19 22:02:06 +0900
commite48372f8e5722643e37185b004469acd174663f7 (patch)
treeb77ec71bb51856f98d34182eca56322750533017 /src
parentd0fa569b7303c2d893b54d0a7af7a521308a5ed4 (diff)
parent61291e06cc804de2075305c220d31ef6072f28c8 (diff)
downloademacs-e48372f8e5722643e37185b004469acd174663f7.tar.gz
emacs-e48372f8e5722643e37185b004469acd174663f7.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in5
-rw-r--r--src/comp.c38
-rw-r--r--src/doc.c24
-rw-r--r--src/dynlib.c2
-rw-r--r--src/emacs.c1
-rw-r--r--src/eval.c9
-rw-r--r--src/frame.c13
-rw-r--r--src/frame.h6
-rw-r--r--src/image.c12
-rw-r--r--src/lisp.h1
-rw-r--r--src/lread.c17
-rw-r--r--src/minibuf.c51
-rw-r--r--src/nsfns.m1
-rw-r--r--src/process.c15
-rw-r--r--src/process.h1
-rw-r--r--src/search.c11
-rw-r--r--src/w32.c4
-rw-r--r--src/w32common.h4
-rw-r--r--src/w32console.c2
-rw-r--r--src/w32fns.c20
-rw-r--r--src/w32heap.c4
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32proc.c8
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32term.c8
-rw-r--r--src/w32term.h2
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c42
-rw-r--r--src/xfns.c20
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c26
31 files changed, 250 insertions, 107 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 5d0d1fb17bd..5da2257ba97 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -674,7 +674,7 @@ ns-app: emacs$(EXEEXT) $(pdmp)
674 $(MAKE) -C ../nextstep all 674 $(MAKE) -C ../nextstep all
675 675
676.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean 676.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
677.PHONY: versionclean extraclean 677.PHONY: versionclean
678 678
679mostlyclean: 679mostlyclean:
680 rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o 680 rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o
@@ -709,9 +709,6 @@ distclean: bootstrap-clean
709 709
710maintainer-clean: distclean 710maintainer-clean: distclean
711 rm -f TAGS 711 rm -f TAGS
712extraclean: distclean
713 rm -f ./*~ \#* TAGS config.in
714
715 712
716ETAGS = ../lib-src/etags${EXEEXT} 713ETAGS = ../lib-src/etags${EXEEXT}
717 714
diff --git a/src/comp.c b/src/comp.c
index 89667b2febc..c0445050b71 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -2745,8 +2745,8 @@ emit_ctxt_code (void)
2745{ 2745{
2746 /* Emit optimize qualities. */ 2746 /* Emit optimize qualities. */
2747 Lisp_Object opt_qly[] = 2747 Lisp_Object opt_qly[] =
2748 { Fcons (Qcomp_speed, make_fixnum (comp.speed)), 2748 { Fcons (Qnative_comp_speed, make_fixnum (comp.speed)),
2749 Fcons (Qcomp_debug, make_fixnum (comp.debug)), 2749 Fcons (Qnative_comp_debug, make_fixnum (comp.debug)),
2750 Fcons (Qgccjit, 2750 Fcons (Qgccjit,
2751 Fcomp_libgccjit_version ()) }; 2751 Fcomp_libgccjit_version ()) };
2752 emit_static_object (TEXT_OPTIM_QLY_SYM, Flist (ARRAYELTS (opt_qly), opt_qly)); 2752 emit_static_object (TEXT_OPTIM_QLY_SYM, Flist (ARRAYELTS (opt_qly), opt_qly));
@@ -4095,11 +4095,11 @@ directory in `comp-eln-load-path' otherwise. */)
4095 Lisp_Object source_filename = filename; 4095 Lisp_Object source_filename = filename;
4096 filename = Fcomp_el_to_eln_rel_filename (filename); 4096 filename = Fcomp_el_to_eln_rel_filename (filename);
4097 4097
4098 /* If base_dir was not specified search inside Vcomp_eln_load_path 4098 /* If base_dir was not specified search inside Vnative_comp_eln_load_path
4099 for the first directory where we have write access. */ 4099 for the first directory where we have write access. */
4100 if (NILP (base_dir)) 4100 if (NILP (base_dir))
4101 { 4101 {
4102 Lisp_Object eln_load_paths = Vcomp_eln_load_path; 4102 Lisp_Object eln_load_paths = Vnative_comp_eln_load_path;
4103 FOR_EACH_TAIL (eln_load_paths) 4103 FOR_EACH_TAIL (eln_load_paths)
4104 { 4104 {
4105 Lisp_Object dir = XCAR (eln_load_paths); 4105 Lisp_Object dir = XCAR (eln_load_paths);
@@ -4358,7 +4358,7 @@ DEFUN ("comp-native-driver-options-effective-p",
4358static void 4358static void
4359add_driver_options (void) 4359add_driver_options (void)
4360{ 4360{
4361 Lisp_Object options = Fsymbol_value (Qcomp_native_driver_options); 4361 Lisp_Object options = Fsymbol_value (Qnative_comp_driver_options);
4362 4362
4363#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ 4363#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
4364 || defined (WINDOWSNT) 4364 || defined (WINDOWSNT)
@@ -4630,7 +4630,7 @@ void
4630eln_load_path_final_clean_up (void) 4630eln_load_path_final_clean_up (void)
4631{ 4631{
4632#ifdef WINDOWSNT 4632#ifdef WINDOWSNT
4633 Lisp_Object dir_tail = Vcomp_eln_load_path; 4633 Lisp_Object dir_tail = Vnative_comp_eln_load_path;
4634 FOR_EACH_TAIL (dir_tail) 4634 FOR_EACH_TAIL (dir_tail)
4635 { 4635 {
4636 Lisp_Object files_in_dir = 4636 Lisp_Object files_in_dir =
@@ -4697,7 +4697,7 @@ maybe_defer_native_compilation (Lisp_Object function_name,
4697 if (!load_gccjit_if_necessary (false)) 4697 if (!load_gccjit_if_necessary (false))
4698 return; 4698 return;
4699 4699
4700 if (!comp_deferred_compilation 4700 if (!native_comp_deferred_compilation
4701 || noninteractive 4701 || noninteractive
4702 || !NILP (Vpurify_flag) 4702 || !NILP (Vpurify_flag)
4703 || !COMPILEDP (definition) 4703 || !COMPILEDP (definition)
@@ -4755,7 +4755,7 @@ void
4755fixup_eln_load_path (Lisp_Object eln_filename) 4755fixup_eln_load_path (Lisp_Object eln_filename)
4756{ 4756{
4757 Lisp_Object last_cell = Qnil; 4757 Lisp_Object last_cell = Qnil;
4758 Lisp_Object tem = Vcomp_eln_load_path; 4758 Lisp_Object tem = Vnative_comp_eln_load_path;
4759 FOR_EACH_TAIL (tem) 4759 FOR_EACH_TAIL (tem)
4760 if (CONSP (tem)) 4760 if (CONSP (tem))
4761 last_cell = tem; 4761 last_cell = tem;
@@ -4856,7 +4856,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump,
4856 /* 'dlopen' returns the same handle when trying to load two times 4856 /* 'dlopen' returns the same handle when trying to load two times
4857 the same shared. In this case touching 'd_reloc' etc leads to 4857 the same shared. In this case touching 'd_reloc' etc leads to
4858 fails in case a frame with a reference to it in a live reg is 4858 fails in case a frame with a reference to it in a live reg is
4859 active (comp-speed > 0). 4859 active (native-comp-speed > 0).
4860 4860
4861 We must *never* mess with static pointers in an already loaded 4861 We must *never* mess with static pointers in an already loaded
4862 eln. */ 4862 eln. */
@@ -5127,7 +5127,7 @@ static bool
5127file_in_eln_sys_dir (Lisp_Object filename) 5127file_in_eln_sys_dir (Lisp_Object filename)
5128{ 5128{
5129 Lisp_Object eln_sys_dir = Qnil; 5129 Lisp_Object eln_sys_dir = Qnil;
5130 Lisp_Object tmp = Vcomp_eln_load_path; 5130 Lisp_Object tmp = Vnative_comp_eln_load_path;
5131 FOR_EACH_TAIL (tmp) 5131 FOR_EACH_TAIL (tmp)
5132 eln_sys_dir = XCAR (tmp); 5132 eln_sys_dir = XCAR (tmp);
5133 return !NILP (Fstring_match (Fregexp_quote (Fexpand_file_name (eln_sys_dir, 5133 return !NILP (Fstring_match (Fregexp_quote (Fexpand_file_name (eln_sys_dir,
@@ -5200,16 +5200,17 @@ syms_of_comp (void)
5200{ 5200{
5201#ifdef HAVE_NATIVE_COMP 5201#ifdef HAVE_NATIVE_COMP
5202 /* Compiler control customizes. */ 5202 /* Compiler control customizes. */
5203 DEFVAR_BOOL ("comp-deferred-compilation", comp_deferred_compilation, 5203 DEFVAR_BOOL ("native-comp-deferred-compilation",
5204 native_comp_deferred_compilation,
5204 doc: /* If non-nil compile loaded .elc files asynchronously. 5205 doc: /* If non-nil compile loaded .elc files asynchronously.
5205 5206
5206After compilation, each function definition is updated to the native 5207After compilation, each function definition is updated to the native
5207compiled one. */); 5208compiled one. */);
5208 comp_deferred_compilation = true; 5209 native_comp_deferred_compilation = true;
5209 5210
5210 DEFSYM (Qcomp_speed, "comp-speed"); 5211 DEFSYM (Qnative_comp_speed, "native-comp-speed");
5211 DEFSYM (Qcomp_debug, "comp-debug"); 5212 DEFSYM (Qnative_comp_debug, "native-comp-debug");
5212 DEFSYM (Qcomp_native_driver_options, "comp-native-driver-options"); 5213 DEFSYM (Qnative_comp_driver_options, "native-comp-driver-options");
5213 DEFSYM (Qcomp_libgccjit_reproducer, "comp-libgccjit-reproducer"); 5214 DEFSYM (Qcomp_libgccjit_reproducer, "comp-libgccjit-reproducer");
5214 5215
5215 /* Limple instruction set. */ 5216 /* Limple instruction set. */
@@ -5272,7 +5273,8 @@ compiled one. */);
5272 DEFSYM (Qlambda_fixup, "lambda-fixup"); 5273 DEFSYM (Qlambda_fixup, "lambda-fixup");
5273 DEFSYM (Qgccjit, "gccjit"); 5274 DEFSYM (Qgccjit, "gccjit");
5274 DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install"); 5275 DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install");
5275 DEFSYM (Qcomp_warning_on_missing_source, "comp-warning-on-missing-source"); 5276 DEFSYM (Qnative_comp_warning_on_missing_source,
5277 "native-comp-warning-on-missing-source");
5276 5278
5277 /* To be signaled by the compiler. */ 5279 /* To be signaled by the compiler. */
5278 DEFSYM (Qnative_compiler_error, "native-compiler-error"); 5280 DEFSYM (Qnative_compiler_error, "native-compiler-error");
@@ -5368,7 +5370,7 @@ For internal use. */);
5368 doc: /* Hash table eln-filename -> el-filename. */); 5370 doc: /* Hash table eln-filename -> el-filename. */);
5369 Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal); 5371 Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal);
5370 5372
5371 DEFVAR_LISP ("comp-eln-load-path", Vcomp_eln_load_path, 5373 DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path,
5372 doc: /* List of eln cache directories. 5374 doc: /* List of eln cache directories.
5373 5375
5374If a directory is non absolute is assumed to be relative to 5376If a directory is non absolute is assumed to be relative to
@@ -5380,7 +5382,7 @@ The last directory of this list is assumed to be the system one. */);
5380 /* Temporary value in use for bootstrap. We can't do better as 5382 /* Temporary value in use for bootstrap. We can't do better as
5381 `invocation-directory' is still unset, will be fixed up during 5383 `invocation-directory' is still unset, will be fixed up during
5382 dump reload. */ 5384 dump reload. */
5383 Vcomp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); 5385 Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
5384 5386
5385 DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines, 5387 DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines,
5386 doc: /* If non-nil enable primitive trampoline synthesis. 5388 doc: /* If non-nil enable primitive trampoline synthesis.
diff --git a/src/doc.c b/src/doc.c
index e179a126184..6be023bb934 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -719,17 +719,19 @@ syms_of_doc (void)
719 719
720 DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style, 720 DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
721 doc: /* Style to use for single quotes in help and messages. 721 doc: /* Style to use for single quotes in help and messages.
722Its value should be a symbol. It works by substituting certain single 722
723quotes for grave accent and apostrophe. This is done in help output 723The value of this variable determines substitution of grave accents
724\(but not for display of Info manuals) and in functions like `message' 724and apostrophes in help output (but not for display of Info
725and `format-message'. It is not done in `format'. 725manuals) and in functions like `message' and `format-message', but not
726 726in `format'.
727`curve' means quote with curved single quotes ‘like this’. 727
728`straight' means quote with straight apostrophes \\='like this\\='. 728The value should be one of these symbols:
729`grave' means quote with grave accent and apostrophe \\=`like this\\='; 729 `curve': quote with curved single quotes ‘like this’.
730i.e., do not alter quote marks. The default value nil acts like 730 `straight': quote with straight apostrophes \\='like this\\='.
731`curve' if curved single quotes are displayable, and like `grave' 731 `grave': quote with grave accent and apostrophe \\=`like this\\=';
732otherwise. */); 732 i.e., do not alter the original quote marks.
733 nil: like `curve' if curved single quotes are displayable,
734 and like `grave' otherwise. This is the default. */);
733 Vtext_quoting_style = Qnil; 735 Vtext_quoting_style = Qnil;
734 736
735 DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag, 737 DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag,
diff --git a/src/dynlib.c b/src/dynlib.c
index 1338e9109c9..a8c88439615 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -135,7 +135,7 @@ dynlib_addr (void (*funcptr) (void), const char **fname, const char **symname)
135 void *addr = (void *) funcptr; 135 void *addr = (void *) funcptr;
136 136
137 /* Step 1: Find the handle of the module where ADDR lives. */ 137 /* Step 1: Find the handle of the module where ADDR lives. */
138 if (os_subtype == OS_9X 138 if (os_subtype == OS_SUBTYPE_9X
139 /* Windows NT family version before XP (v5.1). */ 139 /* Windows NT family version before XP (v5.1). */
140 || ((w32_major_version + (w32_minor_version > 0)) < 6)) 140 || ((w32_major_version + (w32_minor_version > 0)) < 6))
141 { 141 {
diff --git a/src/emacs.c b/src/emacs.c
index 645215b04cf..c8bc0ba4bec 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2309,6 +2309,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
2309 Vdump_mode = build_string (dump_mode); 2309 Vdump_mode = build_string (dump_mode);
2310 2310
2311 /* Enter editor command loop. This never returns. */ 2311 /* Enter editor command loop. This never returns. */
2312 set_initial_minibuffer_mode ();
2312 Frecursive_edit (); 2313 Frecursive_edit ();
2313 eassume (false); 2314 eassume (false);
2314} 2315}
diff --git a/src/eval.c b/src/eval.c
index aeedcc50cc0..18faa0b9b15 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1370,7 +1370,7 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform,
1370 || CONSP (XCAR (tem)))))) 1370 || CONSP (XCAR (tem))))))
1371 error ("Invalid condition handler: %s", 1371 error ("Invalid condition handler: %s",
1372 SDATA (Fprin1_to_string (tem, Qt))); 1372 SDATA (Fprin1_to_string (tem, Qt)));
1373 if (EQ (XCAR (tem), QCsuccess)) 1373 if (CONSP (tem) && EQ (XCAR (tem), QCsuccess))
1374 success_handler = XCDR (tem); 1374 success_handler = XCDR (tem);
1375 else 1375 else
1376 clausenb++; 1376 clausenb++;
@@ -1387,8 +1387,11 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform,
1387 Lisp_Object volatile *clauses = alloca (clausenb * sizeof *clauses); 1387 Lisp_Object volatile *clauses = alloca (clausenb * sizeof *clauses);
1388 clauses += clausenb; 1388 clauses += clausenb;
1389 for (Lisp_Object tail = handlers; CONSP (tail); tail = XCDR (tail)) 1389 for (Lisp_Object tail = handlers; CONSP (tail); tail = XCDR (tail))
1390 if (!EQ (XCAR (XCAR (tail)), QCsuccess)) 1390 {
1391 *--clauses = XCAR (tail); 1391 Lisp_Object tem = XCAR (tail);
1392 if (!(CONSP (tem) && EQ (XCAR (tem), QCsuccess)))
1393 *--clauses = tem;
1394 }
1392 for (ptrdiff_t i = 0; i < clausenb; i++) 1395 for (ptrdiff_t i = 0; i < clausenb; i++)
1393 { 1396 {
1394 Lisp_Object clause = clauses[i]; 1397 Lisp_Object clause = clauses[i];
diff --git a/src/frame.c b/src/frame.c
index eb5aed82f7d..40b8d2b06c1 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -973,6 +973,7 @@ make_frame (bool mini_p)
973 f->no_accept_focus = false; 973 f->no_accept_focus = false;
974 f->z_group = z_group_none; 974 f->z_group = z_group_none;
975 f->tooltip = false; 975 f->tooltip = false;
976 f->was_invisible = false;
976 f->child_frame_border_width = -1; 977 f->child_frame_border_width = -1;
977 f->last_tab_bar_item = -1; 978 f->last_tab_bar_item = -1;
978#ifndef HAVE_EXT_TOOL_BAR 979#ifndef HAVE_EXT_TOOL_BAR
@@ -5865,7 +5866,18 @@ selected frame. This is useful when `make-pointer-invisible' is set. */)
5865 return decode_any_frame (frame)->pointer_invisible ? Qnil : Qt; 5866 return decode_any_frame (frame)->pointer_invisible ? Qnil : Qt;
5866} 5867}
5867 5868
5869DEFUN ("frame--set-was-invisible", Fframe__set_was_invisible,
5870 Sframe__set_was_invisible, 2, 2, 0,
5871 doc: /* Set FRAME's was-invisible flag if WAS-INVISIBLE is non-nil.
5872This function is for internal use only. */)
5873 (Lisp_Object frame, Lisp_Object was_invisible)
5874{
5875 struct frame *f = decode_live_frame (frame);
5868 5876
5877 f->was_invisible = !NILP (was_invisible);
5878
5879 return f->was_invisible ? Qt : Qnil;
5880}
5869 5881
5870/*********************************************************************** 5882/***********************************************************************
5871 Multimonitor data 5883 Multimonitor data
@@ -6518,6 +6530,7 @@ iconify the top level frame instead. */);
6518 defsubr (&Sframe_position); 6530 defsubr (&Sframe_position);
6519 defsubr (&Sset_frame_position); 6531 defsubr (&Sset_frame_position);
6520 defsubr (&Sframe_pointer_visible_p); 6532 defsubr (&Sframe_pointer_visible_p);
6533 defsubr (&Sframe__set_was_invisible);
6521 defsubr (&Sframe_window_state_change); 6534 defsubr (&Sframe_window_state_change);
6522 defsubr (&Sset_frame_window_state_change); 6535 defsubr (&Sset_frame_window_state_change);
6523 defsubr (&Sframe_scale_factor); 6536 defsubr (&Sframe_scale_factor);
diff --git a/src/frame.h b/src/frame.h
index 399948fa7ed..1aba1e3bc47 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -456,7 +456,11 @@ struct frame
456 /* True when new_width or new_height were set by change_frame_size, 456 /* True when new_width or new_height were set by change_frame_size,
457 false when they were set by adjust_frame_size internally or not 457 false when they were set by adjust_frame_size internally or not
458 set. */ 458 set. */
459 bool_bf new_size_p; 459 bool_bf new_size_p : 1;
460
461 /* True when frame was invisible before first MapNotify event. Used
462 in X builds only. */
463 bool_bf was_invisible : 1;
460 464
461 /* Bitfield area ends here. */ 465 /* Bitfield area ends here. */
462 466
diff --git a/src/image.c b/src/image.c
index a78674fed09..67c55ea9ea1 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4191,6 +4191,7 @@ enum xpm_keyword_index
4191 XPM_LAST 4191 XPM_LAST
4192}; 4192};
4193 4193
4194#if defined HAVE_XPM || defined HAVE_NS
4194/* Vector of image_keyword structures describing the format 4195/* Vector of image_keyword structures describing the format
4195 of valid XPM image specifications. */ 4196 of valid XPM image specifications. */
4196 4197
@@ -4208,6 +4209,7 @@ static const struct image_keyword xpm_format[XPM_LAST] =
4208 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, 4209 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
4209 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 4210 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
4210}; 4211};
4212#endif /* HAVE_XPM || HAVE_NS */
4211 4213
4212#if defined HAVE_X_WINDOWS && !defined USE_CAIRO 4214#if defined HAVE_X_WINDOWS && !defined USE_CAIRO
4213 4215
@@ -4431,6 +4433,7 @@ init_xpm_functions (void)
4431 4433
4432#endif /* WINDOWSNT */ 4434#endif /* WINDOWSNT */
4433 4435
4436#if defined HAVE_XPM || defined HAVE_NS
4434/* Value is true if COLOR_SYMBOLS is a valid color symbols list 4437/* Value is true if COLOR_SYMBOLS is a valid color symbols list
4435 for XPM images. Such a list must consist of conses whose car and 4438 for XPM images. Such a list must consist of conses whose car and
4436 cdr are strings. */ 4439 cdr are strings. */
@@ -4451,7 +4454,6 @@ xpm_valid_color_symbols_p (Lisp_Object color_symbols)
4451 return NILP (color_symbols); 4454 return NILP (color_symbols);
4452} 4455}
4453 4456
4454
4455/* Value is true if OBJECT is a valid XPM image specification. */ 4457/* Value is true if OBJECT is a valid XPM image specification. */
4456 4458
4457static bool 4459static bool
@@ -4467,6 +4469,7 @@ xpm_image_p (Lisp_Object object)
4467 && (! fmt[XPM_COLOR_SYMBOLS].count 4469 && (! fmt[XPM_COLOR_SYMBOLS].count
4468 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))); 4470 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)));
4469} 4471}
4472#endif /* HAVE_XPM || HAVE_NS */
4470 4473
4471#endif /* HAVE_XPM || USE_CAIRO || HAVE_NS */ 4474#endif /* HAVE_XPM || USE_CAIRO || HAVE_NS */
4472 4475
@@ -4836,10 +4839,11 @@ xpm_load (struct frame *f, struct image *img)
4836 4839
4837#endif /* HAVE_XPM && !USE_CAIRO */ 4840#endif /* HAVE_XPM && !USE_CAIRO */
4838 4841
4839#if defined USE_CAIRO || (defined HAVE_NS && !defined HAVE_XPM) 4842#if (defined USE_CAIRO && defined HAVE_XPM) \
4843 || (defined HAVE_NS && !defined HAVE_XPM)
4840 4844
4841/* XPM support functions for NS where libxpm is not available. 4845/* XPM support functions for NS where libxpm is not available, and for
4842 Only XPM version 3 (without any extensions) is supported. */ 4846 Cairo. Only XPM version 3 (without any extensions) is supported. */
4843 4847
4844static void xpm_put_color_table_v (Lisp_Object, const char *, 4848static void xpm_put_color_table_v (Lisp_Object, const char *,
4845 int, Lisp_Object); 4849 int, Lisp_Object);
diff --git a/src/lisp.h b/src/lisp.h
index f83c55f827d..91b7a89d0f5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4377,6 +4377,7 @@ extern EMACS_INT this_minibuffer_depth (Lisp_Object);
4377extern EMACS_INT minibuf_level; 4377extern EMACS_INT minibuf_level;
4378extern Lisp_Object get_minibuffer (EMACS_INT); 4378extern Lisp_Object get_minibuffer (EMACS_INT);
4379extern void init_minibuf_once (void); 4379extern void init_minibuf_once (void);
4380extern void set_initial_minibuffer_mode (void);
4380extern void syms_of_minibuf (void); 4381extern void syms_of_minibuf (void);
4381extern void barf_if_interaction_inhibited (void); 4382extern void barf_if_interaction_inhibited (void);
4382 4383
diff --git a/src/lread.c b/src/lread.c
index e53e1f65ab9..bca53a9a37a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1700,7 +1700,7 @@ maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd,
1700 return; 1700 return;
1701 1701
1702 /* Search eln in the eln-cache directories. */ 1702 /* Search eln in the eln-cache directories. */
1703 Lisp_Object eln_path_tail = Vcomp_eln_load_path; 1703 Lisp_Object eln_path_tail = Vnative_comp_eln_load_path;
1704 Lisp_Object src_name = 1704 Lisp_Object src_name =
1705 Fsubstring (*filename, Qnil, make_fixnum (-1)); 1705 Fsubstring (*filename, Qnil, make_fixnum (-1));
1706 if (NILP (Ffile_exists_p (src_name))) 1706 if (NILP (Ffile_exists_p (src_name)))
@@ -1708,7 +1708,8 @@ maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd,
1708 src_name = concat2 (src_name, build_string (".gz")); 1708 src_name = concat2 (src_name, build_string (".gz"));
1709 if (NILP (Ffile_exists_p (src_name))) 1709 if (NILP (Ffile_exists_p (src_name)))
1710 { 1710 {
1711 if (!NILP (find_symbol_value (Qcomp_warning_on_missing_source))) 1711 if (!NILP (find_symbol_value (
1712 Qnative_comp_warning_on_missing_source)))
1712 call2 (intern_c_string ("display-warning"), 1713 call2 (intern_c_string ("display-warning"),
1713 Qcomp, 1714 Qcomp,
1714 CALLN (Fformat, 1715 CALLN (Fformat,
@@ -1944,7 +1945,17 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes,
1944 } 1945 }
1945 else 1946 else
1946 { 1947 {
1947 fd = emacs_open (pfn, O_RDONLY, 0); 1948 /* In some systems (like Windows) finding out if a
1949 file exists is cheaper to do than actually opening
1950 it. Only open the file when we are sure that it
1951 exists. */
1952#ifdef WINDOWSNT
1953 if (faccessat (AT_FDCWD, pfn, R_OK, AT_EACCESS))
1954 fd = -1;
1955 else
1956#endif
1957 fd = emacs_open (pfn, O_RDONLY, 0);
1958
1948 if (fd < 0) 1959 if (fd < 0)
1949 { 1960 {
1950 if (! (errno == ENOENT || errno == ENOTDIR)) 1961 if (! (errno == ENOENT || errno == ENOTDIR))
diff --git a/src/minibuf.c b/src/minibuf.c
index bc7d4393985..cffb7fe787c 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -157,16 +157,15 @@ zip_minibuffer_stacks (Lisp_Object dest_window, Lisp_Object source_window)
157 Fset_window_start (dest_window, Fwindow_start (source_window), Qnil); 157 Fset_window_start (dest_window, Fwindow_start (source_window), Qnil);
158 Fset_window_point (dest_window, Fwindow_point (source_window)); 158 Fset_window_point (dest_window, Fwindow_point (source_window));
159 dw->prev_buffers = sw->prev_buffers; 159 dw->prev_buffers = sw->prev_buffers;
160 set_window_buffer (source_window, get_minibuffer (0), 0, 0); 160 set_window_buffer (source_window, nth_minibuffer (0), 0, 0);
161 sw->prev_buffers = Qnil; 161 sw->prev_buffers = Qnil;
162 return; 162 return;
163 } 163 }
164 164
165 if (live_minibuffer_p (dw->contents)) 165 if (live_minibuffer_p (dw->contents))
166 call1 (Qrecord_window_buffer, dest_window); 166 call1 (Qpush_window_buffer_onto_prev, dest_window);
167 if (live_minibuffer_p (sw->contents)) 167 if (live_minibuffer_p (sw->contents))
168 call1 (Qrecord_window_buffer, source_window); 168 call1 (Qpush_window_buffer_onto_prev, source_window);
169
170 acc = merge_c (dw->prev_buffers, sw->prev_buffers, minibuffer_ent_greater); 169 acc = merge_c (dw->prev_buffers, sw->prev_buffers, minibuffer_ent_greater);
171 170
172 if (!NILP (acc)) 171 if (!NILP (acc))
@@ -179,7 +178,7 @@ zip_minibuffer_stacks (Lisp_Object dest_window, Lisp_Object source_window)
179 } 178 }
180 dw->prev_buffers = acc; 179 dw->prev_buffers = acc;
181 sw->prev_buffers = Qnil; 180 sw->prev_buffers = Qnil;
182 set_window_buffer (source_window, get_minibuffer (0), 0, 0); 181 set_window_buffer (source_window, nth_minibuffer (0), 0, 0);
183} 182}
184 183
185/* If `minibuffer_follows_selected_frame' is t, or we're about to 184/* If `minibuffer_follows_selected_frame' is t, or we're about to
@@ -204,6 +203,14 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion)
204 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window); 203 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window);
205 if (for_deletion && XFRAME (MB_frame) != of) 204 if (for_deletion && XFRAME (MB_frame) != of)
206 MB_frame = selected_frame; 205 MB_frame = selected_frame;
206 if (!for_deletion
207 && MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of))))
208 {
209 Lisp_Object old_frame;
210 XSETFRAME (old_frame, of);
211 Fset_frame_selected_window (old_frame,
212 Fframe_first_window (old_frame), Qnil);
213 }
207 } 214 }
208} 215}
209 216
@@ -220,6 +227,8 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
220 return Qnil; 227 return Qnil;
221 228
222 innermost_MB = nth_minibuffer (minibuf_level); 229 innermost_MB = nth_minibuffer (minibuf_level);
230 if (NILP (innermost_MB))
231 emacs_abort ();
223 FOR_EACH_FRAME (frames, frame) 232 FOR_EACH_FRAME (frames, frame)
224 { 233 {
225 f = XFRAME (frame); 234 f = XFRAME (frame);
@@ -644,7 +653,12 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
644 return unbind_to (count, val); 653 return unbind_to (count, val);
645 } 654 }
646 655
647 minibuf_level++; /* Before calling choose_minibuf_frame. */ 656 /* Ensure now that the latest minibuffer has been created and pushed
657 onto Vminibuffer_list before incrementing minibuf_level, in case
658 a hook called during the minibuffer creation calls
659 Factive_minibuffer_window. */
660 minibuffer = get_minibuffer (minibuf_level + 1);
661 minibuf_level++; /* Before calling choose_minibuf_frame. */
648 662
649 /* Choose the minibuffer window and frame, and take action on them. */ 663 /* Choose the minibuffer window and frame, and take action on them. */
650 664
@@ -672,7 +686,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
672 } 686 }
673 MB_frame = XWINDOW (XFRAME (selected_frame)->minibuffer_window)->frame; 687 MB_frame = XWINDOW (XFRAME (selected_frame)->minibuffer_window)->frame;
674 if (live_minibuffer_p (XWINDOW (minibuf_window)->contents)) 688 if (live_minibuffer_p (XWINDOW (minibuf_window)->contents))
675 call1 (Qrecord_window_buffer, minibuf_window); 689 call1 (Qpush_window_buffer_onto_prev, minibuf_window);
676 690
677 record_unwind_protect_void (minibuffer_unwind); 691 record_unwind_protect_void (minibuffer_unwind);
678 record_unwind_protect (restore_window_configuration, 692 record_unwind_protect (restore_window_configuration,
@@ -758,7 +772,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
758 772
759 /* Switch to the minibuffer. */ 773 /* Switch to the minibuffer. */
760 774
761 minibuffer = get_minibuffer (minibuf_level);
762 set_minibuffer_mode (minibuffer, minibuf_level); 775 set_minibuffer_mode (minibuffer, minibuf_level);
763 Fset_buffer (minibuffer); 776 Fset_buffer (minibuffer);
764 777
@@ -799,7 +812,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
799 /* Empty out the minibuffers of all frames, except those frames 812 /* Empty out the minibuffers of all frames, except those frames
800 where there is an active minibuffer. 813 where there is an active minibuffer.
801 Set them to point to ` *Minibuf-0*', which is always empty. */ 814 Set them to point to ` *Minibuf-0*', which is always empty. */
802 empty_minibuf = get_minibuffer (0); 815 empty_minibuf = nth_minibuffer (0);
803 set_minibuffer_mode (empty_minibuf, 0); 816 set_minibuffer_mode (empty_minibuf, 0);
804 817
805 /* Display this minibuffer in the proper window. */ 818 /* Display this minibuffer in the proper window. */
@@ -961,7 +974,7 @@ static Lisp_Object
961nth_minibuffer (EMACS_INT depth) 974nth_minibuffer (EMACS_INT depth)
962{ 975{
963 Lisp_Object tail = Fnthcdr (make_fixnum (depth), Vminibuffer_list); 976 Lisp_Object tail = Fnthcdr (make_fixnum (depth), Vminibuffer_list);
964 return XCAR (tail); 977 return Fcar (tail);
965} 978}
966 979
967/* Set the major mode of the minibuffer BUF, depending on DEPTH, the 980/* Set the major mode of the minibuffer BUF, depending on DEPTH, the
@@ -1066,9 +1079,13 @@ read_minibuf_unwind (void)
1066 Lisp_Object future_mini_window; 1079 Lisp_Object future_mini_window;
1067 Lisp_Object saved_selected_frame = selected_frame; 1080 Lisp_Object saved_selected_frame = selected_frame;
1068 Lisp_Object window, frames; 1081 Lisp_Object window, frames;
1082 Lisp_Object expired_MB = nth_minibuffer (minibuf_level);
1069 struct window *w; 1083 struct window *w;
1070 struct frame *f; 1084 struct frame *f;
1071 1085
1086 if (NILP (expired_MB))
1087 emacs_abort ();
1088
1072 /* Locate the expired minibuffer. */ 1089 /* Locate the expired minibuffer. */
1073 FOR_EACH_FRAME (frames, exp_MB_frame) 1090 FOR_EACH_FRAME (frames, exp_MB_frame)
1074 { 1091 {
@@ -1078,7 +1095,7 @@ read_minibuf_unwind (void)
1078 { 1095 {
1079 w = XWINDOW (window); 1096 w = XWINDOW (window);
1080 if (EQ (w->frame, exp_MB_frame) 1097 if (EQ (w->frame, exp_MB_frame)
1081 && EQ (w->contents, nth_minibuffer (minibuf_level))) 1098 && EQ (w->contents, expired_MB))
1082 goto found; 1099 goto found;
1083 } 1100 }
1084 } 1101 }
@@ -1094,7 +1111,7 @@ read_minibuf_unwind (void)
1094 minibuffer when we reset the relevant variables. Don't depend on 1111 minibuffer when we reset the relevant variables. Don't depend on
1095 `minibuf_window' here. This could by now be the mini-window of any 1112 `minibuf_window' here. This could by now be the mini-window of any
1096 frame. */ 1113 frame. */
1097 Fset_buffer (nth_minibuffer (minibuf_level)); 1114 Fset_buffer (expired_MB);
1098 minibuf_level--; 1115 minibuf_level--;
1099 1116
1100 /* Restore prompt, etc, from outer minibuffer level. */ 1117 /* Restore prompt, etc, from outer minibuffer level. */
@@ -2254,6 +2271,13 @@ If no minibuffer is active, return nil. */)
2254 2271
2255 2272
2256 2273
2274void
2275set_initial_minibuffer_mode (void)
2276{
2277 Lisp_Object minibuf = get_minibuffer (0);
2278 set_minibuffer_mode (minibuf, 0);
2279}
2280
2257static void init_minibuf_once_for_pdumper (void); 2281static void init_minibuf_once_for_pdumper (void);
2258 2282
2259void 2283void
@@ -2262,6 +2286,8 @@ init_minibuf_once (void)
2262 staticpro (&Vminibuffer_list); 2286 staticpro (&Vminibuffer_list);
2263 staticpro (&Vcommand_loop_level_list); 2287 staticpro (&Vcommand_loop_level_list);
2264 pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper); 2288 pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper);
2289 /* Ensure our inactive minibuffer exists. */
2290 get_minibuffer (0);
2265} 2291}
2266 2292
2267static void 2293static void
@@ -2327,6 +2353,7 @@ syms_of_minibuf (void)
2327 DEFSYM (Qminibuffer_completing_file_name, "minibuffer-completing-file-name"); 2353 DEFSYM (Qminibuffer_completing_file_name, "minibuffer-completing-file-name");
2328 DEFSYM (Qselect_frame_set_input_focus, "select-frame-set-input-focus"); 2354 DEFSYM (Qselect_frame_set_input_focus, "select-frame-set-input-focus");
2329 DEFSYM (Qadd_to_history, "add-to-history"); 2355 DEFSYM (Qadd_to_history, "add-to-history");
2356 DEFSYM (Qpush_window_buffer_onto_prev, "push-window-buffer-onto-prev");
2330 2357
2331 DEFVAR_LISP ("read-expression-history", Vread_expression_history, 2358 DEFVAR_LISP ("read-expression-history", Vread_expression_history,
2332 doc: /* A history list for arguments that are Lisp expressions to evaluate. 2359 doc: /* A history list for arguments that are Lisp expressions to evaluate.
diff --git a/src/nsfns.m b/src/nsfns.m
index 1f281f75fd4..d14f7b51eaf 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1404,6 +1404,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1404 else 1404 else
1405 { 1405 {
1406 /* Must have been Qnil. */ 1406 /* Must have been Qnil. */
1407 f->was_invisible = true;
1407 } 1408 }
1408 } 1409 }
1409 1410
diff --git a/src/process.c b/src/process.c
index 98a6dca8692..f3f4f09f740 100644
--- a/src/process.c
+++ b/src/process.c
@@ -473,8 +473,15 @@ add_read_fd (int fd, fd_callback func, void *data)
473 fd_callback_info[fd].data = data; 473 fd_callback_info[fd].data = data;
474} 474}
475 475
476void
477add_non_keyboard_read_fd (int fd, fd_callback func, void *data)
478{
479 add_read_fd(fd, func, data);
480 fd_callback_info[fd].flags &= ~KEYBOARD_FD;
481}
482
476static void 483static void
477add_non_keyboard_read_fd (int fd) 484add_process_read_fd (int fd)
478{ 485{
479 eassert (fd >= 0 && fd < FD_SETSIZE); 486 eassert (fd >= 0 && fd < FD_SETSIZE);
480 eassert (fd_callback_info[fd].func == NULL); 487 eassert (fd_callback_info[fd].func == NULL);
@@ -483,12 +490,6 @@ add_non_keyboard_read_fd (int fd)
483 fd_callback_info[fd].flags |= FOR_READ; 490 fd_callback_info[fd].flags |= FOR_READ;
484 if (fd > max_desc) 491 if (fd > max_desc)
485 max_desc = fd; 492 max_desc = fd;
486}
487
488static void
489add_process_read_fd (int fd)
490{
491 add_non_keyboard_read_fd (fd);
492 eassert (0 <= fd && fd < FD_SETSIZE); 493 eassert (0 <= fd && fd < FD_SETSIZE);
493 fd_callback_info[fd].flags |= PROCESS_FD; 494 fd_callback_info[fd].flags |= PROCESS_FD;
494} 495}
diff --git a/src/process.h b/src/process.h
index d041ada5867..0890f253a40 100644
--- a/src/process.h
+++ b/src/process.h
@@ -284,6 +284,7 @@ extern bool kbd_on_hold_p (void);
284typedef void (*fd_callback) (int fd, void *data); 284typedef void (*fd_callback) (int fd, void *data);
285 285
286extern void add_read_fd (int fd, fd_callback func, void *data); 286extern void add_read_fd (int fd, fd_callback func, void *data);
287extern void add_non_keyboard_read_fd (int fd, fd_callback func, void *data);
287extern void delete_read_fd (int fd); 288extern void delete_read_fd (int fd);
288extern void add_write_fd (int fd, fd_callback func, void *data); 289extern void add_write_fd (int fd, fd_callback func, void *data);
289extern void delete_write_fd (int fd); 290extern void delete_write_fd (int fd);
diff --git a/src/search.c b/src/search.c
index c757bf3d1f2..df384e1dcff 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2723,7 +2723,6 @@ since only regular expressions have distinguished subexpressions. */)
2723 } 2723 }
2724 2724
2725 newpoint = sub_start + SCHARS (newtext); 2725 newpoint = sub_start + SCHARS (newtext);
2726 ptrdiff_t newstart = sub_start == sub_end ? newpoint : sub_start;
2727 2726
2728 /* Replace the old text with the new in the cleanest possible way. */ 2727 /* Replace the old text with the new in the cleanest possible way. */
2729 replace_range (sub_start, sub_end, newtext, 1, 0, 1, true); 2728 replace_range (sub_start, sub_end, newtext, 1, 0, 1, true);
@@ -2739,11 +2738,11 @@ since only regular expressions have distinguished subexpressions. */)
2739 /* The replace_range etc. functions can trigger modification hooks 2738 /* The replace_range etc. functions can trigger modification hooks
2740 (see signal_before_change and signal_after_change). Try to error 2739 (see signal_before_change and signal_after_change). Try to error
2741 out if these hooks clobber the match data since clobbering can 2740 out if these hooks clobber the match data since clobbering can
2742 result in confusing bugs. Although this sanity check does not 2741 result in confusing bugs. We used to check for changes in
2743 catch all possible clobberings, it should catch many of them. */ 2742 search_regs start and end, but that fails if modification hooks
2744 if (! (search_regs.num_regs == num_regs 2743 remove or add text earlier in the buffer, so just check num_regs
2745 && search_regs.start[sub] == newstart 2744 now. */
2746 && search_regs.end[sub] == newpoint)) 2745 if (search_regs.num_regs != num_regs)
2747 error ("Match data clobbered by buffer modification hooks"); 2746 error ("Match data clobbered by buffer modification hooks");
2748 2747
2749 /* Put point back where it was in the text, if possible. */ 2748 /* Put point back where it was in the text, if possible. */
diff --git a/src/w32.c b/src/w32.c
index 467e6cb4271..26cc28f877c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4747,7 +4747,7 @@ sys_rename_replace (const char *oldname, const char *newname, BOOL force)
4747 /* volume_info is set indirectly by map_w32_filename. */ 4747 /* volume_info is set indirectly by map_w32_filename. */
4748 oldname_dev = volume_info.serialnum; 4748 oldname_dev = volume_info.serialnum;
4749 4749
4750 if (os_subtype == OS_9X) 4750 if (os_subtype == OS_SUBTYPE_9X)
4751 { 4751 {
4752 char * o; 4752 char * o;
4753 char * p; 4753 char * p;
@@ -10468,7 +10468,7 @@ shutdown_handler (DWORD type)
10468HANDLE 10468HANDLE
10469maybe_load_unicows_dll (void) 10469maybe_load_unicows_dll (void)
10470{ 10470{
10471 if (os_subtype == OS_9X) 10471 if (os_subtype == OS_SUBTYPE_9X)
10472 { 10472 {
10473 HANDLE ret = LoadLibrary ("Unicows.dll"); 10473 HANDLE ret = LoadLibrary ("Unicows.dll");
10474 if (ret) 10474 if (ret)
diff --git a/src/w32common.h b/src/w32common.h
index cbe05c5d8d1..6493b9c88d5 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -41,8 +41,8 @@ extern int w32_minor_version;
41extern int w32_build_number; 41extern int w32_build_number;
42 42
43enum { 43enum {
44 OS_9X = 1, 44 OS_SUBTYPE_9X = 1,
45 OS_NT 45 OS_SUBTYPE_NT
46}; 46};
47 47
48extern int os_subtype; 48extern int os_subtype;
diff --git a/src/w32console.c b/src/w32console.c
index cb9e288e880..99546c2d754 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -803,7 +803,7 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
803 ceol_initialized = FALSE; 803 ceol_initialized = FALSE;
804 } 804 }
805 805
806 if (os_subtype == OS_NT) 806 if (os_subtype == OS_SUBTYPE_NT)
807 w32_console_unicode_input = 1; 807 w32_console_unicode_input = 1;
808 else 808 else
809 w32_console_unicode_input = 0; 809 w32_console_unicode_input = 0;
diff --git a/src/w32fns.c b/src/w32fns.c
index 66baeaecbdb..14d1154a2bc 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -6107,6 +6107,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
6107 6107
6108 if (!NILP (visibility)) 6108 if (!NILP (visibility))
6109 w32_make_frame_visible (f); 6109 w32_make_frame_visible (f);
6110 else
6111 f->was_invisible = true;
6110 } 6112 }
6111 6113
6112 store_frame_param (f, Qvisibility, visibility); 6114 store_frame_param (f, Qvisibility, visibility);
@@ -7991,7 +7993,7 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
7991 7993
7992 /* The Unicode version of SHFileOperation is not supported on 7994 /* The Unicode version of SHFileOperation is not supported on
7993 Windows 9X. */ 7995 Windows 9X. */
7994 if (w32_unicode_filenames && os_subtype != OS_9X) 7996 if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
7995 { 7997 {
7996 SHFILEOPSTRUCTW file_op_w; 7998 SHFILEOPSTRUCTW file_op_w;
7997 /* We need one more element beyond MAX_PATH because this is 7999 /* We need one more element beyond MAX_PATH because this is
@@ -9120,7 +9122,7 @@ The coordinates X and Y are interpreted in pixels relative to a position
9120 /* When "mouse trails" are in effect, moving the mouse cursor 9122 /* When "mouse trails" are in effect, moving the mouse cursor
9121 sometimes leaves behind an annoying "ghost" of the pointer. 9123 sometimes leaves behind an annoying "ghost" of the pointer.
9122 Avoid that by momentarily switching off mouse trails. */ 9124 Avoid that by momentarily switching off mouse trails. */
9123 if (os_subtype == OS_NT 9125 if (os_subtype == OS_SUBTYPE_NT
9124 && w32_major_version + w32_minor_version >= 6) 9126 && w32_major_version + w32_minor_version >= 6)
9125 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); 9127 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
9126 SetCursorPos (xval, yval); 9128 SetCursorPos (xval, yval);
@@ -9295,7 +9297,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
9295 if (!OpenPrinter (pname_buf, &hPrn, NULL)) 9297 if (!OpenPrinter (pname_buf, &hPrn, NULL))
9296 return Qnil; 9298 return Qnil;
9297 /* GetPrinterW is not supported by unicows.dll. */ 9299 /* GetPrinterW is not supported by unicows.dll. */
9298 if (w32_unicode_filenames && os_subtype != OS_9X) 9300 if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
9299 GetPrinterW (hPrn, 2, NULL, 0, &dwNeeded); 9301 GetPrinterW (hPrn, 2, NULL, 0, &dwNeeded);
9300 else 9302 else
9301 GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded); 9303 GetPrinterA (hPrn, 2, NULL, 0, &dwNeeded);
@@ -9305,7 +9307,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
9305 return Qnil; 9307 return Qnil;
9306 } 9308 }
9307 /* Call GetPrinter again with big enough memory block. */ 9309 /* Call GetPrinter again with big enough memory block. */
9308 if (w32_unicode_filenames && os_subtype != OS_9X) 9310 if (w32_unicode_filenames && os_subtype != OS_SUBTYPE_9X)
9309 { 9311 {
9310 /* Allocate memory for the PRINTER_INFO_2 struct. */ 9312 /* Allocate memory for the PRINTER_INFO_2 struct. */
9311 ppi2w = xmalloc (dwNeeded); 9313 ppi2w = xmalloc (dwNeeded);
@@ -9441,9 +9443,9 @@ cache_system_info (void)
9441 w32_minor_version = version.info.minor; 9443 w32_minor_version = version.info.minor;
9442 9444
9443 if (version.info.platform & 0x8000) 9445 if (version.info.platform & 0x8000)
9444 os_subtype = OS_9X; 9446 os_subtype = OS_SUBTYPE_9X;
9445 else 9447 else
9446 os_subtype = OS_NT; 9448 os_subtype = OS_SUBTYPE_NT;
9447 9449
9448 /* Cache page size, allocation unit, processor type, etc. */ 9450 /* Cache page size, allocation unit, processor type, etc. */
9449 GetSystemInfo (&sysinfo_cache); 9451 GetSystemInfo (&sysinfo_cache);
@@ -9454,7 +9456,7 @@ cache_system_info (void)
9454 GetVersionEx (&osinfo_cache); 9456 GetVersionEx (&osinfo_cache);
9455 9457
9456 w32_build_number = osinfo_cache.dwBuildNumber; 9458 w32_build_number = osinfo_cache.dwBuildNumber;
9457 if (os_subtype == OS_9X) 9459 if (os_subtype == OS_SUBTYPE_9X)
9458 w32_build_number &= 0xffff; 9460 w32_build_number &= 0xffff;
9459 9461
9460 w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS); 9462 w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
@@ -9633,7 +9635,7 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId)
9633 9635
9634 /* On NT, call ToUnicode instead and then convert to the current 9636 /* On NT, call ToUnicode instead and then convert to the current
9635 console input codepage. */ 9637 console input codepage. */
9636 if (os_subtype == OS_NT) 9638 if (os_subtype == OS_SUBTYPE_NT)
9637 { 9639 {
9638 WCHAR buf[128]; 9640 WCHAR buf[128];
9639 9641
@@ -11047,7 +11049,7 @@ see `w32-ansi-code-page'. */);
11047 w32_multibyte_code_page = _getmbcp (); 11049 w32_multibyte_code_page = _getmbcp ();
11048#endif 11050#endif
11049 11051
11050 if (os_subtype == OS_NT) 11052 if (os_subtype == OS_SUBTYPE_NT)
11051 w32_unicode_gui = 1; 11053 w32_unicode_gui = 1;
11052 else 11054 else
11053 w32_unicode_gui = 0; 11055 w32_unicode_gui = 0;
diff --git a/src/w32heap.c b/src/w32heap.c
index e002f72608a..0f228bfb221 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -269,7 +269,7 @@ init_heap (bool use_dynamic_heap)
269 } 269 }
270#endif 270#endif
271 271
272 if (os_subtype == OS_9X) 272 if (os_subtype == OS_SUBTYPE_9X)
273 { 273 {
274 the_malloc_fn = malloc_after_dump_9x; 274 the_malloc_fn = malloc_after_dump_9x;
275 the_realloc_fn = realloc_after_dump_9x; 275 the_realloc_fn = realloc_after_dump_9x;
@@ -312,7 +312,7 @@ init_heap (bool use_dynamic_heap)
312 } 312 }
313 heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params); 313 heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params);
314 314
315 if (os_subtype == OS_9X) 315 if (os_subtype == OS_SUBTYPE_9X)
316 { 316 {
317 fprintf (stderr, "Cannot dump Emacs on Windows 9X; exiting.\n"); 317 fprintf (stderr, "Cannot dump Emacs on Windows 9X; exiting.\n");
318 exit (-1); 318 exit (-1);
diff --git a/src/w32notify.c b/src/w32notify.c
index b9e90633923..889fd9f3c9f 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -566,7 +566,7 @@ generate notifications correctly, though. */)
566 CHECK_LIST (filter); 566 CHECK_LIST (filter);
567 567
568 /* The underlying features are available only since XP. */ 568 /* The underlying features are available only since XP. */
569 if (os_subtype == OS_9X 569 if (os_subtype == OS_SUBTYPE_9X
570 || (w32_major_version == 5 && w32_minor_version < 1)) 570 || (w32_major_version == 5 && w32_minor_version < 1))
571 { 571 {
572 errno = ENOSYS; 572 errno = ENOSYS;
diff --git a/src/w32proc.c b/src/w32proc.c
index ffa56e135d0..702ea122e65 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -623,7 +623,7 @@ init_timers (void)
623 need to probe for its availability dynamically, and call it 623 need to probe for its availability dynamically, and call it
624 through a pointer. */ 624 through a pointer. */
625 s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */ 625 s_pfn_Get_Thread_Times = NULL; /* in case dumped Emacs comes with a value */
626 if (os_subtype != OS_9X) 626 if (os_subtype != OS_SUBTYPE_9X)
627 s_pfn_Get_Thread_Times = (GetThreadTimes_Proc) 627 s_pfn_Get_Thread_Times = (GetThreadTimes_Proc)
628 get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes"); 628 get_proc_addr (GetModuleHandle ("kernel32.dll"), "GetThreadTimes");
629 629
@@ -2654,7 +2654,7 @@ find_child_console (HWND hwnd, LPARAM arg)
2654 2654
2655 GetClassName (hwnd, window_class, sizeof (window_class)); 2655 GetClassName (hwnd, window_class, sizeof (window_class));
2656 if (strcmp (window_class, 2656 if (strcmp (window_class,
2657 (os_subtype == OS_9X) 2657 (os_subtype == OS_SUBTYPE_9X)
2658 ? "tty" 2658 ? "tty"
2659 : "ConsoleWindowClass") == 0) 2659 : "ConsoleWindowClass") == 0)
2660 { 2660 {
@@ -2878,7 +2878,7 @@ sys_kill (pid_t pid, int sig)
2878 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) 2878 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
2879 { 2879 {
2880#if 1 2880#if 1
2881 if (os_subtype == OS_9X) 2881 if (os_subtype == OS_SUBTYPE_9X)
2882 { 2882 {
2883/* 2883/*
2884 Another possibility is to try terminating the VDM out-right by 2884 Another possibility is to try terminating the VDM out-right by
@@ -3793,7 +3793,7 @@ w32_compare_strings (const char *s1, const char *s2, char *locname,
3793 3793
3794 if (!g_b_init_compare_string_w) 3794 if (!g_b_init_compare_string_w)
3795 { 3795 {
3796 if (os_subtype == OS_9X) 3796 if (os_subtype == OS_SUBTYPE_9X)
3797 { 3797 {
3798 pCompareStringW = (CompareStringW_Proc) 3798 pCompareStringW = (CompareStringW_Proc)
3799 get_proc_addr (LoadLibrary ("Unicows.dll"), 3799 get_proc_addr (LoadLibrary ("Unicows.dll"),
diff --git a/src/w32select.c b/src/w32select.c
index 85f8e5556a2..f19b85a2aec 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1207,7 +1207,7 @@ globals_of_w32select (void)
1207 QANSICP = coding_from_cp (ANSICP); 1207 QANSICP = coding_from_cp (ANSICP);
1208 QOEMCP = coding_from_cp (OEMCP); 1208 QOEMCP = coding_from_cp (OEMCP);
1209 1209
1210 if (os_subtype == OS_NT) 1210 if (os_subtype == OS_SUBTYPE_NT)
1211 Vselection_coding_system = Qutf_16le_dos; 1211 Vselection_coding_system = Qutf_16le_dos;
1212 else if (inhibit_window_system) 1212 else if (inhibit_window_system)
1213 Vselection_coding_system = QOEMCP; 1213 Vselection_coding_system = QOEMCP;
diff --git a/src/w32term.c b/src/w32term.c
index 4f910296ecc..ad4d1a32829 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1916,7 +1916,7 @@ w32_draw_image_foreground (struct glyph_string *s)
1916 /* HALFTONE produces better results, especially when 1916 /* HALFTONE produces better results, especially when
1917 scaling to a larger size, but Windows 9X doesn't 1917 scaling to a larger size, but Windows 9X doesn't
1918 support HALFTONE. */ 1918 support HALFTONE. */
1919 if (os_subtype == OS_NT 1919 if (os_subtype == OS_SUBTYPE_NT
1920 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) 1920 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
1921 SetBrushOrgEx (s->hdc, 0, 0, NULL); 1921 SetBrushOrgEx (s->hdc, 0, 0, NULL);
1922 StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, 1922 StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
@@ -1952,7 +1952,7 @@ w32_draw_image_foreground (struct glyph_string *s)
1952 { 1952 {
1953 int pmode = 0; 1953 int pmode = 0;
1954 /* Windows 9X doesn't support HALFTONE. */ 1954 /* Windows 9X doesn't support HALFTONE. */
1955 if (os_subtype == OS_NT 1955 if (os_subtype == OS_SUBTYPE_NT
1956 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) 1956 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
1957 SetBrushOrgEx (s->hdc, 0, 0, NULL); 1957 SetBrushOrgEx (s->hdc, 0, 0, NULL);
1958 StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, 1958 StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
@@ -6644,7 +6644,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
6644 /* When "mouse trails" are in effect, moving the mouse cursor 6644 /* When "mouse trails" are in effect, moving the mouse cursor
6645 sometimes leaves behind an annoying "ghost" of the pointer. 6645 sometimes leaves behind an annoying "ghost" of the pointer.
6646 Avoid that by momentarily switching off mouse trails. */ 6646 Avoid that by momentarily switching off mouse trails. */
6647 if (os_subtype == OS_NT 6647 if (os_subtype == OS_SUBTYPE_NT
6648 && w32_major_version + w32_minor_version >= 6) 6648 && w32_major_version + w32_minor_version >= 6)
6649 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); 6649 ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0);
6650 SetCursorPos (pt.x, pt.y); 6650 SetCursorPos (pt.x, pt.y);
@@ -7638,7 +7638,7 @@ specified by `file-name-coding-system'.
7638This variable is set to non-nil by default when Emacs runs on Windows 7638This variable is set to non-nil by default when Emacs runs on Windows
7639systems of the NT family, including W2K, XP, Vista, Windows 7 and 7639systems of the NT family, including W2K, XP, Vista, Windows 7 and
7640Windows 8. It is set to nil on Windows 9X. */); 7640Windows 8. It is set to nil on Windows 9X. */);
7641 if (os_subtype == OS_9X) 7641 if (os_subtype == OS_SUBTYPE_9X)
7642 w32_unicode_filenames = 0; 7642 w32_unicode_filenames = 0;
7643 else 7643 else
7644 w32_unicode_filenames = 1; 7644 w32_unicode_filenames = 1;
diff --git a/src/w32term.h b/src/w32term.h
index 7d351df871d..160be357821 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -761,7 +761,7 @@ extern bool w32_image_rotations_p (void);
761extern void setup_w32_kbdhook (void); 761extern void setup_w32_kbdhook (void);
762extern void remove_w32_kbdhook (void); 762extern void remove_w32_kbdhook (void);
763extern int check_w32_winkey_state (int); 763extern int check_w32_winkey_state (int);
764#define w32_kbdhook_active (os_subtype != OS_9X) 764#define w32_kbdhook_active (os_subtype != OS_SUBTYPE_9X)
765#else 765#else
766#define w32_kbdhook_active 0 766#define w32_kbdhook_active 0
767#endif 767#endif
diff --git a/src/window.c b/src/window.c
index 0a14eca58fb..9961c54161d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7264,8 +7264,8 @@ restore_window_configuration (Lisp_Object configuration)
7264{ 7264{
7265 if (CONSP (configuration)) 7265 if (CONSP (configuration))
7266 Fset_window_configuration (XCAR (configuration), 7266 Fset_window_configuration (XCAR (configuration),
7267 XCAR (XCDR (configuration)), 7267 Fcar_safe (XCDR (configuration)),
7268 XCAR (XCDR (XCDR (configuration)))); 7268 Fcar_safe (Fcdr_safe (XCDR (configuration))));
7269 else 7269 else
7270 Fset_window_configuration (configuration, Qnil, Qnil); 7270 Fset_window_configuration (configuration, Qnil, Qnil);
7271} 7271}
diff --git a/src/xdisp.c b/src/xdisp.c
index eea3f81dfa9..74fa0a57e44 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10838,6 +10838,47 @@ include the height of both, if present, in the return value. */)
10838 10838
10839 return Fcons (make_fixnum (x - start_x), make_fixnum (y)); 10839 return Fcons (make_fixnum (x - start_x), make_fixnum (y));
10840} 10840}
10841
10842DEFUN ("display--line-is-continued-p", Fdisplay__line_is_continued_p,
10843 Sdisplay__line_is_continued_p, 0, 0, 0,
10844 doc: /* Return non-nil if the current screen line is continued on display. */)
10845 (void)
10846{
10847 struct buffer *oldb = current_buffer;
10848 struct window *w = XWINDOW (selected_window);
10849 enum move_it_result rc = MOVE_POS_MATCH_OR_ZV;
10850
10851 set_buffer_internal_1 (XBUFFER (w->contents));
10852
10853 if (PT < ZV)
10854 {
10855 struct text_pos startpos;
10856 struct it it;
10857 void *itdata;
10858 /* Use a marker, since vertical-motion enters redisplay, which can
10859 trigger fontifications, which in turn could modify buffer text. */
10860 Lisp_Object opoint = Fpoint_marker ();
10861
10862 /* Make sure to start from the beginning of the current screen
10863 line, so that move_it_in_display_line_to counts pixels correctly. */
10864 Fvertical_motion (make_fixnum (0), selected_window, Qnil);
10865 SET_TEXT_POS (startpos, PT, PT_BYTE);
10866 itdata = bidi_shelve_cache ();
10867 start_display (&it, w, startpos);
10868 /* If lines are truncated, no line is continued. */
10869 if (it.line_wrap != TRUNCATE)
10870 {
10871 it.glyph_row = NULL;
10872 rc = move_it_in_display_line_to (&it, ZV, -1, MOVE_TO_POS);
10873 }
10874 SET_PT_BOTH (marker_position (opoint), marker_byte_position (opoint));
10875 bidi_unshelve_cache (itdata, false);
10876 }
10877 set_buffer_internal_1 (oldb);
10878
10879 return rc == MOVE_LINE_CONTINUED ? Qt : Qnil;
10880}
10881
10841 10882
10842/*********************************************************************** 10883/***********************************************************************
10843 Messages 10884 Messages
@@ -34754,6 +34795,7 @@ be let-bound around code that needs to disable messages temporarily. */);
34754 defsubr (&Swindow_text_pixel_size); 34795 defsubr (&Swindow_text_pixel_size);
34755 defsubr (&Smove_point_visually); 34796 defsubr (&Smove_point_visually);
34756 defsubr (&Sbidi_find_overridden_directionality); 34797 defsubr (&Sbidi_find_overridden_directionality);
34798 defsubr (&Sdisplay__line_is_continued_p);
34757 34799
34758 DEFSYM (Qmenu_bar_update_hook, "menu-bar-update-hook"); 34800 DEFSYM (Qmenu_bar_update_hook, "menu-bar-update-hook");
34759 DEFSYM (Qoverriding_terminal_local_map, "overriding-terminal-local-map"); 34801 DEFSYM (Qoverriding_terminal_local_map, "overriding-terminal-local-map");
diff --git a/src/xfns.c b/src/xfns.c
index 782e0a483c4..e46616e6d66 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4127,12 +4127,21 @@ This function is an internal primitive--use `make-frame' instead. */)
4127 cannot control visibility, so don't try. */ 4127 cannot control visibility, so don't try. */
4128 if (!f->output_data.x->explicit_parent) 4128 if (!f->output_data.x->explicit_parent)
4129 { 4129 {
4130 /* When called from `x-create-frame-with-faces' visibility is
4131 always explicitly nil. */
4130 Lisp_Object visibility 4132 Lisp_Object visibility
4131 = gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0, 4133 = gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0,
4132 RES_TYPE_SYMBOL); 4134 RES_TYPE_SYMBOL);
4135 Lisp_Object height
4136 = gui_display_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER);
4137 Lisp_Object width
4138 = gui_display_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER);
4133 4139
4134 if (EQ (visibility, Qicon)) 4140 if (EQ (visibility, Qicon))
4135 x_iconify_frame (f); 4141 {
4142 f->was_invisible = true;
4143 x_iconify_frame (f);
4144 }
4136 else 4145 else
4137 { 4146 {
4138 if (EQ (visibility, Qunbound)) 4147 if (EQ (visibility, Qunbound))
@@ -4140,8 +4149,17 @@ This function is an internal primitive--use `make-frame' instead. */)
4140 4149
4141 if (!NILP (visibility)) 4150 if (!NILP (visibility))
4142 x_make_frame_visible (f); 4151 x_make_frame_visible (f);
4152 else
4153 f->was_invisible = true;
4143 } 4154 }
4144 4155
4156 /* Leave f->was_invisible true only if height or width were
4157 specified too. This takes effect only when we are not called
4158 from `x-create-frame-with-faces' (see above comment). */
4159 f->was_invisible
4160 = (f->was_invisible
4161 && (!EQ (height, Qunbound) || !EQ (width, Qunbound)));
4162
4145 store_frame_param (f, Qvisibility, visibility); 4163 store_frame_param (f, Qvisibility, visibility);
4146 } 4164 }
4147 4165
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 10565a4b25f..ddb86d82fe1 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -357,7 +357,7 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData,
357 } 357 }
358 358
359 ice_fd = IceConnectionNumber (iceConn); 359 ice_fd = IceConnectionNumber (iceConn);
360 add_read_fd (ice_fd, x_session_check_input, NULL); 360 add_non_keyboard_read_fd (ice_fd, x_session_check_input, NULL);
361} 361}
362 362
363/* Create the client leader window. */ 363/* Create the client leader window. */
diff --git a/src/xterm.c b/src/xterm.c
index 9edaed9a34b..1887c3255d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8181,8 +8181,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
8181#if defined USE_GTK && defined HAVE_GTK3 8181#if defined USE_GTK && defined HAVE_GTK3
8182 /* If GTK3 wants to impose some old size here (Bug#24526), 8182 /* If GTK3 wants to impose some old size here (Bug#24526),
8183 tell it that the current size is what we want. */ 8183 tell it that the current size is what we want. */
8184 xg_frame_set_char_size 8184 if (f->was_invisible)
8185 (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); 8185 {
8186 xg_frame_set_char_size
8187 (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
8188 f->was_invisible = false;
8189 }
8186#endif 8190#endif
8187 XSETFRAME (inev.ie.frame_or_window, f); 8191 XSETFRAME (inev.ie.frame_or_window, f);
8188 } 8192 }
@@ -8443,8 +8447,12 @@ handle_one_xevent (struct x_display_info *dpyinfo,
8443#if defined USE_GTK && defined HAVE_GTK3 8447#if defined USE_GTK && defined HAVE_GTK3
8444 /* If GTK3 wants to impose some old size here (Bug#24526), 8448 /* If GTK3 wants to impose some old size here (Bug#24526),
8445 tell it that the current size is what we want. */ 8449 tell it that the current size is what we want. */
8446 xg_frame_set_char_size 8450 if (f->was_invisible)
8447 (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); 8451 {
8452 xg_frame_set_char_size
8453 (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
8454 f->was_invisible = false;
8455 }
8448#endif 8456#endif
8449 f->output_data.x->has_been_visible = true; 8457 f->output_data.x->has_been_visible = true;
8450 } 8458 }
@@ -9335,6 +9343,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
9335 goto OTHER; 9343 goto OTHER;
9336 9344
9337 case VisibilityNotify: 9345 case VisibilityNotify:
9346 f = x_top_window_to_frame (dpyinfo, event->xvisibility.window);
9347 if (f && (event->xvisibility.state == VisibilityUnobscured
9348 || event->xvisibility.state == VisibilityPartiallyObscured))
9349 SET_FRAME_VISIBLE (f, 1);
9350
9338 goto OTHER; 9351 goto OTHER;
9339 9352
9340 case MappingNotify: 9353 case MappingNotify:
@@ -9591,11 +9604,12 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
9591 /* The foreground of cursor_gc is typically the same as the normal 9604 /* The foreground of cursor_gc is typically the same as the normal
9592 background color, which can cause the cursor box to be invisible. */ 9605 background color, which can cause the cursor box to be invisible. */
9593 xgcv.foreground = f->output_data.x->cursor_pixel; 9606 xgcv.foreground = f->output_data.x->cursor_pixel;
9607 xgcv.line_width = 1;
9594 if (dpyinfo->scratch_cursor_gc) 9608 if (dpyinfo->scratch_cursor_gc)
9595 XChangeGC (dpy, dpyinfo->scratch_cursor_gc, GCForeground, &xgcv); 9609 XChangeGC (dpy, dpyinfo->scratch_cursor_gc, GCForeground | GCLineWidth, &xgcv);
9596 else 9610 else
9597 dpyinfo->scratch_cursor_gc = XCreateGC (dpy, FRAME_X_DRAWABLE (f), 9611 dpyinfo->scratch_cursor_gc = XCreateGC (dpy, FRAME_X_DRAWABLE (f),
9598 GCForeground, &xgcv); 9612 GCForeground | GCLineWidth, &xgcv);
9599 gc = dpyinfo->scratch_cursor_gc; 9613 gc = dpyinfo->scratch_cursor_gc;
9600 9614
9601 /* When on R2L character, show cursor at the right edge of the 9615 /* When on R2L character, show cursor at the right edge of the