otherwise. */
result->kind = no_event;
XSET (result->code, Lisp_Int, event->button);
- XSET (result->timestamp, Lisp_Int, event->time);
+ result->timestamp = event->time;
result->modifiers = (x_convert_modifiers (event->state)
| (event->type == ButtonRelease ? up_modifier : 0));
- XSET (result->timestamp, Lisp_Int, (event->time & 0x7fffff));
/* Notice if the mouse is still grabbed. */
if (event->type == ButtonPress)
other kinds of events (focus changes and button clicks, for
example), or by XQueryPointer calls; when one of these happens, we
get another MotionNotify event the next time the mouse moves. This
- is at least as efficient than getting motion events when mouse
+ is at least as efficient as getting motion events when mouse
tracking is on, and I suspect only negligibly worse when tracking
is off.
static SCREEN_PTR last_mouse_screen;
static XRectangle last_mouse_glyph;
+/* This is a hack. We would really prefer that XTmouse_position would
+ return the time associated with the position it returns, but there
+ doesn't seem to be any way to wrest the timestamp from the server
+ along with the position query. So, we just keep track of the time
+ of the last movement we received, and return that in hopes that
+ it's somewhat accurate. */
+static Time last_mouse_movement_time;
+
/* Function to report a mouse movement to the mainstream Emacs code.
The input handler calls this.
XMotionEvent *event;
{
+ last_mouse_movement_time = event->time;
+
/* Has the mouse moved off the glyph it was on at the last sighting? */
if (event->x < last_mouse_glyph.x
|| event->x >= last_mouse_glyph.x + last_mouse_glyph.width
XTmouse_position (s, x, y, time)
SCREEN_PTR *s;
Lisp_Object *x, *y;
- Lisp_Object *time;
+ unsigned long *time;
{
int ix, iy, dummy;
Display *d = x_current_display;
mouse_moved = 0;
/* I don't know how to find the time for the last movement; it seems
- like XQueryPointer ought to return it, but it doesn't. */
- *time = Qnil;
+ like XQueryPointer ought to return it, but it doesn't. So, we'll
+ return the time of the last MotionNotify event we received. Note
+ that the use of motion hints means that this isn't guaranteed to
+ be accurate at all. */
+ *time = last_mouse_movement_time;
UNBLOCK_INPUT;
}
{
bufp->kind = non_ascii_keystroke;
XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff50);
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
+ bufp->screen = s;
bufp->modifiers = x_convert_modifiers (modifiers);
- XSET (bufp->timestamp, Lisp_Int, event.xkey.time);
+ bufp->timestamp = event.xkey.time;
bufp++;
count++;
numchars--;
if (modifiers & Mod1Mask)
*copy_buffer |= METABIT;
bufp->kind = ascii_keystroke;
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
XSET (bufp->code, Lisp_Int, *copy_buffer);
- XSET (bufp->timestamp, Lisp_Int, event.xkey.time);
+ bufp->screen = s;
+ bufp->timestamp = event.xkey.time;
bufp++;
}
else
{
bufp->kind = ascii_keystroke;
XSET (bufp->code, Lisp_Int, copy_buffer[i]);
- XSET (bufp->timestamp, Lisp_Int, event.xkey.time);
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
+ bufp->screen = s;
+ bufp->timestamp = event.xkey.time;
bufp++;
}
bufp->kind = ascii_keystroke;
XSET (bufp->code, Lisp_Int, where_mapping[i]);
XSET (bufp->time, Lisp_Int, event.xkey.time);
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
+ bufp->screen = s;
bufp++;
}
count += nbytes;
break; /* Entering our own subwindow. */
{
- extern int waiting_for_input;
struct screen *old_s = x_input_screen;
s = x_window_to_screen (event.window);
x_mouse_screen = s;
- if (waiting_for_input && x_focus_screen == 0)
- x_new_focus_screen (s);
+ x_new_focus_screen (s);
}
break;
{
bufp->kind = ascii_keystroke;
bufp->code = (char) 'X' & 037; /* C-x */
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
+ bufp->screen = s;
XSET (bufp->time, Lisp_Int, event.xkey.time);
bufp++;
bufp->kind = ascii_keystroke;
bufp->code = (char) 0; /* C-@ */
- bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s));
+ bufp->screen = s;
XSET (bufp->time, Lisp_Int, event.xkey.time);
bufp++;
{
struct screen_glyphs *current_glyphs = SCREEN_CURRENT_GLYPHS (s);
+ /* If we're not updating, then we want to use the current screen's
+ cursor position, not our local idea of where the cursor ought to be. */
+ if (s != updating_screen)
+ {
+ curs_x = SCREEN_CURSOR_X (s);
+ curs_y = SCREEN_CURSOR_Y (s);
+ }
+
if (! s->visible)
return;
erase it. */
if (s->phys_cursor_x >= 0
&& (!on
- || s->phys_cursor_x != s->cursor_x
- || s->phys_cursor_y != s->cursor_y
+ || s->phys_cursor_x != curs_x
+ || s->phys_cursor_y != curs_y
|| (s->display.x->text_cursor_kind != hollow_box_cursor
&& (s != x_highlight_screen))))
{
&& s == x_highlight_screen)))
{
s->phys_cursor_glyph
- = ((current_glyphs->enable[s->cursor_y]
- && s->cursor_x < current_glyphs->used[s->cursor_y])
- ? current_glyphs->glyphs[s->cursor_y][s->cursor_x]
+ = ((current_glyphs->enable[curs_y]
+ && curs_x < current_glyphs->used[curs_y])
+ ? current_glyphs->glyphs[curs_y][curs_x]
: SPACEGLYPH);
if (s != x_highlight_screen)
{
}
else
{
- x_draw_single_glyph (s, s->cursor_y, s->cursor_x,
+ x_draw_single_glyph (s, curs_y, curs_x,
s->phys_cursor_glyph, 2);
s->display.x->text_cursor_kind = filled_box_cursor;
}
- s->phys_cursor_x = s->cursor_x;
- s->phys_cursor_y = s->cursor_y;
+ s->phys_cursor_x = curs_x;
+ s->phys_cursor_y = curs_y;
}
if (updating_screen != s)
Window window = s->display.x->window_desc;
size_hints.flags = PResizeInc | PMinSize | PMaxSize;
+#ifdef PBaseSize
+ size_hints.flags |= PBaseSize;
+#endif
flexlines = s->height;