WINGs: route XOR drawing through vtable, remove X11 from wtextfield/wsplitview

- wsplitview.c: XFillRectangle+ixorGC replaced with xor_fill_rect vtable call
- wtextfield.c: removed Display *dpy and XRotateBuffers (cut buffer is dead)
- Added xor_fill_rect to W_ViewBackend (X11 impl, Wayland NULL/no-op)
This commit is contained in:
Ollie 2026-05-23 15:53:16 +02:00
parent 9eecb2511c
commit 2dce45432d
5 changed files with 12 additions and 5 deletions

View File

@ -651,6 +651,7 @@ typedef struct W_ViewBackend {
void (*balloon_draw)(void *vctx, struct W_View *view, int x, int y,
int w, int h, const char *text);
void (*text_init)(void *vctx, struct W_View *view, void *stipple_gc_out);
void (*xor_fill_rect)(void *vctx, struct W_View *view, int x, int y, int w, int h);
} W_ViewBackend;
extern const W_ViewBackend W_ViewBackendX11;

View File

@ -451,7 +451,9 @@ static void drawDragingRectangle(WMSplitView * sPtr, int pos)
h = DIVIDER_THICKNESS;
}
XFillRectangle(sPtr->view->screen->display, sPtr->view->window, sPtr->view->screen->ixorGC, x, y, w, h);
W_Screen *scr = sPtr->view->screen;
if (scr->viewBackend->xor_fill_rect)
scr->viewBackend->xor_fill_rect(scr->viewBackendCtx, sPtr->view, x, y, w, h);
}
static void getMinMaxDividerCoord(WMSplitView * sPtr, int divider, int *minC, int *maxC)

View File

@ -1365,8 +1365,6 @@ static void handleTextFieldActionEvents(WMEvent * event, void *data)
TextField *tPtr = (TextField *) data;
static Time lastButtonReleasedEvent = 0;
static Time lastButtonReleasedEvent2 = 0;
Display *dpy = tPtr->view->screen->display;
CHECK_CLASS(data, WC_TextField);
switch (event->type) {
@ -1502,8 +1500,6 @@ static void handleTextFieldActionEvents(WMEvent * event, void *data)
if (!tPtr->flags.secure && tPtr->selection.count != 0) {
int start, count;
XRotateBuffers(dpy, 1);
count = abs(tPtr->selection.count);
if (tPtr->selection.count < 0)
start = tPtr->selection.position - count;

View File

@ -620,4 +620,5 @@ const W_ViewBackend W_ViewBackendWL = {
.bell = NULL,
.balloon_draw = wl_balloon_draw,
.text_init = wl_text_init,
.xor_fill_rect = NULL,
};

View File

@ -520,6 +520,12 @@ static void x11_window_withdraw(void *vctx, W_View *view)
XWithdrawWindow(scr->display, view->window, scr->screen);
}
static void x11_xor_fill_rect(void *vctx, W_View *view, int x, int y, int w, int h)
{
W_Screen *scr = (W_Screen *)vctx;
XFillRectangle(scr->display, view->window, scr->ixorGC, x, y, w, h);
}
const W_ViewBackend W_ViewBackendX11 = {
.screen_init = x11_screen_init,
.screen_fini = x11_screen_fini,
@ -557,4 +563,5 @@ const W_ViewBackend W_ViewBackendX11 = {
.bell = x11_bell,
.balloon_draw = x11_balloon_draw,
.text_init = x11_text_init,
.xor_fill_rect = x11_xor_fill_rect,
};