extern void free_frame_menubar ();
#endif /* USE_X_TOOLKIT */
+#ifndef USE_X_TOOLKIT
+#define x_any_window_to_frame x_window_to_frame
+#endif
+
#ifdef HAVE_X11
#define XMapWindow XMapRaised /* Raise them when mapping. */
#else /* ! defined (HAVE_X11) */
int g = *gp;
GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
- cf = GLYPH_FACE (g);
+ cf = FAST_GLYPH_FACE (g);
/* Find the run of consecutive glyphs with the same face-code.
Extract their character codes into BUF. */
{
g = *gp;
GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
- if (GLYPH_FACE (g) != cf)
+ if (FAST_GLYPH_FACE (g) != cf)
break;
- *cp++ = GLYPH_CHAR (g);
+ *cp++ = FAST_GLYPH_CHAR (g);
--n;
++gp;
}
unsigned long mask;
xgcv.background = f->display.x->cursor_pixel;
- xgcv.foreground = f->display.x->cursor_foreground_pixel;
+ if (face == FRAME_DEFAULT_FACE (f))
+ xgcv.foreground = f->display.x->cursor_foreground_pixel;
+ else
+ xgcv.foreground = face->foreground;
+ /* If the glyph would be invisible,
+ try a different foreground. */
+ if (xgcv.foreground == xgcv.background)
+ xgcv.foreground = face->background;
+ if (xgcv.foreground == xgcv.background)
+ xgcv.foreground = f->display.x->cursor_foreground_pixel;
+ if (xgcv.foreground == xgcv.background)
+ xgcv.foreground = face->foreground;
+ /* Make sure the cursor is distinct from text in this face. */
+ if (xgcv.background == face->background
+ && xgcv.foreground == face->foreground)
+ {
+ xgcv.background = face->foreground;
+ xgcv.foreground = face->background;
+ }
xgcv.font = face->font->fid;
xgcv.graphics_exposures = 0;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
KeyCode code =
mods->modifiermap[(row * mods->max_keypermod) + col];
+ /* Zeroes are used for filler. Skip them. */
+ if (code == 0)
+ continue;
+
/* Are any of this keycode's keysyms a meta key? */
{
int code_col;
XFreeModifiermap (mods);
}
-/* Prepare a menu-event in *RESULT for placement in the input queue. */
-
-static Lisp_Object
-construct_menu_click (result, event, f)
- struct input_event *result;
- XButtonEvent *event;
- struct frame *f;
-{
- /* Make the event type no_event; we'll change that when we decide
- otherwise. */
- result->kind = mouse_click;
- XSET (result->code, Lisp_Int, event->button - Button1);
- result->timestamp = event->time;
- result->modifiers = (x_x_to_emacs_modifiers (event->state)
- | (event->type == ButtonRelease
- ? up_modifier
- : down_modifier));
-
- {
- XFASTINT (result->x) = event->x;
- XFASTINT (result->y) = -1; /* special meaning for menubar */
- XSET (result->frame_or_window, Lisp_Frame, f);
- }
-}
-
/* Convert between the modifier bits X uses and the modifier bits
Emacs uses. */
static unsigned int
that the glyph at X, Y occupies, if BOUNDS != 0.
If NOCLIP is nonzero, do not force the value into range. */
-static void
+void
pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
FRAME_PTR f;
register int pix_x, pix_y;
*y = pix_y;
}
+void
+glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
+ FRAME_PTR f;
+ register int x, y;
+ register int *pix_x, *pix_y;
+{
+ *pix_x = CHAR_TO_PIXEL_COL (f, x);
+ *pix_y = CHAR_TO_PIXEL_ROW (f, y);
+}
+
/* Prepare a mouse-event in *RESULT for placement in the input queue.
If the event is a button press, then note that we have grabbed
{
int row, column;
+#if 0
pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0);
XFASTINT (result->x) = column;
XFASTINT (result->y) = row;
+#endif
+ XFASTINT (result->x) = event->x;
+ XFASTINT (result->y) = event->y;
XSET (result->frame_or_window, Lisp_Frame, f);
}
}
+
+/* Prepare a menu-event in *RESULT for placement in the input queue. */
+
+static Lisp_Object
+construct_menu_click (result, event, f)
+ struct input_event *result;
+ XButtonEvent *event;
+ struct frame *f;
+{
+ /* Make the event type no_event; we'll change that when we decide
+ otherwise. */
+ result->kind = mouse_click;
+ XSET (result->code, Lisp_Int, event->button - Button1);
+ result->timestamp = event->time;
+ result->modifiers = (x_x_to_emacs_modifiers (event->state)
+ | (event->type == ButtonRelease
+ ? up_modifier
+ : down_modifier));
+
+ XFASTINT (result->x) = event->x;
+ XSETINT (result->y, -1);
+ XSET (result->frame_or_window, Lisp_Frame, f);
+}
\f
/* Function to report a mouse movement to the mainstream Emacs code.
The input handler calls this.
never use them in that case.) */
/* Is win one of our frames? */
- f1 = x_window_to_frame (win);
+ f1 = x_any_window_to_frame (win);
}
/* If not, is it one of our scroll bars? */
if (f1)
{
- /* Ok, we found a frame. Convert from pixels to characters
- and store all the values. */
+ int ignore1, ignore2;
- pixel_to_glyph_coords (f1, win_x, win_y, &win_x, &win_y,
+ /* Ok, we found a frame. Store all the values. */
+
+ pixel_to_glyph_coords (f1, win_x, win_y, &ignore1, &ignore2,
&last_mouse_glyph, x_mouse_grabbed);
*bar_window = Qnil;
XGCTYPE (tail) == Lisp_Cons;
tail = XCONS (tail)->cdr)
{
- Lisp_Object frame = XCONS (tail)->car;
- Lisp_Object bar, condemned;
+ Lisp_Object frame, bar, condemned;
+ frame = XCONS (tail)->car;
/* All elements of Vframe_list should be frames. */
if (XGCTYPE (frame) != Lisp_Frame)
abort ();
/* x, y, width, height */
0, 0, XINT (bar->width) - 1, XINT (bar->height) - 1);
- /* Draw another line to make the extra-thick border on the right. */
- XFillRectangle (x_current_display, w, gc,
-
- /* x, y, width, height */
- XINT (bar->width) - 2, 1, 1, XINT (bar->height) - 2);
-
UNBLOCK_INPUT;
}
}
else if (event.xclient.data.l[0] == Xatom_wm_delete_window)
{
- struct frame *f = x_window_to_frame (event.xclient.window);
+ struct frame *f = x_any_window_to_frame (event.xclient.window);
if (f)
{
#ifdef HAVE_X11
case KeyPress:
- f = x_window_to_frame (event.xkey.window);
+ f = x_any_window_to_frame (event.xkey.window);
if (f != 0)
{
then a mere LeaveNotify is enough to free you. */
case EnterNotify:
- f = x_window_to_frame (event.xcrossing.window);
+ f = x_any_window_to_frame (event.xcrossing.window);
if (event.xcrossing.focus) /* Entered Window */
{
break;
case FocusIn:
- f = x_window_to_frame (event.xfocus.window);
+ f = x_any_window_to_frame (event.xfocus.window);
if (event.xfocus.detail != NotifyPointer)
x_focus_event_frame = f;
if (f)
case LeaveNotify:
- f = x_window_to_frame (event.xcrossing.window);
+ f = x_any_window_to_frame (event.xcrossing.window);
if (event.xcrossing.focus)
{
break;
case FocusOut:
- f = x_window_to_frame (event.xfocus.window);
+ f = x_any_window_to_frame (event.xfocus.window);
if (event.xfocus.detail != NotifyPointer
&& f == x_focus_event_frame)
x_focus_event_frame = 0;
break;
case ConfigureNotify:
+ f = x_any_window_to_frame (event.xconfigure.window);
#ifdef USE_X_TOOLKIT
- /* process done in widget.c */
- goto OTHER;
+ if (f
+ && ! event.xconfigure.send_event
+ && (event.xconfigure.window == XtWindow (f->display.x->widget)))
+ {
+ Window win, child;
+ int win_x, win_y;
+
+ /* Find the position of the outside upper-left corner of
+ the window, in the root coordinate system. Don't
+ refer to the parent window here; we may be processing
+ this event after the window manager has changed our
+ parent, but before we have reached the ReparentNotify. */
+ XTranslateCoordinates (x_current_display,
+
+ /* From-window, to-window. */
+ XtWindow (f->display.x->widget),
+ ROOT_WINDOW,
+
+ /* From-position, to-position. */
+ -event.xconfigure.border_width,
+ -event.xconfigure.border_width,
+ &win_x, &win_y,
+
+ /* Child of win. */
+ &child);
+ event.xconfigure.x = win_x;
+ event.xconfigure.y = win_y;
+
+ f->display.x->pixel_width = event.xconfigure.width;
+ f->display.x->pixel_height = event.xconfigure.height;
+ f->display.x->left_pos = event.xconfigure.x;
+ f->display.x->top_pos = event.xconfigure.y;
+ }
+ goto OTHER;
#else /* not USE_X_TOOLKIT */
- f = x_window_to_frame (event.xconfigure.window);
if (f)
{
int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height);
}
}
+/* Nonzero if we had any X protocol errors since we did x_catch_errors. */
+
+int
+x_had_errors_p ()
+{
+ /* Make sure to catch any errors incurred so far. */
+ XSync (x_current_display, False);
+
+ return x_caught_error_message[0] != 0;
+}
+
/* Stop catching X protocol errors and let them make Emacs die. */
void
}
{
- Lisp_Object lispy_name = build_string (fontname);
+ Lisp_Object lispy_name;
+ lispy_name = build_string (fontname);
/* Free the information from XListFonts. The data
we actually retain comes from XLoadQueryFont. */