mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-25 11:45:52 +01:00
Update for 0.51.2-pre2
This commit is contained in:
@@ -24,6 +24,9 @@ typedef struct W_ColorWell {
|
||||
} flags;
|
||||
} ColorWell;
|
||||
|
||||
static char *_ColorWellActivatedNotification = "_ColorWellActivatedNotification";
|
||||
|
||||
|
||||
|
||||
static void destroyColorWell(ColorWell *cPtr);
|
||||
static void paintColorWell(ColorWell *cPtr);
|
||||
@@ -36,6 +39,8 @@ static void handleActionEvents(XEvent *event, void *data);
|
||||
|
||||
static void resizeColorWell();
|
||||
|
||||
|
||||
|
||||
W_ViewProcedureTable _ColorWellViewProcedures = {
|
||||
NULL,
|
||||
resizeColorWell,
|
||||
@@ -58,6 +63,21 @@ static WMDragSourceProcs dragProcs = {
|
||||
|
||||
|
||||
|
||||
static void
|
||||
activatedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
|
||||
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
|
||||
return;
|
||||
|
||||
W_SetViewBackgroundColor(cPtr->view, WMWidgetScreen(cPtr)->gray);
|
||||
paintColorWell(cPtr);
|
||||
|
||||
cPtr->flags.active = 0;
|
||||
}
|
||||
|
||||
|
||||
WMColorWell*
|
||||
WMCreateColorWell(WMWidget *parent)
|
||||
{
|
||||
@@ -97,9 +117,14 @@ WMCreateColorWell(WMWidget *parent)
|
||||
cPtr->colorView->flags.mapWhenRealized = 1;
|
||||
|
||||
cPtr->flags.bordered = 1;
|
||||
|
||||
|
||||
resizeColorWell(cPtr, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
WMAddNotificationObserver(activatedObserver, cPtr,
|
||||
_ColorWellActivatedNotification, NULL);
|
||||
|
||||
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
|
||||
|
||||
return cPtr;
|
||||
}
|
||||
|
||||
@@ -379,14 +404,54 @@ handleDragEvents(XEvent *event, void *data)
|
||||
static void
|
||||
handleActionEvents(XEvent *event, void *data)
|
||||
{
|
||||
/* WMColorWell *cPtr = (ColorWell*)data;*/
|
||||
WMColorWell *cPtr = (ColorWell*)data;
|
||||
WMScreen *scr = WMWidgetScreen(cPtr);
|
||||
WMColorPanel *cpanel;
|
||||
|
||||
if (cPtr->flags.active)
|
||||
W_SetViewBackgroundColor(cPtr->view, scr->gray);
|
||||
else
|
||||
W_SetViewBackgroundColor(cPtr->view, scr->white);
|
||||
paintColorWell(cPtr);
|
||||
|
||||
cPtr->flags.active ^= 1;
|
||||
|
||||
if (cPtr->flags.active) {
|
||||
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
||||
}
|
||||
/*
|
||||
cpanel = WMGetColorPanel(scr);
|
||||
if (cPtr->color)
|
||||
WMSetColorPanelColor(cpanel, cPtr->color);
|
||||
WMShowColorPanel(cpanel);
|
||||
*
|
||||
*/
|
||||
{
|
||||
char *t;
|
||||
WMColor *color;
|
||||
|
||||
t = WMRunInputPanel(scr, NULL, "Advanced Color Picker",
|
||||
"Type a Color (this is temporary!!! I'm not THAT dumb :P)",
|
||||
NULL, "OK", "Cancel");
|
||||
|
||||
if (t) {
|
||||
color = WMCreateNamedColor(scr, t, False);
|
||||
if (color) {
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
free(t);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyColorWell(ColorWell *cPtr)
|
||||
{
|
||||
WMRemoveNotificationObserver(cPtr);
|
||||
|
||||
if (cPtr->color)
|
||||
WMReleaseColor(cPtr->color);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user