Skip to content

Commit 7a80218

Browse files
committed
refactor: remember previous screen clip for scrolling pane
1 parent 95fac7a commit 7a80218

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/gui/scrolling_pane.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,27 @@
66

77
extern int32_t jwin_pal[jcMAX];
88

9-
int32_t screen_w, screen_h;
10-
#define START_CLIP(d) set_clip_rect( \
11-
screen, d->x+2,d->y+2, d->x+d->w-4, d->y+d->h-4)
12-
#define END_CLIP() set_clip_rect( \
13-
screen, 0, 0, LARGE_W, LARGE_H)
9+
#define START_CLIP(d) \
10+
int clip = screen->clip;\
11+
int cl = screen->cl;\
12+
int cr = screen->cr;\
13+
int ct = screen->ct;\
14+
int cb = screen->cb;\
15+
set_clip_rect(screen, d->x+2,d->y+2, d->x+d->w-4, d->y+d->h-4)
16+
#define START_CLIP_BYOB(d) \
17+
clip = screen->clip;\
18+
cl = screen->cl;\
19+
cr = screen->cr;\
20+
ct = screen->ct;\
21+
cb = screen->cb;\
22+
set_clip_rect(screen, d->x+2,d->y+2, d->x+d->w-4, d->y+d->h-4)
23+
24+
#define END_CLIP() \
25+
screen->clip = clip;\
26+
screen->cl = cl;\
27+
screen->cr = cr;\
28+
screen->ct = ct;\
29+
screen->cb = cb;
1430

1531
namespace GUI
1632
{
@@ -217,7 +233,8 @@ void ScrollingPane::applyVisibility(bool visible)
217233
{
218234
if (screen)
219235
{
220-
if(isConstructed()) START_CLIP(alDialog);
236+
int clip, cl, cr, ct, cb;
237+
if(isConstructed()) START_CLIP_BYOB(alDialog);
221238
content->applyVisibility(visible);
222239
if(isConstructed()) END_CLIP();
223240
}

0 commit comments

Comments
 (0)