emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114607: * keyboard.c (init_kboard): Now static. Add


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114607: * keyboard.c (init_kboard): Now static. Add arg
Date: Thu, 10 Oct 2013 06:49:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114607
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2013-10-10 10:48:42 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
  src/keyboard.h                 keyboard.h-20091113204419-o5vbwnq5f7feedwu-450
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-10 00:37:44 +0000
+++ b/src/ChangeLog     2013-10-10 06:48:42 +0000
@@ -1,3 +1,17 @@
+2013-10-10  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>  (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.
 

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2013-10-08 20:04:40 +0000
+++ b/src/keyboard.c    2013-10-10 06:48:42 +0000
@@ -10790,12 +10790,11 @@
   return tem;
 }
 
-
-/*
- * 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 @@
   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 @@
   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 @@
 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

=== modified file 'src/keyboard.h'
--- a/src/keyboard.h    2013-10-08 20:04:40 +0000
+++ b/src/keyboard.h    2013-10-10 06:48:42 +0000
@@ -507,7 +507,7 @@
 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 *);

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2013-10-08 06:12:40 +0000
+++ b/src/nsterm.m      2013-10-10 06:48:42 +0000
@@ -4169,11 +4169,7 @@
   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.  */

=== modified file 'src/term.c'
--- a/src/term.c        2013-10-09 20:18:38 +0000
+++ b/src/term.c        2013-10-10 06:48:42 +0000
@@ -4301,11 +4301,7 @@
   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

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-09-23 03:30:55 +0000
+++ b/src/w32term.c     2013-10-10 06:48:42 +0000
@@ -6262,11 +6262,7 @@
   /* 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.  */

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-09-20 20:23:20 +0000
+++ b/src/xterm.c       2013-10-10 06:48:42 +0000
@@ -9905,15 +9905,7 @@
       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))
          {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]