mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-05 00:15:56 +01:00
Updated/fixed version of colorpanel
This commit is contained in:
@@ -955,7 +955,7 @@ void WMShowColorPanel(WMColorPanel *panel);
|
|||||||
|
|
||||||
void WMCloseColorPanel(WMColorPanel *panel);
|
void WMCloseColorPanel(WMColorPanel *panel);
|
||||||
|
|
||||||
void WMSetColorPanelColor(WMColorPanel *panel, RColor color);
|
void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
|
||||||
|
|
||||||
RColor WMGetColorPanelColor(WMColorPanel *panel);
|
RColor WMGetColorPanelColor(WMColorPanel *panel);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* and similair code-issues
|
* and similair code-issues
|
||||||
* Marco van Hylckama-Vlieg : For once again doing the artwork ;-)
|
* Marco van Hylckama-Vlieg : For once again doing the artwork ;-)
|
||||||
*
|
*
|
||||||
* small note: Tabstop size = 8
|
* small note: Tabstop size = 4
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -324,8 +324,6 @@ WMSetColorPanelAction(WMColorPanel *panel, WMAction *action, void *data)
|
|||||||
panel->clientData = data;
|
panel->clientData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static WMColorPanel*
|
static WMColorPanel*
|
||||||
makeColorPanel(WMScreen *scrPtr, char *name)
|
makeColorPanel(WMScreen *scrPtr, char *name)
|
||||||
{
|
{
|
||||||
@@ -350,6 +348,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
|||||||
WMSetWindowTitle(panel->win, "Colors");
|
WMSetWindowTitle(panel->win, "Colors");
|
||||||
WMSetWindowCloseAction(panel->win, closeWindowCallback, panel);
|
WMSetWindowCloseAction(panel->win, closeWindowCallback, panel);
|
||||||
|
|
||||||
|
|
||||||
/* Set Default ColorPanel Mode(s) */
|
/* Set Default ColorPanel Mode(s) */
|
||||||
panel->mode = WMWheelModeColorPanel;
|
panel->mode = WMWheelModeColorPanel;
|
||||||
panel->lastChanged = WMWheelModeColorPanel;
|
panel->lastChanged = WMWheelModeColorPanel;
|
||||||
@@ -592,9 +591,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->rgbRedT, 40, 18);
|
WMResizeWidget(panel->rgbRedT, 40, 18);
|
||||||
WMMoveWidget(panel->rgbRedT, 146, 13);
|
WMMoveWidget(panel->rgbRedT, 146, 13);
|
||||||
WMSetTextFieldAlignment(panel->rgbRedT, WALeft);
|
WMSetTextFieldAlignment(panel->rgbRedT, WALeft);
|
||||||
WMAddNotificationObserver(rgbTextFieldCallback, panel,
|
WMAddNotificationObserver(rgbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->rgbRedT);
|
||||||
panel->rgbRedT);
|
|
||||||
|
|
||||||
|
|
||||||
panel->rgbGreenS = WMCreateSlider(panel->rgbFrm);
|
panel->rgbGreenS = WMCreateSlider(panel->rgbFrm);
|
||||||
@@ -620,9 +618,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->rgbGreenT, 40, 18);
|
WMResizeWidget(panel->rgbGreenT, 40, 18);
|
||||||
WMMoveWidget(panel->rgbGreenT, 146, 35);
|
WMMoveWidget(panel->rgbGreenT, 146, 35);
|
||||||
WMSetTextFieldAlignment(panel->rgbGreenT, WALeft);
|
WMSetTextFieldAlignment(panel->rgbGreenT, WALeft);
|
||||||
WMAddNotificationObserver(rgbTextFieldCallback, panel,
|
WMAddNotificationObserver(rgbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->rgbGreenT);
|
||||||
panel->rgbGreenT);
|
|
||||||
|
|
||||||
|
|
||||||
panel->rgbBlueS = WMCreateSlider(panel->rgbFrm);
|
panel->rgbBlueS = WMCreateSlider(panel->rgbFrm);
|
||||||
@@ -648,9 +645,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->rgbBlueT, 40, 18);
|
WMResizeWidget(panel->rgbBlueT, 40, 18);
|
||||||
WMMoveWidget(panel->rgbBlueT, 146, 57);
|
WMMoveWidget(panel->rgbBlueT, 146, 57);
|
||||||
WMSetTextFieldAlignment(panel->rgbBlueT, WALeft);
|
WMSetTextFieldAlignment(panel->rgbBlueT, WALeft);
|
||||||
WMAddNotificationObserver(rgbTextFieldCallback, panel,
|
WMAddNotificationObserver(rgbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->rgbBlueT);
|
||||||
panel->rgbBlueT);
|
|
||||||
/* End of RGB Panel */
|
/* End of RGB Panel */
|
||||||
|
|
||||||
/* Widgets for CMYK Panel */
|
/* Widgets for CMYK Panel */
|
||||||
@@ -702,9 +698,9 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->cmykCyanT, 40, 18);
|
WMResizeWidget(panel->cmykCyanT, 40, 18);
|
||||||
WMMoveWidget(panel->cmykCyanT, 146, 13);
|
WMMoveWidget(panel->cmykCyanT, 146, 13);
|
||||||
WMSetTextFieldAlignment(panel->cmykCyanT, WALeft);
|
WMSetTextFieldAlignment(panel->cmykCyanT, WALeft);
|
||||||
WMAddNotificationObserver(cmykTextFieldCallback, panel,
|
WMAddNotificationObserver(cmykTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->cmykCyanT);
|
||||||
panel->cmykCyanT);
|
|
||||||
|
|
||||||
panel->cmykMagentaS = WMCreateSlider(panel->cmykFrm);
|
panel->cmykMagentaS = WMCreateSlider(panel->cmykFrm);
|
||||||
WMResizeWidget(panel->cmykMagentaS, 141, 16);
|
WMResizeWidget(panel->cmykMagentaS, 141, 16);
|
||||||
@@ -729,9 +725,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->cmykMagentaT, 40, 18);
|
WMResizeWidget(panel->cmykMagentaT, 40, 18);
|
||||||
WMMoveWidget(panel->cmykMagentaT, 146, 35);
|
WMMoveWidget(panel->cmykMagentaT, 146, 35);
|
||||||
WMSetTextFieldAlignment(panel->cmykMagentaT, WALeft);
|
WMSetTextFieldAlignment(panel->cmykMagentaT, WALeft);
|
||||||
WMAddNotificationObserver(cmykTextFieldCallback, panel,
|
WMAddNotificationObserver(cmykTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->cmykMagentaT);
|
||||||
panel->cmykMagentaT);
|
|
||||||
|
|
||||||
|
|
||||||
panel->cmykYellowS = WMCreateSlider(panel->cmykFrm);
|
panel->cmykYellowS = WMCreateSlider(panel->cmykFrm);
|
||||||
@@ -757,9 +752,9 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->cmykYellowT, 40, 18);
|
WMResizeWidget(panel->cmykYellowT, 40, 18);
|
||||||
WMMoveWidget(panel->cmykYellowT, 146, 57);
|
WMMoveWidget(panel->cmykYellowT, 146, 57);
|
||||||
WMSetTextFieldAlignment(panel->cmykYellowT, WALeft);
|
WMSetTextFieldAlignment(panel->cmykYellowT, WALeft);
|
||||||
WMAddNotificationObserver(cmykTextFieldCallback, panel,
|
WMAddNotificationObserver(cmykTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->cmykYellowT);
|
||||||
panel->cmykYellowT);
|
|
||||||
|
|
||||||
panel->cmykBlackS = WMCreateSlider(panel->cmykFrm);
|
panel->cmykBlackS = WMCreateSlider(panel->cmykFrm);
|
||||||
WMResizeWidget(panel->cmykBlackS, 141, 16);
|
WMResizeWidget(panel->cmykBlackS, 141, 16);
|
||||||
@@ -785,9 +780,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->cmykBlackT, 40, 18);
|
WMResizeWidget(panel->cmykBlackT, 40, 18);
|
||||||
WMMoveWidget(panel->cmykBlackT, 146, 79);
|
WMMoveWidget(panel->cmykBlackT, 146, 79);
|
||||||
WMSetTextFieldAlignment(panel->cmykBlackT, WALeft);
|
WMSetTextFieldAlignment(panel->cmykBlackT, WALeft);
|
||||||
WMAddNotificationObserver(cmykTextFieldCallback, panel,
|
WMAddNotificationObserver(cmykTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->cmykBlackT);
|
||||||
panel->cmykBlackT);
|
|
||||||
/* End of CMYK Panel */
|
/* End of CMYK Panel */
|
||||||
|
|
||||||
/* Widgets for HSB Panel */
|
/* Widgets for HSB Panel */
|
||||||
@@ -808,9 +802,9 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->hsbHueT, 40, 18);
|
WMResizeWidget(panel->hsbHueT, 40, 18);
|
||||||
WMMoveWidget(panel->hsbHueT, 146, 13);
|
WMMoveWidget(panel->hsbHueT, 146, 13);
|
||||||
WMSetTextFieldAlignment(panel->hsbHueT, WALeft);
|
WMSetTextFieldAlignment(panel->hsbHueT, WALeft);
|
||||||
WMAddNotificationObserver(hsbTextFieldCallback, panel,
|
WMAddNotificationObserver(hsbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->hsbHueT);
|
||||||
panel->hsbHueT);
|
|
||||||
|
|
||||||
panel->hsbSaturationS = WMCreateSlider(panel->hsbFrm);
|
panel->hsbSaturationS = WMCreateSlider(panel->hsbFrm);
|
||||||
WMResizeWidget(panel->hsbSaturationS, 141, 16);
|
WMResizeWidget(panel->hsbSaturationS, 141, 16);
|
||||||
@@ -824,9 +818,9 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->hsbSaturationT, 40, 18);
|
WMResizeWidget(panel->hsbSaturationT, 40, 18);
|
||||||
WMMoveWidget(panel->hsbSaturationT, 146, 35);
|
WMMoveWidget(panel->hsbSaturationT, 146, 35);
|
||||||
WMSetTextFieldAlignment(panel->hsbSaturationT, WALeft);
|
WMSetTextFieldAlignment(panel->hsbSaturationT, WALeft);
|
||||||
WMAddNotificationObserver(hsbTextFieldCallback, panel,
|
WMAddNotificationObserver(hsbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->hsbSaturationT);
|
||||||
panel->hsbSaturationT);
|
|
||||||
|
|
||||||
panel->hsbBrightnessS = WMCreateSlider(panel->hsbFrm);
|
panel->hsbBrightnessS = WMCreateSlider(panel->hsbFrm);
|
||||||
WMResizeWidget(panel->hsbBrightnessS, 141, 16);
|
WMResizeWidget(panel->hsbBrightnessS, 141, 16);
|
||||||
@@ -840,9 +834,8 @@ WMTextDidEndEditingNotification, panel->grayBrightnessT);
|
|||||||
WMResizeWidget(panel->hsbBrightnessT, 40, 18);
|
WMResizeWidget(panel->hsbBrightnessT, 40, 18);
|
||||||
WMMoveWidget(panel->hsbBrightnessT, 146, 57);
|
WMMoveWidget(panel->hsbBrightnessT, 146, 57);
|
||||||
WMSetTextFieldAlignment(panel->hsbBrightnessT, WALeft);
|
WMSetTextFieldAlignment(panel->hsbBrightnessT, WALeft);
|
||||||
WMAddNotificationObserver(hsbTextFieldCallback, panel,
|
WMAddNotificationObserver(hsbTextFieldCallback, panel, \
|
||||||
WMTextDidEndEditingNotification,
|
WMTextDidEndEditingNotification, panel->hsbBrightnessT);
|
||||||
panel->hsbBrightnessT);
|
|
||||||
/* End of HSB Panel */
|
/* End of HSB Panel */
|
||||||
|
|
||||||
|
|
||||||
@@ -1031,32 +1024,9 @@ void
|
|||||||
WMShowColorPanel(WMColorPanel *panel)
|
WMShowColorPanel(WMColorPanel *panel)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
XEvent event;
|
|
||||||
RHSVColor hsvcolor;
|
|
||||||
GC bgc = WMColorGC(scr->black);
|
|
||||||
GC wgc = WMColorGC(scr->white);
|
|
||||||
RColor color;
|
|
||||||
|
|
||||||
panel->wheelMtrx = wheelInitMatrix(panel); /* Needs to be done After Color is set */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Maybe put this in sub-function ... Initialising selection images */
|
|
||||||
RRGBtoHSV(&color, &hsvcolor);
|
|
||||||
panel->colx = 2 + rint((colorWheelSize / 2.0) * (1 + (hsvcolor.saturation/255.0) * cos( hsvcolor.hue*M_PI/180.0)));
|
|
||||||
panel->coly = 2 + rint((colorWheelSize / 2.0) * (1 + (hsvcolor.saturation/255.0) * sin(-hsvcolor.hue*M_PI/180.0)));
|
|
||||||
wheelUpdateBrightnessGradientFromHSV(panel, hsvcolor);
|
|
||||||
WMSetSliderValue(panel->wheelBrightnessS, 255 - hsvcolor.value);
|
|
||||||
|
|
||||||
panel->selectionImg = XCreatePixmap(scr->display, W_VIEW(panel->wheelFrm)->window, 4, 4, scr->depth);
|
|
||||||
XFillRectangle(scr->display, panel->selectionImg, bgc, 0, 0, 4, 4);
|
|
||||||
XFillRectangle(scr->display, panel->selectionImg, wgc, 1, 1, 2, 2);
|
|
||||||
/* End of initialisation section */
|
|
||||||
|
|
||||||
panel->palx = customPaletteWidth/2;
|
|
||||||
panel->paly = customPaletteHeight/2;
|
|
||||||
|
|
||||||
WMSetColorPanelPickerMode(panel, WMWheelModeColorPanel);
|
WMSetColorPanelPickerMode(panel, WMWheelModeColorPanel);
|
||||||
|
wheelInit(panel);
|
||||||
|
|
||||||
WMMapWidget(panel->win);
|
WMMapWidget(panel->win);
|
||||||
}
|
}
|
||||||
@@ -1225,24 +1195,97 @@ WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode)
|
|||||||
panel->mode = mode;
|
panel->mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetColorPanelColor(WMColorPanel *panel, RColor color)
|
WMSetColorPanelColor(WMColorPanel *panel, WMColor *color)
|
||||||
{
|
{
|
||||||
return;
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
|
RHSVColor hsvcolor;
|
||||||
|
RColor intcolor;
|
||||||
|
GC bgc = WMColorGC(scr->black);
|
||||||
|
GC wgc = WMColorGC(scr->white);
|
||||||
|
int originalHue;
|
||||||
|
|
||||||
|
WMSetColorWellColor(panel->colorWell, color);
|
||||||
|
|
||||||
|
intcolor.red = color->color.red >> 8;
|
||||||
|
intcolor.green = color->color.green >> 8;
|
||||||
|
intcolor.blue = color->color.blue >> 8;
|
||||||
|
|
||||||
|
panel->color = intcolor;
|
||||||
|
|
||||||
|
/* If color was set by HSB-Panel do not convert back to hsv */
|
||||||
|
if (panel->lastChanged != WMHSBModeColorPanel) {
|
||||||
|
|
||||||
|
/* if color is black, hue is undetermined, so it must be restored */
|
||||||
|
if ((panel->color.red == 0) &&
|
||||||
|
(panel->color.green == 0) &&
|
||||||
|
(panel->color.blue == 0) &&
|
||||||
|
(panel->hsvcolor.hue <= 359))
|
||||||
|
{
|
||||||
|
originalHue = panel->hsvcolor.hue;
|
||||||
|
RRGBtoHSV(&panel->color, &panel->hsvcolor);
|
||||||
|
panel->hsvcolor.hue = originalHue;
|
||||||
|
} else {
|
||||||
|
RRGBtoHSV(&panel->color, &panel->hsvcolor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
panel->wheelMtrx = wheelInitMatrix(panel); /* Needs to be done After Color is set */
|
||||||
|
|
||||||
|
/* Maybe put this in a sub-function ... Initialising selected images */
|
||||||
|
RRGBtoHSV(&intcolor, &hsvcolor);
|
||||||
|
panel->colx = 2 + rint((colorWheelSize / 2.0) * (1 + (hsvcolor.saturation/255.0) * cos( hsvcolor.hue*M_PI/180.0)));
|
||||||
|
panel->coly = 2 + rint((colorWheelSize / 2.0) * (1 + (hsvcolor.saturation/255.0) * sin(-hsvcolor.hue*M_PI/180.0)));
|
||||||
|
wheelUpdateBrightnessGradientFromHSV(panel, hsvcolor);
|
||||||
|
WMSetSliderValue(panel->wheelBrightnessS, 255 - hsvcolor.value);
|
||||||
|
|
||||||
|
panel->selectionImg = XCreatePixmap(scr->display, W_VIEW(panel->wheelFrm)->window, 4, 4, scr->depth);
|
||||||
|
XFillRectangle(scr->display, panel->selectionImg, bgc, 0, 0, 4, 4);
|
||||||
|
XFillRectangle(scr->display, panel->selectionImg, wgc, 1, 1, 2, 2);
|
||||||
|
/* End of initialisation section */
|
||||||
|
|
||||||
|
panel->palx = customPaletteWidth/2;
|
||||||
|
panel->paly = customPaletteHeight/2;
|
||||||
|
|
||||||
|
WMSetColorPanelPickerMode(panel, panel->mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
updateSwatch(WMColorPanel *panel, RColor color)
|
updateSwatch(WMColorPanel *panel, RColor color)
|
||||||
{
|
{
|
||||||
WMSetColorPanelColor(panel, color);
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
|
WMColor *wellcolor;
|
||||||
|
int originalHue;
|
||||||
|
|
||||||
|
wellcolor = WMCreateRGBColor(scr, color.red << 8, color.green << 8, color.blue << 8, True);
|
||||||
|
|
||||||
|
WMSetColorWellColor(panel->colorWell, wellcolor);
|
||||||
|
WMReleaseColor(wellcolor);
|
||||||
|
|
||||||
|
panel->color = color;
|
||||||
|
|
||||||
|
/* If color was set by HSB-Panel do not convert back to hsv */
|
||||||
|
if (panel->lastChanged != WMHSBModeColorPanel) {
|
||||||
|
|
||||||
|
/* if color is black, hue is undetermined, so it must be restored */
|
||||||
|
if ((panel->color.red == 0) &&
|
||||||
|
(panel->color.green == 0) &&
|
||||||
|
(panel->color.blue == 0) &&
|
||||||
|
(panel->hsvcolor.hue <= 359))
|
||||||
|
{
|
||||||
|
originalHue = panel->hsvcolor.hue;
|
||||||
|
RRGBtoHSV(&panel->color, &panel->hsvcolor);
|
||||||
|
panel->hsvcolor.hue = originalHue;
|
||||||
|
} else {
|
||||||
|
RRGBtoHSV(&panel->color, &panel->hsvcolor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (panel->action && (!panel->flags.dragging || panel->flags.continuous)) {
|
if (panel->action && (!panel->flags.dragging || panel->flags.continuous)) {
|
||||||
(*panel->action)(panel, panel->clientData);
|
(*panel->action)(panel, panel->clientData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modeButtonCallback(WMWidget *w, void *data)
|
modeButtonCallback(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
@@ -1438,7 +1481,6 @@ magnifyCreateView(W_ColorPanel *panel)
|
|||||||
magView->attribs.save_under = True;
|
magView->attribs.save_under = True;
|
||||||
|
|
||||||
W_RealizeView(magView);
|
W_RealizeView(magView);
|
||||||
W_MapView(magView);
|
|
||||||
|
|
||||||
return magView;
|
return magView;
|
||||||
}
|
}
|
||||||
@@ -1502,7 +1544,6 @@ magnifyInitialize(W_ColorPanel *panel)
|
|||||||
panel->magnifyGlass->valid = True;
|
panel->magnifyGlass->valid = True;
|
||||||
|
|
||||||
pixmap = magnifyCreatePixmap(panel);
|
pixmap = magnifyCreatePixmap(panel);
|
||||||
W_MoveView(panel->magnifyGlass->view, x - Cursor_x_hot +1, y - Cursor_y_hot +1);
|
|
||||||
|
|
||||||
XSetWindowBackgroundPixmap(scr->display, panel->magnifyGlass->view->window, pixmap);
|
XSetWindowBackgroundPixmap(scr->display, panel->magnifyGlass->view->window, pixmap);
|
||||||
XClearWindow(scr->display, panel->magnifyGlass->view->window);
|
XClearWindow(scr->display, panel->magnifyGlass->view->window);
|
||||||
@@ -1536,14 +1577,16 @@ magnifyPutCursor(WMWidget *w, void *data)
|
|||||||
|
|
||||||
/* Create magnifying glass */
|
/* Create magnifying glass */
|
||||||
panel->magnifyGlass = wmalloc(sizeof(MovingView));
|
panel->magnifyGlass = wmalloc(sizeof(MovingView));
|
||||||
|
|
||||||
panel->magnifyGlass->view = magnifyCreateView(panel);
|
panel->magnifyGlass->view = magnifyCreateView(panel);
|
||||||
magCursor = magnifyGrabPointer(panel);
|
|
||||||
|
|
||||||
initialPosition = magnifyInitialize(panel);
|
initialPosition = magnifyInitialize(panel);
|
||||||
x = initialPosition.x;
|
x = initialPosition.x;
|
||||||
y = initialPosition.y;
|
y = initialPosition.y;
|
||||||
|
|
||||||
|
W_MoveView(panel->magnifyGlass->view, x - Cursor_x_hot +1, y - Cursor_y_hot +1);
|
||||||
|
W_MapView(panel->magnifyGlass->view);
|
||||||
|
|
||||||
|
magCursor = magnifyGrabPointer(panel);
|
||||||
|
|
||||||
while(panel->magnifyGlass->valid)
|
while(panel->magnifyGlass->valid)
|
||||||
{
|
{
|
||||||
@@ -1603,6 +1646,24 @@ magnifyPutCursor(WMWidget *w, void *data)
|
|||||||
XFreePixmap(scr->display, pixmap);
|
XFreePixmap(scr->display, pixmap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FocusOut: /* fall through */
|
||||||
|
case FocusIn:
|
||||||
|
/*
|
||||||
|
* Color Panel window (panel->win) lost or received focus.
|
||||||
|
* We need to update the pixmap in the magnifying glass.
|
||||||
|
*/
|
||||||
|
XUngrabPointer(scr->display, CurrentTime);
|
||||||
|
W_UnmapView(panel->magnifyGlass->view);
|
||||||
|
|
||||||
|
magnifyInitialize(panel);
|
||||||
|
|
||||||
|
W_MapView(panel->magnifyGlass->view);
|
||||||
|
XGrabPointer (scr->display, panel->magnifyGlass->view->window, True,
|
||||||
|
PointerMotionMask | ButtonPressMask,
|
||||||
|
GrabModeAsync, GrabModeAsync,
|
||||||
|
scr->rootWin, magCursor, CurrentTime);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WMHandleEvent(&event);
|
WMHandleEvent(&event);
|
||||||
break;
|
break;
|
||||||
@@ -3229,12 +3290,15 @@ generateNewFilename(char *curName)
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
char *newName;
|
char *newName;
|
||||||
|
|
||||||
|
|
||||||
|
assert(curName);
|
||||||
|
|
||||||
ptr = curName;
|
ptr = curName;
|
||||||
|
|
||||||
while ((ptr = strrchr(ptr, '{')) && !(sscanf(ptr, "{%i}%c", &n, &c)==1)) {
|
if (
|
||||||
ptr++;
|
((ptr = strrchr(ptr, '{')) == 0) ||
|
||||||
}
|
sscanf(ptr, "{%i}%c", &n, &c) != 1
|
||||||
if (!ptr)
|
)
|
||||||
return wstrappend(curName, " {1}");
|
return wstrappend(curName, " {1}");
|
||||||
|
|
||||||
baseLen = ptr - curName -1;
|
baseLen = ptr - curName -1;
|
||||||
|
|||||||
@@ -424,13 +424,11 @@ handleActionEvents(XEvent *event, void *data)
|
|||||||
if (cPtr->flags.active) {
|
if (cPtr->flags.active) {
|
||||||
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
cpanel = WMGetColorPanel(scr);
|
cpanel = WMGetColorPanel(scr);
|
||||||
if (cPtr->color)
|
if (cPtr->color)
|
||||||
WMSetColorPanelColor(cpanel, cPtr->color);
|
WMSetColorPanelColor(cpanel, cPtr->color);
|
||||||
WMShowColorPanel(cpanel);
|
WMShowColorPanel(cpanel);
|
||||||
*
|
/*
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
@@ -451,6 +449,7 @@ handleActionEvents(XEvent *event, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user