summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan D <jan.h.d@swipnet.se>2015-05-17 16:46:34 +0200
committerJan D <jan.h.d@swipnet.se>2015-05-17 16:46:34 +0200
commit6445ee0fb751ae2c1dfef900d44721b3d952812f (patch)
treed43006cb93d9ea7b00ea02aabcd5577c41ff827f /src
parentf92ac2e82ed199d6f25d2a59508e08addb1150ac (diff)
parentc9c4708ed47b18987940a71b98eb9873150d2b95 (diff)
downloademacs-6445ee0fb751ae2c1dfef900d44721b3d952812f.tar.gz
Merge branch 'master' into cairo
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in77
-rw-r--r--src/alloc.c4
-rw-r--r--src/autodeps.mk5
-rw-r--r--src/buffer.c92
-rw-r--r--src/buffer.h188
-rw-r--r--src/category.c2
-rw-r--r--src/cmds.c2
-rw-r--r--src/deps.mk2
-rw-r--r--src/editfns.c10
-rw-r--r--src/filelock.c49
-rw-r--r--src/gtkutil.c90
-rw-r--r--src/image.c4
-rw-r--r--src/keyboard.c28
-rw-r--r--src/keyboard.h52
-rw-r--r--src/lisp.h4
-rw-r--r--src/lisp.mk174
-rw-r--r--src/lread.c6
-rw-r--r--src/macfont.h6
-rw-r--r--src/nsfns.m31
-rw-r--r--src/nsimage.m104
-rw-r--r--src/nsmenu.m6
-rw-r--r--src/nsterm.h9
-rw-r--r--src/nsterm.m211
-rw-r--r--src/process.c4
-rw-r--r--src/syntax.c2
-rw-r--r--src/window.c6
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xterm.c15
28 files changed, 615 insertions, 579 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 9e7a8a79915..d0df3260356 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -327,10 +327,15 @@ am__v_at_0 = @
am__v_at_1 =
DEPDIR=deps
-## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty.
-DEPFLAGS=@DEPFLAGS@
-## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'.
-MKDEPDIR=@MKDEPDIR@
+AUTO_DEPEND = @AUTO_DEPEND@
+
+ifeq ($(AUTO_DEPEND),yes)
+DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
+MKDEPDIR = ${MKDIR_P} ${DEPDIR}
+else
+DEPFLAGS =
+MKDEPDIR = :
+endif
## DO NOT use -R. There is a special hack described in lastfile.c
## which is used instead. Some initialized data areas are modified
@@ -417,9 +422,37 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
FIRSTFILE_OBJ=@FIRSTFILE_OBJ@
ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
-## Configure inserts the file lisp.mk at this point, defining $lisp.
-@lisp_frag@
-
+## This is the list of all Lisp files that might be loaded into the
+## dumped Emacs. Some of them are not loaded on all platforms, but
+## the DOC file on every platform uses them (because the DOC file is
+## supposed to be platform-independent).
+## Note that this list should not include lisp files which might not
+## be present, like site-load.el and site-init.el; this makefile
+## expects them all to be either present or buildable.
+##
+## To generate this list from loadup.el, we can either:
+## 1) Extract everything matching (load "..."), in which case
+## we need to add charprop.el by hand; or
+## 2) Extract everything matching (load "...", in which case
+## we need to remove leim-list, site-init, and site-load by hand.
+## There's not much to choose between these two approaches,
+## but the second one seems like it could be more future-proof.
+shortlisp =
+lisp.mk: $(lispsource)/loadup.el
+ @rm -f $@
+ ${AM_V_GEN}( echo "shortlisp = \\"; \
+ sed -n 's/^[ \t]*(load "\([^"]*\)".*/\1/p' $< | \
+ sed -e 's/$$/.elc \\/' -e 's/\.el\.elc/.el/'; \
+ echo "" ) > $@
+
+-include lisp.mk
+shortlisp_filter = leim/leim-list.el site-load.elc site-init.elc
+shortlisp := $(filter-out ${shortlisp_filter},${shortlisp})
+## Place loaddefs.el first, so it gets generated first, since it is on
+## the critical path (relevant in parallel compilations).
+## We don't really need to sort, but may as well use it to remove duplicates.
+shortlisp := loaddefs.el loadup.el $(sort ${shortlisp})
+lisp = $(addprefix ${lispsource}/,${shortlisp})
## Construct full set of libraries to be linked.
LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
@@ -453,7 +486,7 @@ $(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \
## since not all pieces are used on all platforms. But DOC depends
## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
emacs$(EXEEXT): temacs$(EXEEXT) \
- $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \
+ lisp.mk $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \
$(lispsource)/international/charprop.el
ifeq ($(CANNOT_DUMP),yes)
ln -f temacs$(EXEEXT) $@
@@ -464,12 +497,9 @@ else
endif
## We run make-docfile twice because the command line may get too long
-## on some systems. The sed command operating on lisp.mk also reduces
-## the length of the command line. Unfortunately, no-one has any idea
+## on some systems. Unfortunately, no-one has any idea
## exactly how long the maximum safe command line length is on all the
-## various systems that Emacs supports. Obviously, the length depends
-## on what your value of $srcdir is. If the length restriction goes
-## away, lisp.mk can be merged back into this file.
+## various systems that Emacs supports.
##
## $(SOME_MACHINE_OBJECTS) comes before $(obj) because some files may
## or may not be included in $(obj), but they are always included in
@@ -477,14 +507,13 @@ endif
## for the first time, this prevents any variation between configurations
## in the contents of the DOC file.
##
-$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp)
+$(etc)/DOC: lisp.mk $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp)
$(AM_V_GEN)$(MKDIR_P) $(etc)
-$(AM_V_at)rm -f $(etc)/DOC
$(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \
$(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC
$(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \
- `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' \
- $(srcdir)/lisp.mk`
+ $(shortlisp)
$(libsrc)/make-docfile$(EXEEXT):
$(MAKE) -C $(libsrc) make-docfile$(EXEEXT)
@@ -584,7 +613,7 @@ bootstrap-clean: clean
fi
distclean: bootstrap-clean
- rm -f Makefile
+ rm -f Makefile lisp.mk
maintainer-clean: distclean
rm -f TAGS
@@ -607,9 +636,11 @@ ctagsfiles3 = [a-zA-Z]*.m
## rather than the file contents.
TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(srcdir)/$(ctagsfiles3)
"$(ETAGS)" --include=../lisp/TAGS --include=$(lwlibdir)/TAGS \
- --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
+ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \
+ --regex='{c}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \
$(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) \
- --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
+ --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/\1/' \
+ --regex='{objc}/[ ]*DEFVAR_[A-Z_ (]+"[^"]+",[ ]\([A-Za-z0-9_]+\)/\1/' \
$(srcdir)/$(ctagsfiles3)
## Arrange to make tags tables for ../lisp and ../lwlib,
@@ -669,8 +700,10 @@ endif
@: Compile some files earlier to speed up further compilation.
$(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
-## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.
-@deps_frag@
-
+ifeq ($(AUTO_DEPEND),yes)
+-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
+else
+include $(srcdir)/deps.mk
+endif
### Makefile.in ends here
diff --git a/src/alloc.c b/src/alloc.c
index 1f4b1a4694e..030c6e06ba8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4496,7 +4496,7 @@ live_buffer_p (struct mem_node *m, void *p)
must not have been killed. */
return (m->type == MEM_TYPE_BUFFER
&& p == m->start
- && !NILP (((struct buffer *) p)->INTERNAL_FIELD (name)));
+ && !NILP (((struct buffer *) p)->name_));
}
#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -5762,7 +5762,7 @@ garbage_collect_1 (void *end)
after GC. It's important to scan finalizers at this stage so
that we can be sure that unmarked finalizers are really
unreachable except for references from their associated functions
- and from other finalizers. */
+ and from other finalizers. */
queue_doomed_finalizers (&doomed_finalizers, &finalizers);
mark_finalizer_list (&doomed_finalizers);
diff --git a/src/autodeps.mk b/src/autodeps.mk
deleted file mode 100644
index 8b014a7508c..00000000000
--- a/src/autodeps.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-### autodeps.mk --- src/Makefile fragment for GNU Emacs
-
-## This is inserted in src/Makefile if AUTO_DEPEND=yes.
-
--include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/src/buffer.c b/src/buffer.c
index 332d6d51a81..b09676c438d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -134,227 +134,227 @@ CHECK_OVERLAY (Lisp_Object x)
static void
bset_abbrev_mode (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (abbrev_mode) = val;
+ b->abbrev_mode_ = val;
}
static void
bset_abbrev_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (abbrev_table) = val;
+ b->abbrev_table_ = val;
}
static void
bset_auto_fill_function (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (auto_fill_function) = val;
+ b->auto_fill_function_ = val;
}
static void
bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (auto_save_file_format) = val;
+ b->auto_save_file_format_ = val;
}
static void
bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (auto_save_file_name) = val;
+ b->auto_save_file_name_ = val;
}
static void
bset_backed_up (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (backed_up) = val;
+ b->backed_up_ = val;
}
static void
bset_begv_marker (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (begv_marker) = val;
+ b->begv_marker_ = val;
}
static void
bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (bidi_display_reordering) = val;
+ b->bidi_display_reordering_ = val;
}
static void
bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (buffer_file_coding_system) = val;
+ b->buffer_file_coding_system_ = val;
}
static void
bset_case_fold_search (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (case_fold_search) = val;
+ b->case_fold_search_ = val;
}
static void
bset_ctl_arrow (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (ctl_arrow) = val;
+ b->ctl_arrow_ = val;
}
static void
bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
+ b->cursor_in_non_selected_windows_ = val;
}
static void
bset_cursor_type (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (cursor_type) = val;
+ b->cursor_type_ = val;
}
static void
bset_display_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (display_table) = val;
+ b->display_table_ = val;
}
static void
bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (extra_line_spacing) = val;
+ b->extra_line_spacing_ = val;
}
static void
bset_file_format (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (file_format) = val;
+ b->file_format_ = val;
}
static void
bset_file_truename (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (file_truename) = val;
+ b->file_truename_ = val;
}
static void
bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (fringe_cursor_alist) = val;
+ b->fringe_cursor_alist_ = val;
}
static void
bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (fringe_indicator_alist) = val;
+ b->fringe_indicator_alist_ = val;
}
static void
bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (fringes_outside_margins) = val;
+ b->fringes_outside_margins_ = val;
}
static void
bset_header_line_format (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (header_line_format) = val;
+ b->header_line_format_ = val;
}
static void
bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
+ b->indicate_buffer_boundaries_ = val;
}
static void
bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (indicate_empty_lines) = val;
+ b->indicate_empty_lines_ = val;
}
static void
bset_invisibility_spec (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (invisibility_spec) = val;
+ b->invisibility_spec_ = val;
}
static void
bset_left_fringe_width (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (left_fringe_width) = val;
+ b->left_fringe_width_ = val;
}
static void
bset_major_mode (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (major_mode) = val;
+ b->major_mode_ = val;
}
static void
bset_mark (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (mark) = val;
+ b->mark_ = val;
}
static void
bset_minor_modes (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (minor_modes) = val;
+ b->minor_modes_ = val;
}
static void
bset_mode_line_format (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (mode_line_format) = val;
+ b->mode_line_format_ = val;
}
static void
bset_mode_name (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (mode_name) = val;
+ b->mode_name_ = val;
}
static void
bset_name (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (name) = val;
+ b->name_ = val;
}
static void
bset_overwrite_mode (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (overwrite_mode) = val;
+ b->overwrite_mode_ = val;
}
static void
bset_pt_marker (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (pt_marker) = val;
+ b->pt_marker_ = val;
}
static void
bset_right_fringe_width (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (right_fringe_width) = val;
+ b->right_fringe_width_ = val;
}
static void
bset_save_length (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (save_length) = val;
+ b->save_length_ = val;
}
static void
bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (scroll_bar_width) = val;
+ b->scroll_bar_width_ = val;
}
static void
bset_scroll_bar_height (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (scroll_bar_height) = val;
+ b->scroll_bar_height_ = val;
}
static void
bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (scroll_down_aggressively) = val;
+ b->scroll_down_aggressively_ = val;
}
static void
bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (scroll_up_aggressively) = val;
+ b->scroll_up_aggressively_ = val;
}
static void
bset_selective_display (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (selective_display) = val;
+ b->selective_display_ = val;
}
static void
bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (selective_display_ellipses) = val;
+ b->selective_display_ellipses_ = val;
}
static void
bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
+ b->vertical_scroll_bar_type_ = val;
}
static void
bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (horizontal_scroll_bar_type) = val;
+ b->horizontal_scroll_bar_type_ = val;
}
static void
bset_word_wrap (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (word_wrap) = val;
+ b->word_wrap_ = val;
}
static void
bset_zv_marker (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (zv_marker) = val;
+ b->zv_marker_ = val;
}
void
@@ -1591,7 +1591,7 @@ compact_buffer (struct buffer *buffer)
turned off in that buffer. Calling truncate_undo_list on
Qt tends to return NULL, which effectively turns undo back on.
So don't call truncate_undo_list if undo_list is Qt. */
- if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt))
+ if (!EQ (BVAR(buffer, undo_list), Qt))
truncate_undo_list (buffer);
/* Shrink buffer gaps. */
diff --git a/src/buffer.h b/src/buffer.h
index 81852cae505..a0410d454cd 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -483,7 +483,7 @@ struct buffer_text
/* Most code should use this macro to access Lisp fields in struct buffer. */
-#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
+#define BVAR(buf, field) ((buf)->field ## _)
/* This is the structure that the buffer Lisp object points to. */
@@ -492,17 +492,17 @@ struct buffer
struct vectorlike_header header;
/* The name of this buffer. */
- Lisp_Object INTERNAL_FIELD (name);
+ Lisp_Object name_;
/* The name of the file visited in this buffer, or nil. */
- Lisp_Object INTERNAL_FIELD (filename);
+ Lisp_Object filename_;
/* Directory for expanding relative file names. */
- Lisp_Object INTERNAL_FIELD (directory);
+ Lisp_Object directory_;
/* True if this buffer has been backed up (if you write to the visited
file and it hasn't been backed up, then a backup will be made). */
- Lisp_Object INTERNAL_FIELD (backed_up);
+ Lisp_Object backed_up_;
/* Length of file when last read or saved.
-1 means auto saving turned off because buffer shrank a lot.
@@ -510,132 +510,132 @@ struct buffer
(That value is used with buffer-swap-text.)
This is not in the struct buffer_text
because it's not used in indirect buffers at all. */
- Lisp_Object INTERNAL_FIELD (save_length);
+ Lisp_Object save_length_;
/* File name used for auto-saving this buffer.
This is not in the struct buffer_text
because it's not used in indirect buffers at all. */
- Lisp_Object INTERNAL_FIELD (auto_save_file_name);
+ Lisp_Object auto_save_file_name_;
/* Non-nil if buffer read-only. */
- Lisp_Object INTERNAL_FIELD (read_only);
+ Lisp_Object read_only_;
/* "The mark". This is a marker which may
point into this buffer or may point nowhere. */
- Lisp_Object INTERNAL_FIELD (mark);
+ Lisp_Object mark_;
/* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
per-buffer variables of this buffer. For locally unbound
symbols, just the symbol appears as the element. */
- Lisp_Object INTERNAL_FIELD (local_var_alist);
+ Lisp_Object local_var_alist_;
/* Symbol naming major mode (e.g., lisp-mode). */
- Lisp_Object INTERNAL_FIELD (major_mode);
+ Lisp_Object major_mode_;
/* Pretty name of major mode (e.g., "Lisp"). */
- Lisp_Object INTERNAL_FIELD (mode_name);
+ Lisp_Object mode_name_;
/* Mode line element that controls format of mode line. */
- Lisp_Object INTERNAL_FIELD (mode_line_format);
+ Lisp_Object mode_line_format_;
/* Analogous to mode_line_format for the line displayed at the top
of windows. Nil means don't display that line. */
- Lisp_Object INTERNAL_FIELD (header_line_format);
+ Lisp_Object header_line_format_;
/* Keys that are bound local to this buffer. */
- Lisp_Object INTERNAL_FIELD (keymap);
+ Lisp_Object keymap_;
/* This buffer's local abbrev table. */
- Lisp_Object INTERNAL_FIELD (abbrev_table);
+ Lisp_Object abbrev_table_;
/* This buffer's syntax table. */
- Lisp_Object INTERNAL_FIELD (syntax_table);
+ Lisp_Object syntax_table_;
/* This buffer's category table. */
- Lisp_Object INTERNAL_FIELD (category_table);
+ Lisp_Object category_table_;
/* Values of several buffer-local variables. */
/* tab-width is buffer-local so that redisplay can find it
in buffers that are not current. */
- Lisp_Object INTERNAL_FIELD (case_fold_search);
- Lisp_Object INTERNAL_FIELD (tab_width);
- Lisp_Object INTERNAL_FIELD (fill_column);
- Lisp_Object INTERNAL_FIELD (left_margin);
+ Lisp_Object case_fold_search_;
+ Lisp_Object tab_width_;
+ Lisp_Object fill_column_;
+ Lisp_Object left_margin_;
/* Function to call when insert space past fill column. */
- Lisp_Object INTERNAL_FIELD (auto_fill_function);
+ Lisp_Object auto_fill_function_;
/* Case table for case-conversion in this buffer.
This char-table maps each char into its lower-case version. */
- Lisp_Object INTERNAL_FIELD (downcase_table);
+ Lisp_Object downcase_table_;
/* Char-table mapping each char to its upper-case version. */
- Lisp_Object INTERNAL_FIELD (upcase_table);
+ Lisp_Object upcase_table_;
/* Char-table for conversion for case-folding search. */
- Lisp_Object INTERNAL_FIELD (case_canon_table);
+ Lisp_Object case_canon_table_;
/* Char-table of equivalences for case-folding search. */
- Lisp_Object INTERNAL_FIELD (case_eqv_table);
+ Lisp_Object case_eqv_table_;
/* Non-nil means do not display continuation lines. */
- Lisp_Object INTERNAL_FIELD (truncate_lines);
+ Lisp_Object truncate_lines_;
/* Non-nil means to use word wrapping when displaying continuation lines. */
- Lisp_Object INTERNAL_FIELD (word_wrap);
+ Lisp_Object word_wrap_;
/* Non-nil means display ctl chars with uparrow. */
- Lisp_Object INTERNAL_FIELD (ctl_arrow);
+ Lisp_Object ctl_arrow_;
/* Non-nil means reorder bidirectional text for display in the
visual order. */
- Lisp_Object INTERNAL_FIELD (bidi_display_reordering);
+ Lisp_Object bidi_display_reordering_;
/* If non-nil, specifies which direction of text to force in all the
paragraphs of the buffer. Nil means determine paragraph
direction dynamically for each paragraph. */
- Lisp_Object INTERNAL_FIELD (bidi_paragraph_direction);
+ Lisp_Object bidi_paragraph_direction_;
/* Non-nil means do selective display;
see doc string in syms_of_buffer (buffer.c) for details. */
- Lisp_Object INTERNAL_FIELD (selective_display);
+ Lisp_Object selective_display_;
/* Non-nil means show ... at end of line followed by invisible lines. */
- Lisp_Object INTERNAL_FIELD (selective_display_ellipses);
+ Lisp_Object selective_display_ellipses_;
/* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
- Lisp_Object INTERNAL_FIELD (minor_modes);
+ Lisp_Object minor_modes_;
/* t if "self-insertion" should overwrite; `binary' if it should also
overwrite newlines and tabs - for editing executables and the like. */
- Lisp_Object INTERNAL_FIELD (overwrite_mode);
+ Lisp_Object overwrite_mode_;
/* Non-nil means abbrev mode is on. Expand abbrevs automatically. */
- Lisp_Object INTERNAL_FIELD (abbrev_mode);
+ Lisp_Object abbrev_mode_;
/* Display table to use for text in this buffer. */
- Lisp_Object INTERNAL_FIELD (display_table);
+ Lisp_Object display_table_;
/* t means the mark and region are currently active. */
- Lisp_Object INTERNAL_FIELD (mark_active);
+ Lisp_Object mark_active_;
/* Non-nil means the buffer contents are regarded as multi-byte
form of characters, not a binary code. */
- Lisp_Object INTERNAL_FIELD (enable_multibyte_characters);
+ Lisp_Object enable_multibyte_characters_;
/* Coding system to be used for encoding the buffer contents on
saving. */
- Lisp_Object INTERNAL_FIELD (buffer_file_coding_system);
+ Lisp_Object buffer_file_coding_system_;
/* List of symbols naming the file format used for visited file. */
- Lisp_Object INTERNAL_FIELD (file_format);
+ Lisp_Object file_format_;
/* List of symbols naming the file format used for auto-save file. */
- Lisp_Object INTERNAL_FIELD (auto_save_file_format);
+ Lisp_Object auto_save_file_format_;
/* True if the newline position cache, width run cache and BIDI paragraph
cache are enabled. See search.c, indent.c and bidi.c for details. */
- Lisp_Object INTERNAL_FIELD (cache_long_scans);
+ Lisp_Object cache_long_scans_;
/* If the width run cache is enabled, this table contains the
character widths width_run_cache (see above) assumes. When we
@@ -643,104 +643,104 @@ struct buffer
current display table to see whether the display table has
affected the widths of any characters. If it has, we
invalidate the width run cache, and re-initialize width_table. */
- Lisp_Object INTERNAL_FIELD (width_table);
+ Lisp_Object width_table_;
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
PT for this buffer when the buffer is not current. */
- Lisp_Object INTERNAL_FIELD (pt_marker);
+ Lisp_Object pt_marker_;
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
BEGV for this buffer when the buffer is not current. */
- Lisp_Object INTERNAL_FIELD (begv_marker);
+ Lisp_Object begv_marker_;
/* In an indirect buffer, or a buffer that is the base of an
indirect buffer, this holds a marker that records
ZV for this buffer when the buffer is not current. */
- Lisp_Object INTERNAL_FIELD (zv_marker);
+ Lisp_Object zv_marker_;
/* This holds the point value before the last scroll operation.
Explicitly setting point sets this to nil. */
- Lisp_Object INTERNAL_FIELD (point_before_scroll);
+ Lisp_Object point_before_scroll_;
/* Truename of the visited file, or nil. */
- Lisp_Object INTERNAL_FIELD (file_truename);
+ Lisp_Object file_truename_;
/* Invisibility spec of this buffer.
t => any non-nil `invisible' property means invisible.
A list => `invisible' property means invisible
if it is memq in that list. */
- Lisp_Object INTERNAL_FIELD (invisibility_spec);
+ Lisp_Object invisibility_spec_;
/* This is the last window that was selected with this buffer in it,
or nil if that window no longer displays this buffer. */
- Lisp_Object INTERNAL_FIELD (last_selected_window);
+ Lisp_Object last_selected_window_;
/* Incremented each time the buffer is displayed in a window. */
- Lisp_Object INTERNAL_FIELD (display_count);
+ Lisp_Object display_count_;
/* Widths of left and right marginal areas for windows displaying
this buffer. */
- Lisp_Object INTERNAL_FIELD (left_margin_cols);
- Lisp_Object INTERNAL_FIELD (right_margin_cols);
+ Lisp_Object left_margin_cols_;
+ Lisp_Object right_margin_cols_;
/* Widths of left and right fringe areas for windows displaying
this buffer. */
- Lisp_Object INTERNAL_FIELD (left_fringe_width);
- Lisp_Object INTERNAL_FIELD (right_fringe_width);
+ Lisp_Object left_fringe_width_;
+ Lisp_Object right_fringe_width_;
/* Non-nil means fringes are drawn outside display margins;
othersize draw them between margin areas and text. */
- Lisp_Object INTERNAL_FIELD (fringes_outside_margins);
+ Lisp_Object fringes_outside_margins_;
/* Width, height and types of scroll bar areas for windows displaying
this buffer. */
- Lisp_Object INTERNAL_FIELD (scroll_bar_width);
- Lisp_Object INTERNAL_FIELD (scroll_bar_height);
- Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type);
- Lisp_Object INTERNAL_FIELD (horizontal_scroll_bar_type);
+ Lisp_Object scroll_bar_width_;
+ Lisp_Object scroll_bar_height_;
+ Lisp_Object vertical_scroll_bar_type_;
+ Lisp_Object horizontal_scroll_bar_type_;
/* Non-nil means indicate lines not displaying text (in a style
like vi). */
- Lisp_Object INTERNAL_FIELD (indicate_empty_lines);
+ Lisp_Object indicate_empty_lines_;
/* Non-nil means indicate buffer boundaries and scrolling. */
- Lisp_Object INTERNAL_FIELD (indicate_buffer_boundaries);
+ Lisp_Object indicate_buffer_boundaries_;
/* Logical to physical fringe bitmap mappings. */
- Lisp_Object INTERNAL_FIELD (fringe_indicator_alist);
+ Lisp_Object fringe_indicator_alist_;
/* Logical to physical cursor bitmap mappings. */
- Lisp_Object INTERNAL_FIELD (fringe_cursor_alist);
+ Lisp_Object fringe_cursor_alist_;
/* Time stamp updated each time this buffer is displayed in a window. */
- Lisp_Object INTERNAL_FIELD (display_time);
+ Lisp_Object display_time_;
/* If scrolling the display because point is below the bottom of a
window showing this buffer, try to choose a window start so
that point ends up this number of lines from the top of the
window. Nil means that scrolling method isn't used. */
- Lisp_Object INTERNAL_FIELD (scroll_up_aggressively);
+ Lisp_Object scroll_up_aggressively_;
/* If scrolling the display because point is above the top of a
window showing this buffer, try to choose a window start so
that point ends up this number of lines from the bottom of the
window. Nil means that scrolling method isn't used. */
- Lisp_Object INTERNAL_FIELD (scroll_down_aggressively);
+ Lisp_Object scroll_down_aggressively_;
/* Desired cursor type in this buffer. See the doc string of
per-buffer variable `cursor-type'. */
- Lisp_Object INTERNAL_FIELD (cursor_type);
+ Lisp_Object cursor_type_;
/* An integer > 0 means put that number of pixels below text lines
in the display of this buffer. */
- Lisp_Object INTERNAL_FIELD (extra_line_spacing);
+ Lisp_Object extra_line_spacing_;
/* Cursor type to display in non-selected windows.
t means to use hollow box cursor.
See `cursor-type' for other values. */
- Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows);
+ Lisp_Object cursor_in_non_selected_windows_;
/* No more Lisp_Object beyond this point. Except undo_list,
which is handled specially in Fgarbage_collect. */
@@ -872,7 +872,7 @@ struct buffer
buffer of an indirect buffer. But we can't store it in the
struct buffer_text because local variables have to be right in
the struct buffer. So we copy it around in set_buffer_internal. */
- Lisp_Object INTERNAL_FIELD (undo_list);
+ Lisp_Object undo_list_;
};
/* Most code should use these functions to set Lisp fields in struct
@@ -881,102 +881,102 @@ struct buffer
INLINE void
bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (bidi_paragraph_direction) = val;
+ b->bidi_paragraph_direction_ = val;
}
INLINE void
bset_cache_long_scans (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (cache_long_scans) = val;
+ b->cache_long_scans_ = val;
}
INLINE void
bset_case_canon_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (case_canon_table) = val;
+ b->case_canon_table_ = val;
}
INLINE void
bset_case_eqv_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (case_eqv_table) = val;
+ b->case_eqv_table_ = val;
}
INLINE void
bset_directory (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (directory) = val;
+ b->directory_ = val;
}
INLINE void
bset_display_count (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (display_count) = val;
+ b->display_count_ = val;
}
INLINE void
bset_display_time (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (display_time) = val;
+ b->display_time_ = val;
}
INLINE void
bset_downcase_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (downcase_table) = val;
+ b->downcase_table_ = val;
}
INLINE void
bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (enable_multibyte_characters) = val;
+ b->enable_multibyte_characters_ = val;
}
INLINE void
bset_filename (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (filename) = val;
+ b->filename_ = val;
}
INLINE void
bset_keymap (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (keymap) = val;
+ b->keymap_ = val;
}
INLINE void
bset_last_selected_window (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (last_selected_window) = val;
+ b->last_selected_window_ = val;
}
INLINE void
bset_local_var_alist (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (local_var_alist) = val;
+ b->local_var_alist_ = val;
}
INLINE void
bset_mark_active (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (mark_active) = val;
+ b->mark_active_ = val;
}
INLINE void
bset_point_before_scroll (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (point_before_scroll) = val;
+ b->point_before_scroll_ = val;
}
INLINE void
bset_read_only (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (read_only) = val;
+ b->read_only_ = val;
}
INLINE void
bset_truncate_lines (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (truncate_lines) = val;
+ b->truncate_lines_ = val;
}
INLINE void
bset_undo_list (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (undo_list) = val;
+ b->undo_list_ = val;
}
INLINE void
bset_upcase_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (upcase_table) = val;
+ b->upcase_table_ = val;
}
INLINE void
bset_width_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (width_table) = val;
+ b->width_table_ = val;
}
/* Number of Lisp_Objects at the beginning of struct buffer.
@@ -1253,7 +1253,7 @@ extern int last_per_buffer_idx;
from the start of a buffer structure. */
#define PER_BUFFER_VAR_OFFSET(VAR) \
- offsetof (struct buffer, INTERNAL_FIELD (VAR))
+ offsetof (struct buffer, VAR ## _)
/* Used to iterate over normal Lisp_Object fields of struct buffer (all
Lisp_Objects except undo_list). If you add, remove, or reorder
diff --git a/src/category.c b/src/category.c
index b20493e5949..ab90f5ff093 100644
--- a/src/category.c
+++ b/src/category.c
@@ -41,7 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
static void
bset_category_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (category_table) = val;
+ b->category_table_ = val;
}
/* The version number of the latest category table. Each category
diff --git a/src/cmds.c b/src/cmds.c
index 168ce8355ed..b590805ea8a 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -473,7 +473,7 @@ internal_self_insert (int c, EMACS_INT n)
}
replace_range (PT, PT + chars_to_delete, string, 1, 1, 1);
- Fforward_char (make_number (n + spaces_to_insert));
+ Fforward_char (make_number (n));
}
else if (n > 1)
{
diff --git a/src/deps.mk b/src/deps.mk
index 71a5f42d22e..23789384fdb 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -20,7 +20,7 @@
## Commentary:
##
-## This file is inserted in src/Makefile if AUTO_DEPEND=no.
+## This file is included in src/Makefile if AUTO_DEPEND=no.
## It defines static dependencies between the various source files.
## FIXME some of these dependencies are platform-specific.
diff --git a/src/editfns.c b/src/editfns.c
index dead48c1a62..cddb0d4eae6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -908,6 +908,10 @@ even in case of abnormal exit (throw or error).
If you only want to save the current buffer but not point,
then just use `save-current-buffer', or even `with-current-buffer'.
+Before Emacs 25.1, `save-excursion' used to save the mark state.
+To save the marker state as well as the point and buffer, use
+`save-mark-and-excursion'.
+
usage: (save-excursion &rest BODY) */)
(Lisp_Object args)
{
@@ -4386,9 +4390,6 @@ usage: (format STRING &rest OBJECTS) */)
nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
val = make_specified_string (buf, nchars, p - buf, multibyte);
- /* If we allocated BUF with malloc, free it too. */
- SAFE_FREE ();
-
/* If the format string has text properties, or any of the string
arguments has text properties, set up text properties of the
result string. */
@@ -4494,6 +4495,9 @@ usage: (format STRING &rest OBJECTS) */)
UNGCPRO;
}
+ /* If we allocated BUF or INFO with malloc, free it too. */
+ SAFE_FREE ();
+
return val;
}
diff --git a/src/filelock.c b/src/filelock.c
index 89d3e350219..4ee7a01ecb8 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -669,10 +669,6 @@ lock_file (Lisp_Object fn)
struct gcpro gcpro1;
USE_SAFE_ALLOCA;
- /* Don't do locking if the user has opted out. */
- if (! create_lockfiles)
- return;
-
/* Don't do locking while dumping Emacs.
Uncompressing wtmp files uses call-process, which does not work
in an uninitialized Emacs. */
@@ -690,9 +686,6 @@ lock_file (Lisp_Object fn)
#endif
encoded_fn = ENCODE_FILE (fn);
- /* Create the name of the lock-file for file fn */
- MAKE_LOCK_NAME (lfname, encoded_fn);
-
/* See if this file is visited and has changed on disk since it was
visited. */
{
@@ -707,27 +700,35 @@ lock_file (Lisp_Object fn)
}
- /* Try to lock the lock. */
- if (0 < lock_if_free (&lock_info, lfname))
+ /* Don't do locking if the user has opted out. */
+ if (create_lockfiles)
{
- /* Someone else has the lock. Consider breaking it. */
- Lisp_Object attack;
- char *dot = lock_info.dot;
- ptrdiff_t pidlen = lock_info.colon - (dot + 1);
- static char const replacement[] = " (pid ";
- int replacementlen = sizeof replacement - 1;
- memmove (dot + replacementlen, dot + 1, pidlen);
- strcpy (dot + replacementlen + pidlen, ")");
- memcpy (dot, replacement, replacementlen);
- attack = call2 (intern ("ask-user-about-lock"), fn,
- build_string (lock_info.user));
- /* Take the lock if the user said so. */
- if (!NILP (attack))
- lock_file_1 (lfname, 1);
+
+ /* Create the name of the lock-file for file fn */
+ MAKE_LOCK_NAME (lfname, encoded_fn);
+
+ /* Try to lock the lock. */
+ if (0 < lock_if_free (&lock_info, lfname))
+ {
+ /* Someone else has the lock. Consider breaking it. */
+ Lisp_Object attack;
+ char *dot = lock_info.dot;
+ ptrdiff_t pidlen = lock_info.colon - (dot + 1);
+ static char const replacement[] = " (pid ";
+ int replacementlen = sizeof replacement - 1;
+ memmove (dot + replacementlen, dot + 1, pidlen);
+ strcpy (dot + replacementlen + pidlen, ")");
+ memcpy (dot, replacement, replacementlen);
+ attack = call2 (intern ("ask-user-about-lock"), fn,
+ build_string (lock_info.user));
+ /* Take the lock if the user said so. */
+ if (!NILP (attack))
+ lock_file_1 (lfname, 1);
+ }
+ SAFE_FREE ();
}
UNGCPRO;
- SAFE_FREE ();
}
void
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d7340ba797e..5d28b0221af 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -869,6 +869,21 @@ xg_clear_under_internal_border (struct frame *f)
}
}
+static int
+xg_get_gdk_scale (void)
+{
+ const char *sscale = getenv ("GDK_SCALE");
+
+ if (sscale)
+ {
+ long scale = atol (sscale);
+ if (0 < scale)
+ return min (scale, INT_MAX);
+ }
+
+ return 1;
+}
+
/* Function to handle resize of our frame. As we have a Gtk+ tool bar
and a Gtk+ menu bar, we get resize events for the edit part of the
frame only. We let Gtk+ deal with the Gtk+ parts.
@@ -919,6 +934,9 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height);
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
gint gwidth, gheight;
+ int totalheight
+ = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
+ int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f);
if (FRAME_PIXEL_HEIGHT (f) == 0)
return;
@@ -929,6 +947,13 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
/* Do this before resize, as we don't know yet if we will be resized. */
xg_clear_under_internal_border (f);
+ if (FRAME_VISIBLE_P (f))
+ {
+ int scale = xg_get_gdk_scale ();
+ totalheight /= scale;
+ totalwidth /= scale;
+ }
+
/* Resize the top level widget so rows and columns remain constant.
When the frame is fullheight and we only want to change the width
@@ -943,38 +968,33 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
frame_size_history_add
(f, Qxg_frame_set_char_size_1, width, height,
list2 (make_number (gheight),
- make_number (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
- + FRAME_MENUBAR_HEIGHT (f))));
+ make_number (totalheight)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
gwidth,
- pixelheight + FRAME_TOOLBAR_HEIGHT (f)
- + FRAME_MENUBAR_HEIGHT (f));
+ totalheight);
}
else if (EQ (fullscreen, Qfullheight) && height == FRAME_TEXT_HEIGHT (f))
{
frame_size_history_add
(f, Qxg_frame_set_char_size_2, width, height,
list2 (make_number (gwidth),
- make_number (pixelwidth + FRAME_TOOLBAR_WIDTH (f))));
+ make_number (totalwidth)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- pixelwidth + FRAME_TOOLBAR_WIDTH (f),
+ totalwidth,
gheight);
}
-
else
{
frame_size_history_add
(f, Qxg_frame_set_char_size_3, width, height,
- list2 (make_number (pixelwidth + FRAME_TOOLBAR_WIDTH (f)),
- make_number (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
- + FRAME_MENUBAR_HEIGHT (f))));
+ list2 (make_number (totalwidth),
+ make_number (totalheight)));
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- pixelwidth + FRAME_TOOLBAR_WIDTH (f),
- pixelheight + FRAME_TOOLBAR_HEIGHT (f)
- + FRAME_MENUBAR_HEIGHT (f));
+ totalwidth,
+ totalheight);
fullscreen = Qnil;
}
@@ -1126,18 +1146,6 @@ delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
-#ifdef HAVE_GTK3
- /* The event doesn't arrive in the normal event loop. Send event
- here. */
- struct frame *f = user_data;
- struct input_event ie;
-
- EVENT_INIT (ie);
- ie.kind = DELETE_WINDOW_EVENT;
- XSETFRAME (ie.frame_or_window, f);
- kbd_buffer_store_event (&ie);
-#endif
-
return TRUE;
}
@@ -1356,6 +1364,7 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
int min_rows = 0, min_cols = 0;
int win_gravity = f->win_gravity;
Lisp_Object fs_state, frame;
+ int scale = xg_get_gdk_scale ();
/* Don't set size hints during initialization; that apparently leads
to a race condition. See the thread at
@@ -1435,6 +1444,11 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
hint_flags |= GDK_HINT_USER_POS;
}
+ size_hints.base_width /= scale;
+ size_hints.base_height /= scale;
+ size_hints.width_inc /= scale;
+ size_hints.height_inc /= scale;
+
if (hint_flags != f->output_data.x->hint_flags
|| memcmp (&size_hints,
&f->output_data.x->size_hints,
@@ -3556,14 +3570,14 @@ update_theme_scrollbar_height (void)
int
xg_get_default_scrollbar_width (void)
{
- return scroll_bar_width_for_theme;
+ return scroll_bar_width_for_theme * xg_get_gdk_scale ();
}
int
xg_get_default_scrollbar_height (void)
{
/* Apparently there's no default height for themes. */
- return scroll_bar_width_for_theme;
+ return scroll_bar_width_for_theme * xg_get_gdk_scale ();
}
/* Return the scrollbar id for X Window WID on display DPY.
@@ -3762,14 +3776,18 @@ xg_update_scrollbar_pos (struct frame *f,
int width,
int height)
{
-
GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
-
if (wscroll)
{
GtkWidget *wfixed = f->output_data.x->edit_widget;
GtkWidget *wparent = gtk_widget_get_parent (wscroll);
gint msl;
+ int scale = xg_get_gdk_scale ();
+
+ top /= scale;
+ left /= scale;
+ height /= scale;
+ left -= (scale - 1) * ((width / scale) >> 1);
/* Clear out old position. */
int oldx = -1, oldy = -1, oldw, oldh;
@@ -3800,11 +3818,15 @@ xg_update_scrollbar_pos (struct frame *f,
gdk_window_process_all_updates ();
#endif
if (oldx != -1 && oldw > 0 && oldh > 0)
- /* Clear under old scroll bar position. This must be done after
- the gtk_widget_queue_draw and gdk_window_process_all_updates
- above. */
- x_clear_area (f,
- oldx, oldy, oldw, oldh);
+ {
+ /* Clear under old scroll bar position. This must be done after
+ the gtk_widget_queue_draw and gdk_window_process_all_updates
+ above. */
+ oldw += (scale - 1) * oldw;
+ oldx -= (scale - 1) * oldw;
+ x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ oldx, oldy, oldw, oldh);
+ }
/* GTK does not redraw until the main loop is entered again, but
if there are no X events pending we will not enter it. So we sync
diff --git a/src/image.c b/src/image.c
index ffbed747590..87029bfa1b0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -237,7 +237,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
- void *bitmap = ns_image_from_XBM (bits, width, height);
+ void *bitmap = ns_image_from_XBM (bits, width, height, 0, 0);
if (!bitmap)
return -1;
#endif
@@ -2706,7 +2706,7 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
convert_mono_to_color_image (f, img, fg, bg);
#elif defined (HAVE_NS)
- img->pixmap = ns_image_from_XBM (data, img->width, img->height);
+ img->pixmap = ns_image_from_XBM (data, img->width, img->height, fg, bg);
#else
img->pixmap =
diff --git a/src/keyboard.c b/src/keyboard.c
index bd79f901970..77f7fb97898 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -391,47 +391,47 @@ static void store_user_signal_events (void);
static void
kset_echo_string (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (echo_string) = val;
+ kb->echo_string_ = val;
}
static void
kset_kbd_queue (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (kbd_queue) = val;
+ kb->kbd_queue_ = val;
}
static void
kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val;
+ kb->Vkeyboard_translate_table_ = val;
}
static void
kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vlast_prefix_arg) = val;
+ kb->Vlast_prefix_arg_ = val;
}
static void
kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vlast_repeatable_command) = val;
+ kb->Vlast_repeatable_command_ = val;
}
static void
kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vlocal_function_key_map) = val;
+ kb->Vlocal_function_key_map_ = val;
}
static void
kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val;
+ kb->Voverriding_terminal_local_map_ = val;
}
static void
kset_real_last_command (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vreal_last_command) = val;
+ kb->Vreal_last_command_ = val;
}
static void
kset_system_key_syms (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (system_key_syms) = val;
+ kb->system_key_syms_ = val;
}
@@ -8707,12 +8707,10 @@ read_char_minibuf_menu_prompt (int commandflag,
while (BUFFERP (obj));
kset_defining_kbd_macro (current_kboard, orig_defn_macro);
- if (!INTEGERP (obj) || XINT (obj) == -2)
- return obj;
-
- if (! EQ (obj, menu_prompt_more_char)
- && (!INTEGERP (menu_prompt_more_char)
- || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char))))))
+ if (!INTEGERP (obj) || XINT (obj) == -2
+ || (! EQ (obj, menu_prompt_more_char)
+ && (!INTEGERP (menu_prompt_more_char)
+ || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))))
{
if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
store_kbd_macro_char (obj);
diff --git a/src/keyboard.h b/src/keyboard.h
index 0ce6d184482..bcdeaf62165 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -25,7 +25,7 @@ INLINE_HEADER_BEGIN
/* Most code should use this macro to access Lisp fields in struct kboard. */
-#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
+#define KVAR(kboard, field) ((kboard)->field ## _)
/* Each KBOARD represents one logical input stream from which Emacs
gets input. If we are using ordinary terminals, it has one KBOARD
@@ -78,32 +78,32 @@ struct kboard
can effectively wait for input in the any-kboard state, and hence
avoid blocking out the other KBOARDs. See universal-argument in
lisp/simple.el for an example. */
- Lisp_Object INTERNAL_FIELD (Voverriding_terminal_local_map);
+ Lisp_Object Voverriding_terminal_local_map_;
/* Last command executed by the editor command loop, not counting
commands that set the prefix argument. */
- Lisp_Object INTERNAL_FIELD (Vlast_command);
+ Lisp_Object Vlast_command_;
/* Normally same as last-command, but never modified by other commands. */
- Lisp_Object INTERNAL_FIELD (Vreal_last_command);
+ Lisp_Object Vreal_last_command_;
/* User-supplied table to translate input characters through. */
- Lisp_Object INTERNAL_FIELD (Vkeyboard_translate_table);
+ Lisp_Object Vkeyboard_translate_table_;
/* Last command that may be repeated by `repeat'. */
- Lisp_Object INTERNAL_FIELD (Vlast_repeatable_command);
+ Lisp_Object Vlast_repeatable_command_;
/* The prefix argument for the next command, in raw form. */
- Lisp_Object INTERNAL_FIELD (Vprefix_arg);
+ Lisp_Object Vprefix_arg_;
/* Saved prefix argument for the last command, in raw form. */
- Lisp_Object INTERNAL_FIELD (Vlast_prefix_arg);
+ Lisp_Object Vlast_prefix_arg_;
/* Unread events specific to this kboard. */
- Lisp_Object INTERNAL_FIELD (kbd_queue);
+ Lisp_Object kbd_queue_;
/* Non-nil while a kbd macro is being defined. */
- Lisp_Object INTERNAL_FIELD (defining_kbd_macro);
+ Lisp_Object defining_kbd_macro_;
/* The start of storage for the current keyboard macro. */
Lisp_Object *kbd_macro_buffer;
@@ -125,28 +125,28 @@ struct kboard
ptrdiff_t kbd_macro_bufsize;
/* Last anonymous kbd macro defined. */
- Lisp_Object INTERNAL_FIELD (Vlast_kbd_macro);
+ Lisp_Object Vlast_kbd_macro_;
/* Alist of system-specific X windows key symbols. */
- Lisp_Object INTERNAL_FIELD (Vsystem_key_alist);
+ Lisp_Object Vsystem_key_alist_;
/* Cache for modify_event_symbol. */
- Lisp_Object INTERNAL_FIELD (system_key_syms);
+ Lisp_Object system_key_syms_;
/* The kind of display: x, w32, ... */
- Lisp_Object INTERNAL_FIELD (Vwindow_system);
+ Lisp_Object Vwindow_system_;
/* Keymap mapping keys to alternative preferred forms.
See the DEFVAR for more documentation. */
- Lisp_Object INTERNAL_FIELD (Vlocal_function_key_map);
+ Lisp_Object Vlocal_function_key_map_;
/* Keymap mapping ASCII function key sequences onto their preferred
forms. Initialized by the terminal-specific lisp files. See the
DEFVAR for more documentation. */
- Lisp_Object INTERNAL_FIELD (Vinput_decode_map);
+ Lisp_Object Vinput_decode_map_;
/* Minibufferless frames on this display use this frame's minibuffer. */
- Lisp_Object INTERNAL_FIELD (Vdefault_minibuffer_frame);
+ Lisp_Object Vdefault_minibuffer_frame_;
/* Number of displays using this KBOARD. Normally 1, but can be
larger when you have multiple screens on a single X display. */
@@ -154,7 +154,7 @@ struct kboard
/* The text we're echoing in the modeline - partial key sequences,
usually. This is nil when not echoing. */
- Lisp_Object INTERNAL_FIELD (echo_string);
+ Lisp_Object echo_string_;
/* This flag indicates that events were put into kbd_queue
while Emacs was running for some other KBOARD.
@@ -179,42 +179,42 @@ struct kboard
INLINE void
kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val;
+ kb->Vdefault_minibuffer_frame_ = val;
}
INLINE void
kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (defining_kbd_macro) = val;
+ kb->defining_kbd_macro_ = val;
}
INLINE void
kset_input_decode_map (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vinput_decode_map) = val;
+ kb->Vinput_decode_map_ = val;
}
INLINE void
kset_last_command (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vlast_command) = val;
+ kb->Vlast_command_ = val;
}
INLINE void
kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vlast_kbd_macro) = val;
+ kb->Vlast_kbd_macro_ = val;
}
INLINE void
kset_prefix_arg (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vprefix_arg) = val;
+ kb->Vprefix_arg_ = val;
}
INLINE void
kset_system_key_alist (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vsystem_key_alist) = val;
+ kb->Vsystem_key_alist_ = val;
}
INLINE void
kset_window_system (struct kboard *kb, Lisp_Object val)
{
- kb->INTERNAL_FIELD (Vwindow_system) = val;
+ kb->Vwindow_system_ = val;
}
/* Temporarily used before a frame has been opened. */
diff --git a/src/lisp.h b/src/lisp.h
index 55c4c662c06..6d34ce3b052 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1144,10 +1144,6 @@ LISP_MACRO_DEFUN_VOID (CHECK_TYPE,
(int ok, Lisp_Object predicate, Lisp_Object x),
(ok, predicate, x))
-/* Deprecated and will be removed soon. */
-
-#define INTERNAL_FIELD(field) field ## _
-
/* See the macros in intervals.h. */
typedef struct interval *INTERVAL;
diff --git a/src/lisp.mk b/src/lisp.mk
deleted file mode 100644
index ee2a07c0fd7..00000000000
--- a/src/lisp.mk
+++ /dev/null
@@ -1,174 +0,0 @@
-### lisp.mk --- src/Makefile fragment for GNU Emacs
-
-## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2015 Free Software
-## Foundation, Inc.
-
-## This file is part of GNU Emacs.
-
-## GNU Emacs is free software: you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-
-## GNU Emacs is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-
-### Commentary:
-
-## This is the list of all Lisp files that might be loaded into the
-## dumped Emacs. Some of them are not loaded on all platforms, but
-## the DOC file on every platform uses them (because the DOC file is
-## supposed to be platform-independent).
-## It is arranged like this because it is easier to generate it
-## semi-mechanically from loadup.el this way.
-## Eg something like:
-## sed -e 's/"[ )].*//' -n -e '/(load "/ s/.*load "//p' loadup.el | \
-## grep -vE 'site-|ldefs-boot'
-## minus any duplicates.
-## Note that you can generally just add a ".elc" extension to every file
-## that does not have an explicit .el extension, but beware of any
-## no-byte-compile ones.
-
-## Confusingly, international/cp51932 and international/eucjp-ms are
-## unconditionally loaded from language/japanese, instead of being
-## loaded directly from loadup.el; FIXME.
-
-## Note that this list should not include lisp files which might not
-## be present, like site-load.el and site-init.el; this makefile
-## expects them all to be either present or buildable.
-
-## Place loaddefs.el first, so it gets generated first, since it is on
-## the critical path (relevant in parallel compilations).
-
-### Code:
-
-## NB: This list is parsed by sed in the main src/Makefile.
-## Do not change the formatting.
-lisp = \
- $(lispsource)/loaddefs.el \
- $(lispsource)/loadup.el \
- $(lispsource)/emacs-lisp/byte-run.elc \
- $(lispsource)/emacs-lisp/backquote.elc \
- $(lispsource)/subr.elc \
- $(lispsource)/version.elc \
- $(lispsource)/widget.elc \
- $(lispsource)/custom.elc \
- $(lispsource)/emacs-lisp/map-ynp.elc \
- $(lispsource)/cus-start.elc \
- $(lispsource)/international/mule.elc \
- $(lispsource)/international/mule-conf.elc \
- $(lispsource)/env.elc \
- $(lispsource)/format.elc \
- $(lispsource)/bindings.elc \
- $(lispsource)/files.elc \
- $(lispsource)/emacs-lisp/macroexp.elc \
- $(lispsource)/cus-face.elc \
- $(lispsource)/faces.elc \
- $(lispsource)/button.elc \
- $(lispsource)/startup.elc \
- $(lispsource)/emacs-lisp/cl-preloaded.elc \
- $(lispsource)/emacs-lisp/nadvice.elc \
- $(lispsource)/minibuffer.elc \
- $(lispsource)/abbrev.elc \
- $(lispsource)/simple.elc \
- $(lispsource)/help.elc \
- $(lispsource)/jka-cmpr-hook.elc \
- $(lispsource)/epa-hook.elc \
- $(lispsource)/international/mule-cmds.elc \
- $(lispsource)/case-table.elc \
- $(lispsource)/international/characters.elc \
- $(lispsource)/composite.elc \
- $(lispsource)/international/charprop.el \
- $(lispsource)/language/chinese.elc \
- $(lispsource)/language/cyrillic.elc \
- $(lispsource)/language/indian.elc \
- $(lispsource)/language/sinhala.elc \
- $(lispsource)/language/english.elc \
- $(lispsource)/language/ethiopic.elc \
- $(lispsource)/language/european.elc \
- $(lispsource)/language/czech.elc \
- $(lispsource)/language/slovak.elc \
- $(lispsource)/language/romanian.elc \
- $(lispsource)/language/greek.elc \
- $(lispsource)/language/hebrew.elc \
- $(lispsource)/language/japanese.elc \
- $(lispsource)/international/cp51932.el \
- $(lispsource)/international/eucjp-ms.el \
- $(lispsource)/language/korean.elc \
- $(lispsource)/language/lao.elc \
- $(lispsource)/language/tai-viet.elc \
- $(lispsource)/language/thai.elc \
- $(lispsource)/language/tibetan.elc \
- $(lispsource)/language/vietnamese.elc \
- $(lispsource)/language/misc-lang.elc \
- $(lispsource)/language/utf-8-lang.elc \
- $(lispsource)/language/georgian.elc \
- $(lispsource)/language/khmer.elc \
- $(lispsource)/language/burmese.elc \
- $(lispsource)/language/cham.elc \
- $(lispsource)/indent.elc \
- $(lispsource)/window.elc \
- $(lispsource)/frame.elc \
- $(lispsource)/term/tty-colors.elc \
- $(lispsource)/font-core.elc \
- $(lispsource)/facemenu.elc \
- $(lispsource)/emacs-lisp/syntax.elc \
- $(lispsource)/font-lock.elc \
- $(lispsource)/jit-lock.elc \
- $(lispsource)/mouse.elc \
- $(lispsource)/scroll-bar.elc \
- $(lispsource)/select.elc \
- $(lispsource)/emacs-lisp/timer.elc \
- $(lispsource)/isearch.elc \
- $(lispsource)/rfn-eshadow.elc \
- $(lispsource)/menu-bar.elc \
- $(lispsource)/emacs-lisp/lisp.elc \
- $(lispsource)/textmodes/page.elc \
- $(lispsource)/register.elc \
- $(lispsource)/textmodes/paragraphs.elc \
- $(lispsource)/progmodes/prog-mode.elc \
- $(lispsource)/emacs-lisp/lisp-mode.elc \
- $(lispsource)/progmodes/elisp-mode.elc \
- $(lispsource)/textmodes/text-mode.elc \
- $(lispsource)/textmodes/fill.elc \
- $(lispsource)/newcomment.elc \
- $(lispsource)/replace.elc \
- $(lispsource)/emacs-lisp/tabulated-list.elc \
- $(lispsource)/buff-menu.elc \
- $(lispsource)/fringe.elc \
- $(lispsource)/emacs-lisp/regexp-opt.elc \
- $(lispsource)/image.elc \
- $(lispsource)/international/fontset.elc \
- $(lispsource)/dnd.elc \
- $(lispsource)/tool-bar.elc \
- $(lispsource)/dynamic-setting.elc \
- $(lispsource)/x-dnd.elc \
- $(lispsource)/term/common-win.elc \
- $(lispsource)/term/x-win.elc \
- $(lispsource)/w32-vars.elc \
- $(lispsource)/term/w32-win.elc \
- $(lispsource)/ls-lisp.elc \
- $(lispsource)/disp-table.elc \
- $(lispsource)/dos-w32.elc \
- $(lispsource)/w32-fns.elc \
- $(lispsource)/dos-fns.elc \
- $(lispsource)/dos-vars.elc \
- $(lispsource)/term/pc-win.elc \
- $(lispsource)/term/internal.elc \
- $(lispsource)/term/ns-win.elc \
- $(lispsource)/mwheel.elc \
- $(lispsource)/emacs-lisp/float-sup.elc \
- $(lispsource)/vc/vc-hooks.elc \
- $(lispsource)/vc/ediff-hook.elc \
- $(lispsource)/electric.elc \
- $(lispsource)/emacs-lisp/eldoc.elc \
- $(lispsource)/uniquify.elc \
- $(lispsource)/tooltip.elc
-
-
-### lisp.mk ends here
diff --git a/src/lread.c b/src/lread.c
index a84450a4364..26c19d8338b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4592,8 +4592,10 @@ of the file, regardless of whether or not it has the `.elc' extension. */);
DEFVAR_LISP ("load-read-function", Vload_read_function,
doc: /* Function used by `load' and `eval-region' for reading expressions.
-The default is nil, which means use the function `read'. */);
- Vload_read_function = Qnil;
+Called with a single argument (the stream from which to read).
+The default is to use the function `read'. */);
+ DEFSYM (Qread, "read");
+ Vload_read_function = Qread;
DEFVAR_LISP ("load-source-file-function", Vload_source_file_function,
doc: /* Function called in `load' to load an Emacs Lisp source file.
diff --git a/src/macfont.h b/src/macfont.h
index f311577f051..403be94e332 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -48,7 +48,7 @@ struct mac_glyph_layout
typedef CTFontDescriptorRef FontDescriptorRef;
typedef CTFontRef FontRef;
typedef CTFontSymbolicTraits FontSymbolicTraits;
-typedef CTCharacterCollection CharacterCollection;
+typedef NSCharacterCollection CharacterCollection;
#define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute
#define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute
@@ -79,8 +79,8 @@ enum {
};
enum {
- MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = kCTIdentityMappingCharacterCollection,
- MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = kCTAdobeJapan1CharacterCollection
+ MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = NSIdentityMappingCharacterCollection,
+ MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = NSAdobeJapan1CharacterCollection
};
#define mac_font_descriptor_create_with_attributes \
diff --git a/src/nsfns.m b/src/nsfns.m
index f8863e6d400..8a3c6ccf2b0 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1075,7 +1075,6 @@ This function is an internal primitive--use `make-frame' instead. */)
Lisp_Object name;
int minibuffer_only = 0;
long window_prompting = 0;
- int width, height;
ptrdiff_t count = specpdl_ptr - specpdl;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
Lisp_Object display;
@@ -1455,6 +1454,15 @@ ns_run_file_dialog (void)
ns_fd_data.panel = nil;
}
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9
+#define MODAL_OK_RESPONSE NSModalResponseOK
+#endif
+#endif
+#ifndef MODAL_OK_RESPONSE
+#define MODAL_OK_RESPONSE NSOKButton
+#endif
+
DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0,
doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
Optional arg DIR, if non-nil, supplies a default directory.
@@ -1466,10 +1474,9 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
Lisp_Object init, Lisp_Object dir_only_p)
{
static id fileDelegate = nil;
- BOOL ret;
BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
id panel;
- Lisp_Object fname;
+ Lisp_Object fname = Qnil;
NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
[NSString stringWithUTF8String: SSDATA (prompt)];
@@ -1549,20 +1556,17 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
while (ns_fd_data.panel != nil)
[NSApp run];
- ret = (ns_fd_data.ret == NSOKButton);
-
- if (ret)
+ if (ns_fd_data.ret == MODAL_OK_RESPONSE)
{
NSString *str = ns_filename_from_panel (panel);
if (! str) str = ns_directory_from_panel (panel);
- if (! str) ret = NO;
- else fname = build_string ([str UTF8String]);
+ if (str) fname = build_string ([str UTF8String]);
}
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
unblock_input ();
- return ret ? fname : Qnil;
+ return fname;
}
const char *
@@ -2677,7 +2681,16 @@ compute_tip_xy (struct frame *f,
pt.y = dpyinfo->last_mouse_motion_y;
/* Convert to screen coordinates */
pt = [view convertPoint: pt toView: nil];
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
pt = [[view window] convertBaseToScreen: pt];
+#else
+ {
+ NSRect r = NSMakeRect (pt.x, pt.y, 0, 0);
+ r = [[view window] convertRectToScreen: r];
+ pt.x = r.origin.x;
+ pt.y = r.origin.y;
+ }
+#endif
}
else
{
diff --git a/src/nsimage.m b/src/nsimage.m
index f37ad38ad1e..9302cd2f212 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -53,12 +53,13 @@ int image_trace_num = 0;
========================================================================== */
void *
-ns_image_from_XBM (unsigned char *bits, int width, int height)
+ns_image_from_XBM (unsigned char *bits, int width, int height,
+ unsigned long fg, unsigned long bg)
{
NSTRACE (ns_image_from_XBM);
return [[EmacsImage alloc] initFromXBM: bits
width: width height: height
- flip: YES];
+ fg: fg bg: bg];
}
void *
@@ -186,7 +187,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
/* The next two lines cause the DPI of the image to be ignored.
This seems to be the behavior users expect. */
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
[image setScalesWhenResized: YES];
+#endif
+#endif
[image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
[image setName: [NSString stringWithUTF8String: SSDATA (file)]];
@@ -204,16 +209,8 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
- flip: (BOOL)flip
+ fg: (unsigned long)fg bg: (unsigned long)bg
{
- return [self initFromSkipXBM: bits width: w height: h flip: flip length: 0];
-}
-
-
-- initFromSkipXBM: (unsigned char *)bits width: (int)w height: (int)h
- flip: (BOOL)flip length: (int)length;
-{
- int bpr = (w + 7) / 8;
unsigned char *planes[5];
[self initWithSize: NSMakeSize (w, h)];
@@ -226,57 +223,58 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
bytesPerRow: w bitsPerPixel: 0];
[bmRep getBitmapDataPlanes: planes];
+
+ if (fg == 0 && bg == 0)
+ bg = 0xffffff;
+
{
/* pull bits out to set the (bytewise) alpha mask */
int i, j, k;
unsigned char *s = bits;
+ unsigned char *rr = planes[0];
+ unsigned char *gg = planes[1];
+ unsigned char *bb = planes[2];
unsigned char *alpha = planes[3];
- unsigned char swt[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13,
- 3, 11, 7, 15};
- unsigned char c, bitPat;
-
- for (j = 0; j < h; j++)
- for (i = 0; i < bpr; i++)
+ unsigned char fgr = (fg >> 16) & 0xff;
+ unsigned char fgg = (fg >> 8) & 0xff;
+ unsigned char fgb = fg & 0xff;
+ unsigned char bgr = (bg >> 16) & 0xff;
+ unsigned char bgg = (bg >> 8) & 0xff;
+ unsigned char bgb = bg & 0xff;
+ unsigned char c;
+
+ int idx = 0;
+ for (j = 0; j < h; ++j)
+ for (i = 0; i < w; )
{
- if (length)
+ c = *s++;
+ for (k = 0; i < w && k < 8; ++k, ++i)
{
- unsigned char s1, s2;
- while (*s++ != 'x' && s < bits + length);
- if (s >= bits + length)
+ *alpha++ = 0xff;
+ if (c & 1)
{
- [bmRep release];
- bmRep = nil;
- return nil;
+ *rr++ = fgr;
+ *gg++ = fgg;
+ *bb++ = fgb;
}
-#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
- s1 = *s++;
- s2 = *s++;
- c = hexchar (s1) * 0x10 + hexchar (s2);
- }
- else
- c = *s++;
-
- bitPat = flip ? swt[c >> 4] | (swt[c & 0xf] << 4) : c ^ 255;
- for (k =0; k<8; k++)
- {
- *alpha++ = (bitPat & 0x80) ? 0xff : 0;
- bitPat <<= 1;
+ else
+ {
+ *rr++ = bgr;
+ *gg++ = bgg;
+ *bb++ = bgb;
+ }
+ idx++;
+ c >>= 1;
}
}
}
+ xbm_fg = fg;
[self addRepresentation: bmRep];
-
- memset (planes[0], 0, w*h);
- memset (planes[1], 0, w*h);
- memset (planes[2], 0, w*h);
- [self setXBMColor: [NSColor blackColor]];
return self;
}
-
-/* Set color for a bitmap image (see initFromSkipXBM). Note that the alpha
- is used as a mask, so we just memset the entire array. */
+/* Set color for a bitmap image. */
- setXBMColor: (NSColor *)color
{
NSSize s = [self size];
@@ -296,19 +294,21 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
[bmRep getBitmapDataPlanes: planes];
- /* we used to just do this, but Cocoa seems to have a bug when rendering
- an alpha-masked image onto a dark background where it bloats the mask */
- /* memset (planes[0..2], r, g, b*0xff, len); */
{
int i, len = s.width*s.height;
int rr = r * 0xff, gg = g * 0xff, bb = b * 0xff;
- for (i =0; i<len; i++)
- if (planes[3][i] != 0)
+ unsigned char fgr = (xbm_fg >> 16) & 0xff;
+ unsigned char fgg = (xbm_fg >> 8) & 0xff;
+ unsigned char fgb = xbm_fg & 0xff;
+
+ for (i = 0; i < len; ++i)
+ if (planes[0][i] == fgr && planes[1][i] == fgg && planes[2][i] == fgb)
{
planes[0][i] = rr;
planes[1][i] = gg;
planes[2][i] = bb;
}
+ xbm_fg = ((rr << 16) & 0xff) + ((gg << 8) & 0xff) + (bb & 0xff);
}
return self;
@@ -356,7 +356,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
/* The next two lines cause the DPI of the image to be ignored.
This seems to be the behavior users expect. */
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
[self setScalesWhenResized: YES];
+#endif
+#endif
[self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])];
break;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 26fe26e5e0d..b5cb64d68e5 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1418,7 +1418,7 @@ Lisp_Object
ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
{
id dialog;
- Lisp_Object window, tem, title;
+ Lisp_Object tem, title;
NSPoint p;
BOOL isQ;
NSAutoreleasePool *pool;
@@ -1506,7 +1506,11 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
area.size.width = ICONSIZE;
area.size.height= ICONSIZE;
img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
[img setScalesWhenResized: YES];
+#endif
+#endif
[img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
imgView = [[NSImageView alloc] initWithFrame: area];
[imgView setImage: img];
diff --git a/src/nsterm.h b/src/nsterm.h
index 9035ee1a328..c06b7c49a6d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -341,13 +341,12 @@ typedef float EmacsCGFloat;
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
NSColor *stippleMask;
+ unsigned long xbm_fg;
}
+ allocInitFromFile: (Lisp_Object)file;
- (void)dealloc;
- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
- flip: (BOOL)flip;
-- initFromSkipXBM: (unsigned char *)bits width: (int)w height: (int)h
- flip: (BOOL)flip length: (int)length;
+ fg: (unsigned long)fg bg: (unsigned long)bg;
- setXBMColor: (NSColor *)color;
- initForXPMWithDepth: (int)depth width: (int)width height: (int)height;
- (void)setPixmapData;
@@ -397,6 +396,7 @@ typedef float EmacsCGFloat;
- condemn;
- reprieve;
- (bool)judge;
++ (CGFloat)scrollerWidth;
@end
@@ -864,7 +864,8 @@ extern void syms_of_nsselect (void);
/* From nsimage.m, needed in image.c */
struct image;
-extern void *ns_image_from_XBM (unsigned char *bits, int width, int height);
+extern void *ns_image_from_XBM (unsigned char *bits, int width, int height,
+ unsigned long fg, unsigned long bg);
extern void *ns_image_for_XPM (int width, int height, int depth);
extern void *ns_image_from_file (Lisp_Object file);
extern bool ns_load_image (struct frame *f, struct image *img,
diff --git a/src/nsterm.m b/src/nsterm.m
index e90c3d70db3..67a03898d13 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1538,7 +1538,7 @@ ns_get_color (const char *name, NSColor **col)
{
NSColor *new = nil;
static char hex[20];
- int scaling;
+ int scaling = 0;
float r = -1.0, g, b;
NSString *nsname = [NSString stringWithUTF8String: name];
@@ -2093,6 +2093,18 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
return;
}
+static void
+ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
+{
+ if (FRAME_NS_VIEW (f))
+ {
+ ns_focus (f, &dest, 1);
+ [FRAME_NS_VIEW (f) scrollRect: src
+ by: NSMakeSize (dest.origin.x - src.origin.x,
+ dest.origin.y - src.origin.y)];
+ ns_unfocus (f);
+ }
+}
static void
ns_scroll_run (struct window *w, struct run *run)
@@ -2145,11 +2157,8 @@ ns_scroll_run (struct window *w, struct run *run)
{
NSRect srcRect = NSMakeRect (x, from_y, width, height);
NSRect dstRect = NSMakeRect (x, to_y, width, height);
- NSPoint dstOrigin = NSMakePoint (x, to_y);
- ns_focus (f, &dstRect, 1);
- NSCopyBits (0, srcRect , dstOrigin);
- ns_unfocus (f);
+ ns_copy_bits (f, srcRect , dstRect);
}
unblock_input ();
@@ -2205,13 +2214,10 @@ ns_shift_glyphs_for_insert (struct frame *f,
{
NSRect srcRect = NSMakeRect (x, y, width, height);
NSRect dstRect = NSMakeRect (x+shift_by, y, width, height);
- NSPoint dstOrigin = dstRect.origin;
NSTRACE (ns_shift_glyphs_for_insert);
- ns_focus (f, &dstRect, 1);
- NSCopyBits (0, srcRect, dstOrigin);
- ns_unfocus (f);
+ ns_copy_bits (f, srcRect, dstRect);
}
@@ -2317,7 +2323,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
for (i = 0; i < len; i++)
cbits[i] = ~(bits[i] & 0xff);
img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h
- flip: NO];
+ fg: 0 bg: 0];
bimgs[p->which - 1] = img;
xfree (cbits);
}
@@ -2459,6 +2465,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
switch (cursor_type)
{
+ case DEFAULT_CURSOR:
case NO_CURSOR:
break;
case FILLED_BOX_CURSOR:
@@ -3188,6 +3195,96 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
static void
+ns_draw_composite_glyph_string_foreground (struct glyph_string *s)
+{
+ int i, j, x;
+ struct font *font = s->font;
+
+ /* If first glyph of S has a left box line, start drawing the text
+ of S to the right of that box line. */
+ if (s->face && s->face->box != FACE_NO_BOX
+ && s->first_glyph->left_box_line_p)
+ x = s->x + eabs (s->face->box_line_width);
+ else
+ x = s->x;
+
+ /* S is a glyph string for a composition. S->cmp_from is the index
+ of the first character drawn for glyphs of this composition.
+ S->cmp_from == 0 means we are drawing the very first character of
+ this composition. */
+
+ /* Draw a rectangle for the composition if the font for the very
+ first character of the composition could not be loaded. */
+ if (s->font_not_found_p)
+ {
+ if (s->cmp_from == 0)
+ {
+ NSRect r = NSMakeRect (s->x, s->y, s->width-1, s->height -1);
+ ns_draw_box (r, 1, FRAME_CURSOR_COLOR (s->f), 1, 1);
+ }
+ }
+ else if (! s->first_glyph->u.cmp.automatic)
+ {
+ int y = s->ybase;
+
+ for (i = 0, j = s->cmp_from; i < s->nchars; i++, j++)
+ /* TAB in a composition means display glyphs with padding
+ space on the left or right. */
+ if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
+ {
+ int xx = x + s->cmp->offsets[j * 2];
+ int yy = y - s->cmp->offsets[j * 2 + 1];
+
+ font->driver->draw (s, j, j + 1, xx, yy, false);
+ if (s->face->overstrike)
+ font->driver->draw (s, j, j + 1, xx + 1, yy, false);
+ }
+ }
+ else
+ {
+ Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
+ Lisp_Object glyph;
+ int y = s->ybase;
+ int width = 0;
+
+ for (i = j = s->cmp_from; i < s->cmp_to; i++)
+ {
+ glyph = LGSTRING_GLYPH (gstring, i);
+ if (NILP (LGLYPH_ADJUSTMENT (glyph)))
+ width += LGLYPH_WIDTH (glyph);
+ else
+ {
+ int xoff, yoff, wadjust;
+
+ if (j < i)
+ {
+ font->driver->draw (s, j, i, x, y, false);
+ if (s->face->overstrike)
+ font->driver->draw (s, j, i, x + 1, y, false);
+ x += width;
+ }
+ xoff = LGLYPH_XOFF (glyph);
+ yoff = LGLYPH_YOFF (glyph);
+ wadjust = LGLYPH_WADJUST (glyph);
+ font->driver->draw (s, i, i + 1, x + xoff, y + yoff, false);
+ if (s->face->overstrike)
+ font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff,
+ false);
+ x += wadjust;
+ j = i + 1;
+ width = 0;
+ }
+ }
+ if (j < i)
+ {
+ font->driver->draw (s, j, i, x, y, false);
+ if (s->face->overstrike)
+ font->driver->draw (s, j, i, x + 1, y, false);
+ }
+ }
+}
+
+static void
ns_draw_glyph_string (struct glyph_string *s)
/* --------------------------------------------------------------------------
External (RIF): Main draw-text call.
@@ -3279,13 +3376,14 @@ ns_draw_glyph_string (struct glyph_string *s)
{
BOOL isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
- int end = isComposite ? s->cmp_to : s->nchars;
-
- font->driver->draw
- (s, s->cmp_from, end, s->x, s->ybase,
- (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
- || flags == NS_DUMPGLYPH_MOUSEFACE);
+ if (isComposite)
+ ns_draw_composite_glyph_string_foreground (s);
+ else
+ font->driver->draw
+ (s, s->cmp_from, s->nchars, s->x, s->ybase,
+ (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
+ || flags == NS_DUMPGLYPH_MOUSEFACE);
}
{
@@ -3866,7 +3964,6 @@ ns_set_horizontal_scroll_bar (struct window *window,
EmacsScroller *bar;
int top, height, left, width;
int window_x, window_width;
- int pixel_width = WINDOW_PIXEL_WIDTH (window);
BOOL update_p = YES;
/* optimization; display engine sends WAY too many of these.. */
@@ -4224,6 +4321,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
terminal->menu_show_hook = ns_menu_show;
terminal->popup_dialog_hook = ns_popup_dialog;
terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
+ terminal->set_horizontal_scroll_bar_hook = ns_set_horizontal_scroll_bar;
terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
@@ -4508,7 +4606,7 @@ ns_term_shutdown (int sig)
- (id)init
{
- if (self = [super init])
+ if ((self = [super init]))
{
#ifdef NS_IMPL_COCOA
self->isFirst = YES;
@@ -4795,21 +4893,43 @@ ns_term_shutdown (int sig)
EV_TRAILER ((id)nil);
}
+static bool
+runAlertPanel(NSString *title,
+ NSString *msgFormat,
+ NSString *defaultButton,
+ NSString *alternateButton)
+{
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
+ return NSRunAlertPanel(title, msgFormat, defaultButton, alternateButton, nil)
+ == NSAlertDefaultReturn;
+#else
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setAlertStyle: NSCriticalAlertStyle];
+ [alert setMessageText: msgFormat];
+ [alert addButtonWithTitle: defaultButton];
+ [alert addButtonWithTitle: alternateButton];
+ NSInteger ret = [alert runModal];
+ [alert release];
+ return ret == NSAlertFirstButtonReturn;
+#endif
+}
+
- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
{
- int ret;
+ bool ret;
if (NILP (ns_confirm_quit)) // || ns_shutdown_properly --> TO DO
return NSTerminateNow;
- ret = NSRunAlertPanel(ns_app_name,
- @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?",
- @"Save Buffers and Exit", @"Cancel", nil);
+ ret = runAlertPanel(ns_app_name,
+ @"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?",
+ @"Save Buffers and Exit", @"Cancel");
- if (ret == NSAlertDefaultReturn)
+ if (ret)
return NSTerminateNow;
- else if (ret == NSAlertAlternateReturn)
+ else
return NSTerminateCancel;
return NSTerminateNow; /* just in case */
}
@@ -5153,9 +5273,6 @@ not_in_argv (NSString *arg)
int code;
unsigned fnKeysym = 0;
static NSMutableArray *nsEvArray;
-#ifdef NS_IMPL_GNUSTEP
- static BOOL firstTime = YES;
-#endif
int left_is_none;
unsigned int flags = [theEvent modifierFlags];
@@ -5384,18 +5501,6 @@ not_in_argv (NSString *arg)
}
-#ifdef NS_IMPL_GNUSTEP
- /* if we get here we should send the key for input manager processing */
- /* Disable warning, there is nothing a user can do about it anyway, and
- it does not seem to matter. */
-#if 0
- if (firstTime && [[NSInputManager currentInputManager]
- wantsToDelayTextChangeNotifications] == NO)
- fprintf (stderr,
- "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n");
-#endif
- firstTime = NO;
-#endif
if (NS_KEYLOG && !processingCompose)
fprintf (stderr, "keyDown: Begin compose sequence.\n");
@@ -6160,8 +6265,10 @@ if (cols > 0 && rows > 0)
[win setAcceptsMouseMovedEvents: YES];
[win setDelegate: self];
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
[win useOptimizedDrawing: YES];
-
+#endif
sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
[win setResizeIncrements: sz];
@@ -6222,8 +6329,10 @@ if (cols > 0 && rows > 0)
if ([col alphaComponent] != (EmacsCGFloat) 1.0)
[win setOpaque: NO];
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
[self allocateGState];
-
+#endif
[NSApp registerServicesMenuSendTypes: ns_send_types
returnTypes: nil];
@@ -6278,7 +6387,7 @@ if (cols > 0 && rows > 0)
}
else if (next_maximized == FULLSCREEN_HEIGHT
|| (next_maximized == -1
- && abs (defaultFrame.size.height - result.size.height)
+ && abs ((int)(defaultFrame.size.height - result.size.height))
> FRAME_LINE_HEIGHT (emacsframe)))
{
/* first click */
@@ -6301,7 +6410,7 @@ if (cols > 0 && rows > 0)
}
else if (next_maximized == FULLSCREEN_MAXIMIZED
|| (next_maximized == -1
- && abs (defaultFrame.size.width - result.size.width)
+ && abs ((int)(defaultFrame.size.width - result.size.width))
> FRAME_COLUMN_WIDTH (emacsframe)))
{
result = defaultFrame; /* second click */
@@ -6548,7 +6657,10 @@ if (cols > 0 && rows > 0)
[fw setTitle:[w title]];
[fw setDelegate:self];
[fw setAcceptsMouseMovedEvents: YES];
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
[fw useOptimizedDrawing: YES];
+#endif
[fw setResizeIncrements: sz];
[fw setBackgroundColor: col];
if ([col alphaComponent] != (EmacsCGFloat) 1.0)
@@ -6791,7 +6903,7 @@ if (cols > 0 && rows > 0)
/* NSDraggingDestination protocol methods. Actually this is not really a
protocol, but a category of Object. O well... */
--(NSUInteger) draggingEntered: (id <NSDraggingInfo>) sender
+-(NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
{
NSTRACE (draggingEntered);
return NSDragOperationGeneric;
@@ -7076,7 +7188,6 @@ if (cols > 0 && rows > 0)
one screen, we want to constrain. Other times not. */
NSArray *screens = [NSScreen screens];
NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i;
- struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
NSTRACE (constrainFrameRect);
NSTRACE_RECT ("input", frameRect);
@@ -7172,7 +7283,15 @@ if (cols > 0 && rows > 0)
{
/* TODO: if we want to allow variable widths, this is the place to do it,
however neither GNUstep nor Cocoa support it very well */
- return [NSScroller scrollerWidth];
+ CGFloat r;
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+ r = [NSScroller scrollerWidth];
+#else
+ r = [NSScroller scrollerWidthForControlSize: NSRegularControlSize
+ scrollerStyle: NSScrollerStyleLegacy];
+#endif
+ return r;
}
diff --git a/src/process.c b/src/process.c
index 3e04cb76387..ce78d818e29 100644
--- a/src/process.c
+++ b/src/process.c
@@ -136,8 +136,8 @@ extern int sys_select (int, fd_set *, fd_set *, fd_set *,
/* Work around GCC 4.7.0 bug with strict overflow checking; see
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
- These lines can be removed once the GCC bug is fixed. */
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+ This bug appears to be fixed in GCC 5.1, so don't work around it there. */
+#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3
# pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
diff --git a/src/syntax.c b/src/syntax.c
index 2f821564294..1695815902a 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -186,7 +186,7 @@ static bool in_classes (int, Lisp_Object);
static void
bset_syntax_table (struct buffer *b, Lisp_Object val)
{
- b->INTERNAL_FIELD (syntax_table) = val;
+ b->syntax_table_ = val;
}
/* Whether the syntax of the character C has the prefix flag set. */
diff --git a/src/window.c b/src/window.c
index 0fcf82d43f4..b8281661b4d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1748,7 +1748,11 @@ if it isn't already recorded. */)
|| b->clip_changed
|| b->prevent_redisplay_optimizations_p
|| window_outdated (w))
- && !noninteractive)
+ /* Don't call display routines if we didn't yet create any real
+ frames, because the glyph matrices are not yet allocated in
+ that case. This could happen in some code that runs in the
+ daemon during initialization (e.g., see bug#20565). */
+ && !(noninteractive || FRAME_INITIAL_P (WINDOW_XFRAME (w))))
{
struct text_pos startp;
struct it it;
diff --git a/src/xdisp.c b/src/xdisp.c
index 5a27adc2b18..c2f0b747c6e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13359,6 +13359,13 @@ redisplay_internal (void)
if (f->fonts_changed)
{
adjust_frame_glyphs (f);
+ /* Disable all redisplay optimizations for this frame.
+ This is because adjust_frame_glyphs resets the
+ enabled_p flag for all glyph rows of all windows, so
+ many optimizations will fail anyway, and some might
+ fail to test that flag and do bogus things as
+ result. */
+ SET_FRAME_GARBAGED (f);
f->fonts_changed = false;
}
/* If cursor type has been changed on the frame
@@ -13753,6 +13760,10 @@ redisplay_internal (void)
if (f->fonts_changed)
{
adjust_frame_glyphs (f);
+ /* Disable all redisplay optimizations for this
+ frame. For the reasons, see the comment near
+ the previous call to adjust_frame_glyphs above. */
+ SET_FRAME_GARBAGED (f);
f->fonts_changed = false;
goto retry_frame;
}
diff --git a/src/xterm.c b/src/xterm.c
index 3d3e0a70cfa..8f595c87214 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -263,7 +263,7 @@ static int x_dispatch_event (XEvent *, Display *);
#endif
/* Don't declare this _Noreturn because we want no
interference with debugging failing X calls. */
-static void x_connection_closed (Display *, const char *);
+static void x_connection_closed (Display *, const char *, bool);
static void x_wm_set_window_state (struct frame *, int);
static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
static void x_initialize (void);
@@ -3664,7 +3664,9 @@ x_draw_glyph_string (struct glyph_string *s)
static void
x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by)
{
- x_free_cr_resources (f);
+/* Never called on a GUI frame, see
+ http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00456.html
+*/
XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f),
f->output_data.x->normal_gc,
x, y, width, height,
@@ -9249,7 +9251,7 @@ static char *error_msg;
the text of an error message that lead to the connection loss. */
static void
-x_connection_closed (Display *dpy, const char *error_message)
+x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
{
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
Lisp_Object frame, tail;
@@ -9268,6 +9270,7 @@ x_connection_closed (Display *dpy, const char *error_message)
dpyinfo->reference_count++;
dpyinfo->terminal->reference_count++;
}
+ if (ioerror) dpyinfo->display = 0;
/* First delete frames whose mini-buffers are on frames
that are on the dead display. */
@@ -9405,7 +9408,7 @@ x_error_quitter (Display *display, XErrorEvent *event)
XGetErrorText (display, event->error_code, buf, sizeof (buf));
sprintf (buf1, "X protocol error: %s on protocol request %d",
buf, event->request_code);
- x_connection_closed (display, buf1);
+ x_connection_closed (display, buf1, false);
}
@@ -9420,7 +9423,7 @@ x_io_error_quitter (Display *display)
snprintf (buf, sizeof buf, "Connection lost to X server `%s'",
DisplayString (display));
- x_connection_closed (display, buf);
+ x_connection_closed (display, buf, true);
return 0;
}
@@ -12251,7 +12254,7 @@ static struct redisplay_interface x_redisplay_interface =
x_draw_window_cursor,
x_draw_vertical_window_border,
x_draw_window_divider,
- x_shift_glyphs_for_insert,
+ x_shift_glyphs_for_insert, /* Never called, se comment in function. */
x_show_hourglass,
x_hide_hourglass
};