view oldXMenu/Post.c @ 103344:d04aeff22966

2009-06-08 Adrian Robert <Adrian.B.Robert@gmail.com> * nsterm.m (ns_use_system_highlight_color): Drop, unused. 2009-06-08 Adrian Robert <Adrian.B.Robert@gmail.com> Changes to support :script/:lang/:otf in NS font driver. * nsfont.m (nsfont_escape_name, nsfont_unescape_name) (nsfont_get_family, nsfont_char_width): Rename to ns_ prefix to indicate not part of font driver interface, and change callers. (ns_get_family): Remove pointless null check. (nsfont_spec_to_traits, nsfont_fmember_to_entity): Replace with ns_spec_to_descriptor, ns_descriptor_to_entity. (nsfont_trait_distance, nsfont_make_fontset_for_font): Remove. (ns_attribute_value, ns_attribute_fvalue, ns_has_attribute) (ns_spec_to_descriptor, ns_descriptor_to_entity) (ns_charset_covers, ns_lang_to_script, ns_otf_to_script) (ns_get_req_script, ns_accumulate_script_ranges) (ns_script_to_charset, ns_get_covering_families, ns_findfonts): New functions. (nsfont_list, nsfont_match): Use ns_findfonts. (nsfont_open): Use font descriptor instead of traits. (nsfont_draw): Handle "automatic" (lookup-table) compositions. (dump_glyphstring): Rename to ns_dump_glyphstring. * nsfns.m (Fns_popup_font_panel): Use shared font manager. * fontset.c (fontset_from_font): Remove NS-specific code. 2009-06-08 Peter Jones <pjones@pmade.com> (tiny change) * nsterm.m (ns_draw_window_cursor): Respect cursor_type for nonactive windows. 2009-06-08 Felix Mueller <felix@enqueue.eu> (tiny change) * nsterm.m (ns_init_paths): Append path separator to INFOPATH variable.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Mon, 08 Jun 2009 04:34:54 +0000
parents fec5e03aaf59
children edf631bdbb7a ec58e5c426ef 5cc91198ffb2
line wrap: on
line source

/* Copyright    Massachusetts Institute of Technology    1985	*/

#include "copyright.h"


/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 *	XMenuPost -	Maps a given menu to the display and activates
 *			the menu for user selection.  The user is allowed to
 *			specify the mouse button event mask that will be used
 *			to identify a selection request.  When a selection
 *			request is received (i.e., when the specified mouse
 *			event occurs) the data  returned will be either the
 *			data associated with the particular selection active
 *			at the time of the selection request or NULL if no
 *			selection was active.  A menu selection is shown to
 *			be active by placing a highlight box around the
 *			selection as the mouse cursor enters its active
 *			region.  Inactive selections will not be highlighted.
 *			As the mouse cursor moved from one menu pane
 *			to another menu pane the pane being entered is raised
 *			and activated and the pane being left is deactivated.
 *			If an error occurs NULL will be returned with the
 *			p_num set to POST_ERROR, s_num set to
 *			NO_SELECTION and _XMErrorCode set to an
 *			appropriate value.
 *			Every time the routine returns successfully the
 *			p_num and s_num indices will be set to indicate
 *			the currently active pane and/or selection.  If the
 *			mouse was not in a selection window at the time
 *			s_num will be set to NO_SELECTION.
 *
 *	Author:		Tony Della Fera, DEC
 *			August, 1984
 *
 */

#include "XMenuInt.h"

char *
XMenuPost(display, menu, p_num, s_num, x_pos, y_pos, event_mask)
    register Display *display;	/* Previously opened display. */
    register XMenu *menu;	/* Menu to post. */
    register int *p_num;	/* Pane number selected. */
    register int *s_num;	/* Selection number selected. */
    register int x_pos;		/* X coordinate of menu position. */
    register int y_pos;		/* Y coordinate of menu position. */
    int event_mask;		/* Mouse button event mask. */
{
    register int stat;		/* Routine call return status. */
    char *data;			/* Return data. */

    /*
     * Set up initial pane and selection assumptions.
     */

    /*
     * Make the procedure call.
     */
    stat = XMenuActivate(
			 display,
			 menu,
			 p_num, s_num,
			 x_pos, y_pos,
			 event_mask,
			 &data, 0);

    /*
     * Check the return value and return accordingly.
     */
    switch (stat) {
	case XM_FAILURE:
	    *p_num = POST_ERROR;
	    *s_num = NO_SELECTION;
	    return(NULL);
	case XM_NO_SELECT:
	case XM_IA_SELECT:
	    *s_num = NO_SELECTION;
	    return(NULL);
	case XM_SUCCESS:
	default:
	    return(data);
    }
}

/* arch-tag: 7b6104e5-fa32-4342-aa17-05296a30dd70
   (do not change this comment) */