static FRAME_PTR last_mouse_frame;
static XRectangle last_mouse_glyph;
+static Lisp_Object last_mouse_press_frame;
+
/* The scroll bar in which the last X motion event occurred.
If the last X motion event occurred in a scroll bar, we set this
BLOCK_INPUT;
+ curs_x = FRAME_CURSOR_X (f);
+ curs_y = FRAME_CURSOR_Y (f);
+
if (f == FRAME_X_DISPLAY_INFO (f)->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
BLOCK_INPUT;
do_line_dance ();
- x_display_cursor (f, 1);
+ x_display_cursor (f, 1, curs_x, curs_y);
- if (f == FRAME_X_DISPLAY_INFO (f)->mouse_face_mouse_frame)
- FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0;
+ FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0;
#if 0
/* This fails in the case of having updated only the echo area
if we have switched buffers. In that case, FRAME_CURRENT_GLYPHS
if (updating_frame == 0)
{
BLOCK_INPUT;
- x_display_cursor (selected_frame, 1);
+ x_display_cursor (selected_frame, 1, curs_x, curs_y);
XFlush (FRAME_X_DISPLAY (selected_frame));
UNBLOCK_INPUT;
}
f->phys_cursor_x = -1;
if (updating_frame == 0)
- {
- f->cursor_x += len;
- x_display_cursor (f, 1);
- f->cursor_x -= len;
- }
+ x_display_cursor (f, 1, FRAME_CURSOR_X (f) + len, FRAME_CURSOR_Y (f));
else
curs_x += len;
ht = f->height;
intborder = f->output_data.x->internal_border_width;
- x_display_cursor (updating_frame, 0);
+ x_update_cursor (updating_frame, 0);
for (i = 0; i < ht; ++i)
if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0)
/* Turn the cursor on if we turned it off. */
if (cursor_cleared)
- x_display_cursor (f, 1);
+ x_update_cursor (f, 1);
}
\f
static void
if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0
&& row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f)
&& EQ (w->window_end_valid, w->buffer)
- && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer)))
+ && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer))
+ && w->last_overlay_modified == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))
{
int *ptr = FRAME_CURRENT_GLYPHS (f)->charstarts[row];
int i, pos;
before = Foverlay_start (overlay);
after = Foverlay_end (overlay);
/* Record this as the current active region. */
- fast_find_position (window, before,
+ fast_find_position (window, XFASTINT (before),
&FRAME_X_DISPLAY_INFO (f)->mouse_face_beg_col,
&FRAME_X_DISPLAY_INFO (f)->mouse_face_beg_row);
FRAME_X_DISPLAY_INFO (f)->mouse_face_past_end
- = !fast_find_position (window, after,
+ = !fast_find_position (window, XFASTINT (after),
&FRAME_X_DISPLAY_INFO (f)->mouse_face_end_col,
&FRAME_X_DISPLAY_INFO (f)->mouse_face_end_row);
FRAME_X_DISPLAY_INFO (f)->mouse_face_window = window;
= Fnext_single_property_change (position, Qmouse_face,
w->buffer, end);
/* Record this as the current active region. */
- fast_find_position (window, before,
+ fast_find_position (window, XFASTINT (before),
&FRAME_X_DISPLAY_INFO (f)->mouse_face_beg_col,
&FRAME_X_DISPLAY_INFO (f)->mouse_face_beg_row);
FRAME_X_DISPLAY_INFO (f)->mouse_face_past_end
- = !fast_find_position (window, after,
+ = !fast_find_position (window, XFASTINT (after),
&FRAME_X_DISPLAY_INFO (f)->mouse_face_end_col,
&FRAME_X_DISPLAY_INFO (f)->mouse_face_end_row);
FRAME_X_DISPLAY_INFO (f)->mouse_face_window = window;
if (maybe_next_line)
{
row++;
- i = 0;
+ lastcol = left;
}
*rowp = row + top;
FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
int i;
int cursor_off = 0;
- int old_curs_x = curs_x;
- int old_curs_y = curs_y;
-
- /* Set these variables temporarily
- so that if we have to turn the cursor off and on again
- we will put it back at the same place. */
- curs_x = f->phys_cursor_x;
- curs_y = f->phys_cursor_y;
for (i = FRAME_X_DISPLAY_INFO (f)->mouse_face_beg_row;
i <= FRAME_X_DISPLAY_INFO (f)->mouse_face_end_row; i++)
&& curs_x >= column - 1
&& curs_x <= endcolumn)
{
- x_display_cursor (f, 0);
+ x_update_cursor (f, 0);
cursor_off = 1;
}
/* If we turned the cursor off, turn it back on. */
if (cursor_off)
- x_display_cursor (f, 1);
-
- curs_x = old_curs_x;
- curs_y = old_curs_y;
+ x_update_cursor (f, 1);
/* Change the mouse cursor according to the value of HL. */
if (hl > 0)
This variable is used for cycling thru the displays. */
static struct x_display_info *next_noop_dpyinfo;
+#define SET_SAVED_MENU_EVENT(size) { \
+ if (f->output_data.x->saved_menu_event == 0) \
+ f->output_data.x->saved_menu_event = (XEvent*)xmalloc (sizeof (XEvent)); \
+ bcopy (&event, f->output_data.x->saved_menu_event, size); \
+ if (numchars >= 1) \
+ { \
+ bufp->kind = menu_bar_activate_event; \
+ XSETFRAME (bufp->frame_or_window, f); \
+ bufp++; \
+ count++; \
+ numchars--; \
+ } \
+ }
+#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
+#define SET_SAVED_KEY_EVENT SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
+
/* Read events coming from the X server.
This routine is called by the SIGIO handler.
We return as soon as there are no more events to be read.
int
XTread_socket (sd, bufp, numchars, waitp, expected)
register int sd;
- register struct input_event *bufp;
- register int numchars;
+ /* register */ struct input_event *bufp;
+ /* register */ int numchars;
int waitp;
int expected;
{
XtAppNextEvent (Xt_app_con, &event);
#else
XNextEvent (dpyinfo->display, &event);
+#endif
+#ifdef HAVE_X_I18N
+ {
+ struct frame *f1 = x_any_window_to_frame (dpyinfo,
+ &event.xclient.window);
+ /* The necessity of the following line took me
+ a full work-day to decipher from the docs!! */
+ if (f1 != 0 && FRAME_XIC (f1) && XFilterEvent (&event, None))
+ break;
+ }
#endif
event_found = 1;
unsigned char copy_buffer[81];
int modifiers;
+#if 0 /* This was how we made f10 work in Motif.
+ The drawback is, you can't type at Emacs when the
+ the mouse is in the menu bar. So it is better to
+ turn off f10 in Motif and let Emacs handle it. */
+#ifdef USE_MOTIF
if (lw_window_is_in_menubar (event.xkey.window,
f->output_data.x->menubar_widget
))
{
- XtDispatchEvent (&event);
+ SET_SAVED_KEY_EVENT;
break;
}
-
+#endif /* USE_MOTIF */
+#endif /* 0 */
+
event.xkey.state
|= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f),
extra_keyboard_modifiers);
#ifdef HAVE_X_I18N
if (FRAME_XIC (f))
{
- /* The necessity of the following line took me
- a full work-day to decipher from the docs!! */
- if (XFilterEvent (&event, None))
- break;
nbytes = XmbLookupString (FRAME_XIC (f),
&event.xkey, copy_buffer,
80, &keysym,
&& event.xbutton.y < f->output_data.x->menubar_height
&& event.xbutton.same_screen)
{
- if (f->output_data.x->saved_button_event == 0)
- f->output_data.x->saved_button_event
- = (XButtonEvent *) xmalloc (sizeof (XButtonEvent));
- bcopy (&event, f->output_data.x->saved_button_event,
- sizeof (XButtonEvent));
- if (numchars >= 1)
+ SET_SAVED_BUTTON_EVENT;
+ XSETFRAME (last_mouse_press_frame, f);
+ }
+ else if (event.type == ButtonPress)
+ {
+ last_mouse_press_frame = Qnil;
+ goto OTHER;
+ }
+#ifdef USE_MOTIF /* This should do not harm for Lucid,
+ but I am trying to be cautious. */
+ else if (event.type == ButtonRelease)
+ {
+ if (!NILP (last_mouse_press_frame))
{
- bufp->kind = menu_bar_activate_event;
- XSETFRAME (bufp->frame_or_window, f);
- bufp++;
- count++;
- numchars--;
+ f = XFRAME (last_mouse_press_frame);
+ if (f->output_data.x)
+ {
+ SET_SAVED_BUTTON_EVENT;
+ }
}
+ else
+ goto OTHER;
}
+#endif /* USE_MOTIF */
else
goto OTHER;
#endif /* USE_X_TOOLKIT */
|| f->phys_cursor_x < 0)
return;
- x_display_cursor (f, 0);
+ x_update_cursor (f, 0);
f->phys_cursor_x = -1;
}
}
/* Display the cursor on frame F, or clear it, according to ON.
- Use the position specified by curs_x and curs_y
- if we are doing an update of frame F now.
- Otherwise use the position in the FRAME_CURSOR_X and FRAME_CURSOR_Y fields
- of F. */
+ Also set the frame's cursor position to X and Y. */
-x_display_cursor (f, on)
+x_display_cursor (f, on, x, y)
struct frame *f;
int on;
+ int x, y;
{
BLOCK_INPUT;
- /* If we're not updating, then don't change the physical cursor
- position. Just change (if appropriate) the style of display. */
- if (f != updating_frame)
- {
- curs_x = FRAME_CURSOR_X (f);
- curs_y = FRAME_CURSOR_Y (f);
- }
-
if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor)
- x_display_box_cursor (f, on, curs_x, curs_y);
+ x_display_box_cursor (f, on, x, y);
else if (FRAME_DESIRED_CURSOR (f) == bar_cursor)
- x_display_bar_cursor (f, on, curs_x, curs_y);
+ x_display_bar_cursor (f, on, x, y);
else
/* Those are the only two we have implemented! */
abort ();
/* Indicate that this display is dead. */
+ #ifdef USE_X_TOOLKIT
+ XtCloseDisplay (display);
+ #endif
+
dpyinfo->display = 0;
/* First delete frames whose minibuffers are on frames
char *full_name;
XFontStruct *font;
int n_fonts;
- Atom FONT_atom;
/* Try to find a character-cell font in the list. */
#if 0
/* Try to get the full name of FONT. Put it in full_name. */
full_name = 0;
- FONT_atom = XInternAtom (FRAME_X_DISPLAY (f), "FONT", False);
for (i = 0; i < font->n_properties; i++)
{
- if (FONT_atom == font->properties[i].name)
+ if (FRAME_X_DISPLAY_INFO (f)->Xatom_FONT == font->properties[i].name)
{
char *name = XGetAtomName (FRAME_X_DISPLAY (f),
(Atom) (font->properties[i].card32));
= XInternAtom (dpyinfo->display, "WM_MOVED", False);
dpyinfo->Xatom_editres
= XInternAtom (dpyinfo->display, "Editres", False);
+ dpyinfo->Xatom_FONT
+ = XInternAtom (dpyinfo->display, "FONT", False);
dpyinfo->Xatom_CLIPBOARD
= XInternAtom (dpyinfo->display, "CLIPBOARD", False);
dpyinfo->Xatom_TIMESTAMP
init_sigio (connection);
#endif /* ! defined (SIGIO) */
+#ifdef USE_LUCID
+ /* Make sure that we have a valid font for dialog boxes
+ so that Xt does not crash. */
+ {
+ Display *dpy = dpyinfo->display;
+ XrmValue d, fr, to;
+ Font font;
+
+ d.addr = (XPointer)&dpy;
+ d.size = sizeof (Display *);
+ fr.addr = XtDefaultFont;
+ fr.size = sizeof (XtDefaultFont);
+ to.size = sizeof (Font *);
+ to.addr = (XPointer)&font;
+ x_catch_errors (dpy);
+ if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL))
+ abort ();
+ if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
+ XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
+ x_uncatch_errors (dpy);
+ }
+#endif
+
+
UNBLOCK_INPUT;
return dpyinfo;
staticpro (&Qvendor_specific_keysyms);
Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
+
+ staticpro (&last_mouse_press_frame);
+ last_mouse_press_frame = Qnil;
}
#endif /* not HAVE_X_WINDOWS */