aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog66
-rw-r--r--src/dbusbind.c23
-rw-r--r--src/font.c37
-rw-r--r--src/font.h8
-rw-r--r--src/fontset.c4
-rw-r--r--src/gtkutil.c75
-rw-r--r--src/keyboard.c8
-rw-r--r--src/nsfns.m50
-rw-r--r--src/nsterm.m3
-rw-r--r--src/xftfont.c143
-rw-r--r--src/xterm.c59
11 files changed, 353 insertions, 123 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2da31448bed..0946148b9a6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -5,8 +5,68 @@
5 `signal_after_change_p' to `coherent_change_p', and make the 5 `signal_after_change_p' to `coherent_change_p', and make the
6 invocation of `modify_region' conditional on it. 6 invocation of `modify_region' conditional on it.
7 7
82010-01-06 David Reitter <david.reitter@gmail.com>
9
10 * nsfns.m (ns_get_screen): Rewrite, returning NULL for non-NS.
11 (Fns_display_usable_bounds): Rewrite, computing bounds properly
12 (Bug#3233).
13
142010-01-06 Jan Djärv <jan.h.d@swipnet.se>
15
16 * font.c (font_open_entity): Enable chache and call cached_font_ok
17 for the driver if defined.
18 (QCuser_spec): New symbol.
19 (font_spec_from_name): Save name as user-spec.
20 (font_load_for_lface): Keep user-spec instead of name.
21 (font_open_by_name): Save name as user-spec.
22 (syms_of_font): Initialize QCuser_spec.
23 (font_clear_prop): Clear name if it exists in font (bug#5157).
24
25 * xftfont.c (xftfont_open): Call xftfont_add_rendering_parameters.
26 (xftfont_add_rendering_parameters, xftfont_cached_font_ok): New.
27 (syms_of_xftfont): Initialize xftfont_driver.cached_font_ok.
28
29 * font.h (struct font_driver): Add cached_font_ok.
30
31 * xterm.c (x_clear_frame): Queue draw for scroll bars.
32
332010-01-05 Jan Djärv <jan.h.d@swipnet.se>
34
35 * xterm.c (x_new_font): Move code for setting rows/cols before
36 resizing ...
37 (x_set_window_size): ... to here. bug #2568.
38
39 * gtkutil.c (xg_clear_under_internal_border): New function.
40 (xg_frame_resized, xg_frame_set_char_size): Call
41 xg_clear_under_internal_border.
42 (xg_update_scrollbar_pos): Clear under old scroll bar position.
432010-01-05 Chong Yidong <cyd@stupidchicken.com>
44
45 * keyboard.c (read_key_sequence): Catch keyboard switch after
46 making a new tty frame (Bug#5095).
47
482010-01-05 Kenichi Handa <handa@m17n.org>
49
50 * fontset.c (fontset_find_font): Fix getting the frame pointer.
51
522010-01-04 Stefan Monnier <monnier@iro.umontreal.ca>
53
54 * dbusbind.c (xd_remove_watch): Avoid trying to convert a void* to
55 Lisp_Object, preferring to convert a lisp_Object to a void* instead.
56 (Fdbus_init_bus): Use XHASH to get a scalar value from a Lisp_Object.
57
582010-01-03 Michael Albinus <michael.albinus@gmx.de>
59
60 * dbusbind.c (xd_add_watch): Improve debug message.
61 (xd_remove_watch): Improve debug message. If DATA is the session
62 bus, unset D-Bus session environment.
63 (Fdbus_init_bus): Pass the bus as argument to
64 dbus_connection_set_watch_functions. (Bug#5283)
65
82010-01-01 Chong Yidong <cyd@stupidchicken.com> 662010-01-01 Chong Yidong <cyd@stupidchicken.com>
9 67
68 * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763).
69
10 * lread.c (syms_of_lread): Make it clearer that these are the 70 * lread.c (syms_of_lread): Make it clearer that these are the
11 names of loaded files (Bug#5068). 71 names of loaded files (Bug#5068).
12 72
@@ -149,7 +209,7 @@
1492009-12-15 Michael Albinus <michael.albinus@gmx.de> 2092009-12-15 Michael Albinus <michael.albinus@gmx.de>
150 210
151 * dbusbind.c (xd_retrieve_arg): Reorder declarations in order to 211 * dbusbind.c (xd_retrieve_arg): Reorder declarations in order to
152 avoid compiler warnings. (Bug #5217). 212 avoid compiler warnings. (Bug #5217)
153 213
1542009-12-14 Kenichi Handa <handa@m17n.org> 2142009-12-14 Kenichi Handa <handa@m17n.org>
155 215
@@ -5324,7 +5384,7 @@
5324 (XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error. 5384 (XD_SIGNAL1, XD_SIGNAL2, XD_SIGNAL3): New macros. Throw Qdbus_error.
5325 (xd_read_queued_messages): Catch Qdbus_error from the macros. 5385 (xd_read_queued_messages): Catch Qdbus_error from the macros.
5326 (all): Replace xsignal1, xsignal2, xsignal3 by the respective 5386 (all): Replace xsignal1, xsignal2, xsignal3 by the respective
5327 macro. (Bug#1186). 5387 macro. (Bug#1186)
5328 5388
53292008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change) 53892008-10-23 Ali Bahrami <ali_gnu@emvision.com> (tiny change)
5330 5390
@@ -21218,7 +21278,7 @@ See ChangeLog.10 for earlier changes.
21218;; add-log-time-zone-rule: t 21278;; add-log-time-zone-rule: t
21219;; End: 21279;; End:
21220 21280
21221 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. 21281 Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
21222 21282
21223 This file is part of GNU Emacs. 21283 This file is part of GNU Emacs.
21224 21284
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7c0be49ab77..974a01e8ead 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -761,14 +761,14 @@ xd_add_watch (watch, data)
761 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) 761 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
762 { 762 {
763#if HAVE_DBUS_WATCH_GET_UNIX_FD 763#if HAVE_DBUS_WATCH_GET_UNIX_FD
764 /* TODO: Reverse these on Win32, which prefers the opposite. */ 764 /* TODO: Reverse these on Win32, which prefers the opposite. */
765 int fd = dbus_watch_get_unix_fd(watch); 765 int fd = dbus_watch_get_unix_fd(watch);
766 if (fd == -1) 766 if (fd == -1)
767 fd = dbus_watch_get_socket(watch); 767 fd = dbus_watch_get_socket(watch);
768#else 768#else
769 int fd = dbus_watch_get_fd(watch); 769 int fd = dbus_watch_get_fd(watch);
770#endif 770#endif
771 XD_DEBUG_MESSAGE ("%d", fd); 771 XD_DEBUG_MESSAGE ("fd %d", fd);
772 772
773 if (fd == -1) 773 if (fd == -1)
774 return FALSE; 774 return FALSE;
@@ -781,7 +781,8 @@ xd_add_watch (watch, data)
781 return TRUE; 781 return TRUE;
782} 782}
783 783
784/* Remove connection file descriptor from input_wait_mask. */ 784/* Remove connection file descriptor from input_wait_mask. DATA is
785 the used bus, either QCdbus_system_bus or QCdbus_session_bus. */
785void 786void
786xd_remove_watch (watch, data) 787xd_remove_watch (watch, data)
787 DBusWatch *watch; 788 DBusWatch *watch;
@@ -791,18 +792,25 @@ xd_remove_watch (watch, data)
791 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE) 792 if (dbus_watch_get_flags (watch) & DBUS_WATCH_READABLE)
792 { 793 {
793#if HAVE_DBUS_WATCH_GET_UNIX_FD 794#if HAVE_DBUS_WATCH_GET_UNIX_FD
794 /* TODO: Reverse these on Win32, which prefers the opposite. */ 795 /* TODO: Reverse these on Win32, which prefers the opposite. */
795 int fd = dbus_watch_get_unix_fd(watch); 796 int fd = dbus_watch_get_unix_fd(watch);
796 if (fd == -1) 797 if (fd == -1)
797 fd = dbus_watch_get_socket(watch); 798 fd = dbus_watch_get_socket(watch);
798#else 799#else
799 int fd = dbus_watch_get_fd(watch); 800 int fd = dbus_watch_get_fd(watch);
800#endif 801#endif
801 XD_DEBUG_MESSAGE ("%d", fd); 802 XD_DEBUG_MESSAGE ("fd %d", fd);
802 803
803 if (fd == -1) 804 if (fd == -1)
804 return; 805 return;
805 806
807 /* Unset session environment. */
808 if ((data != NULL) && (data == (void*) XHASH (QCdbus_session_bus)))
809 {
810 XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
811 unsetenv ("DBUS_SESSION_BUS_ADDRESS");
812 }
813
806 /* Remove the file descriptor from input_wait_mask. */ 814 /* Remove the file descriptor from input_wait_mask. */
807 delete_keyboard_wait_descriptor (fd); 815 delete_keyboard_wait_descriptor (fd);
808 } 816 }
@@ -825,11 +833,12 @@ This is an internal function, it shall not be used outside dbus.el. */)
825 /* Open a connection to the bus. */ 833 /* Open a connection to the bus. */
826 connection = xd_initialize (bus); 834 connection = xd_initialize (bus);
827 835
828 /* Add the watch functions. */ 836 /* Add the watch functions. We pass also the bus as data, in order
837 to distinguish between the busses in xd_remove_watch. */
829 if (!dbus_connection_set_watch_functions (connection, 838 if (!dbus_connection_set_watch_functions (connection,
830 xd_add_watch, 839 xd_add_watch,
831 xd_remove_watch, 840 xd_remove_watch,
832 NULL, NULL, NULL)) 841 NULL, (void*) XHASH (bus), NULL))
833 XD_SIGNAL1 (build_string ("Cannot add watch functions")); 842 XD_SIGNAL1 (build_string ("Cannot add watch functions"));
834 843
835 /* Return. */ 844 /* Return. */
diff --git a/src/font.c b/src/font.c
index 3a8f73a6b03..2141fe651c3 100644
--- a/src/font.c
+++ b/src/font.c
@@ -143,6 +143,8 @@ Lisp_Object Qc, Qm, Qp, Qd;
143 characters; used in xfont.c and ftfont.c. */ 143 characters; used in xfont.c and ftfont.c. */
144Lisp_Object Qja, Qko; 144Lisp_Object Qja, Qko;
145 145
146Lisp_Object QCuser_spec;
147
146Lisp_Object Vfont_encoding_alist; 148Lisp_Object Vfont_encoding_alist;
147 149
148/* Alist of font registry symbol and the corresponding charsets 150/* Alist of font registry symbol and the corresponding charsets
@@ -2989,16 +2991,6 @@ font_open_entity (f, entity, pixel_size)
2989 else if (CONSP (Vface_font_rescale_alist)) 2991 else if (CONSP (Vface_font_rescale_alist))
2990 scaled_pixel_size = pixel_size * font_rescale_ratio (entity); 2992 scaled_pixel_size = pixel_size * font_rescale_ratio (entity);
2991 2993
2992#if 0
2993 /* This doesn't work if you have changed hinting or any other parameter.
2994 We need to make a new object in every case to be sure. */
2995 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist);
2996 objlist = XCDR (objlist))
2997 if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX))
2998 && XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size)
2999 return XCAR (objlist);
3000#endif
3001
3002 val = AREF (entity, FONT_TYPE_INDEX); 2994 val = AREF (entity, FONT_TYPE_INDEX);
3003 for (driver_list = f->font_driver_list; 2995 for (driver_list = f->font_driver_list;
3004 driver_list && ! EQ (driver_list->driver->type, val); 2996 driver_list && ! EQ (driver_list->driver->type, val);
@@ -3006,6 +2998,19 @@ font_open_entity (f, entity, pixel_size)
3006 if (! driver_list) 2998 if (! driver_list)
3007 return Qnil; 2999 return Qnil;
3008 3000
3001 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist);
3002 objlist = XCDR (objlist))
3003 {
3004 Lisp_Object fn = XCAR (objlist);
3005 if (! NILP (AREF (fn, FONT_TYPE_INDEX))
3006 && XFONT_OBJECT (fn)->pixel_size == pixel_size)
3007 {
3008 if (driver_list->driver->cached_font_ok == NULL
3009 || driver_list->driver->cached_font_ok (f, fn, entity))
3010 return fn;
3011 }
3012 }
3013
3009 font_object = driver_list->driver->open (f, entity, scaled_pixel_size); 3014 font_object = driver_list->driver->open (f, entity, scaled_pixel_size);
3010 if (!NILP (font_object)) 3015 if (!NILP (font_object))
3011 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); 3016 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size));
@@ -3161,6 +3166,7 @@ font_spec_from_name (font_name)
3161 if (font_parse_name ((char *) SDATA (font_name), spec) == -1) 3166 if (font_parse_name ((char *) SDATA (font_name), spec) == -1)
3162 return Qnil; 3167 return Qnil;
3163 font_put_extra (spec, QCname, font_name); 3168 font_put_extra (spec, QCname, font_name);
3169 font_put_extra (spec, QCuser_spec, font_name);
3164 return spec; 3170 return spec;
3165} 3171}
3166 3172
@@ -3174,14 +3180,13 @@ font_clear_prop (attrs, prop)
3174 3180
3175 if (! FONTP (font)) 3181 if (! FONTP (font))
3176 return; 3182 return;
3177#if 0 3183
3178 if (! NILP (Ffont_get (font, QCname))) 3184 if (! NILP (Ffont_get (font, QCname)))
3179 { 3185 {
3180 font = Fcopy_font_spec (font); 3186 font = Fcopy_font_spec (font);
3181 font_put_extra (font, QCname, Qnil); 3187 font_put_extra (font, QCname, Qnil);
3182 } 3188 }
3183 3189
3184#endif
3185 if (NILP (AREF (font, prop)) 3190 if (NILP (AREF (font, prop))
3186 && prop != FONT_FAMILY_INDEX 3191 && prop != FONT_FAMILY_INDEX
3187 && prop != FONT_FOUNDRY_INDEX 3192 && prop != FONT_FOUNDRY_INDEX
@@ -3539,8 +3544,8 @@ font_load_for_lface (f, attrs, spec)
3539 entity = font_open_for_lface (f, entity, attrs, spec); 3544 entity = font_open_for_lface (f, entity, attrs, spec);
3540 if (!NILP (entity)) 3545 if (!NILP (entity))
3541 { 3546 {
3542 name = Ffont_get (spec, QCname); 3547 name = Ffont_get (spec, QCuser_spec);
3543 if (STRINGP (name)) font_put_extra (entity, QCname, name); 3548 if (STRINGP (name)) font_put_extra (entity, QCuser_spec, name);
3544 } 3549 }
3545 return entity; 3550 return entity;
3546} 3551}
@@ -3614,7 +3619,7 @@ font_open_by_name (f, name)
3614 ret = font_open_by_spec (f, spec); 3619 ret = font_open_by_spec (f, spec);
3615 /* Do not loose name originally put in. */ 3620 /* Do not loose name originally put in. */
3616 if (!NILP (ret)) 3621 if (!NILP (ret))
3617 font_put_extra (ret, QCname, args[1]); 3622 font_put_extra (ret, QCuser_spec, args[1]);
3618 3623
3619 return ret; 3624 return ret;
3620} 3625}
@@ -5269,6 +5274,8 @@ syms_of_font ()
5269 DEFSYM (Qja, "ja"); 5274 DEFSYM (Qja, "ja");
5270 DEFSYM (Qko, "ko"); 5275 DEFSYM (Qko, "ko");
5271 5276
5277 DEFSYM (QCuser_spec, "user-spec");
5278
5272 staticpro (&null_vector); 5279 staticpro (&null_vector);
5273 null_vector = Fmake_vector (make_number (0), Qnil); 5280 null_vector = Fmake_vector (make_number (0), Qnil);
5274 5281
diff --git a/src/font.h b/src/font.h
index 1a09df2558c..798676d546e 100644
--- a/src/font.h
+++ b/src/font.h
@@ -689,6 +689,14 @@ struct font_driver
689 int c, unsigned variations[256])); 689 int c, unsigned variations[256]));
690 690
691 void (*filter_properties) P_ ((Lisp_Object font, Lisp_Object properties)); 691 void (*filter_properties) P_ ((Lisp_Object font, Lisp_Object properties));
692
693 /* Optional.
694
695 Return non-zero if FONT_OBJECT can be used as a (cached) font
696 for ENTITY on frame F. */
697 int (*cached_font_ok) P_ ((struct frame *f,
698 Lisp_Object font_object,
699 Lisp_Object entity));
692}; 700};
693 701
694 702
diff --git a/src/fontset.c b/src/fontset.c
index 30620e511c8..b62c779be70 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -533,8 +533,8 @@ fontset_find_font (fontset, c, face, id, fallback)
533{ 533{
534 Lisp_Object vec, font_group; 534 Lisp_Object vec, font_group;
535 int i, charset_matched = 0, found_index; 535 int i, charset_matched = 0, found_index;
536 FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset))) 536 FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset))
537 ? XFRAME (selected_frame) : XFRAME (FONTSET_FRAME (fontset)); 537 ? XFRAME (FONTSET_FRAME (fontset)) : XFRAME (selected_frame));
538 Lisp_Object rfont_def; 538 Lisp_Object rfont_def;
539 539
540 font_group = fontset_get_font_group (fontset, fallback ? -1 : c); 540 font_group = fontset_get_font_group (fontset, fallback ? -1 : c);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index cd9c930c7c2..1dab467a0ac 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -568,6 +568,42 @@ xg_set_geometry (f)
568 f->left_pos, f->top_pos); 568 f->left_pos, f->top_pos);
569} 569}
570 570
571/* Clear under internal border if any. As we use a mix of Gtk+ and X calls
572 and use a GtkFixed widget, this doesn't happen automatically. */
573
574static void
575xg_clear_under_internal_border (f)
576 FRAME_PTR f;
577{
578 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
579 {
580 GtkWidget *wfixed = f->output_data.x->edit_widget;
581 gtk_widget_queue_draw (wfixed);
582 gdk_window_process_all_updates ();
583 x_clear_area (FRAME_X_DISPLAY (f),
584 FRAME_X_WINDOW (f),
585 0, 0,
586 FRAME_PIXEL_WIDTH (f),
587 FRAME_INTERNAL_BORDER_WIDTH (f), 0);
588 x_clear_area (FRAME_X_DISPLAY (f),
589 FRAME_X_WINDOW (f),
590 0, 0,
591 FRAME_INTERNAL_BORDER_WIDTH (f),
592 FRAME_PIXEL_HEIGHT (f), 0);
593 x_clear_area (FRAME_X_DISPLAY (f),
594 FRAME_X_WINDOW (f),
595 0, FRAME_PIXEL_HEIGHT (f) - FRAME_INTERNAL_BORDER_WIDTH (f),
596 FRAME_PIXEL_WIDTH (f),
597 FRAME_INTERNAL_BORDER_WIDTH (f), 0);
598 x_clear_area (FRAME_X_DISPLAY (f),
599 FRAME_X_WINDOW (f),
600 FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f),
601 0,
602 FRAME_INTERNAL_BORDER_WIDTH (f),
603 FRAME_PIXEL_HEIGHT (f), 0);
604 }
605}
606
571/* Function to handle resize of our frame. As we have a Gtk+ tool bar 607/* Function to handle resize of our frame. As we have a Gtk+ tool bar
572 and a Gtk+ menu bar, we get resize events for the edit part of the 608 and a Gtk+ menu bar, we get resize events for the edit part of the
573 frame only. We let Gtk+ deal with the Gtk+ parts. 609 frame only. We let Gtk+ deal with the Gtk+ parts.
@@ -584,8 +620,8 @@ xg_frame_resized (f, pixelwidth, pixelheight)
584 if (pixelwidth == -1 && pixelheight == -1) 620 if (pixelwidth == -1 && pixelheight == -1)
585 { 621 {
586 if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f))) 622 if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f)))
587 gdk_window_get_geometry(FRAME_GTK_WIDGET (f)->window, 0, 0, 623 gdk_window_get_geometry (FRAME_GTK_WIDGET (f)->window, 0, 0,
588 &pixelwidth, &pixelheight, 0); 624 &pixelwidth, &pixelheight, 0);
589 else return; 625 else return;
590 } 626 }
591 627
@@ -601,6 +637,7 @@ xg_frame_resized (f, pixelwidth, pixelheight)
601 FRAME_PIXEL_WIDTH (f) = pixelwidth; 637 FRAME_PIXEL_WIDTH (f) = pixelwidth;
602 FRAME_PIXEL_HEIGHT (f) = pixelheight; 638 FRAME_PIXEL_HEIGHT (f) = pixelheight;
603 639
640 xg_clear_under_internal_border (f);
604 change_frame_size (f, rows, columns, 0, 1, 0); 641 change_frame_size (f, rows, columns, 0, 1, 0);
605 SET_FRAME_GARBAGED (f); 642 SET_FRAME_GARBAGED (f);
606 cancel_mouse_face (f); 643 cancel_mouse_face (f);
@@ -637,6 +674,10 @@ xg_frame_set_char_size (f, cols, rows)
637 after calculating that value. */ 674 after calculating that value. */
638 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); 675 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
639 676
677
678 /* Do this before resize, as we don't know yet if we will be resized. */
679 xg_clear_under_internal_border (f);
680
640 /* Must resize our top level widget. Font size may have changed, 681 /* Must resize our top level widget. Font size may have changed,
641 but not rows/cols. */ 682 but not rows/cols. */
642 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 683 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
@@ -3201,15 +3242,43 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
3201 { 3242 {
3202 GtkWidget *wfixed = f->output_data.x->edit_widget; 3243 GtkWidget *wfixed = f->output_data.x->edit_widget;
3203 GtkWidget *wparent = gtk_widget_get_parent (wscroll); 3244 GtkWidget *wparent = gtk_widget_get_parent (wscroll);
3245 GtkFixed *wf = GTK_FIXED (wfixed);
3246
3247 /* Clear out old position. */
3248 GList *iter;
3249 int oldx = -1, oldy = -1, oldw, oldh;
3250 for (iter = wf->children; iter; iter = iter->next)
3251 if (((GtkFixedChild *)iter->data)->widget == wparent)
3252 {
3253 GtkFixedChild *ch = (GtkFixedChild *)iter->data;
3254 if (ch->x != left || ch->y != top)
3255 {
3256 oldx = ch->x;
3257 oldy = ch->y;
3258 gtk_widget_get_size_request (wscroll, &oldw, &oldh);
3259 }
3260 break;
3261 }
3204 3262
3205 /* Move and resize to new values. */ 3263 /* Move and resize to new values. */
3206 gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); 3264 gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
3207 gtk_widget_set_size_request (wscroll, width, height); 3265 gtk_widget_set_size_request (wscroll, width, height);
3208 gtk_widget_queue_draw (wparent); 3266 gtk_widget_queue_draw (wfixed);
3209 gdk_window_process_all_updates (); 3267 gdk_window_process_all_updates ();
3268 if (oldx != -1)
3269 {
3270 /* Clear under old scroll bar position. This must be done after
3271 the gtk_widget_queue_draw and gdk_window_process_all_updates
3272 above. */
3273 x_clear_area (FRAME_X_DISPLAY (f),
3274 FRAME_X_WINDOW (f),
3275 oldx, oldy, oldw, oldh, 0);
3276 }
3277
3210 /* GTK does not redraw until the main loop is entered again, but 3278 /* GTK does not redraw until the main loop is entered again, but
3211 if there are no X events pending we will not enter it. So we sync 3279 if there are no X events pending we will not enter it. So we sync
3212 here to get some events. */ 3280 here to get some events. */
3281
3213 x_sync (f); 3282 x_sync (f);
3214 SET_FRAME_GARBAGED (f); 3283 SET_FRAME_GARBAGED (f);
3215 cancel_mouse_face (f); 3284 cancel_mouse_face (f);
diff --git a/src/keyboard.c b/src/keyboard.c
index 7a137ea0dca..13d13cd3276 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9502,7 +9502,13 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9502 key = read_char (NILP (prompt), nmaps, 9502 key = read_char (NILP (prompt), nmaps,
9503 (Lisp_Object *) submaps, last_nonmenu_event, 9503 (Lisp_Object *) submaps, last_nonmenu_event,
9504 &used_mouse_menu, NULL); 9504 &used_mouse_menu, NULL);
9505 if (INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ 9505 if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
9506 /* When switching to a new tty (with a new keyboard),
9507 read_char returns the new buffer, rather than -2
9508 (Bug#5095). This is because `terminal-init-xterm'
9509 calls read-char, which eats the wrong_kboard_jmpbuf
9510 return. Any better way to fix this? -- cyd */
9511 || (interrupted_kboard != current_kboard))
9506 { 9512 {
9507 int found = 0; 9513 int found = 0;
9508 struct kboard *k; 9514 struct kboard *k;
diff --git a/src/nsfns.m b/src/nsfns.m
index 642ff794c05..08564c7216c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -206,30 +206,28 @@ ns_get_window (Lisp_Object maybeFrame)
206static NSScreen * 206static NSScreen *
207ns_get_screen (Lisp_Object screen) 207ns_get_screen (Lisp_Object screen)
208{ 208{
209 struct terminal *terminal = get_terminal (screen, 1); 209 struct frame *f;
210 struct terminal *terminal;
211
212 if (EQ (Qt, screen)) /* not documented */
213 return [NSScreen mainScreen];
214
215 terminal = get_terminal (screen, 1);
210 if (terminal->type != output_ns) 216 if (terminal->type != output_ns)
211 // Not sure if this special case for nil is needed. It does seem to be 217 return NULL;
212 // important in xfns.c for the make-frame call in frame-initialize, 218
213 // so let's keep it here for now. 219 if (NILP (screen))
214 return (NILP (screen) ? [NSScreen mainScreen] : NULL); 220 f = SELECTED_FRAME ();
221 else if (FRAMEP (screen))
222 f = XFRAME (screen);
215 else 223 else
216 { 224 {
217 struct ns_display_info *dpyinfo = terminal->display_info.ns; 225 struct ns_display_info *dpyinfo = terminal->display_info.ns;
218 struct frame *f = dpyinfo->x_focus_frame; 226 f = (dpyinfo->x_focus_frame || dpyinfo->x_highlight_frame);
219 if (!f)
220 f = dpyinfo->x_highlight_frame;
221 if (!f)
222 return NULL;
223 else
224 {
225 id window = nil;
226 Lisp_Object frame;
227 eassert (FRAME_NS_P (f));
228 XSETFRAME (frame, f);
229 window = ns_get_window (frame);
230 return window ? [window screen] : NULL;
231 }
232 } 227 }
228
229 return ((f && FRAME_NS_P (f)) ? [[FRAME_NS_VIEW (f) window] screen]
230 : NULL);
233} 231}
234 232
235 233
@@ -2325,15 +2323,21 @@ that stands for the selected frame's display. */)
2325 Lisp_Object display; 2323 Lisp_Object display;
2326{ 2324{
2327 int top; 2325 int top;
2326 NSScreen *screen;
2328 NSRect vScreen; 2327 NSRect vScreen;
2329 2328
2330 check_ns (); 2329 check_ns ();
2331 vScreen = [ns_get_screen (display) visibleFrame]; 2330 screen = ns_get_screen (display);
2332 top = vScreen.origin.y == 0.0 ? 2331 if (!screen)
2333 (int) [ns_get_screen (display) frame].size.height - vScreen.size.height : 0; 2332 return Qnil;
2333
2334 vScreen = [screen visibleFrame];
2334 2335
2336 /* NS coordinate system is upside-down.
2337 Transform to screen-specific coordinates. */
2335 return list4 (make_number ((int) vScreen.origin.x), 2338 return list4 (make_number ((int) vScreen.origin.x),
2336 make_number (top), 2339 make_number ((int) [screen frame].size.height
2340 - vScreen.size.height - vScreen.origin.y),
2337 make_number ((int) vScreen.size.width), 2341 make_number ((int) vScreen.size.width),
2338 make_number ((int) vScreen.size.height)); 2342 make_number ((int) vScreen.size.height));
2339} 2343}
diff --git a/src/nsterm.m b/src/nsterm.m
index 9256c084e28..2eebbf86643 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1346,7 +1346,8 @@ ns_get_color (const char *name, NSColor **col)
1346 } 1346 }
1347 else if (!strncmp(name, "rgb:", 4)) /* A newer X11 format -- rgb:r/g/b */ 1347 else if (!strncmp(name, "rgb:", 4)) /* A newer X11 format -- rgb:r/g/b */
1348 { 1348 {
1349 strcpy(hex, name + 4); 1349 strncpy (hex, name + 4, 19);
1350 hex[19] = '\0';
1350 scaling = (strlen(hex) - 2) / 3; 1351 scaling = (strlen(hex) - 2) / 3;
1351 } 1352 }
1352 else if (name[0] == '#') /* An old X11 format; convert to newer */ 1353 else if (name[0] == '#') /* An old X11 format; convert to newer */
diff --git a/src/xftfont.c b/src/xftfont.c
index 82701ce0afe..26294ff16a6 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -237,6 +237,56 @@ xftfont_fix_match (pat, match)
237 } 237 }
238} 238}
239 239
240static void
241xftfont_add_rendering_parameters (pat, entity)
242 FcPattern *pat;
243 Lisp_Object entity;
244{
245 Lisp_Object tail;
246 int ival;
247
248 for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail))
249 {
250 Lisp_Object key = XCAR (XCAR (tail));
251 Lisp_Object val = XCDR (XCAR (tail));
252
253 if (EQ (key, QCantialias))
254 FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue);
255 else if (EQ (key, QChinting))
256 FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue);
257 else if (EQ (key, QCautohint))
258 FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
259 else if (EQ (key, QChintstyle))
260 {
261 if (INTEGERP (val))
262 FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val));
263 else if (SYMBOLP (val)
264 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
265 FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
266 }
267 else if (EQ (key, QCrgba))
268 {
269 if (INTEGERP (val))
270 FcPatternAddInteger (pat, FC_RGBA, XINT (val));
271 else if (SYMBOLP (val)
272 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
273 FcPatternAddInteger (pat, FC_RGBA, ival);
274 }
275 else if (EQ (key, QClcdfilter))
276 {
277 if (INTEGERP (val))
278 FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val));
279 else if (SYMBOLP (val)
280 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
281 FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
282 }
283#ifdef FC_EMBOLDEN
284 else if (EQ (key, QCembolden))
285 FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue);
286#endif
287 }
288}
289
240static Lisp_Object 290static Lisp_Object
241xftfont_open (f, entity, pixel_size) 291xftfont_open (f, entity, pixel_size)
242 FRAME_PTR f; 292 FRAME_PTR f;
@@ -245,7 +295,7 @@ xftfont_open (f, entity, pixel_size)
245{ 295{
246 FcResult result; 296 FcResult result;
247 Display *display = FRAME_X_DISPLAY (f); 297 Display *display = FRAME_X_DISPLAY (f);
248 Lisp_Object val, filename, index, tail, font_object; 298 Lisp_Object val, filename, index, font_object;
249 FcPattern *pat = NULL, *match; 299 FcPattern *pat = NULL, *match;
250 struct xftfont_info *xftfont_info = NULL; 300 struct xftfont_info *xftfont_info = NULL;
251 struct font *font; 301 struct font *font;
@@ -253,7 +303,7 @@ xftfont_open (f, entity, pixel_size)
253 XftFont *xftfont = NULL; 303 XftFont *xftfont = NULL;
254 int spacing; 304 int spacing;
255 char name[256]; 305 char name[256];
256 int len, i, ival; 306 int len, i;
257 XGlyphInfo extents; 307 XGlyphInfo extents;
258 FT_Face ft_face; 308 FT_Face ft_face;
259 FcMatrix *matrix; 309 FcMatrix *matrix;
@@ -297,46 +347,7 @@ xftfont_open (f, entity, pixel_size)
297 over 10x20-ISO8859-1.pcf.gz). */ 347 over 10x20-ISO8859-1.pcf.gz). */
298 FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity)); 348 FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity));
299 349
300 for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) 350 xftfont_add_rendering_parameters (pat, entity);
301 {
302 Lisp_Object key, val;
303
304 key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail));
305 if (EQ (key, QCantialias))
306 FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue);
307 else if (EQ (key, QChinting))
308 FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue);
309 else if (EQ (key, QCautohint))
310 FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
311 else if (EQ (key, QChintstyle))
312 {
313 if (INTEGERP (val))
314 FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val));
315 else if (SYMBOLP (val)
316 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
317 FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
318 }
319 else if (EQ (key, QCrgba))
320 {
321 if (INTEGERP (val))
322 FcPatternAddInteger (pat, FC_RGBA, XINT (val));
323 else if (SYMBOLP (val)
324 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
325 FcPatternAddInteger (pat, FC_RGBA, ival);
326 }
327 else if (EQ (key, QClcdfilter))
328 {
329 if (INTEGERP (val))
330 FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val));
331 else if (SYMBOLP (val)
332 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
333 FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
334 }
335#ifdef FC_EMBOLDEN
336 else if (EQ (key, QCembolden))
337 FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue);
338#endif
339 }
340 351
341 FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); 352 FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename));
342 FcPatternAddInteger (pat, FC_INDEX, XINT (index)); 353 FcPatternAddInteger (pat, FC_INDEX, XINT (index));
@@ -712,6 +723,53 @@ xftfont_end_for_frame (f)
712 return 0; 723 return 0;
713} 724}
714 725
726static int
727xftfont_cached_font_ok (f, font_object, entity)
728 struct frame *f;
729 Lisp_Object font_object;
730 Lisp_Object entity;
731
732{
733 struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object);
734 FcPattern *oldpat = info->xftfont->pattern;
735 Display *display = FRAME_X_DISPLAY (f);
736 FcPattern *pat = FcPatternCreate ();
737 FcBool b1, b2;
738 int ok = 0, i1, i2, r1, r2;
739
740 xftfont_add_rendering_parameters (pat, entity);
741 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
742
743 r1 = FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b1);
744 r2 = FcPatternGetBool (oldpat, FC_ANTIALIAS, 0, &b2);
745 if (r1 != r2 || b1 != b2) goto out;
746 r1 = FcPatternGetBool (pat, FC_HINTING, 0, &b1);
747 r2 = FcPatternGetBool (oldpat, FC_HINTING, 0, &b2);
748 if (r1 != r2 || b1 != b2) goto out;
749 r1 = FcPatternGetBool (pat, FC_AUTOHINT, 0, &b1);
750 r2 = FcPatternGetBool (oldpat, FC_AUTOHINT, 0, &b2);
751 if (r1 != r2 || b1 != b2) goto out;
752#ifdef FC_EMBOLDEN
753 r1 = FcPatternGetBool (pat, FC_EMBOLDEN, 0, &b1);
754 r2 = FcPatternGetBool (oldpat, FC_EMBOLDEN, 0, &b2);
755 if (r1 != r2 || b1 != b2) goto out;
756#endif
757 r1 = FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i1);
758 r2 = FcPatternGetInteger (oldpat, FC_HINT_STYLE, 0, &i2);
759 if (r1 != r2 || i1 != i2) goto out;
760 r1 = FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i1);
761 r2 = FcPatternGetInteger (oldpat, FC_LCD_FILTER, 0, &i2);
762 if (r1 != r2 || i1 != i2) goto out;
763 r1 = FcPatternGetInteger (pat, FC_RGBA, 0, &i1);
764 r2 = FcPatternGetInteger (oldpat, FC_RGBA, 0, &i2);
765 if (r1 != r2 || i1 != i2) goto out;
766
767 ok = 1;
768 out:
769 FcPatternDestroy (pat);
770 return ok;
771}
772
715void 773void
716syms_of_xftfont () 774syms_of_xftfont ()
717{ 775{
@@ -737,6 +795,7 @@ syms_of_xftfont ()
737 xftfont_driver.text_extents = xftfont_text_extents; 795 xftfont_driver.text_extents = xftfont_text_extents;
738 xftfont_driver.draw = xftfont_draw; 796 xftfont_driver.draw = xftfont_draw;
739 xftfont_driver.end_for_frame = xftfont_end_for_frame; 797 xftfont_driver.end_for_frame = xftfont_end_for_frame;
798 xftfont_driver.cached_font_ok = xftfont_cached_font_ok;
740 799
741 register_font_driver (&xftfont_driver, NULL); 800 register_font_driver (&xftfont_driver, NULL);
742} 801}
diff --git a/src/xterm.c b/src/xterm.c
index 7f9f6f3c05e..efd30f4a601 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2951,6 +2951,12 @@ x_clear_frame (struct frame *f)
2951 colors or something like that, then they should be notified. */ 2951 colors or something like that, then they should be notified. */
2952 x_scroll_bar_clear (f); 2952 x_scroll_bar_clear (f);
2953 2953
2954#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
2955 /* Make sure scroll bars are redrawn. As they aren't redrawn by
2956 redisplay, do it here. */
2957 gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
2958#endif
2959
2954 XFlush (FRAME_X_DISPLAY (f)); 2960 XFlush (FRAME_X_DISPLAY (f));
2955 2961
2956 UNBLOCK_INPUT; 2962 UNBLOCK_INPUT;
@@ -8064,32 +8070,7 @@ x_new_font (f, font_object, fontset)
8064 doing it because it's done in Fx_show_tip, and it leads to 8070 doing it because it's done in Fx_show_tip, and it leads to
8065 problems because the tip frame has no widget. */ 8071 problems because the tip frame has no widget. */
8066 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 8072 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
8067 { 8073 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
8068 int rows, cols;
8069
8070 /* When the frame is maximized/fullscreen or running under for
8071 example Xmonad, x_set_window_size will be a no-op.
8072 In that case, the right thing to do is extend rows/cols to
8073 the current frame size. We do that first if x_set_window_size
8074 turns out to not be a no-op (there is no way to know).
8075 The size will be adjusted again if the frame gets a
8076 ConfigureNotify event as a result of x_set_window_size. */
8077 int pixelh = FRAME_PIXEL_HEIGHT (f);
8078#ifdef USE_X_TOOLKIT
8079 /* The menu bar is not part of text lines. The tool bar
8080 is however. */
8081 pixelh -= FRAME_MENUBAR_HEIGHT (f);
8082#endif
8083 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelh);
8084 /* Update f->scroll_bar_actual_width because it is used in
8085 FRAME_PIXEL_WIDTH_TO_TEXT_COLS. */
8086 f->scroll_bar_actual_width
8087 = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
8088 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, FRAME_PIXEL_WIDTH (f));
8089
8090 change_frame_size (f, rows, cols, 0, 1, 0);
8091 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
8092 }
8093 } 8074 }
8094 8075
8095#ifdef HAVE_X_I18N 8076#ifdef HAVE_X_I18N
@@ -8977,6 +8958,32 @@ x_set_window_size (f, change_gravity, cols, rows)
8977{ 8958{
8978 BLOCK_INPUT; 8959 BLOCK_INPUT;
8979 8960
8961 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
8962 {
8963 int r, c;
8964
8965 /* When the frame is maximized/fullscreen or running under for
8966 example Xmonad, x_set_window_size_1 will be a no-op.
8967 In that case, the right thing to do is extend rows/cols to
8968 the current frame size. We do that first if x_set_window_size_1
8969 turns out to not be a no-op (there is no way to know).
8970 The size will be adjusted again if the frame gets a
8971 ConfigureNotify event as a result of x_set_window_size. */
8972 int pixelh = FRAME_PIXEL_HEIGHT (f);
8973#ifdef USE_X_TOOLKIT
8974 /* The menu bar is not part of text lines. The tool bar
8975 is however. */
8976 pixelh -= FRAME_MENUBAR_HEIGHT (f);
8977#endif
8978 r = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelh);
8979 /* Update f->scroll_bar_actual_width because it is used in
8980 FRAME_PIXEL_WIDTH_TO_TEXT_COLS. */
8981 f->scroll_bar_actual_width
8982 = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
8983 c = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, FRAME_PIXEL_WIDTH (f));
8984 change_frame_size (f, r, c, 0, 1, 0);
8985 }
8986
8980#ifdef USE_GTK 8987#ifdef USE_GTK
8981 if (FRAME_GTK_WIDGET (f)) 8988 if (FRAME_GTK_WIDGET (f))
8982 xg_frame_set_char_size (f, cols, rows); 8989 xg_frame_set_char_size (f, cols, rows);