aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-10-10 10:48:42 +0400
committerDmitry Antipov2013-10-10 10:48:42 +0400
commit1afcba638a6ecf9fe6db1e52594024b323d4145e (patch)
treef43c87166dc7ca92b95294029ff23cf71295a8fe /src
parent20832de03e2f5f7a98f97e3f1ae5f03f26d00b77 (diff)
downloademacs-1afcba638a6ecf9fe6db1e52594024b323d4145e.tar.gz
emacs-1afcba638a6ecf9fe6db1e52594024b323d4145e.zip
* keyboard.c (init_kboard): Now static. Add arg
to denote window system. Adjust comment. (init_keyboard): Adjust user. (allocate_kboard): New function. (syms_of_keyboard): * nsterm.m (ns_term_init): * term.c (init_tty): * w32term.c (w32_create_terminal): * xterm.c (x_term_init): Use it. * keyboard.h (init_kboard): Remove prototype. (allocate_kboard): Add prototype.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/keyboard.c38
-rw-r--r--src/keyboard.h2
-rw-r--r--src/nsterm.m6
-rw-r--r--src/term.c6
-rw-r--r--src/w32term.c6
-rw-r--r--src/xterm.c10
7 files changed, 43 insertions, 41 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7e196668796..d5862485a76 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12013-10-10 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * keyboard.c (init_kboard): Now static. Add arg
4 to denote window system. Adjust comment.
5 (init_keyboard): Adjust user.
6 (allocate_kboard): New function.
7 (syms_of_keyboard):
8 * nsterm.m (ns_term_init):
9 * term.c (init_tty):
10 * w32term.c (w32_create_terminal):
11 * xterm.c (x_term_init): Use it.
12 * keyboard.h (init_kboard): Remove prototype.
13 (allocate_kboard): Add prototype.
14
12013-10-10 Barry Fishman <barry_fishman@acm.org> (tiny change) 152013-10-10 Barry Fishman <barry_fishman@acm.org> (tiny change)
2 16
3 * image.c (GIFLIB_MAJOR): Ensure it's defined. 17 * image.c (GIFLIB_MAJOR): Ensure it's defined.
@@ -29,7 +43,7 @@
29 so it shouldn't be used all the time. Perhaps we need two 43 so it shouldn't be used all the time. Perhaps we need two
30 flavors of 'eassert', one for where 'assume' is far more likely 44 flavors of 'eassert', one for where 'assume' is far more likely
31 to help or to hurt; but that can be done later. 45 to help or to hurt; but that can be done later.
32 Problem reported by Dmitry Andipov in 46 Problem reported by Dmitry Antipov in
33 <http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>. 47 <http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>.
34 Also, don't include <verify.h>; no longer needed. 48 Also, don't include <verify.h>; no longer needed.
35 49
diff --git a/src/keyboard.c b/src/keyboard.c
index 669e85518f1..9d0ce14ce6f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10790,12 +10790,11 @@ The `posn-' functions access elements of such lists. */)
10790 return tem; 10790 return tem;
10791} 10791}
10792 10792
10793 10793/* Set up a new kboard object with reasonable initial values.
10794/* 10794 TYPE is a window system for which this keyboard is used. */
10795 * Set up a new kboard object with reasonable initial values. 10795
10796 */ 10796static void
10797void 10797init_kboard (KBOARD *kb, Lisp_Object type)
10798init_kboard (KBOARD *kb)
10799{ 10798{
10800 kset_overriding_terminal_local_map (kb, Qnil); 10799 kset_overriding_terminal_local_map (kb, Qnil);
10801 kset_last_command (kb, Qnil); 10800 kset_last_command (kb, Qnil);
@@ -10816,13 +10815,27 @@ init_kboard (KBOARD *kb)
10816 kb->reference_count = 0; 10815 kb->reference_count = 0;
10817 kset_system_key_alist (kb, Qnil); 10816 kset_system_key_alist (kb, Qnil);
10818 kset_system_key_syms (kb, Qnil); 10817 kset_system_key_syms (kb, Qnil);
10819 kset_window_system (kb, Qt); /* Unset. */ 10818 kset_window_system (kb, type);
10820 kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil)); 10819 kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil));
10821 kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil)); 10820 kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil));
10822 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); 10821 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
10823 kset_default_minibuffer_frame (kb, Qnil); 10822 kset_default_minibuffer_frame (kb, Qnil);
10824} 10823}
10825 10824
10825/* Allocate and basically initialize keyboard
10826 object to use with window system TYPE. */
10827
10828KBOARD *
10829allocate_kboard (Lisp_Object type)
10830{
10831 KBOARD *kb = xmalloc (sizeof *kb);
10832
10833 init_kboard (kb, type);
10834 kb->next_kboard = all_kboards;
10835 all_kboards = kb;
10836 return kb;
10837}
10838
10826/* 10839/*
10827 * Destroy the contents of a kboard object, but not the object itself. 10840 * Destroy the contents of a kboard object, but not the object itself.
10828 * We use this just before deleting it, or if we're going to initialize 10841 * We use this just before deleting it, or if we're going to initialize
@@ -10887,10 +10900,9 @@ init_keyboard (void)
10887 current_kboard = initial_kboard; 10900 current_kboard = initial_kboard;
10888 /* Re-initialize the keyboard again. */ 10901 /* Re-initialize the keyboard again. */
10889 wipe_kboard (current_kboard); 10902 wipe_kboard (current_kboard);
10890 init_kboard (current_kboard);
10891 /* A value of nil for Vwindow_system normally means a tty, but we also use 10903 /* A value of nil for Vwindow_system normally means a tty, but we also use
10892 it for the initial terminal since there is no window system there. */ 10904 it for the initial terminal since there is no window system there. */
10893 kset_window_system (current_kboard, Qnil); 10905 init_kboard (current_kboard, Qnil);
10894 10906
10895 if (!noninteractive) 10907 if (!noninteractive)
10896 { 10908 {
@@ -11695,12 +11707,8 @@ Currently, the only supported values for this
11695variable are `sigusr1' and `sigusr2'. */); 11707variable are `sigusr1' and `sigusr2'. */);
11696 Vdebug_on_event = intern_c_string ("sigusr2"); 11708 Vdebug_on_event = intern_c_string ("sigusr2");
11697 11709
11698 /* Create the initial keyboard. */ 11710 /* Create the initial keyboard. Qt means 'unset'. */
11699 initial_kboard = xmalloc (sizeof *initial_kboard); 11711 initial_kboard = allocate_kboard (Qt);
11700 init_kboard (initial_kboard);
11701 /* Vwindow_system is left at t for now. */
11702 initial_kboard->next_kboard = all_kboards;
11703 all_kboards = initial_kboard;
11704} 11712}
11705 11713
11706void 11714void
diff --git a/src/keyboard.h b/src/keyboard.h
index 49f87b20a43..26cb862e8a0 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -507,7 +507,7 @@ extern unsigned int timers_run;
507extern bool menu_separator_name_p (const char *); 507extern bool menu_separator_name_p (const char *);
508extern bool parse_menu_item (Lisp_Object, int); 508extern bool parse_menu_item (Lisp_Object, int);
509 509
510extern void init_kboard (KBOARD *); 510extern KBOARD *allocate_kboard (Lisp_Object);
511extern void delete_kboard (KBOARD *); 511extern void delete_kboard (KBOARD *);
512extern void not_single_kboard_state (KBOARD *); 512extern void not_single_kboard_state (KBOARD *);
513extern void push_kboard (struct kboard *); 513extern void push_kboard (struct kboard *);
diff --git a/src/nsterm.m b/src/nsterm.m
index ce8d9b2106a..6625d09b5ca 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4169,11 +4169,7 @@ ns_term_init (Lisp_Object display_name)
4169 ns_initialize_display_info (dpyinfo); 4169 ns_initialize_display_info (dpyinfo);
4170 terminal = ns_create_terminal (dpyinfo); 4170 terminal = ns_create_terminal (dpyinfo);
4171 4171
4172 terminal->kboard = xmalloc (sizeof *terminal->kboard); 4172 terminal->kboard = allocate_kboard (Qns);
4173 init_kboard (terminal->kboard);
4174 kset_window_system (terminal->kboard, Qns);
4175 terminal->kboard->next_kboard = all_kboards;
4176 all_kboards = terminal->kboard;
4177 /* Don't let the initial kboard remain current longer than necessary. 4173 /* Don't let the initial kboard remain current longer than necessary.
4178 That would cause problems if a file loaded on startup tries to 4174 That would cause problems if a file loaded on startup tries to
4179 prompt in the mini-buffer. */ 4175 prompt in the mini-buffer. */
diff --git a/src/term.c b/src/term.c
index ad2e90dc795..a8274b19d2a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4301,11 +4301,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4301 tty->mouse_highlight.mouse_face_window = Qnil; 4301 tty->mouse_highlight.mouse_face_window = Qnil;
4302#endif 4302#endif
4303 4303
4304 terminal->kboard = xmalloc (sizeof *terminal->kboard); 4304 terminal->kboard = allocate_kboard (Qnil);
4305 init_kboard (terminal->kboard);
4306 kset_window_system (terminal->kboard, Qnil);
4307 terminal->kboard->next_kboard = all_kboards;
4308 all_kboards = terminal->kboard;
4309 terminal->kboard->reference_count++; 4305 terminal->kboard->reference_count++;
4310 /* Don't let the initial kboard remain current longer than necessary. 4306 /* Don't let the initial kboard remain current longer than necessary.
4311 That would cause problems if a file loaded on startup tries to 4307 That would cause problems if a file loaded on startup tries to
diff --git a/src/w32term.c b/src/w32term.c
index be8ebfe6ab6..4587c7c0676 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6262,11 +6262,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6262 /* We don't yet support separate terminals on W32, so don't try to share 6262 /* We don't yet support separate terminals on W32, so don't try to share
6263 keyboards between virtual terminals that are on the same physical 6263 keyboards between virtual terminals that are on the same physical
6264 terminal like X does. */ 6264 terminal like X does. */
6265 terminal->kboard = xmalloc (sizeof (KBOARD)); 6265 terminal->kboard = allocate_kboard (Qw32);
6266 init_kboard (terminal->kboard);
6267 kset_window_system (terminal->kboard, Qw32);
6268 terminal->kboard->next_kboard = all_kboards;
6269 all_kboards = terminal->kboard;
6270 /* Don't let the initial kboard remain current longer than necessary. 6266 /* Don't let the initial kboard remain current longer than necessary.
6271 That would cause problems if a file loaded on startup tries to 6267 That would cause problems if a file loaded on startup tries to
6272 prompt in the mini-buffer. */ 6268 prompt in the mini-buffer. */
diff --git a/src/xterm.c b/src/xterm.c
index 1ccc1ae649b..3299255461f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9905,15 +9905,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9905 terminal->kboard = share->terminal->kboard; 9905 terminal->kboard = share->terminal->kboard;
9906 else 9906 else
9907 { 9907 {
9908 terminal->kboard = xmalloc (sizeof *terminal->kboard); 9908 terminal->kboard = allocate_kboard (Qx);
9909 init_kboard (terminal->kboard);
9910 kset_window_system (terminal->kboard, Qx);
9911
9912 /* Add the keyboard to the list before running Lisp code (via
9913 Qvendor_specific_keysyms below), since these are not traced
9914 via terminals but only through all_kboards. */
9915 terminal->kboard->next_kboard = all_kboards;
9916 all_kboards = terminal->kboard;
9917 9909
9918 if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound)) 9910 if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
9919 { 9911 {