view oldXMenu/XCrAssoc.c @ 111512:4f757d8e8ed7

Apply XAtom revork patches from Julien Danjou. * xsettings.c (init_xsettings): Use already fetch atoms. * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom from dpyinfo. * xselect.c (Fx_send_client_event): Split and create x_send_client_event. * lisp.h: Do not EXFUN Fx_send_client_event. * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom from dpyinfo. (wm_supports): Use atoms from dpyinfo. (do_ewmh_fullscreen): Use atoms from dpyinfo. (x_ewmh_activate_frame): Use atoms from dpyinfo. (xembed_set_info): Use atoms from dpyinfo. (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and _NET_ACTIVE_WINDOW, XSETTINGS atoms. Get all atoms in one round-trip. (set_wm_state): Use x_send_client_event rather than Fx_send_client_event, using Atom directly. (x_ewmh_activate_frame): Ditto. (x_set_sticky): Pass atoms to set_wm_state. (do_ewmh_fullscreen): Ditto. * xterm.h (x_display_info): Add Xatom_net_supported, Xatom_net_supporting_wm_check, Xatom_net_active_window, Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. * xfns.c (Fx_show_tip): Fix typo in docstring.
author Jan D. <jan.h.d@swipnet.se>
date Fri, 12 Nov 2010 10:31:44 +0100
parents 5cc91198ffb2
children ef719132ddfa
line wrap: on
line source

/* Copyright    Massachusetts Institute of Technology    1985	*/
#include "copyright.h"


#include <config.h>
#include <X11/Xlib.h>
#include <errno.h>
#include "X10.h"

#ifndef NULL
#define NULL 0
#endif

/*
 * XCreateAssocTable - Create an XAssocTable.  The size argument should be
 * a power of two for efficiency reasons.  Some size suggestions: use 32
 * buckets per 100 objects;  a reasonable maximum number of object per
 * buckets is 8.  If there is an error creating the XAssocTable, a NULL
 * pointer is returned.
 */
XAssocTable *XCreateAssocTable(register int size)
	                  		/* Desired size of the table. */
{
	register XAssocTable *table;	/* XAssocTable to be initialized. */
	register XAssoc *buckets;	/* Pointer to the first bucket in */
					/* the bucket array. */

	/* Malloc the XAssocTable. */
	if ((table = (XAssocTable *)malloc(sizeof(XAssocTable))) == NULL) {
		/* malloc call failed! */
		errno = ENOMEM;
		return(NULL);
	}

	/* calloc the buckets (actually just their headers). */
	buckets = (XAssoc *)calloc((unsigned)size, (unsigned)sizeof(XAssoc));
	if (buckets == NULL) {
		/* calloc call failed! */
		errno = ENOMEM;
		return(NULL);
	}

	/* Insert table data into the XAssocTable structure. */
	table->buckets = buckets;
	table->size = size;

	while (--size >= 0) {
		/* Initialize each bucket. */
		buckets->prev = buckets;
		buckets->next = buckets;
		buckets++;
	}

	return(table);
}

/* arch-tag: 5df3237d-ada0-4345-a3ab-282cafb397aa
   (do not change this comment) */