aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-07-16 11:42:15 -0400
committerChong Yidong2010-07-16 11:42:15 -0400
commitfea9cabd275c3d5809b824a6e4a1446441a6793e (patch)
treea5eb69edf85fe28f6b4d5bbc8e3c2c3cfc3d0d37
parent7e4289ad2bbd9f8ed18902f652d3f07380b227bf (diff)
parentf253ef6a8e0dd71cf9fd58e3d9407549d30e091d (diff)
downloademacs-fea9cabd275c3d5809b824a6e4a1446441a6793e.tar.gz
emacs-fea9cabd275c3d5809b824a6e4a1446441a6793e.zip
Merge changes from emacs-23 branch.
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/calendar/cal-tex.el80
-rw-r--r--lisp/calendar/calendar.el4
-rw-r--r--lisp/mail/rmailmm.el4
-rw-r--r--lisp/simple.el7
-rw-r--r--lisp/vc/vc.el17
-rw-r--r--lisp/xt-mouse.el4
-rw-r--r--src/ChangeLog22
-rw-r--r--src/gtkutil.c32
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/w32fns.c5
-rw-r--r--src/xfns.c19
-rw-r--r--src/xmenu.c8
-rw-r--r--src/xterm.c2
-rw-r--r--src/xterm.h5
15 files changed, 169 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 199c8243188..f0ea29a5d89 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12010-07-16 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * vc.el (vc-coding-system-inherit-eol): New defvar.
4 (vc-coding-system-for-diff): Use it to decide whether to inherit
5 from the file the EOL format for reading the diffs of that file.
6 (Bug#4451)
7
82010-07-16 Eli Zaretskii <eliz@gnu.org>
9
10 * mail/rmailmm.el (rmail-mime-save): Make the temp buffer
11 unibyte, so compressed attachments are not compressed again.
12
12010-07-16 Michael Albinus <michael.albinus@gmx.de> 132010-07-16 Michael Albinus <michael.albinus@gmx.de>
2 14
3 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired 15 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
@@ -22,6 +34,11 @@
22 * bookmark.el (bookmark-load-hook): Fix doc string as suggested 34 * bookmark.el (bookmark-load-hook): Fix doc string as suggested
23 by Drew Adams (Bug#5504). 35 by Drew Adams (Bug#5504).
24 36
372010-07-14 Jan Djärv <jan.h.d@swipnet.se>
38
39 * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127
40 now that unicode is used (Bug#6594).
41
252010-07-14 Chong Yidong <cyd@stupidchicken.com> 422010-07-14 Chong Yidong <cyd@stupidchicken.com>
26 43
27 * term/x-win.el (x-select-enable-clipboard): Default to t. 44 * term/x-win.el (x-select-enable-clipboard): Default to t.
@@ -120,6 +137,20 @@
120 * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass 137 * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass
121 empty argument to gvfs-copy. 138 empty argument to gvfs-copy.
122 139
1402010-07-10 Glenn Morris <rgm@gnu.org>
141
142 * calendar/calendar.el (calendar-week-end-day): New function.
143 * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars.
144 Respect calendar-week-start-day. (Bug#6606)
145 (cal-tex-insert-day-names, cal-tex-insert-blank-days)
146 (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day.
147 (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and
148 respect calendar-week-start-day.
149
1502010-07-10 Chong Yidong <cyd@stupidchicken.com>
151
152 * simple.el (use-region-p): Doc fix (Bug#6607).
153
1232010-07-10 Aleksei Gusev <aleksei.gusev@gmail.com> (tiny change) 1542010-07-10 Aleksei Gusev <aleksei.gusev@gmail.com> (tiny change)
124 155
125 * progmodes/compile.el (compilation-error-regexp-alist-alist): Add 156 * progmodes/compile.el (compilation-error-regexp-alist-alist): Add
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index bbddc1ff38c..46fb0869787 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -1,7 +1,7 @@
1;;; cal-tex.el --- calendar functions for printing calendars with LaTeX 1;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
2 2
3;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4;; Free Software Foundation, Inc. 4;; 2009, 2010 Free Software Foundation, Inc.
5 5
6;; Author: Steve Fisk <fisk@bowdoin.edu> 6;; Author: Steve Fisk <fisk@bowdoin.edu>
7;; Edward M. Reingold <reingold@cs.uiuc.edu> 7;; Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -507,6 +507,7 @@ indicates a buffer position to use instead of point."
507 (year (calendar-extract-year date)) 507 (year (calendar-extract-year date))
508 (end-month month) 508 (end-month month)
509 (end-year year) 509 (end-year year)
510 ;; FIXME -landscape sets cal-tex-which-days?
510 (d1 (calendar-absolute-from-gregorian (list month 1 year))) 511 (d1 (calendar-absolute-from-gregorian (list month 1 year)))
511 (d2 (progn 512 (d2 (progn
512 (calendar-increment-month end-month end-year (1- n)) 513 (calendar-increment-month end-month end-year (1- n))
@@ -515,8 +516,7 @@ indicates a buffer position to use instead of point."
515 (calendar-last-day-of-month end-month end-year) 516 (calendar-last-day-of-month end-month end-year)
516 end-year)))) 517 end-year))))
517 (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) 518 (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))
518 (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) 519 (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))))
519 other-month other-year)
520 (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") 520 (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt")
521 (if (> n 1) 521 (if (> n 1)
522 (cal-tex-cmd cal-tex-cal-multi-month) 522 (cal-tex-cmd cal-tex-cal-multi-month)
@@ -526,14 +526,12 @@ indicates a buffer position to use instead of point."
526 (cal-tex-nl ".2cm") 526 (cal-tex-nl ".2cm")
527 (cal-tex-insert-blank-days month year cal-tex-day-prefix) 527 (cal-tex-insert-blank-days month year cal-tex-day-prefix)
528 (dotimes (idummy n) 528 (dotimes (idummy n)
529 (setq other-month month
530 other-year year)
531 (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) 529 (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix)
532 (when (= 6 (mod (calendar-absolute-from-gregorian 530 (when (= (calendar-week-end-day)
533 (list month 531 (calendar-day-of-week
534 (calendar-last-day-of-month month year) 532 (list month
535 year)) 533 (calendar-last-day-of-month month year)
536 7)) ; last day of month was Saturday 534 year))) ; last day of month was last day of week
537 (cal-tex-hfill) 535 (cal-tex-hfill)
538 (cal-tex-nl)) 536 (cal-tex-nl))
539 (calendar-increment-month month year 1)) 537 (calendar-increment-month month year 1))
@@ -570,13 +568,14 @@ are included. Each day is formatted using format DAY-FORMAT."
570 568
571(defun cal-tex-insert-day-names () 569(defun cal-tex-insert-day-names ()
572 "Insert the names of the days at top of a monthly calendar." 570 "Insert the names of the days at top of a monthly calendar."
573 (dotimes (i 7) 571 (let (j)
574 (if (memq i cal-tex-which-days) 572 (dotimes (i 7)
575 (insert (format cal-tex-day-name-format 573 (if (memq (setq j (mod (+ calendar-week-start-day i) 7))
576 (cal-tex-LaTeXify-string 574 cal-tex-which-days)
577 (aref calendar-day-name-array 575 (insert (format cal-tex-day-name-format
578 (mod (+ calendar-week-start-day i) 7)))))) 576 (cal-tex-LaTeXify-string
579 (cal-tex-comment))) 577 (aref calendar-day-name-array j)))))
578 (cal-tex-comment))))
580 579
581(defun cal-tex-insert-month-header (n month year end-month end-year) 580(defun cal-tex-insert-month-header (n month year end-month end-year)
582 "Create a title for a calendar. 581 "Create a title for a calendar.
@@ -603,7 +602,7 @@ blank, no days are inserted."
603 calendar-week-start-day) 602 calendar-week-start-day)
604 7))) 603 7)))
605 (dotimes (i blank-days) 604 (dotimes (i blank-days)
606 (if (memq i cal-tex-which-days) 605 (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days)
607 (insert (format day-format " " " ") "{}{}{}{}%\n")))))) 606 (insert (format day-format " " " ") "{}{}{}{}%\n"))))))
608 607
609(defun cal-tex-insert-blank-days-at-end (month year day-format) 608(defun cal-tex-insert-blank-days-at-end (month year day-format)
@@ -619,38 +618,37 @@ The entry is formatted using DAY-FORMAT."
619 7)) 618 7))
620 (i blank-days)) 619 (i blank-days))
621 (while (<= (setq i (1+ i)) 6) 620 (while (<= (setq i (1+ i)) 6)
622 (if (memq i cal-tex-which-days) 621 (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days)
623 (insert (format day-format "" "") "{}{}{}{}%\n")))))) 622 (insert (format day-format "" "") "{}{}{}{}%\n"))))))
624 623
625(defun cal-tex-first-blank-p (month year) 624(defun cal-tex-first-blank-p (month year)
626 "Determine if any days of the first week will be printed. 625 "Determine if any days of the first week will be printed.
627Return t if there will there be any days of the first week printed 626Return t if there will there be any days of the first week printed
628in the calendar starting in MONTH YEAR." 627in the calendar starting in MONTH YEAR."
629 (let (any-days the-saturday) ; the day of week of 1st Saturday 628 ;; Check days 1-7 of the month, until we find the last day of the week.
630 (dotimes (i 7) 629 (catch 'found
631 (if (= 6 (calendar-day-of-week (list month (1+ i) year))) 630 (let (dow)
632 (setq the-saturday (1+ i)))) 631 (dotimes (i 7)
633 (dotimes (i the-saturday) 632 (if (memq (setq dow (calendar-day-of-week (list month (1+ i) year)))
634 (if (memq (calendar-day-of-week (list month (1+ i) year)) 633 cal-tex-which-days)
635 cal-tex-which-days) 634 (throw 'found t)
636 (setq any-days t))) 635 (if (= dow (calendar-week-end-day)) (throw 'found nil)))))))
637 any-days))
638 636
639(defun cal-tex-last-blank-p (month year) 637(defun cal-tex-last-blank-p (month year)
640 "Determine if any days of the last week will be printed. 638 "Determine if any days of the last week will be printed.
641Return t if there will there be any days of the last week printed 639Return t if there will there be any days of the last week printed
642in the calendar starting in MONTH YEAR." 640in the calendar starting in MONTH YEAR."
643 (let* ((last-day (calendar-last-day-of-month month year)) 641 ;; Check backwards from the last day of the month, until we find the
644 (i (- last-day 7)) 642 ;; start of the last week in the month.
645 any-days the-sunday) ; the day of week of last Sunday 643 (catch 'found
646 (while (<= (setq i (1+ i)) last-day) 644 (let ((last-day (calendar-last-day-of-month month year))
647 (if (zerop (calendar-day-of-week (list month i year))) 645 day dow)
648 (setq the-sunday i))) 646 (dotimes (i 7)
649 (setq i (1- the-sunday)) 647 (if (memq (setq dow (calendar-day-of-week
650 (while (<= (setq i (1+ i)) last-day) 648 (list month (- last-day i) year)))
651 (if (memq (calendar-day-of-week (list month i year)) cal-tex-which-days) 649 cal-tex-which-days)
652 (setq any-days t))) 650 (throw 'found t)
653 any-days)) 651 (if (= dow calendar-week-start-day) (throw 'found nil)))))))
654 652
655(defun cal-tex-number-weeks (month year n) 653(defun cal-tex-number-weeks (month year n)
656 "Determine the number of weeks in a range of dates. 654 "Determine the number of weeks in a range of dates.
@@ -1499,7 +1497,7 @@ Optional string COLSEP gives the column separation (default \"1mm\")."
1499 (- (calendar-day-of-week (list month 1 year)) 1497 (- (calendar-day-of-week (list month 1 year))
1500 calendar-week-start-day) 1498 calendar-week-start-day)
1501 7)) 1499 7))
1502 (last (calendar-last-day-of-month month year)) 1500 (last( calendar-last-day-of-month month year))
1503 (str (concat "\\def\\" name "{\\hbox to" width "{%\n" 1501 (str (concat "\\def\\" name "{\\hbox to" width "{%\n"
1504 "\\vbox to" height "{%\n" 1502 "\\vbox to" height "{%\n"
1505 "\\vfil \\hbox to" width "{%\n" 1503 "\\vfil \\hbox to" width "{%\n"
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index d92942d003f..418f740bb83 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -2226,6 +2226,10 @@ DATE is a list of the form (month day year). A negative year is
2226interpreted as BC; -1 being 1 BC, and so on." 2226interpreted as BC; -1 being 1 BC, and so on."
2227 (mod (calendar-absolute-from-gregorian date) 7)) 2227 (mod (calendar-absolute-from-gregorian date) 7))
2228 2228
2229(defun calendar-week-end-day ()
2230 "Return the index (0 for Sunday, etc.) of the last day of the week."
2231 (mod (+ calendar-week-start-day 6) 7))
2232
2229(defun calendar-unmark () 2233(defun calendar-unmark ()
2230 "Delete all diary/holiday marks/highlighting from the calendar." 2234 "Delete all diary/holiday marks/highlighting from the calendar."
2231 (interactive) 2235 (interactive)
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 415bc20cf50..e8ca11ee349 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -112,6 +112,10 @@ automatically display the image in the buffer."
112 (file-name-as-directory filename)))) 112 (file-name-as-directory filename))))
113 (with-temp-buffer 113 (with-temp-buffer
114 (set-buffer-file-coding-system 'no-conversion) 114 (set-buffer-file-coding-system 'no-conversion)
115 ;; Needed e.g. by jka-compr, so if the attachment is a compressed
116 ;; file, the magic signature compares equal with the unibyte
117 ;; signature string recorded in jka-compr-compression-info-list.
118 (set-buffer-multibyte nil)
115 (insert data) 119 (insert data)
116 (write-region nil nil filename nil nil nil t)))) 120 (write-region nil nil filename nil nil nil t))))
117 121
diff --git a/lisp/simple.el b/lisp/simple.el
index 20e109aaafe..939fbfe4e15 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3761,10 +3761,9 @@ point otherwise."
3761This is used by commands that act specially on the region under 3761This is used by commands that act specially on the region under
3762Transient Mark mode. 3762Transient Mark mode.
3763 3763
3764The return value is t provided Transient Mark mode is enabled and 3764The return value is t if Transient Mark mode is enabled and the
3765the mark is active; and, when `use-empty-active-region' is 3765mark is active; furthermore, if `use-empty-active-region' is nil,
3766non-nil, provided the region is empty. Otherwise, the return 3766the region must not be empty. Otherwise, the return value is nil.
3767value is nil.
3768 3767
3769For some commands, it may be appropriate to ignore the value of 3768For some commands, it may be appropriate to ignore the value of
3770`use-empty-active-region'; in that case, use `region-active-p'." 3769`use-empty-active-region'; in that case, use `region-active-p'."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 434c2a10e14..20e56bbd42f 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1437,6 +1437,16 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
1437;; (vc-call-backend ',(vc-backend f) 1437;; (vc-call-backend ',(vc-backend f)
1438;; 'diff (list ',f) ',rev1 ',rev2)))))) 1438;; 'diff (list ',f) ',rev1 ',rev2))))))
1439 1439
1440(defvar vc-coding-system-inherit-eol t
1441 "When non-nil, inherit the EOL format for reading Diff output from the file.
1442
1443Used in `vc-coding-system-for-diff' to determine the EOL format to use
1444for reading Diff output for a file. If non-nil, the EOL format is
1445inherited from the file itself.
1446Set this variable to nil if your Diff tool might use a different
1447EOL. Then Emacs will auto-detect the EOL format in Diff output, which
1448gives better results.") ;; Cf. bug#4451.
1449
1440(defun vc-coding-system-for-diff (file) 1450(defun vc-coding-system-for-diff (file)
1441 "Return the coding system for reading diff output for FILE." 1451 "Return the coding system for reading diff output for FILE."
1442 (or coding-system-for-read 1452 (or coding-system-for-read
@@ -1444,7 +1454,12 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
1444 ;; use the buffer's coding system 1454 ;; use the buffer's coding system
1445 (let ((buf (find-buffer-visiting file))) 1455 (let ((buf (find-buffer-visiting file)))
1446 (when buf (with-current-buffer buf 1456 (when buf (with-current-buffer buf
1447 buffer-file-coding-system))) 1457 (if vc-coding-system-inherit-eol
1458 buffer-file-coding-system
1459 ;; Don't inherit the EOL part of the coding-system,
1460 ;; because some Diff tools may choose to use
1461 ;; a different one. bug#4451.
1462 (coding-system-base buffer-file-coding-system)))))
1448 ;; otherwise, try to find one based on the file name 1463 ;; otherwise, try to find one based on the file name
1449 (car (find-operation-coding-system 'insert-file-contents file)) 1464 (car (find-operation-coding-system 'insert-file-contents file))
1450 ;; and a final fallback 1465 ;; and a final fallback
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 2d38c6e827c..f802103fbd7 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -122,8 +122,8 @@
122;; read xterm sequences above ascii 127 (#x7f) 122;; read xterm sequences above ascii 127 (#x7f)
123(defun xterm-mouse-event-read () 123(defun xterm-mouse-event-read ()
124 (let ((c (read-char))) 124 (let ((c (read-char)))
125 (if (< c 0) 125 (if (> c #x3FFF80)
126 (+ c #x8000000 128) 126 (+ 128 (- c #x3FFF80))
127 c))) 127 c)))
128 128
129(defun xterm-mouse-truncate-wrap (f) 129(defun xterm-mouse-truncate-wrap (f)
diff --git a/src/ChangeLog b/src/ChangeLog
index 04e74667bc3..02c2969242f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,25 @@
12010-07-14 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
4
5 * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame.
6
7 * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499,
8 i.e. don't put back ButtonRelease (Bug#6608).
9
10 * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter
11 instead of Window. Call xg_event_is_for_menubar when
12 USE_GTK (Bug#6499).
13
14 * gtkutil.h (xg_event_is_for_menubar): Declare.
15
16 * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499).
17
182010-07-14 Eli Zaretskii <eliz@gnu.org>
19
20 * w32fns.c (x_set_foreground_color): Fix setting the cursor color
21 when it's the same as the old foreground. (Bug#6609)
22
12010-07-16 Jan Djärv <jan.h.d@swipnet.se> 232010-07-16 Jan Djärv <jan.h.d@swipnet.se>
2 24
3 * xmenu.c (free_frame_menubar): Only call x_set_window_size if 25 * xmenu.c (free_frame_menubar): Only call x_set_window_size if
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 396d9018e36..8676aa6200c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2856,6 +2856,38 @@ free_frame_menubar (FRAME_PTR f)
2856 } 2856 }
2857} 2857}
2858 2858
2859int
2860xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
2861{
2862 struct x_output *x = f->output_data.x;
2863
2864 if (! x->menubar_widget) return 0;
2865
2866 if (! (event->xbutton.x >= 0
2867 && event->xbutton.x < FRAME_PIXEL_WIDTH (f)
2868 && event->xbutton.y >= 0
2869 && event->xbutton.y < f->output_data.x->menubar_height
2870 && event->xbutton.same_screen))
2871 return 0;
2872
2873 GList *list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget));
2874 if (! list) return 0;
2875 GList *iter;
2876 GdkRectangle rec;
2877 rec.x = event->xbutton.x;
2878 rec.y = event->xbutton.y;
2879 rec.width = 1;
2880 rec.height = 1;
2881 for (iter = list ; iter; iter = g_list_next (iter))
2882 {
2883 GtkWidget *w = GTK_WIDGET (iter->data);
2884 if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL))
2885 break;
2886 }
2887 g_list_free (list);
2888 return iter == 0 ? 0 : 1;
2889}
2890
2859 2891
2860 2892
2861/*********************************************************************** 2893/***********************************************************************
diff --git a/src/gtkutil.h b/src/gtkutil.h
index fcd23b65132..14693650de5 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -153,6 +153,8 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar,
153 153
154extern int xg_update_frame_menubar (FRAME_PTR f); 154extern int xg_update_frame_menubar (FRAME_PTR f);
155 155
156extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
157
156extern int xg_have_tear_offs (void); 158extern int xg_have_tear_offs (void);
157 159
158extern int xg_get_scroll_id_for_window (Display *dpy, Window wid); 160extern int xg_get_scroll_id_for_window (Display *dpy, Window wid);
diff --git a/src/w32fns.c b/src/w32fns.c
index c1791f2bf3e..57786d76795 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1333,7 +1333,10 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1333 if (FRAME_W32_WINDOW (f) != 0) 1333 if (FRAME_W32_WINDOW (f) != 0)
1334 { 1334 {
1335 if (x->cursor_pixel == old_fg) 1335 if (x->cursor_pixel == old_fg)
1336 x->cursor_pixel = fg; 1336 {
1337 x->cursor_pixel = fg;
1338 x->cursor_gc->background = fg;
1339 }
1337 1340
1338 update_face_from_frame_parameter (f, Qforeground_color, arg); 1341 update_face_from_frame_parameter (f, Qforeground_color, arg);
1339 if (FRAME_VISIBLE_P (f)) 1342 if (FRAME_VISIBLE_P (f))
diff --git a/src/xfns.c b/src/xfns.c
index c2135781811..ee020371683 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -398,8 +398,9 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
398/* Likewise, but consider only the menu bar widget. */ 398/* Likewise, but consider only the menu bar widget. */
399 399
400struct frame * 400struct frame *
401x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc) 401x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event)
402{ 402{
403 Window wdesc = event->xany.window;
403 Lisp_Object tail, frame; 404 Lisp_Object tail, frame;
404 struct frame *f; 405 struct frame *f;
405 struct x_output *x; 406 struct x_output *x;
@@ -415,21 +416,11 @@ x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
415 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) 416 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
416 continue; 417 continue;
417 x = f->output_data.x; 418 x = f->output_data.x;
418 /* Match if the window is this frame's menubar. */
419#ifdef USE_GTK 419#ifdef USE_GTK
420 if (x->menubar_widget) 420 if (x->menubar_widget && xg_event_is_for_menubar (f, event))
421 { 421 return f;
422 GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
423
424 /* This gives false positives, but the rectangle check in xterm.c
425 where this is called takes care of that. */
426 if (gwdesc != 0
427 && (gwdesc == x->menubar_widget
428 || gtk_widget_is_ancestor (x->menubar_widget, gwdesc)
429 || gtk_widget_is_ancestor (gwdesc, x->menubar_widget)))
430 return f;
431 }
432#else 422#else
423 /* Match if the window is this frame's menubar. */
433 if (x->menubar_widget 424 if (x->menubar_widget
434 && lw_window_is_in_menubar (wdesc, x->menubar_widget)) 425 && lw_window_is_in_menubar (wdesc, x->menubar_widget))
435 return f; 426 return f;
diff --git a/src/xmenu.c b/src/xmenu.c
index 82b315f83cb..2fb39339b98 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -664,14 +664,6 @@ x_activate_menubar (FRAME_PTR f)
664 BLOCK_INPUT; 664 BLOCK_INPUT;
665 popup_activated_flag = 1; 665 popup_activated_flag = 1;
666#ifdef USE_GTK 666#ifdef USE_GTK
667 /* If we click outside any menu item, the menu bar still grabs.
668 So we send Press and the Release. If outside, grab is released.
669 If on a menu item, it is popped up normally.
670 PutBack is like a stack, so we put back in reverse order. */
671 f->output_data.x->saved_menu_event->type = ButtonRelease;
672 XPutBackEvent (f->output_data.x->display_info->display,
673 f->output_data.x->saved_menu_event);
674 f->output_data.x->saved_menu_event->type = ButtonPress;
675 XPutBackEvent (f->output_data.x->display_info->display, 667 XPutBackEvent (f->output_data.x->display_info->display,
676 f->output_data.x->saved_menu_event); 668 f->output_data.x->saved_menu_event);
677#else 669#else
diff --git a/src/xterm.c b/src/xterm.c
index 0f6d432f979..ddc7a167684 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6743,7 +6743,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6743 f->mouse_moved = 0; 6743 f->mouse_moved = 0;
6744 6744
6745#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6745#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6746 f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); 6746 f = x_menubar_window_to_frame (dpyinfo, &event);
6747 /* For a down-event in the menu bar, 6747 /* For a down-event in the menu bar,
6748 don't pass it to Xt right now. 6748 don't pass it to Xt right now.
6749 Instead, save it away 6749 Instead, save it away
diff --git a/src/xterm.h b/src/xterm.h
index b22c225fed7..5c1213d2bf1 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -381,12 +381,15 @@ extern int use_xim;
381#endif 381#endif
382 382
383/* This checks to make sure we have a display. */ 383/* This checks to make sure we have a display. */
384
384extern void check_x (void); 385extern void check_x (void);
385 386
386extern struct frame *x_window_to_frame (struct x_display_info *, int); 387extern struct frame *x_window_to_frame (struct x_display_info *, int);
387 388
388extern struct frame *x_any_window_to_frame (struct x_display_info *, int); 389extern struct frame *x_any_window_to_frame (struct x_display_info *, int);
389extern struct frame *x_menubar_window_to_frame (struct x_display_info *, int); 390extern struct frame *x_menubar_window_to_frame (struct x_display_info *,
391 XEvent *);
392
390extern struct frame *x_top_window_to_frame (struct x_display_info *, int); 393extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
391 394
392#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) 395#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)