#if defined (WINDOWSNT)
Lisp_Object Qlanguage_change;
#endif
- Lisp_Object Qdrag_n_drop;
- Lisp_Object Qsave_session;
+ static Lisp_Object Qdrag_n_drop;
+ static Lisp_Object Qsave_session;
#ifdef HAVE_DBUS
- Lisp_Object Qdbus_event;
+ static Lisp_Object Qdbus_event;
#endif
- Lisp_Object Qconfig_changed_event;
+Lisp_Object Qxwidget_event;
+ static Lisp_Object Qconfig_changed_event;
/* Lisp_Object Qmouse_movement; - also an event header */
staticpro (&real_this_command);
real_this_command = Qnil;
- Qtimer_event_handler = intern_c_string ("timer-event-handler");
- staticpro (&Qtimer_event_handler);
+ DEFSYM (Qtimer_event_handler, "timer-event-handler");
+ DEFSYM (Qdisabled_command_function, "disabled-command-function");
+ DEFSYM (Qself_insert_command, "self-insert-command");
+ DEFSYM (Qforward_char, "forward-char");
+ DEFSYM (Qbackward_char, "backward-char");
+ DEFSYM (Qdisabled, "disabled");
+ DEFSYM (Qundefined, "undefined");
+ DEFSYM (Qpre_command_hook, "pre-command-hook");
+ DEFSYM (Qpost_command_hook, "post-command-hook");
+ DEFSYM (Qdeferred_action_function, "deferred-action-function");
+ DEFSYM (Qdelayed_warnings_hook, "delayed-warnings-hook");
+ DEFSYM (Qfunction_key, "function-key");
+ DEFSYM (Qmouse_click, "mouse-click");
+ DEFSYM (Qdrag_n_drop, "drag-n-drop");
+ DEFSYM (Qsave_session, "save-session");
+ DEFSYM (Qconfig_changed_event, "config-changed-event");
+ DEFSYM (Qmenu_enable, "menu-enable");
- Qdisabled_command_function = intern_c_string ("disabled-command-function");
- staticpro (&Qdisabled_command_function);
+ #if defined (WINDOWSNT)
+ DEFSYM (Qlanguage_change, "language-change");
+ #endif
- Qself_insert_command = intern_c_string ("self-insert-command");
- staticpro (&Qself_insert_command);
+ #ifdef HAVE_DBUS
+ DEFSYM (Qdbus_event, "dbus-event");
+ #endif
- Qforward_char = intern_c_string ("forward-char");
- staticpro (&Qforward_char);
+
- Qbackward_char = intern_c_string ("backward-char");
- staticpro (&Qbackward_char);
++ Qxwidget_event = intern ("xwidget-event");
++ staticpro (&Qxwidget_event);
+
- Qdisabled = intern_c_string ("disabled");
- staticpro (&Qdisabled);
++
+
- Qundefined = intern_c_string ("undefined");
- staticpro (&Qundefined);
+ DEFSYM (QCenable, ":enable");
+ DEFSYM (QCvisible, ":visible");
+ DEFSYM (QChelp, ":help");
+ DEFSYM (QCfilter, ":filter");
+ DEFSYM (QCbutton, ":button");
+ DEFSYM (QCkeys, ":keys");
+ DEFSYM (QCkey_sequence, ":key-sequence");
+ DEFSYM (QCtoggle, ":toggle");
+ DEFSYM (QCradio, ":radio");
+ DEFSYM (QClabel, ":label");
+ DEFSYM (QCvert_only, ":vert-only");
- Qpre_command_hook = intern_c_string ("pre-command-hook");
- staticpro (&Qpre_command_hook);
+ DEFSYM (Qmode_line, "mode-line");
+ DEFSYM (Qvertical_line, "vertical-line");
+ DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
+ DEFSYM (Qmenu_bar, "menu-bar");
- Qpost_command_hook = intern_c_string ("post-command-hook");
- staticpro (&Qpost_command_hook);
+
- Qdeferred_action_function = intern_c_string ("deferred-action-function");
- staticpro (&Qdeferred_action_function);
+ #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
+ DEFSYM (Qmouse_fixup_help_message, "mouse-fixup-help-message");
+ #endif
- Qcommand_hook_internal = intern_c_string ("command-hook-internal");
- staticpro (&Qcommand_hook_internal);
+ DEFSYM (Qabove_handle, "above-handle");
+ DEFSYM (Qhandle, "handle");
+ DEFSYM (Qbelow_handle, "below-handle");
+ DEFSYM (Qup, "up");
+ DEFSYM (Qdown, "down");
+ DEFSYM (Qtop, "top");
+ DEFSYM (Qbottom, "bottom");
+ DEFSYM (Qend_scroll, "end-scroll");
+ DEFSYM (Qratio, "ratio");
- Qfunction_key = intern_c_string ("function-key");
- staticpro (&Qfunction_key);
- Qmouse_click = intern_c_string ("mouse-click");
- staticpro (&Qmouse_click);
- #if defined (WINDOWSNT)
- Qlanguage_change = intern_c_string ("language-change");
- staticpro (&Qlanguage_change);
- #endif
- Qdrag_n_drop = intern_c_string ("drag-n-drop");
- staticpro (&Qdrag_n_drop);
+ DEFSYM (Qevent_kind, "event-kind");
+ DEFSYM (Qevent_symbol_elements, "event-symbol-elements");
+ DEFSYM (Qevent_symbol_element_mask, "event-symbol-element-mask");
+ DEFSYM (Qmodifier_cache, "modifier-cache");
- Qsave_session = intern_c_string ("save-session");
- staticpro (&Qsave_session);
+ DEFSYM (Qrecompute_lucid_menubar, "recompute-lucid-menubar");
+ DEFSYM (Qactivate_menubar_hook, "activate-menubar-hook");
- #ifdef HAVE_DBUS
- Qdbus_event = intern_c_string ("dbus-event");
- staticpro (&Qdbus_event);
- #endif
+ DEFSYM (Qpolling_period, "polling-period");
- Qxwidget_event = intern ("xwidget-event");
- staticpro (&Qxwidget_event);
+ DEFSYM (Qx_set_selection, "x-set-selection");
+ DEFSYM (QPRIMARY, "PRIMARY");
+ DEFSYM (Qhandle_switch_frame, "handle-switch-frame");
-
- Qmenu_enable = intern ("menu-enable");
- Qconfig_changed_event = intern_c_string ("config-changed-event");
- staticpro (&Qconfig_changed_event);
-
- Qmenu_enable = intern_c_string ("menu-enable");
- staticpro (&Qmenu_enable);
- QCenable = intern_c_string (":enable");
- staticpro (&QCenable);
- QCvisible = intern_c_string (":visible");
- staticpro (&QCvisible);
- QChelp = intern_c_string (":help");
- staticpro (&QChelp);
- QCfilter = intern_c_string (":filter");
- staticpro (&QCfilter);
- QCbutton = intern_c_string (":button");
- staticpro (&QCbutton);
- QCkeys = intern_c_string (":keys");
- staticpro (&QCkeys);
- QCkey_sequence = intern_c_string (":key-sequence");
- staticpro (&QCkey_sequence);
- QCtoggle = intern_c_string (":toggle");
- staticpro (&QCtoggle);
- QCradio = intern_c_string (":radio");
- staticpro (&QCradio);
- QClabel = intern_c_string (":label");
- staticpro (&QClabel);
- QCvert_only = intern_c_string (":vert-only");
- staticpro (&QCvert_only);
-
- Qmode_line = intern_c_string ("mode-line");
- staticpro (&Qmode_line);
- Qvertical_line = intern_c_string ("vertical-line");
- staticpro (&Qvertical_line);
- Qvertical_scroll_bar = intern_c_string ("vertical-scroll-bar");
- staticpro (&Qvertical_scroll_bar);
- Qmenu_bar = intern_c_string ("menu-bar");
- staticpro (&Qmenu_bar);
+ DEFSYM (Qinput_method_function, "input-method-function");
+ DEFSYM (Qinput_method_exit_on_first_char, "input-method-exit-on-first-char");
+ DEFSYM (Qinput_method_use_echo_area, "input-method-use-echo-area");
- #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
- Qmouse_fixup_help_message = intern_c_string ("mouse-fixup-help-message");
- staticpro (&Qmouse_fixup_help_message);
- #endif
-
- Qabove_handle = intern_c_string ("above-handle");
- staticpro (&Qabove_handle);
- Qhandle = intern_c_string ("handle");
- staticpro (&Qhandle);
- Qbelow_handle = intern_c_string ("below-handle");
- staticpro (&Qbelow_handle);
- Qup = intern_c_string ("up");
- staticpro (&Qup);
- Qdown = intern_c_string ("down");
- staticpro (&Qdown);
- Qtop = intern_c_string ("top");
- staticpro (&Qtop);
- Qbottom = intern_c_string ("bottom");
- staticpro (&Qbottom);
- Qend_scroll = intern_c_string ("end-scroll");
- staticpro (&Qend_scroll);
- Qratio = intern_c_string ("ratio");
- staticpro (&Qratio);
-
- Qevent_kind = intern_c_string ("event-kind");
- staticpro (&Qevent_kind);
- Qevent_symbol_elements = intern_c_string ("event-symbol-elements");
- staticpro (&Qevent_symbol_elements);
- Qevent_symbol_element_mask = intern_c_string ("event-symbol-element-mask");
- staticpro (&Qevent_symbol_element_mask);
- Qmodifier_cache = intern_c_string ("modifier-cache");
- staticpro (&Qmodifier_cache);
-
- Qrecompute_lucid_menubar = intern_c_string ("recompute-lucid-menubar");
- staticpro (&Qrecompute_lucid_menubar);
- Qactivate_menubar_hook = intern_c_string ("activate-menubar-hook");
- staticpro (&Qactivate_menubar_hook);
-
- Qpolling_period = intern_c_string ("polling-period");
- staticpro (&Qpolling_period);
-
- Qinput_method_function = intern_c_string ("input-method-function");
- staticpro (&Qinput_method_function);
-
- Qx_set_selection = intern_c_string ("x-set-selection");
- staticpro (&Qx_set_selection);
- QPRIMARY = intern_c_string ("PRIMARY");
- staticpro (&QPRIMARY);
- Qhandle_switch_frame = intern_c_string ("handle-switch-frame");
- staticpro (&Qhandle_switch_frame);
-
- Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char");
- staticpro (&Qinput_method_exit_on_first_char);
- Qinput_method_use_echo_area = intern_c_string ("input-method-use-echo-area");
- staticpro (&Qinput_method_use_echo_area);
+ DEFSYM (Qhelp_form_show, "help-form-show");
Fset (Qinput_method_exit_on_first_char, Qnil);
Fset (Qinput_method_use_echo_area, Qnil);
if (!STRINGP (it->string))
object = it->w->buffer;
- if (CONSP (prop)
- /* Simple properties. */
- && !EQ (XCAR (prop), Qimage)
- && !EQ (XCAR (prop), Qxwidget)
- && !EQ (XCAR (prop), Qspace)
- && !EQ (XCAR (prop), Qwhen)
- && !EQ (XCAR (prop), Qslice)
- && !EQ (XCAR (prop), Qspace_width)
- && !EQ (XCAR (prop), Qheight)
- && !EQ (XCAR (prop), Qraise)
+ display_replaced_p = handle_display_spec (it, propval, object, overlay,
+ position, bufpos,
+ FRAME_WINDOW_P (it->f));
+
+ return display_replaced_p ? HANDLED_RETURN : HANDLED_NORMALLY;
+ }
+
+ /* Subroutine of handle_display_prop. Returns non-zero if the display
+ specification in SPEC is a replacing specification, i.e. it would
+ replace the text covered by `display' property with something else,
+ such as an image or a display string.
+
+ See handle_single_display_spec for documentation of arguments.
+ frame_window_p is non-zero if the window being redisplayed is on a
+ GUI frame; this argument is used only if IT is NULL, see below.
+
+ IT can be NULL, if this is called by the bidi reordering code
+ through compute_display_string_pos, which see. In that case, this
+ function only examines SPEC, but does not otherwise "handle" it, in
+ the sense that it doesn't set up members of IT from the display
+ spec. */
+ static int
+ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
+ Lisp_Object overlay, struct text_pos *position,
+ EMACS_INT bufpos, int frame_window_p)
+ {
+ int replacing_p = 0;
+
+ if (CONSP (spec)
+ /* Simple specerties. */
+ && !EQ (XCAR (spec), Qimage)
++ && !EQ (XCAR (prop), Qxwidget)
+ && !EQ (XCAR (spec), Qspace)
+ && !EQ (XCAR (spec), Qwhen)
+ && !EQ (XCAR (spec), Qslice)
+ && !EQ (XCAR (spec), Qspace_width)
+ && !EQ (XCAR (spec), Qheight)
+ && !EQ (XCAR (spec), Qraise)
/* Marginal area specifications. */
- && !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin))
- && !EQ (XCAR (prop), Qleft_fringe)
- && !EQ (XCAR (prop), Qright_fringe)
- && !NILP (XCAR (prop)))
+ && !(CONSP (XCAR (spec)) && EQ (XCAR (XCAR (spec)), Qmargin))
+ && !EQ (XCAR (spec), Qleft_fringe)
+ && !EQ (XCAR (spec), Qright_fringe)
+ && !NILP (XCAR (spec)))
{
- for (; CONSP (prop); prop = XCDR (prop))
+ for (; CONSP (spec); spec = XCDR (spec))
{
- if (handle_single_display_spec (it, XCAR (prop), object, overlay,
- position, display_replaced_p))
+ if (handle_single_display_spec (it, XCAR (spec), object, overlay,
+ position, bufpos, replacing_p,
+ frame_window_p))
{
- display_replaced_p = 1;
+ replacing_p = 1;
/* If some text in a string is replaced, `position' no
longer points to the position of `object'. */
- if (STRINGP (object))
+ if (!it || STRINGP (object))
break;
}
}
{
Lisp_Object form;
Lisp_Object location, value;
- struct text_pos start_pos, save_pos;
+ struct text_pos start_pos = *position;
int valid_p;
+ //printf("handle_single_display_spec:\n");
/* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
If the result is non-nil, use VALUE instead of SPEC. */
LOCATION specifies where to display: `left-margin',
`right-margin' or nil. */
+ /*
+ printf("handle_single_display_spec xwidgetp:%d imagep:%d spacep:%d display_replaced_before_p:%d stringp:%d\n",
+ XWIDGETP(value),
+ valid_image_p (value),
+ (CONSP (value) && EQ (XCAR (value), Qspace)),
+ display_replaced_before_p,
+ STRINGP (value));
+ */
valid_p = (STRINGP (value)
#ifdef HAVE_WINDOW_SYSTEM
- || (FRAME_WINDOW_P (it->f) && valid_image_p (value))
+ || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p)
+ && valid_image_p (value))
#endif /* not HAVE_WINDOW_SYSTEM */
- || (CONSP (value) && EQ (XCAR (value), Qspace)));
+ || (CONSP (value) && EQ (XCAR (value), Qspace))
+ || XWIDGETP(value)
+ );
- if (valid_p && !display_replaced_before_p)
+ if (valid_p && !display_replaced_p)
{
+ if (!it)
+ return 1;
+
/* Save current settings of IT so that we can restore them
when we are finished with the glyph property value. */
- save_pos = it->position;
- it->position = *position;
- push_it (it);
- it->position = save_pos;
+ push_it (it, position);
it->from_overlay = overlay;
if (NILP (location))
return 0;
}
- /* Check if SPEC is a display sub-property value whose text should be
- treated as intangible. */
-
- static int
- single_display_spec_intangible_p (Lisp_Object prop)
- {
- /* Skip over `when FORM'. */
- if (CONSP (prop) && EQ (XCAR (prop), Qwhen))
- {
- prop = XCDR (prop);
- if (!CONSP (prop))
- return 0;
- prop = XCDR (prop);
- }
-
- if (STRINGP (prop))
- return 1;
-
- if (!CONSP (prop))
- return 0;
-
- /* Skip over `margin LOCATION'. If LOCATION is in the margins,
- we don't need to treat text as intangible. */
- if (EQ (XCAR (prop), Qmargin))
- {
- prop = XCDR (prop);
- if (!CONSP (prop))
- return 0;
-
- prop = XCDR (prop);
- if (!CONSP (prop)
- || EQ (XCAR (prop), Qleft_margin)
- || EQ (XCAR (prop), Qright_margin))
- return 0;
- }
-
- return (CONSP (prop)
- && (EQ (XCAR (prop), Qimage)
- || EQ (XCAR (prop), Qspace)
- || XWIDGETP(prop)));
- }
-
-
+
/* Check if PROP is a display property value whose text should be
- treated as intangible. */
+ treated as intangible. OVERLAY is the overlay from which PROP
+ came, or nil if it came from a text property. CHARPOS and BYTEPOS
+ specify the buffer position covered by PROP. */
int
- display_prop_intangible_p (Lisp_Object prop)
+ display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay,
+ EMACS_INT charpos, EMACS_INT bytepos)
{
- if (CONSP (prop)
- && CONSP (XCAR (prop))
- && !EQ (Qmargin, XCAR (XCAR (prop))))
- {
- /* A list of sub-properties. */
- while (CONSP (prop))
- {
- if (single_display_spec_intangible_p (XCAR (prop)))
- return 1;
- prop = XCDR (prop);
- }
- }
- else if (VECTORP (prop))
- {
- /* A vector of sub-properties. */
- int i;
- for (i = 0; i < ASIZE (prop); ++i)
- if (single_display_spec_intangible_p (AREF (prop, i)))
- return 1;
- }
- else
- return single_display_spec_intangible_p (prop);
+ int frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame));
+ struct text_pos position;
- return 0;
+ SET_TEXT_POS (position, charpos, bytepos);
+ return handle_display_spec (NULL, prop, Qnil, overlay,
+ &position, charpos, frame_window_p);
}
case GET_FROM_STRETCH:
p->u.stretch.object = it->object;
break;
+ case GET_FROM_XWIDGET:
+ p->u.xwidget.object = it->object;
+ break;
+
}
- p->position = it->position;
+ p->position = position ? *position : it->position;
p->current = it->current;
p->end_charpos = it->end_charpos;
p->string_nchars = it->string_nchars;