Commit 99e2d9a9 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Fx_get_mouse_event, Fx_mouse_events): Code deleted.

parent 3a68f530
......@@ -3301,212 +3301,6 @@ x_draw_pixmap (f, x, y, image_data, width, height)
f->display.x->normal_gc, 0, 0, width, height, x, y);
}
#endif
#if 0
#ifdef HAVE_X11
#define XMouseEvent XEvent
#define WhichMouseButton xbutton.button
#define MouseWindow xbutton.window
#define MouseX xbutton.x
#define MouseY xbutton.y
#define MouseTime xbutton.time
#define ButtonReleased ButtonRelease
#define ButtonPressed ButtonPress
#else
#define XMouseEvent XButtonEvent
#define WhichMouseButton detail
#define MouseWindow window
#define MouseX x
#define MouseY y
#define MouseTime time
#endif /* X11 */
DEFUN ("x-mouse-events", Fx_mouse_events, Sx_mouse_events, 0, 0, 0,
"Return number of pending mouse events from X window system.")
()
{
return make_number (queue_event_count (&x_mouse_queue));
}
/* Encode the mouse button events in the form expected by the
mouse code in Lisp. For X11, this means moving the masks around. */
static int
encode_mouse_button (mouse_event)
XMouseEvent mouse_event;
{
register int event_code;
register char key_mask;
event_code = mouse_event.detail & 3;
key_mask = (mouse_event.detail >> 8) & 0xf0;
event_code |= key_mask >> 1;
if (mouse_event.type == ButtonReleased) event_code |= 0x04;
return event_code;
}
DEFUN ("x-get-mouse-event", Fx_get_mouse_event, Sx_get_mouse_event,
0, 1, 0,
"Get next mouse event out of mouse event buffer.\n\
Optional ARG non-nil means return nil immediately if no pending event;\n\
otherwise, wait for an event. Returns a four-part list:\n\
((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ TIMESTAMP).\n\
Normally X-POS and Y-POS are the position of the click on the frame\n\
(measured in characters and lines), and WINDOW is the window clicked in.\n\
KEYSEQ is a string, the key sequence to be looked up in the mouse maps.\n\
If FRAME-PART is non-nil, the event was on a scroll bar;\n\
then Y-POS is really the total length of the scroll bar, while X-POS is\n\
the relative position of the scroll bar's value within that total length,\n\
and a third element OFFSET appears in that list: the height of the thumb-up\n\
area at the top of the scroll bar.\n\
FRAME-PART is one of the following symbols:\n\
`vertical-scroll-bar', `vertical-thumbup', `vertical-thumbdown',\n\
`horizontal-scroll-bar', `horizontal-thumbleft', `horizontal-thumbright'.\n\
TIMESTAMP is the lower 23 bits of the X-server's timestamp for\n\
the mouse event.")
(arg)
Lisp_Object arg;
{
XMouseEvent xrep;
register int com_letter;
register Lisp_Object tempx;
register Lisp_Object tempy;
Lisp_Object part, pos, timestamp;
int prefix;
struct frame *f;
int tem;
while (1)
{
BLOCK_INPUT;
tem = dequeue_event (&xrep, &x_mouse_queue);
UNBLOCK_INPUT;
if (tem)
{
switch (xrep.type)
{
case ButtonPressed:
case ButtonReleased:
com_letter = encode_mouse_button (xrep);
mouse_timestamp = xrep.MouseTime;
if ((f = x_window_to_frame (xrep.MouseWindow)) != 0)
{
Lisp_Object frame;
if (f->display.x->icon_desc == xrep.MouseWindow)
{
x_make_frame_visible (f);
continue;
}
XSET (tempx, Lisp_Int,
min (f->width-1, max (0, (xrep.MouseX - f->display.x->internal_border_width)/FONT_WIDTH (f->display.x->font))));
XSET (tempy, Lisp_Int,
min (f->height-1, max (0, (xrep.MouseY - f->display.x->internal_border_width)/FONT_HEIGHT (f->display.x->font))));
XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
XSET (frame, Lisp_Frame, f);
pos = Fcons (tempx, Fcons (tempy, Qnil));
Vmouse_window
= Flocate_window_from_coordinates (frame, pos);
Vmouse_event
= Fcons (pos,
Fcons (Vmouse_window,
Fcons (Qnil,
Fcons (Fchar_to_string (make_number (com_letter)),
Fcons (timestamp, Qnil)))));
return Vmouse_event;
}
else if ((f = x_window_to_scroll_bar (xrep.MouseWindow, &part, &prefix)) != 0)
{
int pos, len;
Lisp_Object keyseq;
char *partname;
keyseq = concat2 (Fchar_to_string (make_number (prefix)),
Fchar_to_string (make_number (com_letter)));
pos = xrep.MouseY - (f->display.x->v_scroll_bar_width - 2);
XSET (tempx, Lisp_Int, pos);
len = ((FONT_HEIGHT (f->display.x->font) * f->height)
+ f->display.x->internal_border_width
- (2 * (f->display.x->v_scroll_bar_width - 2)));
XSET (tempy, Lisp_Int, len);
XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
Vmouse_window = f->selected_window;
Vmouse_event
= Fcons (Fcons (tempx, Fcons (tempy,
Fcons (make_number (f->display.x->v_scroll_bar_width - 2),
Qnil))),
Fcons (Vmouse_window,
Fcons (intern (part),
Fcons (keyseq, Fcons (timestamp,
Qnil)))));
return Vmouse_event;
}
else
continue;
#ifdef HAVE_X11
case MotionNotify:
com_letter = x11_encode_mouse_button (xrep);
if ((f = x_window_to_frame (xrep.MouseWindow)) != 0)
{
Lisp_Object frame;
XSET (tempx, Lisp_Int,
min (f->width-1,
max (0, (xrep.MouseX - f->display.x->internal_border_width)
/ FONT_WIDTH (f->display.x->font))));
XSET (tempy, Lisp_Int,
min (f->height-1,
max (0, (xrep.MouseY - f->display.x->internal_border_width)
/ FONT_HEIGHT (f->display.x->font))));
XSET (frame, Lisp_Frame, f);
XSET (timestamp, Lisp_Int, (xrep.MouseTime & 0x7fffff));
pos = Fcons (tempx, Fcons (tempy, Qnil));
Vmouse_window
= Flocate_window_from_coordinates (frame, pos);
Vmouse_event
= Fcons (pos,
Fcons (Vmouse_window,
Fcons (Qnil,
Fcons (Fchar_to_string (make_number (com_letter)),
Fcons (timestamp, Qnil)))));
return Vmouse_event;
}
break;
#endif /* HAVE_X11 */
default:
if (f = x_window_to_frame (xrep.MouseWindow))
Vmouse_window = f->selected_window;
else if (f = x_window_to_scroll_bar (xrep.MouseWindow, &part, &prefix))
Vmouse_window = f->selected_window;
return Vmouse_event = Qnil;
}
}
if (!NILP (arg))
return Qnil;
/* Wait till we get another mouse event. */
wait_reading_process_input (0, 0, 2, 0);
}
}
#endif
#ifndef HAVE_X11
DEFUN ("x-store-cut-buffer", Fx_store_cut_buffer, Sx_store_cut_buffer,
......@@ -4004,13 +3798,6 @@ syms_of_xfns ()
defsubr (&Sx_open_connection);
defsubr (&Sx_close_current_connection);
defsubr (&Sx_synchronize);
/* This was used in the old event interface which used a separate
event queue.*/
#if 0
defsubr (&Sx_mouse_events);
defsubr (&Sx_get_mouse_event);
#endif
}
#endif /* HAVE_X_WINDOWS */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment