aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2016-03-30 16:53:36 +0000
committerAlan Mackenzie2016-03-30 16:53:36 +0000
commited19f207449c43f7f08285ada87ae7a46c61c8d1 (patch)
treefc495d64b752f276f1e8dc86427098de80789988 /src
parenteabd667a9584fe5bd2422e296d256dceea67debf (diff)
parent7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 (diff)
downloademacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.tar.gz
emacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.zip
Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25 into emacs-25
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c2
-rw-r--r--src/bidi.c2
-rw-r--r--src/editfns.c6
-rw-r--r--src/emacsgtkfixed.c3
-rw-r--r--src/emacsgtkfixed.h1
-rw-r--r--src/floatfns.c3
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c2
-rw-r--r--src/ftfont.c7
-rw-r--r--src/gtkutil.c112
-rw-r--r--src/image.c3
-rw-r--r--src/keyboard.c19
-rw-r--r--src/lisp.h3
-rw-r--r--src/nsterm.m172
-rw-r--r--src/term.c7
-rw-r--r--src/w32font.c3
-rw-r--r--src/xdisp.c90
-rw-r--r--src/xfns.c2
-rw-r--r--src/xwidget.c4
19 files changed, 298 insertions, 145 deletions
diff --git a/src/alloc.c b/src/alloc.c
index b5be0f6e69c..4c9cbf10724 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3730,7 +3730,6 @@ make_save_ptr_int (void *a, ptrdiff_t b)
3730 return val; 3730 return val;
3731} 3731}
3732 3732
3733#if ! (defined USE_X_TOOLKIT || defined USE_GTK)
3734Lisp_Object 3733Lisp_Object
3735make_save_ptr_ptr (void *a, void *b) 3734make_save_ptr_ptr (void *a, void *b)
3736{ 3735{
@@ -3741,7 +3740,6 @@ make_save_ptr_ptr (void *a, void *b)
3741 p->data[1].pointer = b; 3740 p->data[1].pointer = b;
3742 return val; 3741 return val;
3743} 3742}
3744#endif
3745 3743
3746Lisp_Object 3744Lisp_Object
3747make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) 3745make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c)
diff --git a/src/bidi.c b/src/bidi.c
index a68ffdb7e6d..c23ff954356 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -532,7 +532,7 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
532 /* Copy everything from the start through the active part of 532 /* Copy everything from the start through the active part of
533 the level stack. */ 533 the level stack. */
534 memcpy (to, from, 534 memcpy (to, from,
535 (offsetof (struct bidi_it, level_stack[1]) 535 (offsetof (struct bidi_it, level_stack) + sizeof from->level_stack[0]
536 + from->stack_idx * sizeof from->level_stack[0])); 536 + from->stack_idx * sizeof from->level_stack[0]));
537} 537}
538 538
diff --git a/src/editfns.c b/src/editfns.c
index df982234977..2ac0537eddb 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1456,7 +1456,7 @@ time_overflow (void)
1456 error ("Specified time is not representable"); 1456 error ("Specified time is not representable");
1457} 1457}
1458 1458
1459static void 1459static _Noreturn void
1460invalid_time (void) 1460invalid_time (void)
1461{ 1461{
1462 error ("Invalid time specification"); 1462 error ("Invalid time specification");
@@ -1848,7 +1848,9 @@ lisp_time_struct (Lisp_Object specified_time, int *plen)
1848 Lisp_Object high, low, usec, psec; 1848 Lisp_Object high, low, usec, psec;
1849 struct lisp_time t; 1849 struct lisp_time t;
1850 int len = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec); 1850 int len = disassemble_lisp_time (specified_time, &high, &low, &usec, &psec);
1851 int val = len ? decode_time_components (high, low, usec, psec, &t, 0) : 0; 1851 if (!len)
1852 invalid_time ();
1853 int val = decode_time_components (high, low, usec, psec, &t, 0);
1852 check_time_validity (val); 1854 check_time_validity (val);
1853 *plen = len; 1855 *plen = len;
1854 return t; 1856 return t;
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index cebd7b613c7..ca0bbfbb866 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -27,13 +27,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "emacsgtkfixed.h" 27#include "emacsgtkfixed.h"
28 28
29/* Silence a bogus diagnostic; see GNOME bug 683906. */ 29/* Silence a bogus diagnostic; see GNOME bug 683906. */
30#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) 30#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) && ! GLIB_CHECK_VERSION (2, 35, 7)
31# pragma GCC diagnostic push 31# pragma GCC diagnostic push
32# pragma GCC diagnostic ignored "-Wunused-local-typedefs" 32# pragma GCC diagnostic ignored "-Wunused-local-typedefs"
33#endif 33#endif
34 34
35typedef struct _EmacsFixed EmacsFixed; 35typedef struct _EmacsFixed EmacsFixed;
36typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
37typedef struct _EmacsFixedClass EmacsFixedClass; 36typedef struct _EmacsFixedClass EmacsFixedClass;
38 37
39struct _EmacsFixedPrivate 38struct _EmacsFixedPrivate
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
index 3d6a76ab570..0d09525e02a 100644
--- a/src/emacsgtkfixed.h
+++ b/src/emacsgtkfixed.h
@@ -30,7 +30,6 @@ G_BEGIN_DECLS
30struct frame; 30struct frame;
31 31
32typedef struct _EmacsFixedPrivate EmacsFixedPrivate; 32typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
33typedef struct _EmacsFixedClass EmacsFixedClass;
34 33
35struct _EmacsFixed 34struct _EmacsFixed
36{ 35{
diff --git a/src/floatfns.c b/src/floatfns.c
index b9af03b3431..c1bd25877e3 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -3,8 +3,7 @@
3Copyright (C) 1988, 1993-1994, 1999, 2001-2016 Free Software Foundation, 3Copyright (C) 1988, 1993-1994, 1999, 2001-2016 Free Software Foundation,
4Inc. 4Inc.
5 5
6Author: Wolfgang Rupprecht (ac 6Author: Wolfgang Rupprecht (according to ack.texi)
7ording to ack.texi)
8 7
9This file is part of GNU Emacs. 8This file is part of GNU Emacs.
10 9
diff --git a/src/font.c b/src/font.c
index 5ab3b3e8399..2519599bc63 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5317,7 +5317,7 @@ syms_of_font (void)
5317 DEFSYM (Qja, "ja"); 5317 DEFSYM (Qja, "ja");
5318 DEFSYM (Qko, "ko"); 5318 DEFSYM (Qko, "ko");
5319 5319
5320 DEFSYM (QCuser_spec, "user-spec"); 5320 DEFSYM (QCuser_spec, ":user-spec");
5321 5321
5322 staticpro (&scratch_font_spec); 5322 staticpro (&scratch_font_spec);
5323 scratch_font_spec = Ffont_spec (0, NULL); 5323 scratch_font_spec = Ffont_spec (0, NULL);
diff --git a/src/frame.c b/src/frame.c
index 7511d5323ca..53ff05965c1 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4565,7 +4565,7 @@ On Nextstep, this just calls `ns-parse-geometry'. */)
4565 4565
4566 This function does not make the coordinates positive. */ 4566 This function does not make the coordinates positive. */
4567 4567
4568#define DEFAULT_ROWS 35 4568#define DEFAULT_ROWS 36
4569#define DEFAULT_COLS 80 4569#define DEFAULT_COLS 80
4570 4570
4571long 4571long
diff --git a/src/ftfont.c b/src/ftfont.c
index a402245a067..7285aee9bd4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2596,7 +2596,12 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
2596 language information, and select a proper flt for them 2596 language information, and select a proper flt for them
2597 here. */ 2597 here. */
2598 int c1 = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 1)); 2598 int c1 = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 1));
2599 if (CHAR_HAS_CATEGORY (c1, '^')) 2599 /* For the combining characters in the range U+300..U+36F,
2600 "combining" is the sole FLT provided by the m17n-lib. In
2601 addition, it is the sole FLT that can handle the other
2602 combining characters with non-OTF fonts. */
2603 if ((0x300 <= c1 && c1 <= 0x36F)
2604 || (! otf && CHAR_HAS_CATEGORY (c1, '^')))
2600 flt = mflt_get (msymbol ("combining")); 2605 flt = mflt_get (msymbol ("combining"));
2601 } 2606 }
2602 if (! flt && ! otf) 2607 if (! flt && ! otf)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 7dca5851f29..e791e6ac317 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -252,35 +252,6 @@ xg_create_default_cursor (Display *dpy)
252 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); 252 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
253} 253}
254 254
255static GdkPixbuf *
256xg_get_pixbuf_from_pixmap (struct frame *f, Pixmap pix)
257{
258 int iunused;
259 GdkPixbuf *tmp_buf;
260 Window wunused;
261 unsigned int width, height, uunused;
262 XImage *xim;
263
264 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
265 &width, &height, &uunused, &uunused);
266
267 xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height,
268 ~0, XYPixmap);
269 if (!xim) return 0;
270
271 tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data,
272 GDK_COLORSPACE_RGB,
273 FALSE,
274 xim->bitmap_unit,
275 width,
276 height,
277 xim->bytes_per_line,
278 NULL,
279 NULL);
280 XDestroyImage (xim);
281 return tmp_buf;
282}
283
284/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 255/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
285 256
286static GdkPixbuf * 257static GdkPixbuf *
@@ -288,46 +259,43 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f,
288 Pixmap pix, 259 Pixmap pix,
289 Pixmap mask) 260 Pixmap mask)
290{ 261{
291 int width, height; 262 GdkPixbuf *icon_buf = 0;
292 GdkPixbuf *icon_buf, *tmp_buf; 263 int iunused;
293 264 Window wunused;
294 tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); 265 unsigned int width, height, depth, uunused;
295 icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0);
296 g_object_unref (G_OBJECT (tmp_buf));
297
298 width = gdk_pixbuf_get_width (icon_buf);
299 height = gdk_pixbuf_get_height (icon_buf);
300 266
301 if (mask) 267 if (FRAME_DISPLAY_INFO (f)->red_bits != 8)
268 return 0;
269 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
270 &width, &height, &uunused, &depth);
271 if (depth != 24)
272 return 0;
273 XImage *xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height,
274 ~0, XYPixmap);
275 if (xim)
302 { 276 {
303 GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); 277 XImage *xmm = (! mask ? 0
304 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); 278 : XGetImage (FRAME_X_DISPLAY (f), mask, 0, 0,
305 guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); 279 width, height, ~0, XYPixmap));
306 int rowstride = gdk_pixbuf_get_rowstride (icon_buf); 280 icon_buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
307 int mask_rowstride = gdk_pixbuf_get_rowstride (mask_buf); 281 if (icon_buf)
308 int y; 282 {
309 283 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf);
310 for (y = 0; y < height; ++y) 284 int rowjunkwidth = gdk_pixbuf_get_rowstride (icon_buf) - width * 4;
311 { 285 for (int y = 0; y < height; y++, pixels += rowjunkwidth)
312 guchar *iconptr, *maskptr; 286 for (int x = 0; x < width; x++)
313 int x; 287 {
314 288 unsigned long rgb = XGetPixel (xim, x, y);
315 iconptr = pixels + y * rowstride; 289 *pixels++ = (rgb >> 16) & 255;
316 maskptr = mask_pixels + y * mask_rowstride; 290 *pixels++ = (rgb >> 8) & 255;
317 291 *pixels++ = rgb & 255;
318 for (x = 0; x < width; ++x) 292 *pixels++ = xmm && !XGetPixel (xmm, x, y) ? 0 : 255;
319 { 293 }
320 /* In a bitmap, RGB is either 255/255/255 or 0/0/0. Checking 294 }
321 just R is sufficient. */
322 if (maskptr[0] == 0)
323 iconptr[3] = 0; /* 0, 1, 2 is R, G, B. 3 is alpha. */
324
325 iconptr += rowstride/width;
326 maskptr += mask_rowstride/width;
327 }
328 }
329 295
330 g_object_unref (G_OBJECT (mask_buf)); 296 if (xmm)
297 XDestroyImage (xmm);
298 XDestroyImage (xim);
331 } 299 }
332 300
333 return icon_buf; 301 return icon_buf;
@@ -1300,7 +1268,7 @@ xg_create_frame_widgets (struct frame *f)
1300 if (! g_signal_handler_find (G_OBJECT (gs), 1268 if (! g_signal_handler_find (G_OBJECT (gs),
1301 G_SIGNAL_MATCH_FUNC, 1269 G_SIGNAL_MATCH_FUNC,
1302 0, 0, 0, 1270 0, 0, 0,
1303 G_CALLBACK (style_changed_cb), 1271 (gpointer) G_CALLBACK (style_changed_cb),
1304 0)) 1272 0))
1305 { 1273 {
1306 g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name", 1274 g_signal_connect (G_OBJECT (gs), "notify::gtk-theme-name",
@@ -1832,14 +1800,10 @@ xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
1832 1800
1833 if (!!visible != !!toggle_on) 1801 if (!!visible != !!toggle_on)
1834 { 1802 {
1835 g_signal_handlers_block_by_func (G_OBJECT (wtoggle), 1803 gpointer cb = (gpointer) G_CALLBACK (xg_toggle_visibility_cb);
1836 G_CALLBACK (xg_toggle_visibility_cb), 1804 g_signal_handlers_block_by_func (G_OBJECT (wtoggle), cb, gobject);
1837 gobject);
1838 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wtoggle), visible); 1805 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wtoggle), visible);
1839 g_signal_handlers_unblock_by_func 1806 g_signal_handlers_unblock_by_func (G_OBJECT (wtoggle), cb, gobject);
1840 (G_OBJECT (wtoggle),
1841 G_CALLBACK (xg_toggle_visibility_cb),
1842 gobject);
1843 } 1807 }
1844 x_gtk_show_hidden_files = visible; 1808 x_gtk_show_hidden_files = visible;
1845 } 1809 }
diff --git a/src/image.c b/src/image.c
index a44b90b78e7..e8418b840c6 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1830,6 +1830,9 @@ cache_image (struct frame *f, struct image *img)
1830 struct image_cache *c = FRAME_IMAGE_CACHE (f); 1830 struct image_cache *c = FRAME_IMAGE_CACHE (f);
1831 ptrdiff_t i; 1831 ptrdiff_t i;
1832 1832
1833 if (!c)
1834 c = FRAME_IMAGE_CACHE (f) = make_image_cache ();
1835
1833 /* Find a free slot in c->images. */ 1836 /* Find a free slot in c->images. */
1834 for (i = 0; i < c->used; ++i) 1837 for (i = 0; i < c->used; ++i)
1835 if (c->images[i] == NULL) 1838 if (c->images[i] == NULL)
diff --git a/src/keyboard.c b/src/keyboard.c
index 29d6d6778f4..9618e38e575 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -430,10 +430,9 @@ kset_system_key_syms (struct kboard *kb, Lisp_Object val)
430static bool 430static bool
431echo_keystrokes_p (void) 431echo_keystrokes_p (void)
432{ 432{
433 return (!cursor_in_echo_area) 433 return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
434 && (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0 434 : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0
435 : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 435 : false);
436 : false);
437} 436}
438 437
439/* Add C to the echo string, without echoing it immediately. C can be 438/* Add C to the echo string, without echoing it immediately. C can be
@@ -2530,7 +2529,7 @@ read_char (int commandflag, Lisp_Object map,
2530 if (KEYMAPP (map) && INTERACTIVE 2529 if (KEYMAPP (map) && INTERACTIVE
2531 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) 2530 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
2532 /* Don't bring up a menu if we already have another event. */ 2531 /* Don't bring up a menu if we already have another event. */
2533 && NILP (Vunread_command_events) 2532 && !CONSP (Vunread_command_events)
2534 && !detect_input_pending_run_timers (0)) 2533 && !detect_input_pending_run_timers (0))
2535 { 2534 {
2536 c = read_char_minibuf_menu_prompt (commandflag, map); 2535 c = read_char_minibuf_menu_prompt (commandflag, map);
@@ -2661,7 +2660,7 @@ read_char (int commandflag, Lisp_Object map,
2661 && !EQ (XCAR (prev_event), Qmenu_bar) 2660 && !EQ (XCAR (prev_event), Qmenu_bar)
2662 && !EQ (XCAR (prev_event), Qtool_bar) 2661 && !EQ (XCAR (prev_event), Qtool_bar)
2663 /* Don't bring up a menu if we already have another event. */ 2662 /* Don't bring up a menu if we already have another event. */
2664 && NILP (Vunread_command_events)) 2663 && !CONSP (Vunread_command_events))
2665 { 2664 {
2666 c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu); 2665 c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu);
2667 2666
@@ -8902,7 +8901,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8902 if (!echo_keystrokes_p ()) 8901 if (!echo_keystrokes_p ())
8903 current_kboard->immediate_echo = false; 8902 current_kboard->immediate_echo = false;
8904 } 8903 }
8905 else if (echo_keystrokes_p ()) 8904 else if (cursor_in_echo_area /* FIXME: Not sure why we test this here,
8905 maybe we should just drop this test. */
8906 && echo_keystrokes_p ())
8906 /* This doesn't put in a dash if the echo buffer is empty, so 8907 /* This doesn't put in a dash if the echo buffer is empty, so
8907 you don't always see a dash hanging out in the minibuffer. */ 8908 you don't always see a dash hanging out in the minibuffer. */
8908 echo_dash (); 8909 echo_dash ();
@@ -9877,7 +9878,7 @@ clear_input_pending (void)
9877bool 9878bool
9878requeued_events_pending_p (void) 9879requeued_events_pending_p (void)
9879{ 9880{
9880 return (!NILP (Vunread_command_events)); 9881 return (CONSP (Vunread_command_events));
9881} 9882}
9882 9883
9883DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, 9884DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0,
@@ -9888,7 +9889,7 @@ if there is a doubt, the value is t.
9888If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) 9889If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */)
9889 (Lisp_Object check_timers) 9890 (Lisp_Object check_timers)
9890{ 9891{
9891 if (!NILP (Vunread_command_events) 9892 if (CONSP (Vunread_command_events)
9892 || !NILP (Vunread_post_input_method_events) 9893 || !NILP (Vunread_post_input_method_events)
9893 || !NILP (Vunread_input_method_events)) 9894 || !NILP (Vunread_input_method_events))
9894 return (Qt); 9895 return (Qt);
diff --git a/src/lisp.h b/src/lisp.h
index 27588848c29..6a98adbda9c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1766,7 +1766,8 @@ CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct)
1766 1766
1767/* Make sure that sub char-table contents slot is where we think it is. */ 1767/* Make sure that sub char-table contents slot is where we think it is. */
1768verify (offsetof (struct Lisp_Sub_Char_Table, contents) 1768verify (offsetof (struct Lisp_Sub_Char_Table, contents)
1769 == offsetof (struct Lisp_Vector, contents[SUB_CHAR_TABLE_OFFSET])); 1769 == (offsetof (struct Lisp_Vector, contents)
1770 + SUB_CHAR_TABLE_OFFSET * sizeof (Lisp_Object)));
1770 1771
1771/*********************************************************************** 1772/***********************************************************************
1772 Symbols 1773 Symbols
diff --git a/src/nsterm.m b/src/nsterm.m
index 38aa4a3a413..4048ac46546 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -646,41 +646,128 @@ ns_release_autorelease_pool (void *pool)
646} 646}
647 647
648 648
649/* True, if the menu bar should be hidden. */
650
651static BOOL 649static BOOL
652ns_menu_bar_should_be_hidden (void) 650ns_menu_bar_should_be_hidden (void)
651/* True, if the menu bar should be hidden. */
653{ 652{
654 return !NILP (ns_auto_hide_menu_bar) 653 return !NILP (ns_auto_hide_menu_bar)
655 && [NSApp respondsToSelector:@selector(setPresentationOptions:)]; 654 && [NSApp respondsToSelector:@selector(setPresentationOptions:)];
656} 655}
657 656
658 657
659static CGFloat 658struct EmacsMargins
660ns_menu_bar_height (NSScreen *screen) 659{
661/* The height of the menu bar, if visible. 660 CGFloat top;
661 CGFloat bottom;
662 CGFloat left;
663 CGFloat right;
664};
662 665
663 Note: Don't use this when fullscreen is enabled -- the screen 666
664 sometimes includes, sometimes excludes the menu bar area. */ 667static struct EmacsMargins
668ns_screen_margins (NSScreen *screen)
669/* The parts of SCREEN used by the operating system. */
665{ 670{
666 CGFloat res; 671 NSTRACE ("ns_screen_margins");
672
673 struct EmacsMargins margins;
667 674
675 NSRect screenFrame = [screen frame];
676 NSRect screenVisibleFrame = [screen visibleFrame];
677
678 /* Sometimes, visibleFrame isn't up-to-date with respect to a hidden
679 menu bar, check this explicitly. */
668 if (ns_menu_bar_should_be_hidden()) 680 if (ns_menu_bar_should_be_hidden())
669 { 681 {
670 res = 0; 682 margins.top = 0;
671 } 683 }
672 else 684 else
673 { 685 {
674 NSRect screenFrame = [screen frame];
675 NSRect screenVisibleFrame = [screen visibleFrame];
676
677 CGFloat frameTop = screenFrame.origin.y + screenFrame.size.height; 686 CGFloat frameTop = screenFrame.origin.y + screenFrame.size.height;
678 CGFloat visibleFrameTop = (screenVisibleFrame.origin.y 687 CGFloat visibleFrameTop = (screenVisibleFrame.origin.y
679 + screenVisibleFrame.size.height); 688 + screenVisibleFrame.size.height);
680 689
681 res = frameTop - visibleFrameTop; 690 margins.top = frameTop - visibleFrameTop;
691 }
692
693 {
694 CGFloat frameRight = screenFrame.origin.x + screenFrame.size.width;
695 CGFloat visibleFrameRight = (screenVisibleFrame.origin.x
696 + screenVisibleFrame.size.width);
697 margins.right = frameRight - visibleFrameRight;
698 }
699
700 margins.bottom = screenVisibleFrame.origin.y - screenFrame.origin.y;
701 margins.left = screenVisibleFrame.origin.x - screenFrame.origin.x;
702
703 NSTRACE_MSG ("left:%g right:%g top:%g bottom:%g",
704 margins.left,
705 margins.right,
706 margins.top,
707 margins.bottom);
708
709 return margins;
710}
711
712
713/* A screen margin between 1 and DOCK_IGNORE_LIMIT (inclusive) is
714 assumed to contain a hidden dock. OS X currently use 4 pixels for
715 this, however, to be future compatible, a larger value is used. */
716#define DOCK_IGNORE_LIMIT 6
717
718static struct EmacsMargins
719ns_screen_margins_ignoring_hidden_dock (NSScreen *screen)
720/* The parts of SCREEN used by the operating system, excluding the parts
721reserved for an hidden dock. */
722{
723 NSTRACE ("ns_screen_margins_ignoring_hidden_dock");
682 724
725 struct EmacsMargins margins = ns_screen_margins(screen);
726
727 /* OS X (currently) reserved 4 pixels along the edge where a hidden
728 dock is located. Unfortunately, it's not possible to find the
729 location and information about if the dock is hidden. Instead,
730 it is assumed that if the margin of an edge is less than
731 DOCK_IGNORE_LIMIT, it contains a hidden dock. */
732 if (margins.left <= DOCK_IGNORE_LIMIT)
733 {
734 margins.left = 0;
683 } 735 }
736 if (margins.right <= DOCK_IGNORE_LIMIT)
737 {
738 margins.right = 0;
739 }
740 if (margins.top <= DOCK_IGNORE_LIMIT)
741 {
742 margins.top = 0;
743 }
744 /* Note: This doesn't occur in current versions of OS X, but
745 included for completeness and future compatibility. */
746 if (margins.bottom <= DOCK_IGNORE_LIMIT)
747 {
748 margins.bottom = 0;
749 }
750
751 NSTRACE_MSG ("left:%g right:%g top:%g bottom:%g",
752 margins.left,
753 margins.right,
754 margins.top,
755 margins.bottom);
756
757 return margins;
758}
759
760
761static CGFloat
762ns_menu_bar_height (NSScreen *screen)
763/* The height of the menu bar, if visible.
764
765 Note: Don't use this when fullscreen is enabled -- the screen
766 sometimes includes, sometimes excludes the menu bar area. */
767{
768 struct EmacsMargins margins = ns_screen_margins(screen);
769
770 CGFloat res = margins.top;
684 771
685 NSTRACE ("ns_menu_bar_height " NSTRACE_FMT_RETURN " %.0f", res); 772 NSTRACE ("ns_menu_bar_height " NSTRACE_FMT_RETURN " %.0f", res);
686 773
@@ -1172,10 +1259,31 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
1172 ========================================================================== */ 1259 ========================================================================== */
1173 1260
1174 1261
1262// This bell implementation shows the visual bell image asynchronously
1263// from the rest of Emacs. This is done by adding a NSView to the
1264// superview of the Emacs window and removing it using a timer.
1265//
1266// Unfortunately, some Emacs operations, like scrolling, is done using
1267// low-level primitives that copy the content of the window, including
1268// the bell image. To some extent, this is handled by removing the
1269// image prior to scrolling and marking that the window is in need for
1270// redisplay.
1271//
1272// To test this code, make sure that there is no artifacts of the bell
1273// image in the following situations. Use a non-empty buffer (like the
1274// tutorial) to ensure that a scroll is performed:
1275//
1276// * Single-window: C-g C-v
1277//
1278// * Side-by-windows: C-x 3 C-g C-v
1279//
1280// * Windows above each other: C-x 2 C-g C-v
1281
1175@interface EmacsBell : NSImageView 1282@interface EmacsBell : NSImageView
1176{ 1283{
1177 // Number of currently active bell:s. 1284 // Number of currently active bell:s.
1178 unsigned int nestCount; 1285 unsigned int nestCount;
1286 NSView * mView;
1179 bool isAttached; 1287 bool isAttached;
1180} 1288}
1181- (void)show:(NSView *)view; 1289- (void)show:(NSView *)view;
@@ -1204,7 +1312,6 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
1204 [self.image unlockFocus]; 1312 [self.image unlockFocus];
1205#else 1313#else
1206 self.image = [NSImage imageNamed:NSImageNameCaution]; 1314 self.image = [NSImage imageNamed:NSImageNameCaution];
1207 [self.image setScalesWhenResized:YES];
1208 [self.image setSize:NSMakeSize(self.image.size.width * 5, 1315 [self.image setSize:NSMakeSize(self.image.size.width * 5,
1209 self.image.size.height * 5)]; 1316 self.image.size.height * 5)];
1210#endif 1317#endif
@@ -1229,6 +1336,7 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
1229 [self setFrameSize:self.image.size]; 1336 [self setFrameSize:self.image.size];
1230 1337
1231 isAttached = true; 1338 isAttached = true;
1339 mView = view;
1232 [[[view window] contentView] addSubview:self 1340 [[[view window] contentView] addSubview:self
1233 positioned:NSWindowAbove 1341 positioned:NSWindowAbove
1234 relativeTo:nil]; 1342 relativeTo:nil];
@@ -1258,9 +1366,12 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
1258 1366
1259-(void)remove 1367-(void)remove
1260{ 1368{
1369 NSTRACE ("[EmacsBell remove]");
1261 if (isAttached) 1370 if (isAttached)
1262 { 1371 {
1372 NSTRACE_MSG ("removeFromSuperview");
1263 [self removeFromSuperview]; 1373 [self removeFromSuperview];
1374 mView.needsDisplay = YES;
1264 isAttached = false; 1375 isAttached = false;
1265 } 1376 }
1266} 1377}
@@ -1310,6 +1421,8 @@ static void hide_bell ()
1310 Ensure the bell is hidden. 1421 Ensure the bell is hidden.
1311 -------------------------------------------------------------------------- */ 1422 -------------------------------------------------------------------------- */
1312{ 1423{
1424 NSTRACE ("hide_bell");
1425
1313 if (bell_view != nil) 1426 if (bell_view != nil)
1314 { 1427 {
1315 [bell_view remove]; 1428 [bell_view remove];
@@ -2392,6 +2505,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2392static void 2505static void
2393ns_copy_bits (struct frame *f, NSRect src, NSRect dest) 2506ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
2394{ 2507{
2508 NSTRACE ("ns_copy_bits");
2509
2395 if (FRAME_NS_VIEW (f)) 2510 if (FRAME_NS_VIEW (f))
2396 { 2511 {
2397 hide_bell(); // Ensure the bell image isn't scrolled. 2512 hide_bell(); // Ensure the bell image isn't scrolled.
@@ -7839,9 +7954,10 @@ not_in_argv (NSString *arg)
7839 // the menu-bar. 7954 // the menu-bar.
7840 [super zoom:sender]; 7955 [super zoom:sender];
7841 7956
7842#elsif 0 7957#elif 0
7843 // Native zoom done using the standard zoom animation, plus an 7958 // Native zoom done using the standard zoom animation, plus an
7844 // explicit resize to cover the full screen. 7959 // explicit resize to cover the full screen, except the menu-bar and
7960 // dock, if present.
7845 [super zoom:sender]; 7961 [super zoom:sender];
7846 7962
7847 // After the native zoom, resize the resulting frame to fill the 7963 // After the native zoom, resize the resulting frame to fill the
@@ -7861,6 +7977,9 @@ not_in_argv (NSString *arg)
7861 NSTRACE_FSTYPE ("fullscreenState", fs_state); 7977 NSTRACE_FSTYPE ("fullscreenState", fs_state);
7862 7978
7863 NSRect sr = [screen frame]; 7979 NSRect sr = [screen frame];
7980 struct EmacsMargins margins
7981 = ns_screen_margins_ignoring_hidden_dock(screen);
7982
7864 NSRect wr = [self frame]; 7983 NSRect wr = [self frame];
7865 NSTRACE_RECT ("Rect after zoom", wr); 7984 NSTRACE_RECT ("Rect after zoom", wr);
7866 7985
@@ -7869,15 +7988,15 @@ not_in_argv (NSString *arg)
7869 if (fs_state == FULLSCREEN_MAXIMIZED 7988 if (fs_state == FULLSCREEN_MAXIMIZED
7870 || fs_state == FULLSCREEN_HEIGHT) 7989 || fs_state == FULLSCREEN_HEIGHT)
7871 { 7990 {
7872 newWr.origin.x = 0; 7991 newWr.origin.y = sr.origin.y + margins.bottom;
7873 newWr.size.height = sr.size.height - ns_menu_bar_height(screen); 7992 newWr.size.height = sr.size.height - margins.top - margins.bottom;
7874 } 7993 }
7875 7994
7876 if (fs_state == FULLSCREEN_MAXIMIZED 7995 if (fs_state == FULLSCREEN_MAXIMIZED
7877 || fs_state == FULLSCREEN_WIDTH) 7996 || fs_state == FULLSCREEN_WIDTH)
7878 { 7997 {
7879 newWr.origin.y = 0; 7998 newWr.origin.x = sr.origin.x + margins.left;
7880 newWr.size.width = sr.size.width; 7999 newWr.size.width = sr.size.width - margins.right - margins.left;
7881 } 8000 }
7882 8001
7883 if (newWr.size.width != wr.size.width 8002 if (newWr.size.width != wr.size.width
@@ -7890,13 +8009,20 @@ not_in_argv (NSString *arg)
7890 } 8009 }
7891 } 8010 }
7892#else 8011#else
7893 // Non-native zoom which is done instantaneously. The resulting frame 8012 // Non-native zoom which is done instantaneously. The resulting
7894 // covers the entire screen, except the menu-bar, if present. 8013 // frame covers the entire screen, except the menu-bar and dock, if
8014 // present.
7895 NSScreen * screen = [self screen]; 8015 NSScreen * screen = [self screen];
7896 if (screen != nil) 8016 if (screen != nil)
7897 { 8017 {
7898 NSRect sr = [screen frame]; 8018 NSRect sr = [screen frame];
7899 sr.size.height -= ns_menu_bar_height (screen); 8019 struct EmacsMargins margins
8020 = ns_screen_margins_ignoring_hidden_dock(screen);
8021
8022 sr.size.height -= (margins.top + margins.bottom);
8023 sr.size.width -= (margins.left + margins.right);
8024 sr.origin.x += margins.left;
8025 sr.origin.y += margins.bottom;
7900 8026
7901 sr = [[self delegate] windowWillUseStandardFrame:self 8027 sr = [[self delegate] windowWillUseStandardFrame:self
7902 defaultFrame:sr]; 8028 defaultFrame:sr];
diff --git a/src/term.c b/src/term.c
index 17f36795998..a77e5729b5b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3402,9 +3402,11 @@ static void
3402tty_pop_down_menu (Lisp_Object arg) 3402tty_pop_down_menu (Lisp_Object arg)
3403{ 3403{
3404 tty_menu *menu = XSAVE_POINTER (arg, 0); 3404 tty_menu *menu = XSAVE_POINTER (arg, 0);
3405 struct buffer *orig_buffer = XSAVE_POINTER (arg, 1);
3405 3406
3406 block_input (); 3407 block_input ();
3407 tty_menu_destroy (menu); 3408 tty_menu_destroy (menu);
3409 set_buffer_internal (orig_buffer);
3408 unblock_input (); 3410 unblock_input ();
3409} 3411}
3410 3412
@@ -3683,7 +3685,10 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags,
3683 3685
3684 pane = selidx = 0; 3686 pane = selidx = 0;
3685 3687
3686 record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); 3688 /* We save and restore the current buffer because tty_menu_activate
3689 triggers redisplay, which switches buffers at will. */
3690 record_unwind_protect (tty_pop_down_menu,
3691 make_save_ptr_ptr (menu, current_buffer));
3687 3692
3688 specbind (Qoverriding_terminal_local_map, 3693 specbind (Qoverriding_terminal_local_map,
3689 Fsymbol_value (Qtty_menu_navigation_map)); 3694 Fsymbol_value (Qtty_menu_navigation_map));
diff --git a/src/w32font.c b/src/w32font.c
index a1878adb4bd..018e6572563 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -796,7 +796,8 @@ w32font_list_internal (struct frame *f, Lisp_Object font_spec,
796 && !EQ (spec_charset, Qiso10646_1) 796 && !EQ (spec_charset, Qiso10646_1)
797 && !EQ (spec_charset, Qunicode_bmp) 797 && !EQ (spec_charset, Qunicode_bmp)
798 && !EQ (spec_charset, Qunicode_sip) 798 && !EQ (spec_charset, Qunicode_sip)
799 && !EQ (spec_charset, Qunknown)) 799 && !EQ (spec_charset, Qunknown)
800 && !EQ (spec_charset, Qascii_0))
800 return Qnil; 801 return Qnil;
801 } 802 }
802 803
diff --git a/src/xdisp.c b/src/xdisp.c
index ce992d42531..5be94f0cd07 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7229,18 +7229,21 @@ get_next_display_element (struct it *it)
7229 { 7229 {
7230 ptrdiff_t ignore; 7230 ptrdiff_t ignore;
7231 int next_face_id; 7231 int next_face_id;
7232 bool text_from_string = false;
7233 /* Normally, the next buffer location is stored in
7234 IT->current.pos... */
7232 struct text_pos pos = it->current.pos; 7235 struct text_pos pos = it->current.pos;
7233 7236
7234 /* For a string from a display property, the next 7237 /* ...but for a string from a display property, the
7235 buffer position is stored in the 'position' 7238 next buffer position is stored in the 'position'
7236 member of the iteration stack slot below the 7239 member of the iteration stack slot below the
7237 current one, see handle_single_display_spec. By 7240 current one, see handle_single_display_spec. By
7238 contrast, it->current.pos was not yet updated 7241 contrast, it->current.pos was not yet updated to
7239 to point to that buffer position; that will 7242 point to that buffer position; that will happen
7240 happen in pop_it, after we finish displaying the 7243 in pop_it, after we finish displaying the current
7241 current string. Note that we already checked 7244 string. Note that we already checked above that
7242 above that it->sp is positive, so subtracting one 7245 it->sp is positive, so subtracting one from it is
7243 from it is safe. */ 7246 safe. */
7244 if (it->from_disp_prop_p) 7247 if (it->from_disp_prop_p)
7245 { 7248 {
7246 int stackp = it->sp - 1; 7249 int stackp = it->sp - 1;
@@ -7249,19 +7252,49 @@ get_next_display_element (struct it *it)
7249 while (stackp >= 0 7252 while (stackp >= 0
7250 && STRINGP ((it->stack + stackp)->string)) 7253 && STRINGP ((it->stack + stackp)->string))
7251 stackp--; 7254 stackp--;
7252 eassert (stackp >= 0); 7255 if (stackp < 0)
7253 pos = (it->stack + stackp)->position; 7256 {
7257 /* If no stack slot was found for iterating
7258 a buffer, we are displaying text from a
7259 string, most probably the mode line or
7260 the header line, and that string has a
7261 display string on some of its
7262 characters. */
7263 text_from_string = true;
7264 pos = it->stack[it->sp - 1].position;
7265 }
7266 else
7267 pos = (it->stack + stackp)->position;
7254 } 7268 }
7255 else 7269 else
7256 INC_TEXT_POS (pos, it->multibyte_p); 7270 INC_TEXT_POS (pos, it->multibyte_p);
7257 7271
7258 if (CHARPOS (pos) >= ZV) 7272 if (text_from_string)
7273 {
7274 Lisp_Object base_string = it->stack[it->sp - 1].string;
7275
7276 if (CHARPOS (pos) >= SCHARS (base_string) - 1)
7277 it->end_of_box_run_p = true;
7278 else
7279 {
7280 next_face_id
7281 = face_at_string_position (it->w, base_string,
7282 CHARPOS (pos), 0,
7283 &ignore, face_id, false);
7284 it->end_of_box_run_p
7285 = (FACE_FROM_ID (it->f, next_face_id)->box
7286 == FACE_NO_BOX);
7287 }
7288 }
7289 else if (CHARPOS (pos) >= ZV)
7259 it->end_of_box_run_p = true; 7290 it->end_of_box_run_p = true;
7260 else 7291 else
7261 { 7292 {
7262 next_face_id = face_at_buffer_position 7293 next_face_id =
7263 (it->w, CHARPOS (pos), &ignore, 7294 face_at_buffer_position (it->w, CHARPOS (pos), &ignore,
7264 CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, false, -1); 7295 CHARPOS (pos)
7296 + TEXT_PROP_DISTANCE_LIMIT,
7297 false, -1);
7265 it->end_of_box_run_p 7298 it->end_of_box_run_p
7266 = (FACE_FROM_ID (it->f, next_face_id)->box 7299 = (FACE_FROM_ID (it->f, next_face_id)->box
7267 == FACE_NO_BOX); 7300 == FACE_NO_BOX);
@@ -10524,8 +10557,8 @@ ensure_echo_area_buffers (void)
10524 suitable buffer from echo_buffer[] and clear it. 10557 suitable buffer from echo_buffer[] and clear it.
10525 10558
10526 If WHICH < 0, set echo_area_buffer[1] to echo_area_buffer[0], so 10559 If WHICH < 0, set echo_area_buffer[1] to echo_area_buffer[0], so
10527 that the current message becomes the last displayed one, make 10560 that the current message becomes the last displayed one, choose a
10528 choose a suitable buffer for echo_area_buffer[0], and clear it. 10561 suitable buffer for echo_area_buffer[0], and clear it.
10529 10562
10530 Value is what FN returns. */ 10563 Value is what FN returns. */
10531 10564
@@ -10559,7 +10592,7 @@ with_echo_area_buffer (struct window *w, int which,
10559 echo_area_buffer[this_one] = Qnil; 10592 echo_area_buffer[this_one] = Qnil;
10560 } 10593 }
10561 10594
10562 /* Choose a suitable buffer from echo_buffer[] is we don't 10595 /* Choose a suitable buffer from echo_buffer[] if we don't
10563 have one. */ 10596 have one. */
10564 if (NILP (echo_area_buffer[this_one])) 10597 if (NILP (echo_area_buffer[this_one]))
10565 { 10598 {
@@ -17049,7 +17082,16 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
17049 ignore_mouse_drag_p = true; 17082 ignore_mouse_drag_p = true;
17050#endif 17083#endif
17051 } 17084 }
17085 ptrdiff_t count1 = SPECPDL_INDEX ();
17086 /* x_consider_frame_title calls select-frame, which calls
17087 resize_mini_window, which could resize the mini-window and by
17088 that undo the effect of this redisplay cycle wrt minibuffer
17089 and echo-area display. Binding inhibit-redisplay to t makes
17090 the call to resize_mini_window a no-op, thus avoiding the
17091 adverse side effects. */
17092 specbind (Qinhibit_redisplay, Qt);
17052 x_consider_frame_title (w->frame); 17093 x_consider_frame_title (w->frame);
17094 unbind_to (count1, Qnil);
17053#endif 17095#endif
17054 } 17096 }
17055 17097
@@ -31389,8 +31431,11 @@ Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */);
31389 Vtruncate_partial_width_windows, 31431 Vtruncate_partial_width_windows,
31390 doc: /* Non-nil means truncate lines in windows narrower than the frame. 31432 doc: /* Non-nil means truncate lines in windows narrower than the frame.
31391For an integer value, truncate lines in each window narrower than the 31433For an integer value, truncate lines in each window narrower than the
31392full frame width, provided the window width is less than that integer; 31434full frame width, provided the total window width in column units is less
31393otherwise, respect the value of `truncate-lines'. 31435than that integer; otherwise, respect the value of `truncate-lines'.
31436The total width of the window is as returned by `window-total-width', it
31437includes the fringes, the continuation and truncation glyphs, the
31438display margins (if any), and the scroll bar
31394 31439
31395For any other non-nil value, truncate lines in all windows that do 31440For any other non-nil value, truncate lines in all windows that do
31396not span the full frame width. 31441not span the full frame width.
@@ -31598,7 +31643,12 @@ A value of t means resize them to fit the text displayed in them.
31598A value of `grow-only', the default, means let mini-windows grow only; 31643A value of `grow-only', the default, means let mini-windows grow only;
31599they return to their normal size when the minibuffer is closed, or the 31644they return to their normal size when the minibuffer is closed, or the
31600echo area becomes empty. */); 31645echo area becomes empty. */);
31601 Vresize_mini_windows = Qgrow_only; 31646 /* Contrary to the doc string, we initialize this to nil, so that
31647 loading loadup.el won't try to resize windows before loading
31648 window.el, where some functions we need to call for this live.
31649 We assign the 'grow-only' value right after loading window.el
31650 during loadup. */
31651 Vresize_mini_windows = Qnil;
31602 31652
31603 DEFVAR_LISP ("blink-cursor-alist", Vblink_cursor_alist, 31653 DEFVAR_LISP ("blink-cursor-alist", Vblink_cursor_alist,
31604 doc: /* Alist specifying how to blink the cursor off. 31654 doc: /* Alist specifying how to blink the cursor off.
diff --git a/src/xfns.c b/src/xfns.c
index 0a4a09ef285..b22af5c830d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -273,7 +273,7 @@ x_real_pos_and_offsets (struct frame *f,
273 XFree (tmp_children); 273 XFree (tmp_children);
274#endif 274#endif
275 275
276 if (wm_window == rootw || had_errors) 276 if (had_errors || wm_window == rootw)
277 break; 277 break;
278 278
279 win = wm_window; 279 win = wm_window;
diff --git a/src/xwidget.c b/src/xwidget.c
index d438d879098..c24475f5312 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -767,14 +767,14 @@ VALUE is the amount to scroll, either relatively or absolutely. */)
767 Lisp_Object value) 767 Lisp_Object value)
768{ 768{
769 CHECK_XWIDGET (xwidget); 769 CHECK_XWIDGET (xwidget);
770 CHECK_NATNUM (value); 770 CHECK_NUMBER (value);
771 struct xwidget *xw = XXWIDGET (xwidget); 771 struct xwidget *xw = XXWIDGET (xwidget);
772 GtkAdjustment *adjustment 772 GtkAdjustment *adjustment
773 = ((EQ (Qhorizontal, axis) 773 = ((EQ (Qhorizontal, axis)
774 ? gtk_scrolled_window_get_hadjustment 774 ? gtk_scrolled_window_get_hadjustment
775 : gtk_scrolled_window_get_vadjustment) 775 : gtk_scrolled_window_get_vadjustment)
776 (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr))); 776 (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr)));
777 double final_value = XFASTINT (value); 777 double final_value = XINT (value);
778 if (EQ (Qt, relative)) 778 if (EQ (Qt, relative))
779 final_value += gtk_adjustment_get_value (adjustment); 779 final_value += gtk_adjustment_get_value (adjustment);
780 gtk_adjustment_set_value (adjustment, final_value); 780 gtk_adjustment_set_value (adjustment, final_value);