mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-07 00:35:53 +01:00
Update for 0.52.0. This is a test version, which brings the Appearance
section to WPrefs for testing purposes.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
changes since wmaker 0.51.2:
|
||||
............................
|
||||
|
||||
- added WMColorWellDidChangeNotification
|
||||
- added wfindfileinarray()
|
||||
|
||||
changes since wmaker 0.51.1:
|
||||
...........................
|
||||
............................
|
||||
|
||||
- wusergnusteppath() will return a statically allocated string now.
|
||||
DO NOT FREE IT ANYMORE!!
|
||||
|
||||
@@ -971,6 +971,10 @@ WMColor *WMGetColorWellColor(WMColorWell *cPtr);
|
||||
|
||||
void WSetColorWellBordered(WMColorWell *cPtr, Bool flag);
|
||||
|
||||
|
||||
extern char *WMColorWellDidChangeNotification;
|
||||
|
||||
|
||||
/* ...................................................................... */
|
||||
|
||||
WMScrollView *WMCreateScrollView(WMWidget *parent);
|
||||
|
||||
@@ -136,6 +136,8 @@ char *wfindfile(char *paths, char *file);
|
||||
|
||||
char *wfindfileinlist(char **path_list, char *file);
|
||||
|
||||
char *wfindfileinarray(proplist_t array, char *file);
|
||||
|
||||
char *wexpandpath(char *path);
|
||||
|
||||
/* don't free the returned string */
|
||||
|
||||
@@ -283,3 +283,58 @@ wfindfileinlist(char **path_list, char *file)
|
||||
|
||||
|
||||
|
||||
char*
|
||||
wfindfileinarray(proplist_t array, char *file)
|
||||
{
|
||||
int i;
|
||||
char *path;
|
||||
int len, flen;
|
||||
char *fullpath;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
if (*file=='/' || *file=='~' || !array) {
|
||||
if (access(file, F_OK)<0) {
|
||||
fullpath = wexpandpath(file);
|
||||
if (!fullpath)
|
||||
return NULL;
|
||||
|
||||
if (access(fullpath, F_OK)<0) {
|
||||
free(fullpath);
|
||||
return NULL;
|
||||
} else {
|
||||
return fullpath;
|
||||
}
|
||||
} else {
|
||||
return wstrdup(file);
|
||||
}
|
||||
}
|
||||
|
||||
flen = strlen(file);
|
||||
for (i=0; PLGetNumberOfElements(array); i++) {
|
||||
char *p = PLGetString(PLGetArrayElement(array, i));
|
||||
|
||||
len = strlen(p);
|
||||
path = wmalloc(len+flen+2);
|
||||
path = memcpy(path, p, len);
|
||||
path[len]=0;
|
||||
strcat(path, "/");
|
||||
strcat(path, file);
|
||||
/* expand tilde */
|
||||
fullpath = wexpandpath(path);
|
||||
free(path);
|
||||
if (fullpath) {
|
||||
/* check if file exists */
|
||||
if (access(fullpath, F_OK)==0) {
|
||||
return fullpath;
|
||||
}
|
||||
free(fullpath);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -918,6 +918,7 @@ listCallback(void *self, void *clientData)
|
||||
i = bPtr->usedColumnCount-bPtr->maxVisibleColumns;
|
||||
scrollToColumn(bPtr, i, True);
|
||||
}
|
||||
|
||||
|
||||
/* call callback for click */
|
||||
if (bPtr->action)
|
||||
|
||||
@@ -320,8 +320,8 @@ WMGetColorRGBDescription(WMColor *color)
|
||||
{
|
||||
char *str = wmalloc(32);
|
||||
|
||||
sprintf(str, "rgb:%4x/%4x/%4x", color->color.red, color->color.green,
|
||||
color->color.blue);
|
||||
sprintf(str, "#%02x%02x%02x", color->color.red>>8, color->color.green>>8,
|
||||
color->color.blue>>8);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
|
||||
|
||||
|
||||
typedef struct W_ColorWell {
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
@@ -323,6 +326,8 @@ dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image)
|
||||
case ButtonRelease:
|
||||
if (activeWell != NULL) {
|
||||
WMSetColorWellColor(activeWell, cPtr->color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification,
|
||||
activeWell, NULL);
|
||||
} else {
|
||||
slideView(dragView, ev.xbutton.x_root, ev.xbutton.y_root,
|
||||
event->xmotion.x_root, event->xmotion.y_root);
|
||||
@@ -438,6 +443,8 @@ handleActionEvents(XEvent *event, void *data)
|
||||
color = WMCreateNamedColor(scr, t, False);
|
||||
if (color) {
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification,
|
||||
cPtr, NULL);
|
||||
WMReleaseColor(color);
|
||||
}
|
||||
free(t);
|
||||
|
||||
@@ -65,6 +65,7 @@ static void updateScroller(List *lPtr);
|
||||
|
||||
static void vScrollCallBack(WMWidget *scroller, void *self);
|
||||
|
||||
static void updateGeometry(WMList *lPtr);
|
||||
static void resizeList();
|
||||
|
||||
|
||||
@@ -187,7 +188,9 @@ WMInsertListItem(WMList *lPtr, int row, char *text)
|
||||
memset(item, 0, sizeof(WMListItem));
|
||||
item->text = wstrdup(text);
|
||||
|
||||
if (lPtr->selectedItem >= row && lPtr->selectedItem >= 0)
|
||||
|
||||
if (lPtr->selectedItem >= row && lPtr->selectedItem >= 0
|
||||
&& row >= 0)
|
||||
lPtr->selectedItem++;
|
||||
|
||||
if (lPtr->items==NULL) {
|
||||
@@ -311,6 +314,8 @@ WMSetListUserDrawItemHeight(WMList *lPtr, unsigned short height)
|
||||
|
||||
lPtr->flags.userItemHeight = 1;
|
||||
lPtr->itemHeight = height;
|
||||
|
||||
updateGeometry(lPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -804,14 +809,10 @@ handleActionEvents(XEvent *event, void *data)
|
||||
|
||||
|
||||
static void
|
||||
resizeList(WMList *lPtr, unsigned int width, unsigned int height)
|
||||
{
|
||||
W_ResizeView(lPtr->view, width, height);
|
||||
|
||||
WMResizeWidget(lPtr->vScroller, 1, height-2);
|
||||
|
||||
lPtr->fullFitLines = (height - 4) / lPtr->itemHeight;
|
||||
if (lPtr->fullFitLines * lPtr->itemHeight < height-4) {
|
||||
updateGeometry(WMList *lPtr)
|
||||
{
|
||||
lPtr->fullFitLines = (lPtr->view->size.height - 4) / lPtr->itemHeight;
|
||||
if (lPtr->fullFitLines * lPtr->itemHeight < lPtr->view->size.height - 4) {
|
||||
lPtr->flags.dontFitAll = 1;
|
||||
} else {
|
||||
lPtr->flags.dontFitAll = 0;
|
||||
@@ -827,6 +828,17 @@ resizeList(WMList *lPtr, unsigned int width, unsigned int height)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
resizeList(WMList *lPtr, unsigned int width, unsigned int height)
|
||||
{
|
||||
W_ResizeView(lPtr->view, width, height);
|
||||
|
||||
WMResizeWidget(lPtr->vScroller, 1, height-2);
|
||||
|
||||
updateGeometry(lPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyList(List *lPtr)
|
||||
{
|
||||
|
||||
@@ -512,17 +512,17 @@ W_ResizeView(W_View *view, unsigned int width, unsigned int height)
|
||||
void
|
||||
W_RedisplayView(W_View *view)
|
||||
{
|
||||
XExposeEvent ev;
|
||||
XEvent ev;
|
||||
|
||||
if (!view->flags.mapped)
|
||||
return;
|
||||
|
||||
ev.type = Expose;
|
||||
ev.display = view->screen->display;
|
||||
ev.window = view->window;
|
||||
ev.count = 0;
|
||||
ev.xexpose.type = Expose;
|
||||
ev.xexpose.display = view->screen->display;
|
||||
ev.xexpose.window = view->window;
|
||||
ev.xexpose.count = 0;
|
||||
|
||||
WMHandleEvent((XEvent*)&ev);
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user