colorpanel: split into wcolorpanel.c + _x11.c + _wl.c (412->0 X11 calls)
This commit is contained in:
parent
39b63a8184
commit
14b660ff50
|
|
@ -74,7 +74,8 @@ libWINGs_la_SOURCES = \
|
|||
wview.c \
|
||||
wview_wl.c \
|
||||
wclient_wl.c \
|
||||
wwindow.c
|
||||
wwindow.c \
|
||||
wcolorpanel.c
|
||||
|
||||
# X11 backend sources — only compiled when --enable-x11-backend (the default).
|
||||
if USE_X11_BACKEND
|
||||
|
|
@ -98,7 +99,7 @@ else
|
|||
# symbols normally exported from *_x11.c files, so applications that
|
||||
# link libWINGs but never call them resolve cleanly in pure-Wayland
|
||||
# builds.
|
||||
libWINGs_la_SOURCES += wstubs_no_x11.c
|
||||
libWINGs_la_SOURCES += wcolorpanel_wl.c wstubs_no_x11.c
|
||||
endif
|
||||
|
||||
if USE_WAYLAND_CLIENT
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* wcolorpanelP.h — Private header for color panel three-way split.
|
||||
*
|
||||
* Shared types between wcolorpanel.c, wcolorpanel_x11.c, and
|
||||
* wcolorpanel_wl.c. Included after WINGsP.h.
|
||||
*/
|
||||
|
||||
#ifndef WCOLORPANEL_P_H
|
||||
#define WCOLORPANEL_P_H
|
||||
|
||||
typedef struct CPColor {
|
||||
RColor rgb;
|
||||
RHSVColor hsv;
|
||||
enum {
|
||||
cpNone,
|
||||
cpRGB,
|
||||
cpHSV
|
||||
} set;
|
||||
} CPColor;
|
||||
|
||||
typedef struct WheelMatrix {
|
||||
unsigned int width, height;
|
||||
unsigned char *data[3];
|
||||
unsigned char values[256];
|
||||
} wheelMatrix;
|
||||
|
||||
enum {
|
||||
CPmenuNewFromFile,
|
||||
CPmenuRename,
|
||||
CPmenuRemove,
|
||||
CPmenuCopy,
|
||||
CPmenuNewFromClipboard
|
||||
};
|
||||
|
||||
enum {
|
||||
CLmenuAdd,
|
||||
CLmenuRename,
|
||||
CLmenuRemove
|
||||
};
|
||||
|
||||
#define PWIDTH 194
|
||||
#define PHEIGHT 266
|
||||
#define colorWheelSize 150
|
||||
#define customPaletteWidth 182
|
||||
#define customPaletteHeight 106
|
||||
#define knobThickness 8
|
||||
|
||||
#define SPECTRUM_WIDTH 511
|
||||
#define SPECTRUM_HEIGHT 360
|
||||
|
||||
#define COLORWHEEL_PART 1
|
||||
#define CUSTOMPALETTE_PART 2
|
||||
|
||||
typedef struct W_ColorPanel {
|
||||
WMWindow *win;
|
||||
WMFont *font8;
|
||||
WMFont *font12;
|
||||
void *clientData;
|
||||
WMAction2 *action;
|
||||
|
||||
/* Common Stuff */
|
||||
WMColorWell *colorWell;
|
||||
WMButton *magnifyBtn;
|
||||
WMButton *wheelBtn;
|
||||
WMButton *slidersBtn;
|
||||
WMButton *customPaletteBtn;
|
||||
WMButton *colorListBtn;
|
||||
|
||||
/* Magnifying Glass */
|
||||
void *magnifyGlass;
|
||||
|
||||
/* ColorWheel Panel */
|
||||
WMFrame *wheelFrm;
|
||||
WMSlider *wheelBrightnessS;
|
||||
WMView *wheelView;
|
||||
|
||||
/* Slider Panels */
|
||||
WMFrame *slidersFrm;
|
||||
WMFrame *seperatorFrm;
|
||||
WMButton *grayBtn;
|
||||
WMButton *rgbBtn;
|
||||
WMButton *cmykBtn;
|
||||
WMButton *hsbBtn;
|
||||
/* Gray Scale Panel */
|
||||
WMFrame *grayFrm;
|
||||
WMLabel *grayMinL;
|
||||
WMLabel *grayMaxL;
|
||||
WMSlider *grayBrightnessS;
|
||||
WMTextField *grayBrightnessT;
|
||||
WMButton *grayPresetBtn[7];
|
||||
|
||||
/* RGB Panel */
|
||||
WMButton *rgbDecB;
|
||||
WMButton *rgbHexB;
|
||||
WMFrame *rgbFrm;
|
||||
WMLabel *rgbMinL;
|
||||
WMLabel *rgbMaxL;
|
||||
WMSlider *rgbRedS;
|
||||
WMSlider *rgbGreenS;
|
||||
WMSlider *rgbBlueS;
|
||||
WMTextField *rgbRedT;
|
||||
WMTextField *rgbGreenT;
|
||||
WMTextField *rgbBlueT;
|
||||
enum {
|
||||
RGBdec,
|
||||
RGBhex
|
||||
} rgbState;
|
||||
|
||||
/* CMYK Panel */
|
||||
WMFrame *cmykFrm;
|
||||
WMLabel *cmykMinL;
|
||||
WMLabel *cmykMaxL;
|
||||
WMSlider *cmykCyanS;
|
||||
WMSlider *cmykMagentaS;
|
||||
WMSlider *cmykYellowS;
|
||||
WMSlider *cmykBlackS;
|
||||
WMTextField *cmykCyanT;
|
||||
WMTextField *cmykMagentaT;
|
||||
WMTextField *cmykYellowT;
|
||||
WMTextField *cmykBlackT;
|
||||
|
||||
/* HSB Panel */
|
||||
WMFrame *hsbFrm;
|
||||
WMSlider *hsbHueS;
|
||||
WMSlider *hsbSaturationS;
|
||||
WMSlider *hsbBrightnessS;
|
||||
WMTextField *hsbHueT;
|
||||
WMTextField *hsbSaturationT;
|
||||
WMTextField *hsbBrightnessT;
|
||||
|
||||
/* Custom Palette Panel */
|
||||
WMFrame *customPaletteFrm;
|
||||
WMPopUpButton *customPaletteHistoryBtn;
|
||||
WMFrame *customPaletteContentFrm;
|
||||
WMPopUpButton *customPaletteMenuBtn;
|
||||
WMView *customPaletteContentView;
|
||||
|
||||
/* Color List Panel */
|
||||
WMFrame *colorListFrm;
|
||||
WMPopUpButton *colorListHistoryBtn;
|
||||
WMList *colorListContentLst;
|
||||
WMPopUpButton *colorListColorMenuBtn;
|
||||
WMPopUpButton *colorListListMenuBtn;
|
||||
|
||||
/* Look-Up Tables and Images */
|
||||
wheelMatrix *wheelMtrx;
|
||||
WMNativePixmap wheelImg;
|
||||
WMNativePixmap selectionImg;
|
||||
WMNativePixmap selectionBackImg;
|
||||
RImage *customPaletteImg;
|
||||
char *lastBrowseDir;
|
||||
|
||||
/* Common Data Fields */
|
||||
CPColor color; /* Current color */
|
||||
WMColorPanelMode mode; /* Current color selection mode */
|
||||
WMColorPanelMode slidersmode; /* Current color sel. mode sliders panel */
|
||||
WMColorPanelMode lastChanged; /* Panel that last changed the color */
|
||||
int colx, coly; /* (x,y) of sel.-marker in WheelMode */
|
||||
int palx, paly; /* (x,y) of sel.-marker in
|
||||
CustomPaletteMode */
|
||||
double palXRatio, palYRatio; /* Ratios in x & y between
|
||||
original and scaled
|
||||
palettesize */
|
||||
int currentPalette;
|
||||
char *configurationPath;
|
||||
|
||||
struct {
|
||||
unsigned int continuous:1;
|
||||
unsigned int dragging:1;
|
||||
} flags;
|
||||
} W_ColorPanel;
|
||||
|
||||
|
||||
|
||||
/* Exported from wcolorpanel.c for backend magnifying glass files */
|
||||
void updateSwatch(struct W_ColorPanel *panel, struct CPColor color);
|
||||
void wheelInit(struct W_ColorPanel *panel);
|
||||
void wheelRender(struct W_ColorPanel *panel);
|
||||
void wheelPaint(struct W_ColorPanel *panel);
|
||||
void grayInit(struct W_ColorPanel *panel);
|
||||
void rgbInit(struct W_ColorPanel *panel);
|
||||
void cmykInit(struct W_ColorPanel *panel);
|
||||
void hsbInit(struct W_ColorPanel *panel);
|
||||
int getPickerPart(struct W_ColorPanel *panel, int x, int y);
|
||||
void readConfiguration(struct W_ColorPanel *panel);
|
||||
void closeWindowCallback(void *w, void *data);
|
||||
void modeButtonCallback(void *w, void *data);
|
||||
void convertCPColor(struct CPColor *color);
|
||||
|
||||
#endif /* WCOLORPANEL_P_H */
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* wcolorpanel_wl.c — Wayland backend for Color Panel magnifying glass.
|
||||
*
|
||||
* Screen pixel capture is not available via standard Wayland protocols,
|
||||
* so the magnifying glass feature is stubbed with a user-visible alert.
|
||||
*/
|
||||
|
||||
#include "wconfig.h"
|
||||
#include "WINGsP.h"
|
||||
#include "wcolorpanelP.h"
|
||||
|
||||
void W_ColorPanelMagnify(struct WMWidget *w, void *data)
|
||||
{
|
||||
struct W_ColorPanel *panel = (struct W_ColorPanel *)data;
|
||||
(void)w;
|
||||
|
||||
WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
|
||||
_("Color Picker"),
|
||||
_("Screen color picking is not available\n"
|
||||
"on the Wayland backend."),
|
||||
_("OK"), NULL, NULL);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue