split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.
It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.
Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.
To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.
A global variable named 'amulets', would be found in ga.
ga.amulets
^ ^
A global varable named 'move', would be found in gm.
gm.moves
^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
gv.val_for_n_or_more
^ ^
A global variable named 'youmonst' would be found in gy.
gy.youmonst
^ ^
This commit is contained in:
@@ -957,8 +957,8 @@ X11_putstr(winid window, int attr, const char *str)
|
||||
|
||||
switch (wp->type) {
|
||||
case NHW_MESSAGE:
|
||||
(void) strncpy(g.toplines, str, TBUFSZ); /* for Norep(). */
|
||||
g.toplines[TBUFSZ - 1] = 0;
|
||||
(void) strncpy(gt.toplines, str, TBUFSZ); /* for Norep(). */
|
||||
gt.toplines[TBUFSZ - 1] = 0;
|
||||
append_message(wp, str);
|
||||
break;
|
||||
#ifndef STATUS_HILITES
|
||||
@@ -1272,7 +1272,7 @@ X11_update_inventory(int arg)
|
||||
|
||||
if (iflags.perm_invent) {
|
||||
/* skip any calls to update_inventory() before in_moveloop starts */
|
||||
if (g.program_state.in_moveloop || g.program_state.gameover) {
|
||||
if (gp.program_state.in_moveloop || gp.program_state.gameover) {
|
||||
updated_inventory = 1; /* hack to avoid mapping&raising window */
|
||||
if (!arg) {
|
||||
(void) display_inventory((char *) 0, FALSE);
|
||||
@@ -1754,7 +1754,7 @@ X11_hangup(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
||||
static void
|
||||
X11_bail(const char *mesg)
|
||||
{
|
||||
g.program_state.something_worth_saving = 0;
|
||||
gp.program_state.something_worth_saving = 0;
|
||||
clearlocks();
|
||||
X11_exit_nhwindows(mesg);
|
||||
nh_terminate(EXIT_SUCCESS);
|
||||
@@ -1771,7 +1771,7 @@ askname_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
||||
nhUse(num_params);
|
||||
|
||||
nh_XtPopdown(w);
|
||||
(void) strcpy(g.plname, "Mumbles"); /* give them a name... ;-) */
|
||||
(void) strcpy(gp.plname, "Mumbles"); /* give them a name... ;-) */
|
||||
exit_x_event = TRUE;
|
||||
}
|
||||
|
||||
@@ -1796,11 +1796,11 @@ askname_done(Widget w, XtPointer client_data, XtPointer call_data)
|
||||
}
|
||||
|
||||
/* Truncate name if necessary */
|
||||
if (len >= sizeof g.plname - 1)
|
||||
len = sizeof g.plname - 1;
|
||||
if (len >= sizeof gp.plname - 1)
|
||||
len = sizeof gp.plname - 1;
|
||||
|
||||
(void) strncpy(g.plname, s, len);
|
||||
g.plname[len] = '\0';
|
||||
(void) strncpy(gp.plname, s, len);
|
||||
gp.plname[len] = '\0';
|
||||
XtFree(s);
|
||||
|
||||
nh_XtPopdown(XtParent(dialog));
|
||||
@@ -1848,7 +1848,7 @@ X11_askname(void)
|
||||
(XtCallbackProc) 0);
|
||||
|
||||
SetDialogPrompt(dialog, nhStr("What is your name?")); /* set prompt */
|
||||
SetDialogResponse(dialog, g.plname, PL_NSIZ); /* set default answer */
|
||||
SetDialogResponse(dialog, gp.plname, PL_NSIZ); /* set default answer */
|
||||
|
||||
XtRealizeWidget(popup);
|
||||
positionpopup(popup, TRUE); /* center,bottom */
|
||||
@@ -1997,7 +1997,7 @@ X11_getlin(
|
||||
/* we get here after the popup has exited;
|
||||
put prompt and response into the message window (and into
|
||||
core's dumplog history) unless play hasn't started yet */
|
||||
if (g.program_state.in_moveloop || g.program_state.gameover) {
|
||||
if (gp.program_state.in_moveloop || gp.program_state.gameover) {
|
||||
/* single space has meaning (to remove a previously applied name) so
|
||||
show it clearly; don't care about legibility of multiple spaces */
|
||||
const char *visanswer = !input[0] ? "<empty>"
|
||||
@@ -2511,12 +2511,12 @@ highlight_yn(boolean init)
|
||||
Arg args[2];
|
||||
XGCValues vals;
|
||||
unsigned long fg_bg = (GCForeground | GCBackground);
|
||||
GC gc = (xmap->map_information->is_tile
|
||||
GC ggc = (xmap->map_information->is_tile
|
||||
? xmap->map_information->tile_map.white_gc
|
||||
: xmap->map_information->text_map.copy_gc);
|
||||
|
||||
(void) memset((genericptr_t) &vals, 0, sizeof vals);
|
||||
if (XGetGCValues(XtDisplay(xmap->w), gc, fg_bg, &vals)) {
|
||||
if (XGetGCValues(XtDisplay(xmap->w), ggc, fg_bg, &vals)) {
|
||||
XtSetArg(args[0], XtNforeground, vals.foreground);
|
||||
XtSetArg(args[1], XtNbackground, vals.background);
|
||||
XtSetValues(yn_label, args, TWO);
|
||||
|
||||
@@ -64,7 +64,7 @@ static void X11_free_gc(struct xwindow *wp, GC gc, X11_color color);
|
||||
static void X11_set_map_font(struct xwindow *wp);
|
||||
#endif
|
||||
static void X11_draw_image_string(Display *display, Drawable d,
|
||||
GC gc, int x, int y,
|
||||
GC ggc, int x, int y,
|
||||
const X11_map_symbol *string, int length);
|
||||
static Font X11_get_map_font(struct xwindow *wp);
|
||||
static XFontStruct *X11_get_map_font_struct(struct xwindow *wp);
|
||||
@@ -1024,7 +1024,7 @@ static void
|
||||
map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */
|
||||
{
|
||||
int x, y;
|
||||
glyph_info gi;
|
||||
glyph_info ginfo;
|
||||
short unexp_idx, nothg_idx;
|
||||
/* unsigned short g_stone = cmap_to_glyph(S_stone); */
|
||||
unsigned short g_unexp = GLYPH_UNEXPLORED, g_nothg = GLYPH_NOTHING;
|
||||
@@ -1035,10 +1035,10 @@ map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */
|
||||
mgunexp = glyph2ttychar(GLYPH_UNEXPLORED);
|
||||
mgnothg = glyph2ttychar(GLYPH_NOTHING);
|
||||
|
||||
map_glyphinfo(0, 0, g_unexp, 0, &gi);
|
||||
unexp_idx = gi.gm.tileidx;
|
||||
map_glyphinfo(0, 0, g_nothg, 0, &gi);
|
||||
nothg_idx = gi.gm.tileidx;
|
||||
map_glyphinfo(0, 0, g_unexp, 0, &ginfo);
|
||||
unexp_idx = ginfo.gm.tileidx;
|
||||
map_glyphinfo(0, 0, g_nothg, 0, &ginfo);
|
||||
nothg_idx = ginfo.gm.tileidx;
|
||||
|
||||
/*
|
||||
* Tiles map tracks glyphs.
|
||||
@@ -1453,7 +1453,7 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
|
||||
X11_map_symbol *t_ptr;
|
||||
int cur_col, win_ystart;
|
||||
X11_color color;
|
||||
GC gc;
|
||||
GC ggc;
|
||||
|
||||
for (row = start_row; row <= stop_row; row++) {
|
||||
win_ystart =
|
||||
@@ -1470,15 +1470,15 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
|
||||
c_ptr++;
|
||||
}
|
||||
|
||||
gc = X11_make_gc(wp, text_map, color, inverted);
|
||||
ggc = X11_make_gc(wp, text_map, color, inverted);
|
||||
X11_draw_image_string(XtDisplay(wp->w), XtWindow(wp->w),
|
||||
gc,
|
||||
ggc,
|
||||
text_map->square_lbearing
|
||||
+ (text_map->square_width
|
||||
* (cur_col - COL0_OFFSET)),
|
||||
win_ystart, t_ptr, count);
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
X11_free_gc(wp, gc, color);
|
||||
X11_free_gc(wp, ggc, color);
|
||||
#endif
|
||||
|
||||
/* move text pointer and column count */
|
||||
@@ -1524,7 +1524,7 @@ X11_make_gc(struct xwindow *wp UNUSED, struct text_map_info_t *text_map,
|
||||
X11_color color, boolean inverted)
|
||||
{
|
||||
boolean cur_inv = inverted;
|
||||
GC gc;
|
||||
GC ggc;
|
||||
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
if ((color & 0x80000000) != 0) {
|
||||
@@ -1551,11 +1551,11 @@ X11_make_gc(struct xwindow *wp UNUSED, struct text_map_info_t *text_map,
|
||||
}
|
||||
values.function = GXcopy;
|
||||
values.font = X11_get_map_font(wp);
|
||||
gc = XtGetGC(wp->w,
|
||||
ggc = XtGetGC(wp->w,
|
||||
GCFunction | GCForeground | GCBackground | GCFont,
|
||||
&values);
|
||||
} else {
|
||||
gc = (cur_inv ? text_map->inv_copy_gc : text_map->copy_gc);
|
||||
ggc = (cur_inv ? text_map->inv_copy_gc : text_map->copy_gc);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
@@ -1564,7 +1564,7 @@ X11_make_gc(struct xwindow *wp UNUSED, struct text_map_info_t *text_map,
|
||||
color -= CLR_MAX;
|
||||
cur_inv = !cur_inv;
|
||||
}
|
||||
gc = iflags.use_color
|
||||
ggc = iflags.use_color
|
||||
? (cur_inv
|
||||
? text_map->inv_color_gcs[color]
|
||||
: text_map->color_gcs[color])
|
||||
@@ -1572,16 +1572,16 @@ X11_make_gc(struct xwindow *wp UNUSED, struct text_map_info_t *text_map,
|
||||
? text_map->inv_copy_gc
|
||||
: text_map->copy_gc);
|
||||
}
|
||||
return gc;
|
||||
return ggc;
|
||||
}
|
||||
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
static void
|
||||
X11_free_gc(struct xwindow *wp, GC gc, X11_color color)
|
||||
X11_free_gc(struct xwindow *wp, GC ggc, X11_color color)
|
||||
{
|
||||
if ((color & 0x80000000) != 0 && iflags.use_color) {
|
||||
/* X11_make_gc allocated a new GC */
|
||||
XtReleaseGC(wp->w, gc);
|
||||
XtReleaseGC(wp->w, ggc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1589,7 +1589,7 @@ X11_free_gc(struct xwindow *wp, GC gc, X11_color color)
|
||||
|
||||
static void
|
||||
X11_draw_image_string(Display *display, Drawable d,
|
||||
GC gc, int x, int y,
|
||||
GC ggc, int x, int y,
|
||||
const X11_map_symbol *string, int length)
|
||||
{
|
||||
#ifdef ENHANCED_SYMBOLS
|
||||
@@ -1610,9 +1610,9 @@ X11_draw_image_string(Display *display, Drawable d,
|
||||
wstr[i].byte1 = ch >> 8;
|
||||
wstr[i].byte2 = ch & 0xFF;
|
||||
}
|
||||
XDrawImageString16(display, d, gc, x, y, wstr, length);
|
||||
XDrawImageString16(display, d, ggc, x, y, wstr, length);
|
||||
#else /* !ENHANCED_SYMBOLS */
|
||||
XDrawImageString(display, d, gc, x, y, (char *) string, length);
|
||||
XDrawImageString(display, d, ggc, x, y, (char *) string, length);
|
||||
#endif /* ?ENHANCED_SYMBOLS */
|
||||
}
|
||||
|
||||
@@ -1988,7 +1988,7 @@ x_event(int exit_condition)
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
/* pkey(retval); */
|
||||
keep_going = FALSE;
|
||||
} else if (g.program_state.done_hup) {
|
||||
} else if (gp.program_state.done_hup) {
|
||||
retval = '\033';
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
keep_going = FALSE;
|
||||
@@ -2007,7 +2007,7 @@ x_event(int exit_condition)
|
||||
/* pkey(retval); */
|
||||
}
|
||||
keep_going = FALSE;
|
||||
} else if (g.program_state.done_hup) {
|
||||
} else if (gp.program_state.done_hup) {
|
||||
retval = '\033';
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
keep_going = FALSE;
|
||||
|
||||
@@ -349,11 +349,11 @@ plsel_dialog_acceptvalues(void)
|
||||
XtSetArg(args[0], nhStr(XtNstring), &s);
|
||||
XtGetValues(plsel_name_input, args, ONE);
|
||||
|
||||
(void) strncpy(g.plname, (char *) s, sizeof g.plname - 1);
|
||||
g.plname[sizeof g.plname - 1] = '\0';
|
||||
(void) mungspaces(g.plname);
|
||||
if (strlen(g.plname) < 1)
|
||||
(void) strcpy(g.plname, "Mumbles");
|
||||
(void) strncpy(gp.plname, (char *) s, sizeof gp.plname - 1);
|
||||
gp.plname[sizeof gp.plname - 1] = '\0';
|
||||
(void) mungspaces(gp.plname);
|
||||
if (strlen(gp.plname) < 1)
|
||||
(void) strcpy(gp.plname, "Mumbles");
|
||||
iflags.renameinprogress = FALSE;
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ X11_player_selection_randomize(void)
|
||||
{
|
||||
int nrole = plsel_n_roles;
|
||||
int nrace = plsel_n_races;
|
||||
int ro, ra, al, ge;
|
||||
int ro, ra, al, gend;
|
||||
boolean choose_race_first;
|
||||
boolean picksomething = (flags.initrole == ROLE_NONE
|
||||
|| flags.initrace == ROLE_NONE
|
||||
@@ -520,12 +520,12 @@ X11_player_selection_randomize(void)
|
||||
}
|
||||
}
|
||||
|
||||
ge = flags.initgend;
|
||||
if (ge == ROLE_NONE) {
|
||||
ge = rn2(ROLE_GENDERS);
|
||||
gend = flags.initgend;
|
||||
if (gend == ROLE_NONE) {
|
||||
gend = rn2(ROLE_GENDERS);
|
||||
}
|
||||
while (!validgend(ro, ra, ge)) {
|
||||
ge = rn2(ROLE_GENDERS);
|
||||
while (!validgend(ro, ra, gend)) {
|
||||
gend = rn2(ROLE_GENDERS);
|
||||
}
|
||||
|
||||
al = flags.initalign;
|
||||
@@ -536,7 +536,7 @@ X11_player_selection_randomize(void)
|
||||
al = rn2(ROLE_ALIGNS);
|
||||
}
|
||||
|
||||
XawToggleSetCurrent(plsel_gend_radios[0], i2xtp(ge + 1));
|
||||
XawToggleSetCurrent(plsel_gend_radios[0], i2xtp(gend + 1));
|
||||
XawToggleSetCurrent(plsel_align_radios[0], i2xtp(al + 1));
|
||||
XawToggleSetCurrent(plsel_race_radios[0], i2xtp(ra + 1));
|
||||
XawToggleSetCurrent(plsel_role_radios[0], i2xtp(ro + 1));
|
||||
@@ -776,8 +776,8 @@ X11_create_player_selection_name(Widget form)
|
||||
XtSetArg(args[num_args], nhStr(XtNeditType),
|
||||
!plsel_ask_name ? XawtextRead : XawtextEdit); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNresize), XawtextResizeWidth); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNstring), g.plname); num_args++;
|
||||
XtSetArg(args[num_args], XtNinsertPosition, strlen(g.plname)); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNstring), gp.plname); num_args++;
|
||||
XtSetArg(args[num_args], XtNinsertPosition, strlen(gp.plname)); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNaccelerators),
|
||||
XtParseAcceleratorTable(plsel_input_accelerators)); num_args++;
|
||||
plsel_name_input = XtCreateManagedWidget("name_input",
|
||||
@@ -1217,7 +1217,7 @@ X11_player_selection_dialog(void)
|
||||
if (plsel_align_radios)
|
||||
free(plsel_align_radios);
|
||||
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1291,7 +1291,7 @@ X11_player_selection_prompts(void)
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1360,7 +1360,7 @@ X11_player_selection_prompts(void)
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1428,7 +1428,7 @@ X11_player_selection_prompts(void)
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1494,7 +1494,7 @@ X11_player_selection_prompts(void)
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || gp.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1516,15 +1516,15 @@ void
|
||||
X11_player_selection(void)
|
||||
{
|
||||
if (iflags.wc_player_selection == VIA_DIALOG) {
|
||||
if (!*g.plname) {
|
||||
if (!*gp.plname) {
|
||||
#ifdef UNIX
|
||||
char *defplname = get_login_name();
|
||||
#else
|
||||
char *defplname = (char *)0;
|
||||
#endif
|
||||
(void) strncpy(g.plname, defplname ? defplname : "Mumbles",
|
||||
sizeof g.plname - 1);
|
||||
g.plname[sizeof g.plname - 1] = '\0';
|
||||
(void) strncpy(gp.plname, defplname ? defplname : "Mumbles",
|
||||
sizeof gp.plname - 1);
|
||||
gp.plname[sizeof gp.plname - 1] = '\0';
|
||||
iflags.renameinprogress = TRUE;
|
||||
}
|
||||
X11_player_selection_dialog();
|
||||
|
||||
@@ -1463,7 +1463,7 @@ update_val(struct X_status_value *attr_rec, long new_value)
|
||||
|
||||
if (attr_rec->type == SV_LABEL) {
|
||||
if (attr_rec == &shown_stats[F_NAME]) {
|
||||
Strcpy(buf, g.plname);
|
||||
Strcpy(buf, gp.plname);
|
||||
buf[0] = highc(buf[0]);
|
||||
Strcat(buf, " the ");
|
||||
if (Upolyd) {
|
||||
@@ -1478,11 +1478,11 @@ update_val(struct X_status_value *attr_rec, long new_value)
|
||||
Strcat(buf, mnam);
|
||||
} else
|
||||
Strcat(buf,
|
||||
rank_of(u.ulevel, g.pl_character[0], flags.female));
|
||||
rank_of(u.ulevel, gp.pl_character[0], flags.female));
|
||||
|
||||
} else if (attr_rec == &shown_stats[F_DLEVEL]) {
|
||||
if (!describe_level(buf, 0)) {
|
||||
Strcpy(buf, g.dungeons[u.uz.dnum].dname);
|
||||
Strcpy(buf, gd.dungeons[u.uz.dnum].dname);
|
||||
Sprintf(eos(buf), ", level %d", depth(&u.uz));
|
||||
}
|
||||
} else {
|
||||
@@ -1869,7 +1869,7 @@ update_fancy_status_field(int i, int color, int attributes)
|
||||
break; /* special */
|
||||
|
||||
case F_GOLD:
|
||||
val = money_cnt(g.invent);
|
||||
val = money_cnt(gi.invent);
|
||||
if (val < 0L)
|
||||
val = 0L; /* ought to issue impossible() and discard gold */
|
||||
break;
|
||||
@@ -1899,7 +1899,7 @@ update_fancy_status_field(int i, int color, int attributes)
|
||||
val = (long) u.ualign.type;
|
||||
break;
|
||||
case F_TIME:
|
||||
val = flags.time ? (long) g.moves : 0L;
|
||||
val = flags.time ? (long) gm.moves : 0L;
|
||||
break;
|
||||
case F_SCORE:
|
||||
#ifdef SCORE_ON_BOTL
|
||||
|
||||
@@ -293,7 +293,7 @@ create_text_window(struct xwindow *wp)
|
||||
XtParseTranslationTable(text_translations));
|
||||
num_args++;
|
||||
|
||||
wp->w = XtCreateManagedWidget(g.killer.name[0] && WIN_MAP == WIN_ERR
|
||||
wp->w = XtCreateManagedWidget(gk.killer.name[0] && WIN_MAP == WIN_ERR
|
||||
? "tombstone"
|
||||
: "text_text", /* name */
|
||||
asciiTextWidgetClass,
|
||||
@@ -464,10 +464,10 @@ calculate_rip_text(int how, time_t when)
|
||||
long cash;
|
||||
|
||||
/* Put name on stone */
|
||||
Sprintf(rip_line[NAME_LINE], "%.16s", g.plname); /* STONE_LINE_LEN */
|
||||
Sprintf(rip_line[NAME_LINE], "%.16s", gp.plname); /* STONE_LINE_LEN */
|
||||
|
||||
/* Put $ on stone */
|
||||
cash = max(g.done_money, 0L);
|
||||
cash = max(gd.done_money, 0L);
|
||||
/* arbitrary upper limit; practical upper limit is quite a bit less */
|
||||
if (cash > 999999999L)
|
||||
cash = 999999999L;
|
||||
@@ -517,7 +517,7 @@ rip_exposed(Widget w, XtPointer client_data UNUSED,
|
||||
Arg args[8];
|
||||
XGCValues values;
|
||||
XtGCMask mask;
|
||||
GC gc;
|
||||
GC ggc;
|
||||
static Pixmap rip_pixmap = None;
|
||||
int i, x, y;
|
||||
|
||||
@@ -540,10 +540,10 @@ rip_exposed(Widget w, XtPointer client_data UNUSED,
|
||||
XtGetValues(w, args, 1);
|
||||
values.function = GXcopy;
|
||||
values.font = WindowFont(w);
|
||||
gc = XtGetGC(w, mask, &values);
|
||||
ggc = XtGetGC(w, mask, &values);
|
||||
|
||||
if (rip_pixmap != None) {
|
||||
XCopyArea(dpy, rip_pixmap, XtWindow(w), gc, event->x, event->y,
|
||||
XCopyArea(dpy, rip_pixmap, XtWindow(w), ggc, event->x, event->y,
|
||||
event->width, event->height, event->x, event->y);
|
||||
}
|
||||
|
||||
@@ -554,12 +554,12 @@ rip_exposed(Widget w, XtPointer client_data UNUSED,
|
||||
XFontStruct *font = WindowFontStruct(w);
|
||||
int width = XTextWidth(font, rip_line[i], len);
|
||||
|
||||
XDrawString(dpy, XtWindow(w), gc, x - width / 2, y, rip_line[i], len);
|
||||
XDrawString(dpy, XtWindow(w), ggc, x - width / 2, y, rip_line[i], len);
|
||||
x += appResources.tombtext_dx;
|
||||
y += appResources.tombtext_dy;
|
||||
}
|
||||
|
||||
XtReleaseGC(w, gc);
|
||||
XtReleaseGC(w, ggc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user