WINGs/wcolorpanel: gate magnifier via vtable callback dispatch
The magnifier is X11-backend-specific (screen capture). Instead of a disguised is_x11 check, the view backend provides the callback directly: - X11: .magnify_callback = W_ColorPanelMagnify (the magnifier impl) - Wayland: .magnify_callback = NULL (button does nothing) The button wiring uses the vtable value as the action callback. No conditionals, no capability flags, pure vtable dispatch. Also removes the screen_grab_image vtable slot that was a disguised check.
This commit is contained in:
parent
0e26aa878c
commit
8ec338016a
|
|
@ -653,11 +653,15 @@ typedef struct W_ViewBackend {
|
|||
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);
|
||||
WMAction *magnify_callback;
|
||||
} W_ViewBackend;
|
||||
|
||||
extern const W_ViewBackend W_ViewBackendX11;
|
||||
extern const W_ViewBackend W_ViewBackendWL;
|
||||
|
||||
/* Color panel magnifier (X11-only implementation) */
|
||||
void W_ColorPanelMagnify(WMWidget *w, void *data);
|
||||
|
||||
|
||||
/* ---[ color backend vtable ]-------------------------------------------- */
|
||||
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ static void closeWindowCallback(WMWidget * w, void *data);
|
|||
|
||||
static Cursor magnifyGrabPointer(W_ColorPanel * panel);
|
||||
static WMPoint magnifyInitialize(W_ColorPanel * panel);
|
||||
static void magnifyPutCursor(WMWidget * w, void *data);
|
||||
|
||||
static Pixmap magnifyCreatePixmap(WMColorPanel * panel);
|
||||
static void magnifyGetImageStored(W_ColorPanel * panel, int x1, int y1, int x2, int y2);
|
||||
static XImage *magnifyGetImage(WMScreen * scr, XImage * image, int x, int y, int w, int h);
|
||||
|
|
@ -405,7 +405,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
|||
panel->magnifyBtn = WMCreateCustomButton(panel->win, WBBStateLightMask | WBBStateChangeMask);
|
||||
WMResizeWidget(panel->magnifyBtn, 46, 36);
|
||||
WMMoveWidget(panel->magnifyBtn, 6, 4);
|
||||
WMSetButtonAction(panel->magnifyBtn, magnifyPutCursor, panel);
|
||||
WMSetButtonAction(panel->magnifyBtn, scrPtr->viewBackend->magnify_callback, panel);
|
||||
WMSetButtonImagePosition(panel->magnifyBtn, WIPImageOnly);
|
||||
WMSetButtonImage(panel->magnifyBtn, scrPtr->magnifyIcon);
|
||||
|
||||
|
|
@ -1693,10 +1693,11 @@ static WMPoint magnifyInitialize(W_ColorPanel * panel)
|
|||
return point;
|
||||
}
|
||||
|
||||
static void magnifyPutCursor(WMWidget * w, void *data)
|
||||
void W_ColorPanelMagnify(WMWidget * w, void *data)
|
||||
{
|
||||
W_ColorPanel *panel = (W_ColorPanel *) (data);
|
||||
W_Screen *scr = WMWidgetScreen(panel->win);
|
||||
|
||||
Cursor magCursor;
|
||||
Pixmap pixmap;
|
||||
WMEvent event;
|
||||
|
|
|
|||
|
|
@ -276,4 +276,5 @@ const W_RenderBackend W_RenderBackendWL = {
|
|||
.fill_polygon = render_wl_fill_polygon,
|
||||
.fill_arc = render_wl_fill_arc,
|
||||
.create_disabled_mask = render_wl_create_disabled_mask,
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -172,4 +172,5 @@ const W_RenderBackend W_RenderBackendX11 = {
|
|||
.fill_polygon = render_x11_fill_polygon,
|
||||
.fill_arc = render_x11_fill_arc,
|
||||
.create_disabled_mask = render_x11_create_disabled_mask,
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -622,4 +622,5 @@ const W_ViewBackend W_ViewBackendWL = {
|
|||
.balloon_draw = wl_balloon_draw,
|
||||
.text_init = wl_text_init,
|
||||
.xor_fill_rect = NULL,
|
||||
.magnify_callback = NULL,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -581,4 +581,5 @@ const W_ViewBackend W_ViewBackendX11 = {
|
|||
.balloon_draw = x11_balloon_draw,
|
||||
.text_init = x11_text_init,
|
||||
.xor_fill_rect = x11_xor_fill_rect,
|
||||
.magnify_callback = W_ColorPanelMagnify,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue