projects
/
screensavers
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4267333
)
Made NEDsim double-buffered.
author
Aaron Taylor
<ataylor@subgeniuskitty.com>
Fri, 9 Jul 2021 19:59:58 +0000
(12:59 -0700)
committer
Aaron Taylor
<ataylor@subgeniuskitty.com>
Fri, 9 Jul 2021 19:59:58 +0000
(12:59 -0700)
hacks/NEDsim/NEDsim.c
patch
|
blob
|
blame
|
history
diff --git
a/hacks/NEDsim/NEDsim.c
b/hacks/NEDsim/NEDsim.c
index
6778c2d
..
8bd2f29
100644
(file)
--- a/
hacks/NEDsim/NEDsim.c
+++ b/
hacks/NEDsim/NEDsim.c
@@
-181,20
+181,20
@@
draw_rect_area(struct NEDsim * nedsim, size_t x_origin, size_t y_origin, size_t
y_origin += nedsim->origin_y_offset;
x_size *= nedsim->cell_size;
y_size *= nedsim->cell_size;
y_origin += nedsim->origin_y_offset;
x_size *= nedsim->cell_size;
y_size *= nedsim->cell_size;
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, x_origin, y_origin, x_size, y_size);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, x_origin, y_origin, x_size, y_size);
set_color(nedsim, &color_list[nedsim->color_index].border);
if (bord_top) {
set_color(nedsim, &color_list[nedsim->color_index].border);
if (bord_top) {
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, x_origin, y_origin, x_size, nedsim->border_size);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, x_origin, y_origin, x_size, nedsim->border_size);
}
if (bord_bottom) {
}
if (bord_bottom) {
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, x_origin, (y_origin + y_size - nedsim->border_size), x_size, nedsim->border_size);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, x_origin, (y_origin + y_size - nedsim->border_size), x_size, nedsim->border_size);
}
if (bord_left) {
}
if (bord_left) {
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, x_origin, y_origin, nedsim->border_size, y_size);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, x_origin, y_origin, nedsim->border_size, y_size);
}
if (bord_right) {
}
if (bord_right) {
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, (x_origin + x_size - nedsim->border_size), y_origin, nedsim->border_size, y_size);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, (x_origin + x_size - nedsim->border_size), y_origin, nedsim->border_size, y_size);
}
}
}
}
@@
-226,7
+226,7
@@
draw_circular_area(struct NEDsim * nedsim, size_t x, size_t y, double diameter)
y -= (0.5 * nedsim->border_size);
// Start angle 0 and ending angle 360*64 is one full circle in Xlib units.
y -= (0.5 * nedsim->border_size);
// Start angle 0 and ending angle 360*64 is one full circle in Xlib units.
- XFillArc(nedsim->dpy, nedsim->
win
, nedsim->gc, x, y, diameter, diameter, 0, 360*64);
+ XFillArc(nedsim->dpy, nedsim->
panel
, nedsim->gc, x, y, diameter, diameter, 0, 360*64);
}
// TODO: Explain
}
// TODO: Explain
@@
-240,11
+240,11
@@
draw_panel(struct NEDsim * nedsim)
// Draw background color over entire window.
set_color(nedsim, &color_list[nedsim->color_index].panel_bg);
// Draw background color over entire window.
set_color(nedsim, &color_list[nedsim->color_index].panel_bg);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, 0, 0, nedsim->dpy_width, nedsim->dpy_height);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, 0, 0, nedsim->dpy_width, nedsim->dpy_height);
// Draw NED panel in foreground color.
set_color(nedsim, &color_list[nedsim->color_index].panel_fg);
// Draw NED panel in foreground color.
set_color(nedsim, &color_list[nedsim->color_index].panel_fg);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size * OVERALL_WIDTH_IN_CELLS,
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size * OVERALL_WIDTH_IN_CELLS,
@@
-253,25
+253,25
@@
draw_panel(struct NEDsim * nedsim)
// Give the panel rounded corners by first deleting the four right-angle corners...
set_color(nedsim, &color_list[nedsim->color_index].panel_bg);
// Give the panel rounded corners by first deleting the four right-angle corners...
set_color(nedsim, &color_list[nedsim->color_index].panel_bg);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size,
nedsim->cell_size
);
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size,
nedsim->cell_size
);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)),
nedsim->origin_y_offset,
nedsim->cell_size,
nedsim->cell_size
);
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)),
nedsim->origin_y_offset,
nedsim->cell_size,
nedsim->cell_size
);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset,
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)),
nedsim->cell_size,
nedsim->cell_size
);
nedsim->origin_x_offset,
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)),
nedsim->cell_size,
nedsim->cell_size
);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)),
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)),
nedsim->cell_size,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-1)),
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 1)),
nedsim->cell_size,
@@
-279,25
+279,25
@@
draw_panel(struct NEDsim * nedsim)
);
// ...and then replacing them with filled arcs, forming rounded corners.
set_color(nedsim, &color_list[nedsim->color_index].panel_fg);
);
// ...and then replacing them with filled arcs, forming rounded corners.
set_color(nedsim, &color_list[nedsim->color_index].panel_fg);
- XFillArc(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillArc(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size * 2, nedsim->cell_size * 2,
180*64, -90*64
);
nedsim->origin_x_offset,
nedsim->origin_y_offset,
nedsim->cell_size * 2, nedsim->cell_size * 2,
180*64, -90*64
);
- XFillArc(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillArc(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)),
nedsim->origin_y_offset,
nedsim->cell_size * 2, nedsim->cell_size * 2,
0, 90*64
);
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)),
nedsim->origin_y_offset,
nedsim->cell_size * 2, nedsim->cell_size * 2,
0, 90*64
);
- XFillArc(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillArc(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset,
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)),
nedsim->cell_size * 2, nedsim->cell_size * 2,
180*64, 90*64
);
nedsim->origin_x_offset,
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)),
nedsim->cell_size * 2, nedsim->cell_size * 2,
180*64, 90*64
);
- XFillArc(nedsim->dpy, nedsim->
win
, nedsim->gc,
+ XFillArc(nedsim->dpy, nedsim->
panel
, nedsim->gc,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)),
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)),
nedsim->cell_size * 2, nedsim->cell_size * 2,
nedsim->origin_x_offset + (nedsim->cell_size * (OVERALL_WIDTH_IN_CELLS-2)),
nedsim->origin_y_offset + (nedsim->cell_size * (HEADER_HEIGHT_IN_CELLS + nedsim->num_data_rows + FOOTER_HEIGHT_IN_CELLS - 2)),
nedsim->cell_size * 2, nedsim->cell_size * 2,
@@
-328,7
+328,7
@@
draw_logo(struct NEDsim * nedsim)
get_text_size(nedsim, "NED", &text_x_size, &text_y_size);
int local_x_offset = ((LOGO_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((LOGO_NAME_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "NED", &text_x_size, &text_y_size);
int local_x_offset = ((LOGO_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((LOGO_NAME_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (LOGO_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (LOGO_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((LOGO_Y_OFFSET+LOGO_NAME_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "NED", 3);
// And draw the 'subgeniuskitty.com' text in the bottom box.
((LOGO_Y_OFFSET+LOGO_NAME_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "NED", 3);
// And draw the 'subgeniuskitty.com' text in the bottom box.
@@
-336,7
+336,7
@@
draw_logo(struct NEDsim * nedsim)
get_text_size(nedsim, "subgeniuskitty.com", &text_x_size, &text_y_size);
local_x_offset = ((LOGO_WIDTH * nedsim->cell_size) - text_x_size) / 2;
local_y_offset = ((LOGO_WEBSITE_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "subgeniuskitty.com", &text_x_size, &text_y_size);
local_x_offset = ((LOGO_WIDTH * nedsim->cell_size) - text_x_size) / 2;
local_y_offset = ((LOGO_WEBSITE_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (LOGO_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (LOGO_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((LOGO_Y_OFFSET+LOGO_NAME_HEIGHT+LOGO_WEBSITE_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "subgeniuskitty.com", 18);
}
((LOGO_Y_OFFSET+LOGO_NAME_HEIGHT+LOGO_WEBSITE_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "subgeniuskitty.com", 18);
}
@@
-362,7
+362,7
@@
draw_halt(struct NEDsim * nedsim)
get_text_size(nedsim, "HALT", &text_x_size, &text_y_size);
int local_x_offset = ((HALT_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((HALT_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "HALT", &text_x_size, &text_y_size);
int local_x_offset = ((HALT_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((HALT_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (HALT_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (HALT_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((HALT_Y_OFFSET+HALT_LIGHT_HEIGHT+HALT_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "HALT", 4);
}
((HALT_Y_OFFSET+HALT_LIGHT_HEIGHT+HALT_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "HALT", 4);
}
@@
-426,7
+426,7
@@
draw_pc(struct NEDsim * nedsim)
get_text_size(nedsim, "PC", &text_x_size, &text_y_size);
int local_x_offset = ((PC_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((PC_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "PC", &text_x_size, &text_y_size);
int local_x_offset = ((PC_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((PC_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (PC_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (PC_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((PC_Y_OFFSET+PC_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "PC", 2);
}
((PC_Y_OFFSET+PC_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "PC", 2);
}
@@
-452,7
+452,7
@@
draw_sc(struct NEDsim * nedsim)
get_text_size(nedsim, "SC", &text_x_size, &text_y_size);
int local_x_offset = ((SC_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((SC_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "SC", &text_x_size, &text_y_size);
int local_x_offset = ((SC_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((SC_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (SC_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (SC_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((SC_Y_OFFSET+SC_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "SC", 2);
}
((SC_Y_OFFSET+SC_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "SC", 2);
}
@@
-484,7
+484,7
@@
draw_psw(struct NEDsim * nedsim)
get_text_size(nedsim, "N", &text_x_size, &text_y_size);
int local_x_offset = ((PSW_LABEL_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((PSW_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "N", &text_x_size, &text_y_size);
int local_x_offset = ((PSW_LABEL_WIDTH * nedsim->cell_size) - text_x_size) / 2;
int local_y_offset = ((PSW_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (PSW_N_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (PSW_N_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((PSW_Y_OFFSET+PSW_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "N", 1);
// Now draw the label text "Z".
((PSW_Y_OFFSET+PSW_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "N", 1);
// Now draw the label text "Z".
@@
-492,7
+492,7
@@
draw_psw(struct NEDsim * nedsim)
get_text_size(nedsim, "Z", &text_x_size, &text_y_size);
local_x_offset = ((PSW_LABEL_WIDTH * nedsim->cell_size) - text_x_size) / 2;
local_y_offset = ((PSW_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
get_text_size(nedsim, "Z", &text_x_size, &text_y_size);
local_x_offset = ((PSW_LABEL_WIDTH * nedsim->cell_size) - text_x_size) / 2;
local_y_offset = ((PSW_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, (PSW_Z_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, (PSW_Z_X_OFFSET * nedsim->cell_size + nedsim->origin_x_offset + local_x_offset),
((PSW_Y_OFFSET+PSW_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "Z", 1);
}
((PSW_Y_OFFSET+PSW_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "Z", 1);
}
@@
-518,7
+518,7
@@
draw_stack(struct NEDsim * nedsim)
int text_x_size, text_y_size;
get_text_size(nedsim, "Stack Size:", &text_x_size, &text_y_size);
int local_y_offset = ((STACK_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
int text_x_size, text_y_size;
get_text_size(nedsim, "Stack Size:", &text_x_size, &text_y_size);
int local_y_offset = ((STACK_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, ((STACK_X_OFFSET + 1) * nedsim->cell_size + nedsim->origin_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, ((STACK_X_OFFSET + 1) * nedsim->cell_size + nedsim->origin_x_offset),
((STACK_Y_OFFSET+STACK_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "Stack Size:", 11);
}
((STACK_Y_OFFSET+STACK_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "Stack Size:", 11);
}
@@
-546,7
+546,7
@@
draw_heap(struct NEDsim * nedsim)
int text_x_size, text_y_size;
get_text_size(nedsim, "RAM Base:", &text_x_size, &text_y_size);
int local_y_offset = ((HEAP_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
int text_x_size, text_y_size;
get_text_size(nedsim, "RAM Base:", &text_x_size, &text_y_size);
int local_y_offset = ((HEAP_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, ((HEAP_X_OFFSET + 1) * nedsim->cell_size + nedsim->origin_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, ((HEAP_X_OFFSET + 1) * nedsim->cell_size + nedsim->origin_x_offset),
((HEAP_Y_OFFSET+HEAP_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "RAM Base:", 9);
// Now draw the address text.
((HEAP_Y_OFFSET+HEAP_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), "RAM Base:", 9);
// Now draw the address text.
@@
-555,7
+555,7
@@
draw_heap(struct NEDsim * nedsim)
snprintf(address, sizeof(address), "0x%08X", HEAP_START_ADDRESS);
get_text_size(nedsim, address, &text_x_size, &text_y_size);
local_y_offset = ((HEAP_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
snprintf(address, sizeof(address), "0x%08X", HEAP_START_ADDRESS);
get_text_size(nedsim, address, &text_x_size, &text_y_size);
local_y_offset = ((HEAP_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, ((HEAP_X_OFFSET + 1 + (HEAP_WIDTH / 2)) * nedsim->cell_size + nedsim->origin_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, ((HEAP_X_OFFSET + 1 + (HEAP_WIDTH / 2)) * nedsim->cell_size + nedsim->origin_x_offset),
((HEAP_Y_OFFSET+HEAP_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), address, strlen(address));
}
((HEAP_Y_OFFSET+HEAP_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), address, strlen(address));
}
@@
-621,7
+621,7
@@
update_display(struct NEDsim * nedsim)
int text_x_size, text_y_size;
get_text_size(nedsim, stack_size, &text_x_size, &text_y_size);
int local_y_offset = ((STACK_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
int text_x_size, text_y_size;
get_text_size(nedsim, stack_size, &text_x_size, &text_y_size);
int local_y_offset = ((STACK_LABEL_HEIGHT * nedsim->cell_size) - text_y_size) / 2;
- XDrawString(nedsim->dpy, nedsim->
win
, nedsim->gc, ((STACK_X_OFFSET + 1 + (STACK_WIDTH / 2)) * nedsim->cell_size + nedsim->origin_x_offset),
+ XDrawString(nedsim->dpy, nedsim->
panel
, nedsim->gc, ((STACK_X_OFFSET + 1 + (STACK_WIDTH / 2)) * nedsim->cell_size + nedsim->origin_x_offset),
((STACK_Y_OFFSET+STACK_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), stack_size, strlen(stack_size));
// Draw the heap lights.
((STACK_Y_OFFSET+STACK_LABEL_HEIGHT) * nedsim->cell_size + nedsim->origin_y_offset - local_y_offset), stack_size, strlen(stack_size));
// Draw the heap lights.
@@
-654,6
+654,7
@@
NEDsim_free(Display * dpy, Window win, void * closure)
// TODO: Replace all this with proper code to free everything related to the screensaver itself.
XFreeGC(nedsim->dpy, nedsim->gc);
// TODO: Replace all this with proper code to free everything related to the screensaver itself.
XFreeGC(nedsim->dpy, nedsim->gc);
+ XFreePixmap(nedsim->dpy, nedsim->panel);
free(nedsim);
}
free(nedsim);
}
@@
-692,6
+693,7
@@
NEDsim_init(Display * dpy, Window win)
}
nedsim->gc = XCreateGC(nedsim->dpy, nedsim->win, GCForeground, &gcv);
}
nedsim->gc = XCreateGC(nedsim->dpy, nedsim->win, GCForeground, &gcv);
+ nedsim->panel = XCreatePixmap(nedsim->dpy, nedsim->win, nedsim->dpy_width, nedsim->dpy_height, xgwa.depth);
// TODO: Do this properly.
nedsim->color_index = 0;
// TODO: Do this properly.
nedsim->color_index = 0;
@@
-748,9
+750,11
@@
NEDsim_draw(Display * dpy, Window win, void * closure)
update_display(nedsim);
} else {
set_color(nedsim, &color_list[nedsim->color_index].error_on);
update_display(nedsim);
} else {
set_color(nedsim, &color_list[nedsim->color_index].error_on);
- XFillRectangle(nedsim->dpy, nedsim->
win
, nedsim->gc, 0, 0, nedsim->dpy_width, nedsim->dpy_height);
+ XFillRectangle(nedsim->dpy, nedsim->
panel
, nedsim->gc, 0, 0, nedsim->dpy_width, nedsim->dpy_height);
}
}
+ XCopyArea(nedsim->dpy, nedsim->panel, nedsim->win, nedsim->gc, 0, 0, nedsim->dpy_width, nedsim->dpy_height, 0, 0);
+
return nedsim->delay;
}
return nedsim->delay;
}