]> git.eshelyaron.com Git - emacs.git/commitdiff
* keyboard.c (init_kboard): Now static. Add arg
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 10 Oct 2013 06:48:42 +0000 (10:48 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 10 Oct 2013 06:48:42 +0000 (10:48 +0400)
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.

src/ChangeLog
src/keyboard.c
src/keyboard.h
src/nsterm.m
src/term.c
src/w32term.c
src/xterm.c

index 7e19666879622c6eec08eb07bce4d3e8b861121e..d5862485a76b9af5ff2ce4ea772b17ae9beb8828 100644 (file)
@@ -1,3 +1,17 @@
+2013-10-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * 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.
+
 2013-10-10  Barry Fishman  <barry_fishman@acm.org>  (tiny change)
 
        * image.c (GIFLIB_MAJOR): Ensure it's defined.
@@ -29,7 +43,7 @@
        so it shouldn't be used all the time.  Perhaps we need two
        flavors of 'eassert', one for where 'assume' is far more likely
        to help or to hurt; but that can be done later.
-       Problem reported by Dmitry Andipov in
+       Problem reported by Dmitry Antipov in
        <http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>.
        Also, don't include <verify.h>; no longer needed.
 
index 669e85518f1b24b6cb965d2de3352564b8b493fe..9d0ce14ce6fec62d80fd2bd18bf1933c9afdb775 100644 (file)
@@ -10790,12 +10790,11 @@ The `posn-' functions access elements of such lists.  */)
   return tem;
 }
 
-\f
-/*
- * Set up a new kboard object with reasonable initial values.
- */
-void
-init_kboard (KBOARD *kb)
+/* Set up a new kboard object with reasonable initial values.
+   TYPE is a window system for which this keyboard is used.  */
+
+static void
+init_kboard (KBOARD *kb, Lisp_Object type)
 {
   kset_overriding_terminal_local_map (kb, Qnil);
   kset_last_command (kb, Qnil);
@@ -10816,13 +10815,27 @@ init_kboard (KBOARD *kb)
   kb->reference_count = 0;
   kset_system_key_alist (kb, Qnil);
   kset_system_key_syms (kb, Qnil);
-  kset_window_system (kb, Qt); /* Unset.  */
+  kset_window_system (kb, type);
   kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil));
   kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil));
   Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
   kset_default_minibuffer_frame (kb, Qnil);
 }
 
+/* Allocate and basically initialize keyboard
+   object to use with window system TYPE.  */
+
+KBOARD *
+allocate_kboard (Lisp_Object type)
+{
+  KBOARD *kb = xmalloc (sizeof *kb);
+
+  init_kboard (kb, type);
+  kb->next_kboard = all_kboards;
+  all_kboards = kb;
+  return kb;
+}
+
 /*
  * Destroy the contents of a kboard object, but not the object itself.
  * We use this just before deleting it, or if we're going to initialize
@@ -10887,10 +10900,9 @@ init_keyboard (void)
   current_kboard = initial_kboard;
   /* Re-initialize the keyboard again.  */
   wipe_kboard (current_kboard);
-  init_kboard (current_kboard);
   /* A value of nil for Vwindow_system normally means a tty, but we also use
      it for the initial terminal since there is no window system there.  */
-  kset_window_system (current_kboard, Qnil);
+  init_kboard (current_kboard, Qnil);
 
   if (!noninteractive)
     {
@@ -11695,12 +11707,8 @@ Currently, the only supported values for this
 variable are `sigusr1' and `sigusr2'.  */);
   Vdebug_on_event = intern_c_string ("sigusr2");
 
-  /* Create the initial keyboard.  */
-  initial_kboard = xmalloc (sizeof *initial_kboard);
-  init_kboard (initial_kboard);
-  /* Vwindow_system is left at t for now.  */
-  initial_kboard->next_kboard = all_kboards;
-  all_kboards = initial_kboard;
+  /* Create the initial keyboard.  Qt means 'unset'.  */
+  initial_kboard = allocate_kboard (Qt);
 }
 
 void
index 49f87b20a438070ed899060476341141ea14cc1a..26cb862e8a06982db55930dfe39125a787f0605f 100644 (file)
@@ -507,7 +507,7 @@ extern unsigned int timers_run;
 extern bool menu_separator_name_p (const char *);
 extern bool parse_menu_item (Lisp_Object, int);
 
-extern void init_kboard (KBOARD *);
+extern KBOARD *allocate_kboard (Lisp_Object);
 extern void delete_kboard (KBOARD *);
 extern void not_single_kboard_state (KBOARD *);
 extern void push_kboard (struct kboard *);
index ce8d9b2106a4fdeda0a099c76c7aa5527437e564..6625d09b5ca502005e356e13c56c397c3689de61 100644 (file)
@@ -4169,11 +4169,7 @@ ns_term_init (Lisp_Object display_name)
   ns_initialize_display_info (dpyinfo);
   terminal = ns_create_terminal (dpyinfo);
 
-  terminal->kboard = xmalloc (sizeof *terminal->kboard);
-  init_kboard (terminal->kboard);
-  kset_window_system (terminal->kboard, Qns);
-  terminal->kboard->next_kboard = all_kboards;
-  all_kboards = terminal->kboard;
+  terminal->kboard = allocate_kboard (Qns);
   /* Don't let the initial kboard remain current longer than necessary.
      That would cause problems if a file loaded on startup tries to
      prompt in the mini-buffer.  */
index ad2e90dc795511e4152e7fca383e9ecb0515affd..a8274b19d2a348d950b45c00baaf5d56800ce38f 100644 (file)
@@ -4301,11 +4301,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
   tty->mouse_highlight.mouse_face_window = Qnil;
 #endif
 
-  terminal->kboard = xmalloc (sizeof *terminal->kboard);
-  init_kboard (terminal->kboard);
-  kset_window_system (terminal->kboard, Qnil);
-  terminal->kboard->next_kboard = all_kboards;
-  all_kboards = terminal->kboard;
+  terminal->kboard = allocate_kboard (Qnil);
   terminal->kboard->reference_count++;
   /* Don't let the initial kboard remain current longer than necessary.
      That would cause problems if a file loaded on startup tries to
index be8ebfe6ab69e6205836954c597c6c74559de78e..4587c7c06766bbe0b602d00cfbe6528ebe255195 100644 (file)
@@ -6262,11 +6262,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
   /* We don't yet support separate terminals on W32, so don't try to share
      keyboards between virtual terminals that are on the same physical
      terminal like X does.  */
-  terminal->kboard = xmalloc (sizeof (KBOARD));
-  init_kboard (terminal->kboard);
-  kset_window_system (terminal->kboard, Qw32);
-  terminal->kboard->next_kboard = all_kboards;
-  all_kboards = terminal->kboard;
+  terminal->kboard = allocate_kboard (Qw32);
   /* Don't let the initial kboard remain current longer than necessary.
      That would cause problems if a file loaded on startup tries to
      prompt in the mini-buffer.  */
index 1ccc1ae649b318af068f9350b3537cadc68eca5d..3299255461fd821e9f9c6c0b047789e193182439 100644 (file)
@@ -9905,15 +9905,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
       terminal->kboard = share->terminal->kboard;
     else
       {
-       terminal->kboard = xmalloc (sizeof *terminal->kboard);
-       init_kboard (terminal->kboard);
-       kset_window_system (terminal->kboard, Qx);
-
-       /* Add the keyboard to the list before running Lisp code (via
-           Qvendor_specific_keysyms below), since these are not traced
-           via terminals but only through all_kboards.  */
-       terminal->kboard->next_kboard = all_kboards;
-       all_kboards = terminal->kboard;
+       terminal->kboard = allocate_kboard (Qx);
 
        if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
          {