Commit 55660072 authored by Paul Eggert's avatar Paul Eggert

Modernize to C89, for better static checking.

* Activate.c (XMenuActivate): Callback's first arg is readonly.
* AddPane.c (XMenuAddPane): Label is readonly.  Rename local
to avoid shadowing.
* AddSel.c (XMenuAddSelection): Help arg is readonly.  Rename local.
* Create.c (atoi, atof): Remove decls; include <stdlib.h>.
(MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
(x_get_resource_string): Args are readonly.
(XAllocDisplayColor): colorName is readonly.
(XMenuCreate): def_env is readonly.  Remove unused locals.  Avoid
"else;".
* Destroy.c (XMenuDestroy): Return void.
* Error.c (XMenuError): Remove const pointer.
* EvHand.c (XMenuEventHandler): Return void.
* FindPane.c, FindSel.c: Include <string.h>.
* InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
* InsSel.c (XMenuInsertSelection): Likewise.
* Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
(_XMErrorList): Now const.
(_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
(_XMRefreshSelection): Return void.
(_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
shadowing.
(_XMWinQueFlush): Use stack, not heap.  Don't use uninitialized var.
* SetAEQ.c (XMenuSetAEQ): Now returns void.
* SetFrz.c (XMenuSetFreeze): Likewise.
* X10.h (XAssoc): Use void * for generic pointer.
* XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
* XDestAssoc.c, XMakeAssoc.c: Likewise.
* XDestAssoc.c (XDestroyAssocTable): Return void.
* XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
* XMenu.h, XMenuInt.h: Adjust to signature changes.  Use const
for pointers to readonly storage.
* insque.c: Include XMenuInt.h, to check our own signature.
(emacs_insque, emacs_remque): Use void * for generic pointers.
parent aefd87e1
......@@ -122,7 +122,7 @@ XMenuActivate(
int y_pos, /* Y coordinate of menu position. */
unsigned int event_mask, /* Mouse button event mask. */
char **data, /* Pointer to return data value. */
void (* help_callback) (char *, int, int)) /* Help callback. */
void (*help_callback) (char const *, int, int)) /* Help callback. */
{
int status; /* X routine call status. */
int orig_x; /* Upper left menu origin X coord. */
......
......@@ -16,14 +16,14 @@
#include "XMenuInt.h"
int
XMenuAddPane(Display *display, register XMenu *menu, register char *label, int active)
XMenuAddPane(Display *display, register XMenu *menu, register char const *label, int active)
/* Menu object to be modified. */
/* Selection label. */
/* Make selection active? */
{
register XMPane *pane; /* Newly created pane. */
register XMSelect *select; /* Initial selection for the new pane. */
register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
......@@ -44,8 +44,8 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
select = (XMSelect *)calloc(1, sizeof(XMSelect));
if (select == NULL) {
sel = (XMSelect *)calloc(1, sizeof(XMSelect));
if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
......@@ -62,11 +62,11 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
select->next = select;
select->prev = select;
select->type = SL_HEADER;
select->serial = -1;
select->parent_p = pane;
sel->next = sel;
sel->prev = sel;
sel->type = SL_HEADER;
sel->serial = -1;
sel->parent_p = pane;
/*
* Fill the XMPane structure.
......@@ -78,7 +78,7 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
pane->s_list = select;
pane->s_list = sel;
/*
* Insert the pane at the end of the pane list.
......@@ -101,4 +101,3 @@ XMenuAddPane(Display *display, register XMenu *menu, register char *label, int a
_XMErrorCode = XME_NO_ERROR;
return((menu->p_count - 1));
}
......@@ -17,8 +17,8 @@
#include "XMenuInt.h"
int
XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help)
XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help)
/* Menu object to be modified. */
/* Pane number to be modified. */
/* Data value. */
......@@ -27,7 +27,7 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
/* Help string */
{
register XMPane *pane; /* Pane containing the new selection. */
register XMSelect *select; /* Newly created selection. */
register XMSelect *sel; /* Newly created selection. */
int label_length; /* Label lenght in characters. */
......@@ -49,8 +49,8 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
/*
* Calloc the XMSelect structure.
*/
select = (XMSelect *)calloc(1, sizeof(XMSelect));
if (select == NULL) {
sel = (XMSelect *)calloc(1, sizeof(XMSelect));
if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
......@@ -65,27 +65,27 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
select->type = SEPARATOR;
select->active = 0;
sel->type = SEPARATOR;
sel->active = 0;
}
else
{
select->type = SELECTION;
select->active = active;
sel->type = SELECTION;
sel->active = active;
}
select->serial = -1;
select->label = label;
select->label_width = label_width;
select->label_length = label_length;
select->data = data;
select->parent_p = pane;
select->help_string = help;
sel->serial = -1;
sel->label = label;
sel->label_width = label_width;
sel->label_length = label_length;
sel->data = data;
sel->parent_p = pane;
sel->help_string = help;
/*
* Insert the selection at the end of the selection list.
*/
emacs_insque(select, pane->s_list->prev);
emacs_insque(sel, pane->s_list->prev);
/*
* Update the selection count.
......@@ -103,4 +103,3 @@ XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, ch
_XMErrorCode = XME_NO_ERROR;
return((pane->s_count - 1));
}
2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
Modernize to C89, for better static checking.
* Activate.c (XMenuActivate): Callback's first arg is readonly.
* AddPane.c (XMenuAddPane): Label is readonly. Rename local
to avoid shadowing.
* AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local.
* Create.c (atoi, atof): Remove decls; include <stdlib.h>.
(MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
(x_get_resource_string): Args are readonly.
(XAllocDisplayColor): colorName is readonly.
(XMenuCreate): def_env is readonly. Remove unused locals. Avoid
"else;".
* Destroy.c (XMenuDestroy): Return void.
* Error.c (XMenuError): Remove const pointer.
* EvHand.c (XMenuEventHandler): Return void.
* FindPane.c, FindSel.c: Include <string.h>.
* InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
* InsSel.c (XMenuInsertSelection): Likewise.
* Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
(_XMErrorList): Now const.
(_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
(_XMRefreshSelection): Return void.
(_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
shadowing.
(_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var.
* SetAEQ.c (XMenuSetAEQ): Now returns void.
* SetFrz.c (XMenuSetFreeze): Likewise.
* X10.h (XAssoc): Use void * for generic pointer.
* XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
* XDestAssoc.c, XMakeAssoc.c: Likewise.
* XDestAssoc.c (XDestroyAssocTable): Return void.
* XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
* XMenu.h, XMenuInt.h: Adjust to signature changes. Use const
for pointers to readonly storage.
* insque.c: Include XMenuInt.h, to check our own signature.
(emacs_insque, emacs_remque): Use void * for generic pointers.
2011-03-07 Chong Yidong <cyd@stupidchicken.com>
* Version 23.3 released.
......
......@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "XMenuInt.h"
#include <stdlib.h>
#ifdef EMACS_BITMAP_FILES
#include "../src/bitmaps/dimple1.xbm"
......@@ -71,7 +71,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define DEF_MENU_STYLE LEFT
#define DEF_MENU_MODE BOX
#define DEF_INACT_PNUM 3
#define MAX_INACT_PNUM 4
#define DEF_P_STYLE CENTER
......@@ -88,16 +87,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define XASSOC_TABLE_SIZE 64
#define TILE_BUF_SIZE 5
int atoi(const char *);
double atof(const char *);
char *x_get_resource_string (char *attribute, char *class);
char *x_get_resource_string (char const *, char const *);
static Status
XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk)
XAllocDisplayColor(Display *display, Colormap map, char const *colorName,
XColor *color, XColor *junk)
{
return (colorName!=0 &&
XParseColor(display, map, colorName, color) &&
......@@ -106,13 +102,11 @@ XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *colo
XMenu *
XMenuCreate(Display *display, Window parent, register char *def_env)
XMenuCreate(Display *display, Window parent, register char const *def_env)
/* ID of previously opened display */
/* Window ID of the menu's parent window. */
/* X Defaults program environment name. */
{
register int i; /* Loop counter. */
register int j; /* Loop counter. */
register char *def_val; /* X Default value temp variable. */
register XMenu *menu; /* Pointer to the new menu. */
......@@ -125,7 +119,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
int reverse; /* Reverse video mode. */
XMStyle p_style; /* Pane display style. */
char *p_fnt_name; /* Flag font name. */
char const *p_fnt_name; /* Flag font name. */
XFontStruct *p_fnt_info; /* Flag font structure */
int p_fnt_pad; /* Flag font padding in pixels. */
double p_spread; /* Pane spread in flag height fractions. */
......@@ -138,7 +132,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
GC pane_GC; /* Pane graphics context. */
XMStyle s_style; /* Selection display style. */
char *s_fnt_name; /* Selection font name. */
char const *s_fnt_name; /* Selection font name. */
XFontStruct *s_fnt_info; /* Selection font structure. */
int s_fnt_pad; /* Selection font padding in pixels. */
int s_fnt_height; /* Selection font character height */
......@@ -151,10 +145,8 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
GC inverse_select_GC; /* GC used for inverse video selection. */
GC inact_GC; /* GC for inactive pane header and */
/* selections. */
GC inact_GC_noexpose;
XColor color_def; /* Temp color definition holder. */
XColor screen_def; /* Temp screen color definition holder */
XColor p_bdr_color; /* Color of border. */
XColor s_bdr_color; /* Color of highlight. */
XColor p_frg_color; /* Color of pane foreground color. */
......@@ -166,17 +158,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
int inact_pnum; /* Inactive background pattern number. */
Pixel p_bdr_pixel; /* Pane border pixel. */
Pixel s_bdr_pixel; /* Selection border pixel. */
Pixel p_frg_pixel; /* Pane foreground pixel. */
Pixel s_frg_pixel; /* Selection foreground pixel. */
Pixel bkgnd_pixel; /* Menu background pixel. */
int *width, *height;
Pixmap *bitmap;
int *x_hot, *y_hot;
int status; /* Return code from XReadBitmapFile. */
Pixmap cursor; /* Cursor pixmap holder. */
Pixmap cursor_mask; /* Cursor mask pixmap holder. */
Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
......@@ -282,7 +263,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
&mouse_color, &color_def)
);
else ;
else {}
def_val = x_get_resource_string ("menuBackground", "MenuBackground");
if (
......@@ -304,7 +285,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
"white",
&bkgnd_color, &color_def)
);
else;
else {}
def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern");
if (def_val != NULL) {
......@@ -401,7 +382,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
"black",
&s_frg_color, &color_def)
) ;
else ;
else {}
def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
......@@ -424,7 +405,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
"black",
&s_bdr_color, &color_def)
) ;
else ;
else {}
def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth");
if (def_val != NULL) s_bdr_width = atoi(def_val);
......@@ -681,9 +662,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
valuemask |= (GCGraphicsExposures);
values->graphics_exposures = False;
inact_GC_noexpose = XCreateGC (display,
root,
valuemask, values);
/*
......@@ -752,4 +730,3 @@ XMenuCreate(Display *display, Window parent, register char *def_env)
_XMErrorCode = XME_NO_ERROR;
return(menu);
}
......@@ -15,8 +15,9 @@
#include "XMenuInt.h"
void
XMenuDestroy(Display *display, register XMenu *menu)
/* Menu object to destroy. */
{
register XMPane *p_ptr; /* Pointer to the current pane. */
......@@ -114,4 +115,3 @@ XMenuDestroy(Display *display, register XMenu *menu)
*/
free(menu);
}
......@@ -16,7 +16,7 @@
#include "XMenuInt.h"
char *
char const *
XMenuError(void)
{
static char message[128]; /* Error message buffer. */
......@@ -27,4 +27,3 @@ XMenuError(void)
sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode);
return(message);
}
......@@ -15,6 +15,7 @@
#include "XMenuInt.h"
void
XMenuEventHandler(int (*handler) (XEvent*))
{
/*
......@@ -22,4 +23,3 @@ XMenuEventHandler(int (*handler) (XEvent*))
*/
_XMEventHandler = handler;
}
......@@ -15,6 +15,7 @@
*/
#include "XMenuInt.h"
#include <string.h>
int
XMenuFindPane(register XMenu *menu, register char *label)
......@@ -60,4 +61,3 @@ XMenuFindPane(register XMenu *menu, register char *label)
_XMErrorCode = XME_P_NOT_FOUND;
return (XM_FAILURE);
}
......@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "XMenuInt.h"
#include <string.h>
int
XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
......@@ -83,4 +84,3 @@ XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
_XMErrorCode = XME_S_NOT_FOUND;
return (XM_FAILURE);
}
......@@ -26,7 +26,7 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
{
register XMPane *p_ptr; /* XMPane pointer. */
register XMPane *pane; /* Newly created pane. */
register XMSelect *select; /* Initial selection for the new pane. */
register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
......@@ -54,8 +54,8 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
select = (XMSelect *)calloc(1, sizeof(XMSelect));
if (select == NULL) {
sel = (XMSelect *)calloc(1, sizeof(XMSelect));
if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
......@@ -70,11 +70,11 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
select->next = select;
select->prev = select;
select->type = SL_HEADER;
select->serial = -1;
select->parent_p = pane;
sel->next = sel;
sel->prev = sel;
sel->type = SL_HEADER;
sel->serial = -1;
sel->parent_p = pane;
/*
* Fill the XMPane structure.
......@@ -85,7 +85,7 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
pane->s_list = select;
pane->s_list = sel;
/*
* Insert the pane after the pane with the pane
......@@ -110,4 +110,3 @@ XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int activ
_XMErrorCode = XME_NO_ERROR;
return(p_num);
}
......@@ -28,7 +28,7 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
XMSelect *select; /* Newly created selection. */
XMSelect *sel; /* Newly created selection. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
......@@ -57,8 +57,8 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
/*
* Calloc the XMSelect structure.
*/
select = (XMSelect *)calloc(1, sizeof(XMSelect));
if (select == NULL) {
sel = (XMSelect *)calloc(1, sizeof(XMSelect));
if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
......@@ -75,28 +75,28 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
select->type = SEPARATOR;
select->active = 0;
sel->type = SEPARATOR;
sel->active = 0;
}
else
{
select->type = SELECTION;
select->active = active;
sel->type = SELECTION;
sel->active = active;
}
select->active = active;
select->serial = -1;
select->label = label;
select->label_width = label_width;
select->label_length = label_length;
select->data = data;
select->parent_p = p_ptr;
sel->active = active;
sel->serial = -1;
sel->label = label;
sel->label_width = label_width;
sel->label_length = label_length;
sel->data = data;
sel->parent_p = p_ptr;
/*
* Insert the selection after the selection with the selection
* number one less than the desired number for the new selection.
*/
emacs_insque(select, s_ptr);
emacs_insque(sel, s_ptr);
/*
* Update the selection count.
......@@ -114,4 +114,3 @@ XMenuInsertSelection(register XMenu *menu, register int p_num, register int s_nu
_XMErrorCode = XME_NO_ERROR;
return(s_num);
}
......@@ -32,18 +32,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "XMenuInt.h"
/*
* Toggle color macro.
*/
#define toggle_color(x) \
((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
/*
* Internal Window creation queue sizes.
*/
#define S_QUE_SIZE 300
#define P_QUE_SIZE 20
#define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
/*
......@@ -71,7 +64,7 @@ int _XMErrorCode = XME_NO_ERROR;
/*
* _XMErrorList - Global XMenu error code description strings.
*/
char *
char const *const
_XMErrorList[XME_CODE_COUNT] = {
"No error", /* XME_NO_ERROR */
"Menu not initialized", /* XME_NOT_INIT */
......@@ -103,6 +96,7 @@ int (*_XMEventHandler)(XEvent*) = NULL;
* _XMWinQueInit - Internal routine to initialize the window
* queue.
*/
void
_XMWinQueInit(void)
{
/*
......@@ -138,7 +132,7 @@ _XMWinQueInit(void)
*/
int
_XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPane *p_ptr)
/* Menu being manipulated. */
/* XMPane being queued. */
{
......@@ -172,7 +166,7 @@ _XMWinQueAddPane(register Display *display, register XMenu *menu, register XMPan
*/
int
_XMWinQueAddSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr)
/* Menu being manipulated. */
/* XMSelection being queued. */
{
......@@ -205,8 +199,8 @@ _XMWinQueAddSelection(register Display *display, register XMenu *menu, register
* selection window queues.
*/
int
_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *select)
_XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane *pane, XMSelect *sel)
/* Menu being manipulated. */
/* Current pane. */
{
......@@ -215,7 +209,8 @@ _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
unsigned long valuemask; /* Which attributes to set. */
XSetWindowAttributes *attributes; /* Attributes to be set. */
XSetWindowAttributes attributes_buf; /* Attributes to be set. */
XSetWindowAttributes *attributes = &attributes_buf;
/*
* If the pane window queue is not empty...
......@@ -226,7 +221,6 @@ _XMWinQueFlush(register Display *display, register XMenu *menu, register XMPane
* set up attributes for pane window to be created.
*/
valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
attributes = (XSetWindowAttributes *)malloc(sizeof(XSetWindowAttributes));
attributes->border_pixel = menu->p_bdr_color;
attributes->background_pixmap = menu->inact_pixmap;
attributes->override_redirect = True;
......@@ -415,6 +409,7 @@ _XMGetSelectionPtr(register XMPane *p_ptr, register int s_num)
* _XMRecomputeGlobals - Internal subroutine to recompute menu wide
* global values.
*/
void
_XMRecomputeGlobals(register Display *display, register XMenu *menu)
/*X11 display variable. */
/* Menu object to compute from. */
......@@ -681,7 +676,7 @@ _XMRecomputePane(register Display *display, register XMenu *menu, register XMPan
*/
int
_XMRecomputeSelection(register Display *display, register XMenu *menu, register XMSelect *s_ptr, register int s_num)
/* Menu object being recomputed. */
/* Selection pointer. */
/* Selection sequence number. */
......@@ -810,6 +805,7 @@ _XMRecomputeSelection(register Display *display, register XMenu *menu, register
* recomputed before calling this routine or
* unpredictable results will follow.
*/
void
_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y)
/* Not used. Included for consistency. */
/* Menu being computed against. */
......@@ -870,6 +866,7 @@ _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane *p_ptr,
* _XMRefreshPane - Internal subroutine to completely refresh
* the contents of a pane.
*/
void
_XMRefreshPane(register Display *display, register XMenu *menu, register XMPane *pane)
{
register XMSelect *s_list = pane->s_list;
......@@ -937,34 +934,35 @@ _XMRefreshPane(register Display *display, register XMenu *menu, register XMPane
* _XMRefreshSelection - Internal subroutine that refreshes
* a single selection window.
*/
_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *select)
void
_XMRefreshSelection(register Display *display, register XMenu *menu, register XMSelect *sel)
{
register int width = select->window_w;
register int height = select->window_h;
register int width = sel->window_w;
register int height = sel->window_h;
register int bdr_width = menu->s_bdr_width;
if (select->type == SEPARATOR) {
if (sel->type == SEPARATOR) {
XDrawLine(display,
select->parent_p->window,
sel->parent_p->window,
menu->normal_select_GC,
select->window_x,
select->window_y + height / 2,
select->window_x + width,
select->window_y + height / 2);
sel->window_x,
sel->window_y + height / 2,
sel->window_x + width,
sel->window_y + height / 2);
}
else if (select->activated) {
else if (sel->activated) {
if (menu->menu_mode == INVERT) {
XFillRectangle(display,
select->parent_p->window,
sel->parent_p->window,
menu->normal_select_GC,
select->window_x, select->window_y,
sel->window_x, sel->window_y,
width, height);
XDrawString(display,
select->parent_p->window,
sel->parent_p->window,
menu->inverse_select_GC,
select->label_x,
select->label_y,
select->label, select->label_length);
sel->label_x,
sel->label_y,
sel->label, sel->label_length);
}
else {
/*
......@@ -975,42 +973,41 @@ _XMRefreshSelection(register Display *display, register XMenu *menu, register XM
*/
XDrawRectangle(display,
select->parent_p->window,
sel->parent_p->window,
menu->normal_select_GC,
select->window_x + (bdr_width >> 1),
select->window_y + (bdr_width >> 1 ),
sel->window_x + (bdr_width >> 1),
sel->window_y + (bdr_width >> 1 ),
width - bdr_width,
height - bdr_width);
XDrawString(display,
select->parent_p->window,
sel->parent_p->window,
menu->normal_select_GC,
select->label_x,
select->label_y,
select->label, select->label_length);
sel->label_x,
sel->label_y,
sel->label, sel->label_length);
}
}
else {
XClearArea(display,
select->parent_p->window,
select->window_x, select->window_y,
sel->parent_p->window,
sel->window_x, sel->window_y,
width, height,
False);
if (select->active) {
if (sel->active) {
XDrawString(display,
select->parent_p->window,
sel->parent_p->window,
menu->normal_select_GC,
select->label_x,
select->label_y,
select->label, select->label_length);
sel->label_x,
sel->label_y,
sel->label, sel->label_length);
}
else {
XDrawString(display,
select->parent_p->window,
sel->parent_p->window,
menu->inact_GC,
select->label_x,
select->label_y,
select->label, select->label_length);
sel->label_x,
sel->label_y,
sel->label, sel->label_length);
}
}
}
......@@ -18,6 +18,7 @@
#include "XMenuInt.h"
void
XMenuSetAEQ(register XMenu *menu, register int aeq)
/* Menu object to be modified. */
/* AEQ mode? */
......@@ -27,4 +28,3 @@ XMenuSetAEQ(register XMenu *menu, register int aeq)
*/
menu->aeq = aeq;
}
......@@ -17,6 +17,7 @@
#include "XMenuInt.h"
void
XMenuSetFreeze(register XMenu *menu, register int freeze)
/* Menu object to be modified. */