aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/dispnew.c2
-rw-r--r--src/keyboard.c47
-rw-r--r--src/keyboard.h5
-rw-r--r--src/nsterm.m5
-rw-r--r--src/termhooks.h15
-rw-r--r--src/w32inevt.c1
-rw-r--r--src/w32inevt.h2
-rw-r--r--src/w32term.c4
-rw-r--r--src/xterm.c12
10 files changed, 46 insertions, 60 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2ee57d8531c..7f9cac9fa21 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12012-09-20 Paul Eggert <eggert@cs.ucla.edu>
2
3 Omit unused arg EXPECTED from socket hooks.
4 * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input):
5 * nsterm.m (ns_term_init):
6 * termhooks.h (struct terminal.read_socket_hook):
7 * w32inevt.c (w32_console_read_socket):
8 * w32term.c (w32_read_socket):
9 * xterm.c (XTread_socket):
10 Omit unused arg EXPECTED. All callers changed.
11 (store_user_signal_events): Return void, not int, since callers no
12 longer care about the return value. All uses changed.
13
12012-09-20 Juanma Barranquero <lekktu@gmail.com> 142012-09-20 Juanma Barranquero <lekktu@gmail.com>
2 15
3 * w32gui.h (XParseGeometry): Do not declare. 16 * w32gui.h (XParseGeometry): Do not declare.
diff --git a/src/dispnew.c b/src/dispnew.c
index 5827316a7b7..fc966581adb 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5971,7 +5971,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
5971 5971
5972 5972
5973#ifdef USABLE_SIGIO 5973#ifdef USABLE_SIGIO
5974 gobble_input (0); 5974 gobble_input ();
5975#endif 5975#endif
5976 5976
5977 wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, 5977 wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display,
diff --git a/src/keyboard.c b/src/keyboard.c
index 01644b3832d..098d3530ef8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -413,7 +413,7 @@ static EMACS_TIME timer_last_idleness_start_time;
413/* Function for init_keyboard to call with no args (if nonzero). */ 413/* Function for init_keyboard to call with no args (if nonzero). */
414static void (*keyboard_init_hook) (void); 414static void (*keyboard_init_hook) (void);
415 415
416static int read_avail_input (int); 416static int read_avail_input (void);
417static void get_input_pending (int *, int); 417static void get_input_pending (int *, int);
418static int readable_events (int); 418static int readable_events (int);
419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, 419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
@@ -448,7 +448,7 @@ static void timer_stop_idle (void);
448static void timer_resume_idle (void); 448static void timer_resume_idle (void);
449static void deliver_user_signal (int); 449static void deliver_user_signal (int);
450static char *find_user_signal_name (int); 450static char *find_user_signal_name (int);
451static int store_user_signal_events (void); 451static void store_user_signal_events (void);
452 452
453/* These setters are used only in this file, so they can be private. */ 453/* These setters are used only in this file, so they can be private. */
454static inline void 454static inline void
@@ -2010,7 +2010,7 @@ poll_for_input_1 (void)
2010{ 2010{
2011 if (interrupt_input_blocked == 0 2011 if (interrupt_input_blocked == 0
2012 && !waiting_for_input) 2012 && !waiting_for_input)
2013 read_avail_input (0); 2013 read_avail_input ();
2014} 2014}
2015 2015
2016/* Timer callback function for poll_timer. TIMER is equal to 2016/* Timer callback function for poll_timer. TIMER is equal to
@@ -3843,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3843 interrupt handlers have not read it, read it now. */ 3843 interrupt handlers have not read it, read it now. */
3844 3844
3845#ifdef USABLE_SIGIO 3845#ifdef USABLE_SIGIO
3846 gobble_input (0); 3846 gobble_input ();
3847#endif 3847#endif
3848 if (kbd_fetch_ptr != kbd_store_ptr) 3848 if (kbd_fetch_ptr != kbd_store_ptr)
3849 break; 3849 break;
@@ -3869,8 +3869,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3869 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); 3869 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
3870 3870
3871 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) 3871 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
3872 /* Pass 1 for EXPECT since we just waited to have input. */ 3872 read_avail_input ();
3873 read_avail_input (1);
3874 } 3873 }
3875 3874
3876 if (CONSP (Vunread_command_events)) 3875 if (CONSP (Vunread_command_events))
@@ -6734,14 +6733,14 @@ get_input_pending (int *addr, int flags)
6734 return; 6733 return;
6735 6734
6736 /* Try to read some input and see how much we get. */ 6735 /* Try to read some input and see how much we get. */
6737 gobble_input (0); 6736 gobble_input ();
6738 *addr = (!NILP (Vquit_flag) || readable_events (flags)); 6737 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6739} 6738}
6740 6739
6741/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ 6740/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
6742 6741
6743void 6742void
6744gobble_input (int expected) 6743gobble_input (void)
6745{ 6744{
6746#ifdef USABLE_SIGIO 6745#ifdef USABLE_SIGIO
6747 if (interrupt_input) 6746 if (interrupt_input)
@@ -6750,7 +6749,7 @@ gobble_input (int expected)
6750 sigemptyset (&blocked); 6749 sigemptyset (&blocked);
6751 sigaddset (&blocked, SIGIO); 6750 sigaddset (&blocked, SIGIO);
6752 pthread_sigmask (SIG_BLOCK, &blocked, &procmask); 6751 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6753 read_avail_input (expected); 6752 read_avail_input ();
6754 pthread_sigmask (SIG_SETMASK, &procmask, 0); 6753 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6755 } 6754 }
6756 else 6755 else
@@ -6764,13 +6763,13 @@ gobble_input (int expected)
6764 sigemptyset (&blocked); 6763 sigemptyset (&blocked);
6765 sigaddset (&blocked, SIGALRM); 6764 sigaddset (&blocked, SIGALRM);
6766 pthread_sigmask (SIG_BLOCK, &blocked, &procmask); 6765 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6767 read_avail_input (expected); 6766 read_avail_input ();
6768 pthread_sigmask (SIG_SETMASK, &procmask, 0); 6767 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6769 } 6768 }
6770 else 6769 else
6771#endif 6770#endif
6772#endif 6771#endif
6773 read_avail_input (expected); 6772 read_avail_input ();
6774} 6773}
6775 6774
6776/* Put a BUFFER_SWITCH_EVENT in the buffer 6775/* Put a BUFFER_SWITCH_EVENT in the buffer
@@ -6826,15 +6825,14 @@ record_asynch_buffer_change (void)
6826 this is a bad time to try to read input. */ 6825 this is a bad time to try to read input. */
6827 6826
6828static int 6827static int
6829read_avail_input (int expected) 6828read_avail_input (void)
6830{ 6829{
6831 int nread = 0; 6830 int nread = 0;
6832 int err = 0; 6831 int err = 0;
6833 struct terminal *t; 6832 struct terminal *t;
6834 6833
6835 /* Store pending user signal events, if any. */ 6834 /* Store pending user signal events, if any. */
6836 if (store_user_signal_events ()) 6835 store_user_signal_events ();
6837 expected = 0;
6838 6836
6839 /* Loop through the available terminals, and call their input hooks. */ 6837 /* Loop through the available terminals, and call their input hooks. */
6840 t = terminal_list; 6838 t = terminal_list;
@@ -6851,11 +6849,8 @@ read_avail_input (int expected)
6851 hold_quit.kind = NO_EVENT; 6849 hold_quit.kind = NO_EVENT;
6852 6850
6853 /* No need for FIONREAD or fcntl; just say don't wait. */ 6851 /* No need for FIONREAD or fcntl; just say don't wait. */
6854 while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0) 6852 while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
6855 { 6853 nread += nr;
6856 nread += nr;
6857 expected = 0;
6858 }
6859 6854
6860 if (nr == -1) /* Not OK to read input now. */ 6855 if (nr == -1) /* Not OK to read input now. */
6861 { 6856 {
@@ -6950,7 +6945,6 @@ decode_keyboard_code (struct tty_display_info *tty,
6950 6945
6951int 6946int
6952tty_read_avail_input (struct terminal *terminal, 6947tty_read_avail_input (struct terminal *terminal,
6953 int expected,
6954 struct input_event *hold_quit) 6948 struct input_event *hold_quit)
6955{ 6949{
6956 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than 6950 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
@@ -7170,8 +7164,7 @@ handle_async_input (void)
7170 7164
7171 while (1) 7165 while (1)
7172 { 7166 {
7173 int nread; 7167 int nread = read_avail_input ();
7174 nread = read_avail_input (1);
7175 /* -1 means it's not ok to read the input now. 7168 /* -1 means it's not ok to read the input now.
7176 UNBLOCK_INPUT will read it later; now, avoid infinite loop. 7169 UNBLOCK_INPUT will read it later; now, avoid infinite loop.
7177 0 means there was no keyboard input available. */ 7170 0 means there was no keyboard input available. */
@@ -7323,25 +7316,25 @@ find_user_signal_name (int sig)
7323 return NULL; 7316 return NULL;
7324} 7317}
7325 7318
7326static int 7319static void
7327store_user_signal_events (void) 7320store_user_signal_events (void)
7328{ 7321{
7329 struct user_signal_info *p; 7322 struct user_signal_info *p;
7330 struct input_event buf; 7323 struct input_event buf;
7331 int nstored = 0; 7324 bool buf_initialized = 0;
7332 7325
7333 for (p = user_signals; p; p = p->next) 7326 for (p = user_signals; p; p = p->next)
7334 if (p->npending > 0) 7327 if (p->npending > 0)
7335 { 7328 {
7336 sigset_t blocked, procmask; 7329 sigset_t blocked, procmask;
7337 7330
7338 if (nstored == 0) 7331 if (! buf_initialized)
7339 { 7332 {
7340 memset (&buf, 0, sizeof buf); 7333 memset (&buf, 0, sizeof buf);
7341 buf.kind = USER_SIGNAL_EVENT; 7334 buf.kind = USER_SIGNAL_EVENT;
7342 buf.frame_or_window = selected_frame; 7335 buf.frame_or_window = selected_frame;
7336 buf_initialized = 1;
7343 } 7337 }
7344 nstored += p->npending;
7345 7338
7346 sigemptyset (&blocked); 7339 sigemptyset (&blocked);
7347 sigaddset (&blocked, p->sig); 7340 sigaddset (&blocked, p->sig);
@@ -7357,8 +7350,6 @@ store_user_signal_events (void)
7357 7350
7358 pthread_sigmask (SIG_SETMASK, &procmask, 0); 7351 pthread_sigmask (SIG_SETMASK, &procmask, 0);
7359 } 7352 }
7360
7361 return nstored;
7362} 7353}
7363 7354
7364 7355
diff --git a/src/keyboard.h b/src/keyboard.h
index 91484b3649b..3601f68be9f 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -523,7 +523,7 @@ extern void input_poll_signal (int);
523extern void start_polling (void); 523extern void start_polling (void);
524extern void stop_polling (void); 524extern void stop_polling (void);
525extern void set_poll_suppress_count (int); 525extern void set_poll_suppress_count (int);
526extern void gobble_input (int); 526extern void gobble_input (void);
527extern int input_polling_used (void); 527extern int input_polling_used (void);
528extern void clear_input_pending (void); 528extern void clear_input_pending (void);
529extern int requeued_events_pending_p (void); 529extern int requeued_events_pending_p (void);
@@ -547,8 +547,7 @@ extern Lisp_Object menu_item_eval_property (Lisp_Object);
547extern int kbd_buffer_events_waiting (int); 547extern int kbd_buffer_events_waiting (int);
548extern void add_user_signal (int, const char *); 548extern void add_user_signal (int, const char *);
549 549
550extern int tty_read_avail_input (struct terminal *, int, 550extern int tty_read_avail_input (struct terminal *, struct input_event *);
551 struct input_event *);
552extern EMACS_TIME timer_check (void); 551extern EMACS_TIME timer_check (void);
553extern void mark_kboards (void); 552extern void mark_kboards (void);
554 553
diff --git a/src/nsterm.m b/src/nsterm.m
index 0b26508dbd0..aa869e3ff44 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3336,8 +3336,7 @@ ns_send_appdefined (int value)
3336} 3336}
3337 3337
3338static int 3338static int
3339ns_read_socket (struct terminal *terminal, int expected, 3339ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3340 struct input_event *hold_quit)
3341/* -------------------------------------------------------------------------- 3340/* --------------------------------------------------------------------------
3342 External (hook): Post an event to ourself and keep reading events until 3341 External (hook): Post an event to ourself and keep reading events until
3343 we read it back again. In effect process all events which were waiting. 3342 we read it back again. In effect process all events which were waiting.
@@ -4204,7 +4203,7 @@ ns_term_init (Lisp_Object display_name)
4204 NSColorPboardType, 4203 NSColorPboardType,
4205 NSFontPboardType, nil] retain]; 4204 NSFontPboardType, nil] retain];
4206 4205
4207 4206
4208 [NSApp run]; 4207 [NSApp run];
4209 ns_do_open_file = YES; 4208 ns_do_open_file = YES;
4210 return dpyinfo; 4209 return dpyinfo;
diff --git a/src/termhooks.h b/src/termhooks.h
index 46962a1217d..53e401de409 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -592,23 +592,14 @@ struct terminal
592 592
593 TERMINAL indicates which terminal device to read from. Input 593 TERMINAL indicates which terminal device to read from. Input
594 events should be read into BUF, the size of which is given in 594 events should be read into BUF, the size of which is given in
595 SIZE. EXPECTED is non-zero if the caller suspects that new input 595 SIZE.
596 is available.
597 596
598 A positive return value indicates that that many input events 597 A positive return value indicates that that many input events
599 where read into BUF. 598 were read into BUF.
600 Zero means no events were immediately available. 599 Zero means no events were immediately available.
601 A value of -1 means a transient read error, while -2 indicates 600 A value of -1 means a transient read error, while -2 indicates
602 that the device was closed (hangup), and it should be deleted. 601 that the device was closed (hangup), and it should be deleted. */
603
604 XXX Please note that a non-zero value of EXPECTED only means that
605 there is available input on at least one of the currently opened
606 terminal devices -- but not necessarily on this device.
607 Therefore, in most cases EXPECTED should be simply ignored.
608
609 XXX This documentation needs to be updated. */
610 int (*read_socket_hook) (struct terminal *terminal, 602 int (*read_socket_hook) (struct terminal *terminal,
611 int expected,
612 struct input_event *hold_quit); 603 struct input_event *hold_quit);
613 604
614 /* Called when a frame's display becomes entirely up to date. */ 605 /* Called when a frame's display becomes entirely up to date. */
diff --git a/src/w32inevt.c b/src/w32inevt.c
index d4cc620335c..a96d8d70483 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -744,7 +744,6 @@ maybe_generate_resize_event (void)
744 744
745int 745int
746w32_console_read_socket (struct terminal *terminal, 746w32_console_read_socket (struct terminal *terminal,
747 int expected,
748 struct input_event *hold_quit) 747 struct input_event *hold_quit)
749{ 748{
750 int nev, add; 749 int nev, add;
diff --git a/src/w32inevt.h b/src/w32inevt.h
index c874e58ef39..319688b877b 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22extern int w32_console_unicode_input; 22extern int w32_console_unicode_input;
23 23
24extern int w32_console_read_socket (struct terminal *term, int numchars, 24extern int w32_console_read_socket (struct terminal *term,
25 struct input_event *hold_quit); 25 struct input_event *hold_quit);
26extern void w32_console_mouse_position (FRAME_PTR *f, int insist, 26extern void w32_console_mouse_position (FRAME_PTR *f, int insist,
27 Lisp_Object *bar_window, 27 Lisp_Object *bar_window,
diff --git a/src/w32term.c b/src/w32term.c
index 6244728b264..b8227c52fed 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4137,8 +4137,6 @@ static char dbcs_lead = 0;
4137 We return the number of characters stored into the buffer, 4137 We return the number of characters stored into the buffer,
4138 thus pretending to be `read'. 4138 thus pretending to be `read'.
4139 4139
4140 EXPECTED is nonzero if the caller knows input is available.
4141
4142 Some of these messages are reposted back to the message queue since the 4140 Some of these messages are reposted back to the message queue since the
4143 system calls the windows proc directly in a context where we cannot return 4141 system calls the windows proc directly in a context where we cannot return
4144 the data nor can we guarantee the state we are in. So if we dispatch them 4142 the data nor can we guarantee the state we are in. So if we dispatch them
@@ -4149,7 +4147,7 @@ static char dbcs_lead = 0;
4149*/ 4147*/
4150 4148
4151static int 4149static int
4152w32_read_socket (struct terminal *terminal, int expected, 4150w32_read_socket (struct terminal *terminal,
4153 struct input_event *hold_quit) 4151 struct input_event *hold_quit)
4154{ 4152{
4155 int count = 0; 4153 int count = 0;
diff --git a/src/xterm.c b/src/xterm.c
index 9ab53dc087a..8c955d0e576 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7109,19 +7109,15 @@ x_dispatch_event (XEvent *event, Display *display)
7109 7109
7110 7110
7111/* Read events coming from the X server. 7111/* Read events coming from the X server.
7112 This routine is called by the SIGIO handler only if SYNC_INPUT is 7112 Return as soon as there are no more events to be read.
7113 not defined.
7114 We return as soon as there are no more events to be read.
7115 7113
7116 We return the number of characters stored into the buffer, 7114 Return the number of characters stored into the buffer,
7117 thus pretending to be `read' (except the characters we store 7115 thus pretending to be `read' (except the characters we store
7118 in the keyboard buffer can be multibyte, so are not necessarily 7116 in the keyboard buffer can be multibyte, so are not necessarily
7119 C chars). 7117 C chars). */
7120
7121 EXPECTED is nonzero if the caller knows input is available. */
7122 7118
7123static int 7119static int
7124XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) 7120XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
7125{ 7121{
7126 int count = 0; 7122 int count = 0;
7127 int event_found = 0; 7123 int event_found = 0;