mirror of
https://git.savannah.gnu.org/git/screen.git
synced 2026-02-10 17:31:59 +02:00
Code reformating (viewport.c)
Signed-off-by: Alexander Naumov <alexander_naumov@opensuse.org>
This commit is contained in:
157
src/viewport.c
157
src/viewport.c
@@ -33,108 +33,97 @@
|
||||
|
||||
extern struct display *display;
|
||||
|
||||
int
|
||||
RethinkDisplayViewports()
|
||||
{
|
||||
int RethinkDisplayViewports() {
|
||||
struct canvas *cv;
|
||||
struct viewport *vp, *vpn;
|
||||
|
||||
/* free old viewports */
|
||||
for (cv = display->d_cvlist; cv; cv = cv->c_next)
|
||||
{
|
||||
for (vp = cv->c_vplist; vp; vp = vpn)
|
||||
{
|
||||
vp->v_canvas = 0;
|
||||
vpn = vp->v_next;
|
||||
bzero((char *)vp, sizeof(*vp));
|
||||
free(vp);
|
||||
}
|
||||
cv->c_vplist = 0;
|
||||
for (cv = display->d_cvlist; cv; cv = cv->c_next) {
|
||||
for (vp = cv->c_vplist; vp; vp = vpn) {
|
||||
vp->v_canvas = 0;
|
||||
vpn = vp->v_next;
|
||||
bzero((char *)vp, sizeof(*vp));
|
||||
free(vp);
|
||||
}
|
||||
cv->c_vplist = 0;
|
||||
}
|
||||
display->d_vpxmin = -1;
|
||||
display->d_vpxmax = -1;
|
||||
|
||||
for (cv = display->d_cvlist; cv; cv = cv->c_next)
|
||||
{
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
for (cv = display->d_cvlist; cv; cv = cv->c_next) {
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
#ifdef HOLE
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = (cv->c_ys + cv->c_ye) / 2;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = cv->c_ye;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = (cv->c_ys + cv->c_ye) / 2;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = cv->c_ye;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = (cv->c_xs + cv->c_xe) / 2;
|
||||
vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = (cv->c_xs + cv->c_xe) / 2;
|
||||
vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4;
|
||||
vp->v_xe = (3 * cv->c_xs + cv->c_xe) / 4 - 1;
|
||||
vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4;
|
||||
vp->v_xe = (3 * cv->c_xs + cv->c_xe) / 4 - 1;
|
||||
vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = cv->c_ys;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = (3 * cv->c_ys + cv->c_ye) / 4 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
|
||||
return -1;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = cv->c_ys;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = (3 * cv->c_ys + cv->c_ye) / 4 - 1;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
#else
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = cv->c_ys;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = cv->c_ye;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
vp->v_canvas = cv;
|
||||
vp->v_xs = cv->c_xs;
|
||||
vp->v_ys = cv->c_ys;
|
||||
vp->v_xe = cv->c_xe;
|
||||
vp->v_ye = cv->c_ye;
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
vp->v_next = cv->c_vplist;
|
||||
cv->c_vplist = vp;
|
||||
#endif
|
||||
|
||||
if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1)
|
||||
display->d_vpxmin = cv->c_xs;
|
||||
if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1)
|
||||
display->d_vpxmax = cv->c_xe;
|
||||
}
|
||||
if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1)
|
||||
display->d_vpxmin = cv->c_xs;
|
||||
if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1)
|
||||
display->d_vpxmax = cv->c_xe;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
RethinkViewportOffsets(cv)
|
||||
struct canvas *cv;
|
||||
void RethinkViewportOffsets(struct canvas *cv)
|
||||
{
|
||||
struct viewport *vp;
|
||||
|
||||
for (vp = cv->c_vplist; vp; vp = vp->v_next)
|
||||
{
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
}
|
||||
for (vp = cv->c_vplist; vp; vp = vp->v_next) {
|
||||
vp->v_xoff = cv->c_xoff;
|
||||
vp->v_yoff = cv->c_yoff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user