view oldXMenu/DelSel.c @ 50894:4dc2d45403ec

(with-vc-properties, with-vc-file, edit-vc-file): Add `declare's for debugging and indentation. (vc-do-command): Use `remq'. (vc-buffer-context): Remove unused var `curbuf'. (vc-next-action-dired): Remove unused var `dired-dir'. (vc-switches): New fun. (vc-diff-switches-list): Use it. (vc-dired-hook): Remove unused var `cvs-dir'. (vc-dired-purge): Remove unused var `subdir'. (vc-cancel-version): Remove unused var `config'. (vc-rename-master): Use dolist iso mapcar. (vc-rename-file): Remove redundant tests. Clear the properties of the old file name. (vc-annotate): Pass the complete filename to `annotate-command'. (vc-annotate-lines): Remove unused var `overlay'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 08 May 2003 17:41:16 +0000
parents 23a1cea22d13
children 695cf19ef79e d7ddb3e565de
line wrap: on
line source

#include "copyright.h"

/* $Header: /cvs/emacs/oldXMenu/DelSel.c,v 1.1 1999/10/03 19:34:58 fx Exp $ */
/* Copyright    Massachusetts Institute of Technology    1985	*/

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 * 	XMenuDeleteSelection - Deletes a selection from an XMenu object.
 *
 *	Author:		Tony Della Fera, DEC
 *			20-Nov-85
 *
 */

#include "XMenuInt.h"

int
XMenuDeleteSelection(display, menu, p_num, s_num)
    register Display *display;	/* Previously opened display. */
    register XMenu *menu;	/* Menu object to be modified. */
    register int p_num;		/* Pane number to be deleted. */
    register int s_num;		/* Selection number to be deleted. */
{
    register XMPane *p_ptr;	/* Pointer to pane being deleted. */
    register XMSelect *s_ptr;	/* Pointer to selections being deleted. */

    /*
     * Find the right pane.
     */
    p_ptr = _XMGetPanePtr(menu, p_num);
    if (p_ptr == NULL) return(XM_FAILURE);

    /*
     * Find the right selection.
     */
    s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
    if (s_ptr == NULL) return(XM_FAILURE);

    /*
     * Remove the selection from the association table.
     */
    XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);

    /*
     * Remove the selection from the parent pane's selection
     * list and update the selection count.
     */
    emacs_remque(s_ptr);
    p_ptr->s_count--;

    /*
     * Destroy the selection transparency.
     */
    if (s_ptr->window) XDestroyWindow(display, s_ptr->window);

    /*
     * Free the selection's XMSelect structure.
     */
    free(s_ptr);

    /*
     * Schedule a recompute.
     */
    menu->recompute = 1;

    /*
     * Return the selection number just deleted.
     */
    _XMErrorCode = XME_NO_ERROR;
    return(s_num);
}