diff options
| author | Paul Eggert | 2011-04-16 01:25:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-16 01:25:42 -0700 |
| commit | 55660072db3bb05d1daba0eb67865913b82d313a (patch) | |
| tree | bbeda328257b0960f227c5509224077c7cf9c158 /oldXMenu/Create.c | |
| parent | aefd87e148d11777492fc068f3eddf2945cfbfc5 (diff) | |
| download | emacs-55660072db3bb05d1daba0eb67865913b82d313a.tar.gz emacs-55660072db3bb05d1daba0eb67865913b82d313a.zip | |
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.
Diffstat (limited to 'oldXMenu/Create.c')
| -rw-r--r-- | oldXMenu/Create.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c index 8354208773f..25f1f1c3381 100644 --- a/oldXMenu/Create.c +++ b/oldXMenu/Create.c | |||
| @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 31 | ||
| 32 | #include <config.h> | 32 | #include <config.h> |
| 33 | #include "XMenuInt.h" | 33 | #include "XMenuInt.h" |
| 34 | 34 | #include <stdlib.h> | |
| 35 | 35 | ||
| 36 | #ifdef EMACS_BITMAP_FILES | 36 | #ifdef EMACS_BITMAP_FILES |
| 37 | #include "../src/bitmaps/dimple1.xbm" | 37 | #include "../src/bitmaps/dimple1.xbm" |
| @@ -71,7 +71,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 71 | #define DEF_MENU_STYLE LEFT | 71 | #define DEF_MENU_STYLE LEFT |
| 72 | #define DEF_MENU_MODE BOX | 72 | #define DEF_MENU_MODE BOX |
| 73 | #define DEF_INACT_PNUM 3 | 73 | #define DEF_INACT_PNUM 3 |
| 74 | #define MAX_INACT_PNUM 4 | ||
| 75 | 74 | ||
| 76 | #define DEF_P_STYLE CENTER | 75 | #define DEF_P_STYLE CENTER |
| 77 | 76 | ||
| @@ -88,16 +87,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 88 | 87 | ||
| 89 | #define XASSOC_TABLE_SIZE 64 | 88 | #define XASSOC_TABLE_SIZE 64 |
| 90 | 89 | ||
| 91 | #define TILE_BUF_SIZE 5 | 90 | char *x_get_resource_string (char const *, char const *); |
| 92 | |||
| 93 | int atoi(const char *); | ||
| 94 | double atof(const char *); | ||
| 95 | char *x_get_resource_string (char *attribute, char *class); | ||
| 96 | 91 | ||
| 97 | 92 | ||
| 98 | 93 | ||
| 99 | static Status | 94 | static Status |
| 100 | XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *color, XColor *junk) | 95 | XAllocDisplayColor(Display *display, Colormap map, char const *colorName, |
| 96 | XColor *color, XColor *junk) | ||
| 101 | { | 97 | { |
| 102 | return (colorName!=0 && | 98 | return (colorName!=0 && |
| 103 | XParseColor(display, map, colorName, color) && | 99 | XParseColor(display, map, colorName, color) && |
| @@ -106,13 +102,11 @@ XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor *colo | |||
| 106 | 102 | ||
| 107 | 103 | ||
| 108 | XMenu * | 104 | XMenu * |
| 109 | XMenuCreate(Display *display, Window parent, register char *def_env) | 105 | XMenuCreate(Display *display, Window parent, register char const *def_env) |
| 110 | /* ID of previously opened display */ | 106 | /* ID of previously opened display */ |
| 111 | /* Window ID of the menu's parent window. */ | 107 | /* Window ID of the menu's parent window. */ |
| 112 | /* X Defaults program environment name. */ | 108 | /* X Defaults program environment name. */ |
| 113 | { | 109 | { |
| 114 | register int i; /* Loop counter. */ | ||
| 115 | register int j; /* Loop counter. */ | ||
| 116 | register char *def_val; /* X Default value temp variable. */ | 110 | register char *def_val; /* X Default value temp variable. */ |
| 117 | 111 | ||
| 118 | register XMenu *menu; /* Pointer to the new menu. */ | 112 | register XMenu *menu; /* Pointer to the new menu. */ |
| @@ -125,7 +119,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 125 | int reverse; /* Reverse video mode. */ | 119 | int reverse; /* Reverse video mode. */ |
| 126 | 120 | ||
| 127 | XMStyle p_style; /* Pane display style. */ | 121 | XMStyle p_style; /* Pane display style. */ |
| 128 | char *p_fnt_name; /* Flag font name. */ | 122 | char const *p_fnt_name; /* Flag font name. */ |
| 129 | XFontStruct *p_fnt_info; /* Flag font structure */ | 123 | XFontStruct *p_fnt_info; /* Flag font structure */ |
| 130 | int p_fnt_pad; /* Flag font padding in pixels. */ | 124 | int p_fnt_pad; /* Flag font padding in pixels. */ |
| 131 | double p_spread; /* Pane spread in flag height fractions. */ | 125 | double p_spread; /* Pane spread in flag height fractions. */ |
| @@ -138,7 +132,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 138 | GC pane_GC; /* Pane graphics context. */ | 132 | GC pane_GC; /* Pane graphics context. */ |
| 139 | 133 | ||
| 140 | XMStyle s_style; /* Selection display style. */ | 134 | XMStyle s_style; /* Selection display style. */ |
| 141 | char *s_fnt_name; /* Selection font name. */ | 135 | char const *s_fnt_name; /* Selection font name. */ |
| 142 | XFontStruct *s_fnt_info; /* Selection font structure. */ | 136 | XFontStruct *s_fnt_info; /* Selection font structure. */ |
| 143 | int s_fnt_pad; /* Selection font padding in pixels. */ | 137 | int s_fnt_pad; /* Selection font padding in pixels. */ |
| 144 | int s_fnt_height; /* Selection font character height */ | 138 | int s_fnt_height; /* Selection font character height */ |
| @@ -151,10 +145,8 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 151 | GC inverse_select_GC; /* GC used for inverse video selection. */ | 145 | GC inverse_select_GC; /* GC used for inverse video selection. */ |
| 152 | GC inact_GC; /* GC for inactive pane header and */ | 146 | GC inact_GC; /* GC for inactive pane header and */ |
| 153 | /* selections. */ | 147 | /* selections. */ |
| 154 | GC inact_GC_noexpose; | ||
| 155 | 148 | ||
| 156 | XColor color_def; /* Temp color definition holder. */ | 149 | XColor color_def; /* Temp color definition holder. */ |
| 157 | XColor screen_def; /* Temp screen color definition holder */ | ||
| 158 | XColor p_bdr_color; /* Color of border. */ | 150 | XColor p_bdr_color; /* Color of border. */ |
| 159 | XColor s_bdr_color; /* Color of highlight. */ | 151 | XColor s_bdr_color; /* Color of highlight. */ |
| 160 | XColor p_frg_color; /* Color of pane foreground color. */ | 152 | XColor p_frg_color; /* Color of pane foreground color. */ |
| @@ -166,17 +158,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 166 | 158 | ||
| 167 | int inact_pnum; /* Inactive background pattern number. */ | 159 | int inact_pnum; /* Inactive background pattern number. */ |
| 168 | 160 | ||
| 169 | Pixel p_bdr_pixel; /* Pane border pixel. */ | ||
| 170 | Pixel s_bdr_pixel; /* Selection border pixel. */ | ||
| 171 | Pixel p_frg_pixel; /* Pane foreground pixel. */ | ||
| 172 | Pixel s_frg_pixel; /* Selection foreground pixel. */ | ||
| 173 | Pixel bkgnd_pixel; /* Menu background pixel. */ | ||
| 174 | |||
| 175 | int *width, *height; | ||
| 176 | Pixmap *bitmap; | ||
| 177 | int *x_hot, *y_hot; | ||
| 178 | int status; /* Return code from XReadBitmapFile. */ | ||
| 179 | |||
| 180 | Pixmap cursor; /* Cursor pixmap holder. */ | 161 | Pixmap cursor; /* Cursor pixmap holder. */ |
| 181 | Pixmap cursor_mask; /* Cursor mask pixmap holder. */ | 162 | Pixmap cursor_mask; /* Cursor mask pixmap holder. */ |
| 182 | Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */ | 163 | Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */ |
| @@ -282,7 +263,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 282 | &mouse_color, &color_def) | 263 | &mouse_color, &color_def) |
| 283 | ); | 264 | ); |
| 284 | 265 | ||
| 285 | else ; | 266 | else {} |
| 286 | 267 | ||
| 287 | def_val = x_get_resource_string ("menuBackground", "MenuBackground"); | 268 | def_val = x_get_resource_string ("menuBackground", "MenuBackground"); |
| 288 | if ( | 269 | if ( |
| @@ -304,7 +285,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 304 | "white", | 285 | "white", |
| 305 | &bkgnd_color, &color_def) | 286 | &bkgnd_color, &color_def) |
| 306 | ); | 287 | ); |
| 307 | else; | 288 | else {} |
| 308 | 289 | ||
| 309 | def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern"); | 290 | def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern"); |
| 310 | if (def_val != NULL) { | 291 | if (def_val != NULL) { |
| @@ -401,7 +382,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 401 | "black", | 382 | "black", |
| 402 | &s_frg_color, &color_def) | 383 | &s_frg_color, &color_def) |
| 403 | ) ; | 384 | ) ; |
| 404 | else ; | 385 | else {} |
| 405 | 386 | ||
| 406 | 387 | ||
| 407 | def_val = x_get_resource_string ("selectionBorder", "SelectionBorder"); | 388 | def_val = x_get_resource_string ("selectionBorder", "SelectionBorder"); |
| @@ -424,7 +405,7 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 424 | "black", | 405 | "black", |
| 425 | &s_bdr_color, &color_def) | 406 | &s_bdr_color, &color_def) |
| 426 | ) ; | 407 | ) ; |
| 427 | else ; | 408 | else {} |
| 428 | 409 | ||
| 429 | def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth"); | 410 | def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth"); |
| 430 | if (def_val != NULL) s_bdr_width = atoi(def_val); | 411 | if (def_val != NULL) s_bdr_width = atoi(def_val); |
| @@ -681,9 +662,6 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 681 | 662 | ||
| 682 | valuemask |= (GCGraphicsExposures); | 663 | valuemask |= (GCGraphicsExposures); |
| 683 | values->graphics_exposures = False; | 664 | values->graphics_exposures = False; |
| 684 | inact_GC_noexpose = XCreateGC (display, | ||
| 685 | root, | ||
| 686 | valuemask, values); | ||
| 687 | 665 | ||
| 688 | 666 | ||
| 689 | /* | 667 | /* |
| @@ -752,4 +730,3 @@ XMenuCreate(Display *display, Window parent, register char *def_env) | |||
| 752 | _XMErrorCode = XME_NO_ERROR; | 730 | _XMErrorCode = XME_NO_ERROR; |
| 753 | return(menu); | 731 | return(menu); |
| 754 | } | 732 | } |
| 755 | |||