summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 3442b18409a..9e90899c569 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5127,6 +5127,17 @@ static short const scroll_bar_parts[] = {
SYMBOL_INDEX (Qrightmost), SYMBOL_INDEX (Qend_scroll), SYMBOL_INDEX (Qratio)
};
+/* An array of symbol indexes of internal border parts, indexed by an enum
+ internal_border_part value. Note that Qnil corresponds to
+ internal_border_part_none and should not appear in Lisp events. */
+static short const internal_border_parts[] = {
+ SYMBOL_INDEX (Qnil), SYMBOL_INDEX (Qleft_edge),
+ SYMBOL_INDEX (Qtop_left_corner), SYMBOL_INDEX (Qtop_edge),
+ SYMBOL_INDEX (Qtop_right_corner), SYMBOL_INDEX (Qright_edge),
+ SYMBOL_INDEX (Qbottom_right_corner), SYMBOL_INDEX (Qbottom_edge),
+ SYMBOL_INDEX (Qbottom_left_corner)
+};
+
/* A vector, indexed by button number, giving the down-going location
of currently depressed buttons, both scroll bar and non-scroll bar.
@@ -5164,15 +5175,15 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
Lisp_Object extra_info = Qnil;
/* Coordinate pixel positions to return. */
int xret = 0, yret = 0;
- /* The window under frame pixel coordinates (x,y) */
- Lisp_Object window = f
+ /* The window or frame under frame pixel coordinates (x,y) */
+ Lisp_Object window_or_frame = f
? window_from_coordinates (f, XINT (x), XINT (y), &part, 0)
: Qnil;
- if (WINDOWP (window))
+ if (WINDOWP (window_or_frame))
{
/* It's a click in window WINDOW at frame coordinates (X,Y) */
- struct window *w = XWINDOW (window);
+ struct window *w = XWINDOW (window_or_frame);
Lisp_Object string_info = Qnil;
ptrdiff_t textpos = 0;
int col = -1, row = -1;
@@ -5361,17 +5372,31 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
make_number (row)),
extra_info)));
}
- else if (f != 0)
+
+#ifdef HAVE_WINDOW_SYSTEM
+ else if (f)
{
/* Return mouse pixel coordinates here. */
- XSETFRAME (window, f);
+ XSETFRAME (window_or_frame, f);
xret = XINT (x);
yret = XINT (y);
+
+ if (FRAME_LIVE_P (f)
+ && FRAME_INTERNAL_BORDER_WIDTH (f) > 0
+ && !NILP (get_frame_param (f, Qdrag_internal_border)))
+ {
+ enum internal_border_part part
+ = frame_internal_border_part (f, xret, yret);
+
+ posn = builtin_lisp_symbol (internal_border_parts[part]);
+ }
}
+#endif
+
else
- window = Qnil;
+ window_or_frame = Qnil;
- return Fcons (window,
+ return Fcons (window_or_frame,
Fcons (posn,
Fcons (Fcons (make_number (xret),
make_number (yret)),
@@ -11159,6 +11184,17 @@ syms_of_keyboard (void)
Fset (Qinput_method_exit_on_first_char, Qnil);
Fset (Qinput_method_use_echo_area, Qnil);
+ /* Symbols for dragging internal borders. */
+ DEFSYM (Qdrag_internal_border, "drag-internal-border");
+ DEFSYM (Qleft_edge, "left-edge");
+ DEFSYM (Qtop_left_corner, "top-left-corner");
+ DEFSYM (Qtop_edge, "top-edge");
+ DEFSYM (Qtop_right_corner, "top-right-corner");
+ DEFSYM (Qright_edge, "right-edge");
+ DEFSYM (Qbottom_right_corner, "bottom-right-corner");
+ DEFSYM (Qbottom_edge, "bottom-edge");
+ DEFSYM (Qbottom_left_corner, "bottom-left-corner");
+
/* Symbols to head events. */
DEFSYM (Qmouse_movement, "mouse-movement");
DEFSYM (Qscroll_bar_movement, "scroll-bar-movement");