[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 46cfe5c 6/7: Check for existence of terminal hooks
From: |
Alexander Gramiak |
Subject: |
[Emacs-diffs] master 46cfe5c 6/7: Check for existence of terminal hooks before use |
Date: |
Fri, 26 Apr 2019 18:59:17 -0400 (EDT) |
branch: master
commit 46cfe5cb1fe9cca5e2fa9f993320c46b1b564609
Author: Alexander Gramiak <address@hidden>
Commit: Alexander Gramiak <address@hidden>
Check for existence of terminal hooks before use
This should not be necessary, and is merely a precaution. For
background, see:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00639.html
* src/frame.c:
* src/xdisp.c: Check for existence of terminal hooks before use.
---
src/frame.c | 39 +++++++++++++++++++++++----------------
src/frame.h | 3 ++-
src/xdisp.c | 13 ++++++++-----
3 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/src/frame.c b/src/frame.c
index 22a7985..328facd 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -482,7 +482,8 @@ keep_ratio (struct frame *f, struct frame *p, int
old_width, int old_height,
f->top_pos = pos_y;
}
- FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1);
+ if (FRAME_TERMINAL (f)->set_frame_offset_hook)
+ FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1);
}
if (!CONSP (keep_ratio) || !NILP (Fcar (keep_ratio)))
@@ -669,11 +670,12 @@ adjust_frame_size (struct frame *f, int new_width, int
new_height, int inhibit,
list2 (inhibit_horizontal ? Qt : Qnil,
inhibit_vertical ? Qt : Qnil));
- FRAME_TERMINAL (f)->set_window_size_hook (f,
- 0,
- new_text_width,
- new_text_height,
- 1);
+ if (FRAME_TERMINAL (f)->set_window_size_hook)
+ FRAME_TERMINAL (f)->set_window_size_hook (f,
+ 0,
+ new_text_width,
+ new_text_height,
+ 1);
f->resized_p = true;
return;
@@ -1370,7 +1372,7 @@ do_switch_frame (Lisp_Object frame, int track, int
for_deletion, Lisp_Object nor
#else /* ! 0 */
/* Instead, apply it only to the frame we're pointing to. */
#ifdef HAVE_WINDOW_SYSTEM
- if (track && FRAME_WINDOW_P (f))
+ if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame)
{
Lisp_Object focus, gfocus;
@@ -2836,7 +2838,7 @@ If there is no window system support, this function does
nothing. */)
{
#ifdef HAVE_WINDOW_SYSTEM
struct frame *f = decode_window_system_frame (frame);
- if (f)
+ if (f && FRAME_TERMINAL (f)->focus_frame_hook)
FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate));
#endif
return Qnil;
@@ -3602,10 +3604,11 @@ bottom edge of FRAME's display. */)
if (FRAME_WINDOW_P (f))
{
#ifdef HAVE_WINDOW_SYSTEM
- FRAME_TERMINAL (f)->set_frame_offset_hook (f,
- XFIXNUM (x),
- XFIXNUM (y),
- 1);
+ if (FRAME_TERMINAL (f)->set_frame_offset_hook)
+ FRAME_TERMINAL (f)->set_frame_offset_hook (f,
+ XFIXNUM (x),
+ XFIXNUM (y),
+ 1);
#endif
}
@@ -4161,7 +4164,8 @@ gui_set_frame_parameters (struct frame *f, Lisp_Object
alist)
f->win_gravity = NorthWestGravity;
/* Actually set that position, and convert to absolute. */
- FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1);
+ if (FRAME_TERMINAL (f)->set_frame_offset_hook)
+ FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1);
}
if (fullscreen_change)
@@ -4436,7 +4440,8 @@ gui_set_font (struct frame *f, Lisp_Object arg,
Lisp_Object oldval)
if (! NILP (Fequal (font_object, oldval)))
return;
- FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset);
+ if (FRAME_TERMINAL (f)->set_new_font_hook)
+ FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset);
store_frame_param (f, Qfont, arg);
#ifdef HAVE_X_WINDOWS
store_frame_param (f, Qfont_parameter, font_param);
@@ -4716,7 +4721,8 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object
arg, Lisp_Object oldval)
}
else
{
- FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f);
+ if (FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook)
+ FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f);
if (FRAME_NATIVE_WINDOW (f))
adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
@@ -4746,7 +4752,8 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object
arg, Lisp_Object oldval)
}
else
{
- FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f);
+ if (FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook)
+ FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f);
if (FRAME_NATIVE_WINDOW (f))
adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
diff --git a/src/frame.h b/src/frame.h
index e66590e..7059773 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1602,7 +1602,8 @@ gui_set_bitmap_icon (struct frame *f)
{
Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist);
- if (CONSP (obj) && !NILP (XCDR (obj)))
+ if (CONSP (obj) && !NILP (XCDR (obj))
+ && FRAME_TERMINAL (f)->set_bitmap_icon_hook)
FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj));
}
diff --git a/src/xdisp.c b/src/xdisp.c
index 19fbf93..34e89c7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12077,9 +12077,10 @@ gui_consider_frame_title (Lisp_Object frame)
already wasted too much time by walking through the list with
display_mode_element, then we might need to optimize at a
higher level than this.) */
- if (! STRINGP (f->name)
- || SBYTES (f->name) != len
- || memcmp (title, SDATA (f->name), len) != 0)
+ if ((! STRINGP (f->name)
+ || SBYTES (f->name) != len
+ || memcmp (title, SDATA (f->name), len) != 0)
+ && FRAME_TERMINAL (f)->implicit_set_name_hook)
FRAME_TERMINAL (f)->implicit_set_name_hook (f,
make_string (title, len),
Qnil);
@@ -12856,7 +12857,8 @@ redisplay_tool_bar (struct frame *f)
if (new_height != WINDOW_PIXEL_HEIGHT (w))
{
- FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height);
+ if (FRAME_TERMINAL (f)->change_tool_bar_height_hook)
+ FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height);
frame_default_tool_bar_height = new_height;
/* Always do that now. */
clear_glyph_matrix (w->desired_matrix);
@@ -12951,7 +12953,8 @@ redisplay_tool_bar (struct frame *f)
if (change_height_p)
{
- FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height);
+ if (FRAME_TERMINAL (f)->change_tool_bar_height_hook)
+ FRAME_TERMINAL (f)->change_tool_bar_height_hook (f,
new_height);
frame_default_tool_bar_height = new_height;
clear_glyph_matrix (w->desired_matrix);
f->n_tool_bar_rows = nrows;
- [Emacs-diffs] master updated (86b6e91 -> 0239767), Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master da9541d 2/7: Add prefixes to some window system-dependent procedures, Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master 46cfe5c 6/7: Check for existence of terminal hooks before use,
Alexander Gramiak <=
- [Emacs-diffs] master 41e20ee 4/7: Add terminal hook defined_color_hook, Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master 5d8b0fa 5/7: Add terminal hook query_frame_background_color, Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master ff4e31f 1/7: Rename generic x_* procedures in xdisp.c, Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master 0239767 7/7: Rename x_highlight_frame property to highlight_frame, Alexander Gramiak, 2019/04/26
- [Emacs-diffs] master a411517 3/7: Rename generic x_* identifiers, Alexander Gramiak, 2019/04/26