Send NoExposure in CopyArea

Im not sure if/when i should be sending GraphicsExposure but this fixes
xterm hanging when scrolling
This commit is contained in:
Oskari Alaranta 2026-02-21 04:32:48 +02:00
parent 88ccba3dee
commit 8a0f287d8c
2 changed files with 36 additions and 2 deletions

View File

@ -2466,6 +2466,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
uint32_t foreground = 0x000000; uint32_t foreground = 0x000000;
uint32_t background = 0x000000; uint32_t background = 0x000000;
uint32_t font = None; uint32_t font = None;
bool graphics_exposures = true;
uint32_t clip_mask = 0; uint32_t clip_mask = 0;
int32_t clip_origin_x = 0; int32_t clip_origin_x = 0;
int32_t clip_origin_y = 0; int32_t clip_origin_y = 0;
@ -2489,6 +2490,10 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
dprintln(" font: {}", value); dprintln(" font: {}", value);
font = value; font = value;
break; break;
case 16:
dprintln(" graphics-exposures: {}", value);
graphics_exposures = value;
break;
case 17: case 17:
dprintln(" clip-origin-x: {}", value); dprintln(" clip-origin-x: {}", value);
clip_origin_x = value; clip_origin_x = value;
@ -2514,6 +2519,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
.foreground = foreground, .foreground = foreground,
.background = background, .background = background,
.font = font, .font = font,
.graphics_exposures = graphics_exposures,
.clip_mask = clip_mask, .clip_mask = clip_mask,
.clip_origin_x = clip_origin_x, .clip_origin_x = clip_origin_x,
.clip_origin_y = clip_origin_y, .clip_origin_y = clip_origin_y,
@ -2557,6 +2563,10 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
dprintln(" font: {}", value); dprintln(" font: {}", value);
gc.font = value; gc.font = value;
break; break;
case 16:
dprintln(" graphics-exposures: {}", value);
gc.graphics_exposures = value;
break;
case 17: case 17:
dprintln(" clip-origin-x: {}", value); dprintln(" clip-origin-x: {}", value);
gc.clip_origin_x = value; gc.clip_origin_x = value;
@ -2727,7 +2737,15 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
} }
}; };
for (int32_t yoff = 0; yoff < request.height; yoff++) const int32_t start_x = request.srcX < request.dstX ? request.width - 1 : 0;
const int32_t stop_x = request.srcX < request.dstX ? -1 : request.width;
const int32_t step_x = request.srcX < request.dstX ? -1 : 1;
const int32_t start_y = request.srcY < request.dstY ? request.height - 1 : 0;
const int32_t stop_y = request.srcY < request.dstY ? -1 : request.height;
const int32_t step_y = request.srcY < request.dstY ? -1 : 1;
for (int32_t yoff = start_y; yoff != stop_y; yoff += step_y)
{ {
const int32_t src_y = request.srcY + yoff; const int32_t src_y = request.srcY + yoff;
const int32_t dst_y = request.dstY + yoff; const int32_t dst_y = request.dstY + yoff;
@ -2735,7 +2753,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
continue; continue;
if (dst_y < 0 || dst_y >= dst_h) if (dst_y < 0 || dst_y >= dst_h)
continue; continue;
for (int32_t xoff = 0; xoff < request.width; xoff++) for (int32_t xoff = start_x; xoff != stop_x; xoff += step_x)
{ {
const int32_t src_x = request.srcX + xoff; const int32_t src_x = request.srcX + xoff;
const int32_t dst_x = request.dstX + xoff; const int32_t dst_x = request.dstX + xoff;
@ -2748,6 +2766,20 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
} }
} }
if (gc.graphics_exposures)
{
xEvent event = { .u = {
.noExposure = {
.drawable = request.dstDrawable,
.minorEvent = 0,
.majorEvent = X_CopyArea,
}
}};
event.u.u.type = NoExpose;
event.u.u.sequenceNumber = client_info.sequence;
TRY(encode(client_info.output_buffer, event));
}
if (dst_drawable.type == Object::Type::Window) if (dst_drawable.type == Object::Type::Window)
invalidate_window(request.dstDrawable, request.dstX, request.dstY, request.width, request.height); invalidate_window(request.dstDrawable, request.dstX, request.dstY, request.width, request.height);

View File

@ -114,6 +114,8 @@ struct Object
uint32_t font; uint32_t font;
bool graphics_exposures;
uint32_t clip_mask; uint32_t clip_mask;
int32_t clip_origin_x; int32_t clip_origin_x;
int32_t clip_origin_y; int32_t clip_origin_y;