[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104155: Fix bug #8597 with setting f
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104155: Fix bug #8597 with setting frame background mode on w32 console. |
Date: |
Sat, 07 May 2011 18:44:19 +0300 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104155
fixes bug(s): http://debbugs.gnu.org/8597
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2011-05-07 18:44:19 +0300
message:
Fix bug #8597 with setting frame background mode on w32 console.
src/w32console.c (Fset_screen_color): Doc fix.
(Fget_screen_color): New function.
(syms_of_ntterm): Defsubr it.
lisp/term/w32console.el (terminal-init-w32console): Call
get-screen-color and use its output to set the frame
background-mode.
modified:
lisp/ChangeLog
lisp/term/w32console.el
src/ChangeLog
src/w32console.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-05-07 04:03:49 +0000
+++ b/lisp/ChangeLog 2011-05-07 15:44:19 +0000
@@ -1,3 +1,9 @@
+2011-05-07 Eli Zaretskii <address@hidden>
+
+ * term/w32console.el (terminal-init-w32console): Call
+ get-screen-color and use its output to set the frame
+ background-mode. (Bug#8597)
+
2011-05-07 Stefan Monnier <address@hidden>
Make bytecomp.el understand that defmethod defines funs (bug#8631).
=== modified file 'lisp/term/w32console.el'
--- a/lisp/term/w32console.el 2011-01-25 04:08:28 +0000
+++ b/lisp/term/w32console.el 2011-05-07 15:44:19 +0000
@@ -59,6 +59,19 @@
(setq colors (cdr colors)
color (car colors))))
(clear-face-cache)
+ ;; Figure out what are the colors of the console window, and set up
+ ;; the background-mode correspondingly.
+ (let* ((screen-color (get-screen-color))
+ (bg (cadr screen-color))
+ (descr (tty-color-by-index bg))
+ r g b bg-mode)
+ (setq r (nth 2 descr)
+ g (nth 3 descr)
+ b (nth 4 descr))
+ (if (< (+ r g b) (* .6 (+ 65535 65535 65535)))
+ (setq bg-mode 'dark)
+ (setq bg-mode 'light))
+ (set-terminal-parameter nil 'background-mode bg-mode))
(tty-set-up-initial-frame-faces)
(run-hooks 'terminal-init-w32-hook))
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-05-07 11:25:05 +0000
+++ b/src/ChangeLog 2011-05-07 15:44:19 +0000
@@ -1,5 +1,9 @@
2011-05-07 Eli Zaretskii <address@hidden>
+ * w32console.c (Fset_screen_color): Doc fix.
+ (Fget_screen_color): New function.
+ (syms_of_ntterm): Defsubr it.
+
* callproc.c (call_process_cleanup): Don't close and unlink the
temporary file if Fcall_process didn't create it in the first
place.
=== modified file 'src/w32console.c'
--- a/src/w32console.c 2011-03-14 17:07:53 +0000
+++ b/src/w32console.c 2011-05-07 15:44:19 +0000
@@ -705,7 +705,9 @@
DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0,
- doc: /* Set screen colors. */)
+ doc: /* Set screen foreground and background colors.
+
+Arguments should be indices between 0 and 15, see w32console.el. */)
(Lisp_Object foreground, Lisp_Object background)
{
char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4);
@@ -714,6 +716,18 @@
return Qt;
}
+DEFUN ("get-screen-color", Fget_screen_color, Sget_screen_color, 0, 0, 0,
+ doc: /* Get color indices of the current screen foreground and
background.
+
+The colors are returned as a list of 2 indices (FOREGROUND BACKGROUND).
+See w32console.el and `tty-defined-color-alist' for mapping of indices
+to colors. */)
+ (void)
+{
+ return Fcons (make_number (char_attr_normal & 0x000f),
+ Fcons (make_number ((char_attr_normal >> 4) & 0x000f), Qnil));
+}
+
DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
doc: /* Set cursor size. */)
(Lisp_Object size)
@@ -739,6 +753,7 @@
w32_use_full_screen_buffer = 0;
defsubr (&Sset_screen_color);
+ defsubr (&Sget_screen_color);
defsubr (&Sset_cursor_size);
defsubr (&Sset_message_beep);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104155: Fix bug #8597 with setting frame background mode on w32 console.,
Eli Zaretskii <=