aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c71
1 files changed, 54 insertions, 17 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 55486c6d9ab..9e90899c569 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39#include "intervals.h" 39#include "intervals.h"
40#include "keymap.h" 40#include "keymap.h"
41#include "blockinput.h" 41#include "blockinput.h"
42#include "sysstdio.h"
42#include "systime.h" 43#include "systime.h"
43#include "atimer.h" 44#include "atimer.h"
44#include "process.h" 45#include "process.h"
@@ -3290,7 +3291,7 @@ record_char (Lisp_Object c)
3290 if (INTEGERP (c)) 3291 if (INTEGERP (c))
3291 { 3292 {
3292 if (XUINT (c) < 0x100) 3293 if (XUINT (c) < 0x100)
3293 putc (XUINT (c), dribble); 3294 putc_unlocked (XUINT (c), dribble);
3294 else 3295 else
3295 fprintf (dribble, " 0x%"pI"x", XUINT (c)); 3296 fprintf (dribble, " 0x%"pI"x", XUINT (c));
3296 } 3297 }
@@ -3303,15 +3304,15 @@ record_char (Lisp_Object c)
3303 3304
3304 if (SYMBOLP (dribblee)) 3305 if (SYMBOLP (dribblee))
3305 { 3306 {
3306 putc ('<', dribble); 3307 putc_unlocked ('<', dribble);
3307 fwrite (SDATA (SYMBOL_NAME (dribblee)), sizeof (char), 3308 fwrite_unlocked (SDATA (SYMBOL_NAME (dribblee)), sizeof (char),
3308 SBYTES (SYMBOL_NAME (dribblee)), 3309 SBYTES (SYMBOL_NAME (dribblee)),
3309 dribble); 3310 dribble);
3310 putc ('>', dribble); 3311 putc_unlocked ('>', dribble);
3311 } 3312 }
3312 } 3313 }
3313 3314
3314 fflush (dribble); 3315 fflush_unlocked (dribble);
3315 unblock_input (); 3316 unblock_input ();
3316 } 3317 }
3317} 3318}
@@ -3769,7 +3770,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3769 detaching from the terminal. */ 3770 detaching from the terminal. */
3770 || (IS_DAEMON && DAEMON_RUNNING)) 3771 || (IS_DAEMON && DAEMON_RUNNING))
3771 { 3772 {
3772 int c = getchar (); 3773 int c = getchar_unlocked ();
3773 XSETINT (obj, c); 3774 XSETINT (obj, c);
3774 *kbp = current_kboard; 3775 *kbp = current_kboard;
3775 return obj; 3776 return obj;
@@ -5126,6 +5127,17 @@ static short const scroll_bar_parts[] = {
5126 SYMBOL_INDEX (Qrightmost), SYMBOL_INDEX (Qend_scroll), SYMBOL_INDEX (Qratio) 5127 SYMBOL_INDEX (Qrightmost), SYMBOL_INDEX (Qend_scroll), SYMBOL_INDEX (Qratio)
5127}; 5128};
5128 5129
5130/* An array of symbol indexes of internal border parts, indexed by an enum
5131 internal_border_part value. Note that Qnil corresponds to
5132 internal_border_part_none and should not appear in Lisp events. */
5133static short const internal_border_parts[] = {
5134 SYMBOL_INDEX (Qnil), SYMBOL_INDEX (Qleft_edge),
5135 SYMBOL_INDEX (Qtop_left_corner), SYMBOL_INDEX (Qtop_edge),
5136 SYMBOL_INDEX (Qtop_right_corner), SYMBOL_INDEX (Qright_edge),
5137 SYMBOL_INDEX (Qbottom_right_corner), SYMBOL_INDEX (Qbottom_edge),
5138 SYMBOL_INDEX (Qbottom_left_corner)
5139};
5140
5129/* A vector, indexed by button number, giving the down-going location 5141/* A vector, indexed by button number, giving the down-going location
5130 of currently depressed buttons, both scroll bar and non-scroll bar. 5142 of currently depressed buttons, both scroll bar and non-scroll bar.
5131 5143
@@ -5163,15 +5175,15 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5163 Lisp_Object extra_info = Qnil; 5175 Lisp_Object extra_info = Qnil;
5164 /* Coordinate pixel positions to return. */ 5176 /* Coordinate pixel positions to return. */
5165 int xret = 0, yret = 0; 5177 int xret = 0, yret = 0;
5166 /* The window under frame pixel coordinates (x,y) */ 5178 /* The window or frame under frame pixel coordinates (x,y) */
5167 Lisp_Object window = f 5179 Lisp_Object window_or_frame = f
5168 ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0) 5180 ? window_from_coordinates (f, XINT (x), XINT (y), &part, 0)
5169 : Qnil; 5181 : Qnil;
5170 5182
5171 if (WINDOWP (window)) 5183 if (WINDOWP (window_or_frame))
5172 { 5184 {
5173 /* It's a click in window WINDOW at frame coordinates (X,Y) */ 5185 /* It's a click in window WINDOW at frame coordinates (X,Y) */
5174 struct window *w = XWINDOW (window); 5186 struct window *w = XWINDOW (window_or_frame);
5175 Lisp_Object string_info = Qnil; 5187 Lisp_Object string_info = Qnil;
5176 ptrdiff_t textpos = 0; 5188 ptrdiff_t textpos = 0;
5177 int col = -1, row = -1; 5189 int col = -1, row = -1;
@@ -5360,17 +5372,31 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5360 make_number (row)), 5372 make_number (row)),
5361 extra_info))); 5373 extra_info)));
5362 } 5374 }
5363 else if (f != 0) 5375
5376#ifdef HAVE_WINDOW_SYSTEM
5377 else if (f)
5364 { 5378 {
5365 /* Return mouse pixel coordinates here. */ 5379 /* Return mouse pixel coordinates here. */
5366 XSETFRAME (window, f); 5380 XSETFRAME (window_or_frame, f);
5367 xret = XINT (x); 5381 xret = XINT (x);
5368 yret = XINT (y); 5382 yret = XINT (y);
5383
5384 if (FRAME_LIVE_P (f)
5385 && FRAME_INTERNAL_BORDER_WIDTH (f) > 0
5386 && !NILP (get_frame_param (f, Qdrag_internal_border)))
5387 {
5388 enum internal_border_part part
5389 = frame_internal_border_part (f, xret, yret);
5390
5391 posn = builtin_lisp_symbol (internal_border_parts[part]);
5392 }
5369 } 5393 }
5394#endif
5395
5370 else 5396 else
5371 window = Qnil; 5397 window_or_frame = Qnil;
5372 5398
5373 return Fcons (window, 5399 return Fcons (window_or_frame,
5374 Fcons (posn, 5400 Fcons (posn,
5375 Fcons (Fcons (make_number (xret), 5401 Fcons (Fcons (make_number (xret),
5376 make_number (yret)), 5402 make_number (yret)),
@@ -10377,7 +10403,7 @@ handle_interrupt (bool in_signal_handler)
10377 sigemptyset (&blocked); 10403 sigemptyset (&blocked);
10378 sigaddset (&blocked, SIGINT); 10404 sigaddset (&blocked, SIGINT);
10379 pthread_sigmask (SIG_BLOCK, &blocked, 0); 10405 pthread_sigmask (SIG_BLOCK, &blocked, 0);
10380 fflush (stdout); 10406 fflush_unlocked (stdout);
10381 } 10407 }
10382 10408
10383 reset_all_sys_modes (); 10409 reset_all_sys_modes ();
@@ -11158,6 +11184,17 @@ syms_of_keyboard (void)
11158 Fset (Qinput_method_exit_on_first_char, Qnil); 11184 Fset (Qinput_method_exit_on_first_char, Qnil);
11159 Fset (Qinput_method_use_echo_area, Qnil); 11185 Fset (Qinput_method_use_echo_area, Qnil);
11160 11186
11187 /* Symbols for dragging internal borders. */
11188 DEFSYM (Qdrag_internal_border, "drag-internal-border");
11189 DEFSYM (Qleft_edge, "left-edge");
11190 DEFSYM (Qtop_left_corner, "top-left-corner");
11191 DEFSYM (Qtop_edge, "top-edge");
11192 DEFSYM (Qtop_right_corner, "top-right-corner");
11193 DEFSYM (Qright_edge, "right-edge");
11194 DEFSYM (Qbottom_right_corner, "bottom-right-corner");
11195 DEFSYM (Qbottom_edge, "bottom-edge");
11196 DEFSYM (Qbottom_left_corner, "bottom-left-corner");
11197
11161 /* Symbols to head events. */ 11198 /* Symbols to head events. */
11162 DEFSYM (Qmouse_movement, "mouse-movement"); 11199 DEFSYM (Qmouse_movement, "mouse-movement");
11163 DEFSYM (Qscroll_bar_movement, "scroll-bar-movement"); 11200 DEFSYM (Qscroll_bar_movement, "scroll-bar-movement");