1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-08 09:25:49 +01:00

Updating to version 0.20.2

Many bug fixes.
This commit is contained in:
dan
1998-10-21 14:43:47 +00:00
parent 9d2e6ef9f1
commit 9af1c6c415
222 changed files with 9132 additions and 4322 deletions

View File

@@ -1,6 +1,13 @@
changes since wmaker 0.20.0:
............................
- added generic object field for WMListItem. This is for hanging generic
clientdata
changes since wmaker 0.20.0:
............................
- changed WMGetFilePanelFile() with WMGetFilePanelFileName()
- made SavePanel

View File

@@ -6,7 +6,7 @@ SUBDIRS = Resources
LIBLIST= -L$(top_builddir)/wrlib -lwraster @XLFLAGS@ @GFXLIBS@ @XLIBS@ \
-lm @LIBPL_LIBS@
-lm -L$(top_builddir)/libPropList -lPropList
lib_LIBRARIES = libWINGs.a
@@ -78,13 +78,13 @@ libWINGs_a_SOURCES = \
findfile.c \
hashtable.c \
memory.c \
usleep.c
usleep.c
##
## Find a better way than $(GFXFLAGS) to inform widgets.c wich of
## tiff or xpm images should be used
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src @XCFLAGS@ \
INCLUDES = @XCFLAGS@ -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" $(GFXFLAGS) -DDEBUG \
@LIBPL_INC_PATH@
-I$(top_srcdir)/libPropList

View File

@@ -68,8 +68,6 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LIBPL_INC_PATH = @LIBPL_INC_PATH@
LIBPL_LIBS = @LIBPL_LIBS@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -96,7 +94,7 @@ AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS = Resources
LIBLIST= -L$(top_builddir)/wrlib -lwraster @XLFLAGS@ @GFXLIBS@ @XLIBS@ \
-lm @LIBPL_LIBS@
-lm -L$(top_builddir)/libPropList -lPropList
lib_LIBRARIES = libWINGs.a
@@ -165,11 +163,11 @@ libWINGs_a_SOURCES = \
findfile.c \
hashtable.c \
memory.c \
usleep.c
usleep.c
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src @XCFLAGS@ \
INCLUDES = @XCFLAGS@ -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" $(GFXFLAGS) -DDEBUG \
@LIBPL_INC_PATH@
-I$(top_srcdir)/libPropList
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../src/config.h
CONFIG_CLEAN_FILES =

View File

@@ -25,9 +25,9 @@ and faster than say, Motif or even Athena. Knowing Xlib will help you to
workaround some of it's limitations, although you'll probably be able to
write something like a trivial tic-tac-toe game without knowing much Xlib.
Some of it's functions are designed to support the WindowMaker window
Some of it's functions are designed to support the Window Maker window
manager (see http://windowmaker.org) In fact, it's primary role is to
support WindowMaker. All other uses of it are just an added bonus.
support Window Maker. All other uses of it are just an added bonus.
It will help you to understand the API if you read the ApplicationKit
reference manual, distributed as a PDF by Apple. The function names,

View File

@@ -68,8 +68,6 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LIBPL_INC_PATH = @LIBPL_INC_PATH@
LIBPL_LIBS = @LIBPL_LIBS@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@

View File

@@ -6,7 +6,7 @@
#include <wraster.h>
#include <X11/Xlib.h>
#define WINGS_H_VERSION 980922
#define WINGS_H_VERSION 980930
@@ -286,6 +286,7 @@ typedef struct W_FontPanel WMFontPanel;
/* item for WMList */
typedef struct WMListItem {
char *text;
void *clientData; /* ptr for user clientdata. */
struct WMListItem *nextPtr;
@@ -393,6 +394,12 @@ void WMScreenMainLoop(WMScreen *scr);
RContext *WMScreenRContext(WMScreen *scr);
Display *WMScreenDisplay(WMScreen *scr);
int WMScreenDepth(WMScreen *scr);
void WMSetApplicationIconImage(WMScreen *app, WMPixmap *icon);
WMPixmap *WMGetApplicationIconImage(WMScreen *app);
@@ -434,11 +441,11 @@ WMHandlerID WMAddInputHandler(int fd, int condition, WMInputProc *proc,
void WMDeleteInputHandler(WMHandlerID handlerID);
/* ....................................................................... */
/*
void WMDragImageFromView(WMView *view, WMPixmap *image, WMPoint atLocation,
WMSize mouseOffset, XEvent *event, Bool slideBack);
*/
/* ....................................................................... */
@@ -547,8 +554,6 @@ int WMWidthOfString(WMFont *font, char *text, int length);
WMScreen *WMWidgetScreen(WMWidget *w);
Display *WMScreenDisplay(WMScreen *scr);
void WMUnmapWidget(WMWidget *w);
void WMMapWidget(WMWidget *w);
@@ -898,6 +903,10 @@ WMScroller *WMGetScrollViewHorizontalScroller(WMScrollView *sPtr);
WMScroller *WMGetScrollViewVerticalScroller(WMScrollView *sPtr);
void WMSetScrollViewLineScroll(WMScrollView *sPtr, int amount);
void WMSetScrollViewPageScroll(WMScrollView *sPtr, int amount);
/* ....................................................................... */
WMSlider *WMCreateSlider(WMWidget *parent);
@@ -963,7 +972,7 @@ void WMDestroyInputPanel(WMInputPanel *panel);
/* ....................................................................... */
/* only 1 instance per WMScreen */
WMOpenPanel *WMGetOpenPanel(WMScreen *app);
WMOpenPanel *WMGetOpenPanel(WMScreen *scrPtr);
WMSavePanel *WMGetSavePanel(WMScreen *scrPtr);

View File

@@ -6,7 +6,7 @@
#include "WINGs.h"
#include "WUtil.h"
#if WINGS_H_VERSION < 980922
#if WINGS_H_VERSION < 980930
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
#endif
@@ -234,8 +234,8 @@ typedef struct W_View {
#if 0
struct W_DragSourceProcs *dragSourceProcs;
struct W_DragDestinationProcs *dragDestinationProcs;
#endif
int helpContext;
#endif
struct {
unsigned int realized:1;

View File

@@ -5,6 +5,13 @@
#include <sys/types.h>
/* SunOS 4.x Blargh.... */
#ifndef NULL
#define NULL ((void*)0)
#endif
/*
* Warning: proplist.h #defines BOOL which will clash with the
* typedef BOOL in Xmd.h
@@ -65,7 +72,12 @@ typedef struct {
} WMHashTableCallbacks;
#if 0
typedef struct {
char character; /* the escape character */
char *value; /* value to place */
} WMSEscapes;
#endif
typedef void WMNotificationObserverAction(void *observerData,
@@ -105,6 +117,10 @@ char *wdefaultspathfordomain(char *domain);
void wusleep(unsigned int microsec);
#if 0
int wsprintesc(char *buffer, int length, char *format, WMSEscapes **escapes,
int count);
#endif
/*......................................................................*/

View File

@@ -1,5 +1,5 @@
/*
* WindowMaker miscelaneous function library
* Window Maker miscelaneous function library
*
* Copyright (c) 1997 Alfredo K. Kojima
*
@@ -53,7 +53,8 @@ wfatal(const char *msg, ...)
fputs(_WINGS_progname, stderr);
fputs(" fatal error: ",stderr);
fputs(buf, stderr);
fflush(NULL);
fflush(stdout);
fflush(stderr);
va_end(args);
}
@@ -79,7 +80,8 @@ wwarning(const char *msg, ...)
fputs(_WINGS_progname, stderr);
fputs(" warning: ",stderr);
fputs(buf, stderr);
fflush(NULL);
fflush(stdout);
fflush(stderr);
va_end(args);
}
@@ -109,7 +111,8 @@ wsyserror(const char *msg, ...)
strcat(buf, strerror(error));
strcat(buf,"\n");
fputs(buf, stderr);
fflush(NULL);
fflush(stderr);
fflush(stdout);
#else
perror(buf);
#endif

View File

@@ -1,5 +1,5 @@
/*
* WindowMaker miscelaneous function library
* Window Maker miscelaneous function library
*
* Copyright (c) 1997 Alfredo K. Kojima
*

View File

@@ -1,5 +1,5 @@
/*
* WindowMaker miscelaneous function library
* Window Maker miscelaneous function library
*
* Copyright (c) 1997 Alfredo K. Kojima
*

View File

@@ -7,17 +7,16 @@
# include <sys/time.h>
#endif
#ifdef _AIX
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if defined(HAVE_SELECT)
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
void
wusleep(unsigned int microsecs)

View File

@@ -435,9 +435,10 @@ paintItem(WMList *lPtr, Drawable d, char *text, int state, WMRect *rect)
width, height);
else
XClearArea(scr->display, d, x, y, width, height, False);
W_PaintText(view, d, scr->normalFont, x+4, y, width,
WALeft, W_GC(scr->black), False, text, strlen(text));
if (text)
W_PaintText(view, d, scr->normalFont, x+4, y, width,
WALeft, W_GC(scr->black), False, text, strlen(text));
if (state & WLDSIsBranch) {
XDrawLine(scr->display, d, W_GC(scr->darkGray), x+width-11, y+3,

View File

@@ -31,7 +31,7 @@ extern _WINGsConfiguration WINGsConfiguration;
typedef struct TimerHandler {
WMCallback *callback; /* procedure to call */
unsigned long msec; /* when to call the callback */
struct timeval when; /* when to call the callback */
void *clientData;
struct TimerHandler *next;
} TimerHandler;
@@ -114,22 +114,32 @@ static WMEventHook *extraEventHandler=NULL;
#define idlePending() (idleHandler)
/* return current time in milliseconds */
#ifdef HAVE_GETTIMEOFDAY
static unsigned long
rightNow(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
return 1000L*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec/1000L;
static void
rightNow(struct timeval *tv) {
gettimeofday(tv, NULL);
}
#else /* !HAVE_GETTIMEOFDAY */
# define rightNow() (1000*(unsigned long)time(NULL))
# define rightNow(tv) (tv)->tv_sec==time(NULL),(tv)->tv_usec=0
#endif /* !HAVE_GETTIMEOFDAY */
/* is t1 after t2 ? */
#define IS_AFTER(t1, t2) (((t1).tv_sec > (t2).tv_sec) || \
(((t1).tv_sec == (t2).tv_sec) \
&& ((t1).tv_usec > (t2).tv_usec)))
static void
addmillisecs(struct timeval *tv, int milliseconds)
{
tv->tv_usec += milliseconds*1000;
tv->tv_sec += tv->tv_usec/1000000;
tv->tv_usec = tv->tv_usec%1000000;
}
WMHandlerID
WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
{
@@ -139,17 +149,18 @@ WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
if (!handler)
return NULL;
handler->msec = rightNow()+milliseconds;
rightNow(&handler->when);
addmillisecs(&handler->when, milliseconds);
handler->callback = callback;
handler->clientData = cdata;
/* insert callback in queue, sorted by time left */
if (!timerHandler || timerHandler->msec >= handler->msec) {
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
/* first in the queue */
handler->next = timerHandler;
timerHandler = handler;
} else {
tmp = timerHandler;
while (tmp->next && tmp->next->msec < handler->msec) {
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
tmp = tmp->next;
}
handler->next = tmp->next;
@@ -341,12 +352,11 @@ static void
checkTimerHandlers()
{
TimerHandler *handler;
unsigned long now = rightNow();
struct timeval now;
rightNow(&now);
if (!timerHandler || (timerHandler->msec > now))
return;
while (timerHandler && timerHandler->msec <= now) {
while (timerHandler && IS_AFTER(now, timerHandler->when)) {
handler = timerHandler;
timerHandler = timerHandler->next;
handler->next = NULL;
@@ -357,22 +367,26 @@ checkTimerHandlers()
static unsigned long
msToNextTimerEvent()
static void
delayUntilNextTimerEvent(struct timeval *delay)
{
unsigned long now;
struct timeval now;
if (!timerHandler) {
/* The return value of this function is only valid if there _are_
timers active. */
return 0;
delay->tv_sec = 0;
delay->tv_usec = 0;
return;
}
now = rightNow();
if (timerHandler->msec < now) {
return 0;
rightNow(&now);
if (IS_AFTER(now, timerHandler->when)) {
delay->tv_sec = 0;
delay->tv_usec = 0;
} else {
return timerHandler->msec - now;
delay->tv_sec = timerHandler->when.tv_sec - now.tv_sec;
delay->tv_usec = timerHandler->when.tv_usec - now.tv_usec;
}
}
@@ -693,7 +707,6 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
#ifndef HAVE_SELECT
#error This_system_does_not_have_select(2)_and_is_not_supported
#endif
unsigned long milliseconds;
struct timeval timeout;
struct timeval *timeoutPtr;
fd_set rset, wset, eset;
@@ -730,9 +743,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
* next timer expires.
*/
if (timerPending()) {
milliseconds = msToNextTimerEvent();
timeout.tv_sec = milliseconds / 1000;
timeout.tv_usec = (milliseconds % 1000) * 1000;
delayUntilNextTimerEvent(&timeout);
timeoutPtr = &timeout;
} else {
timeoutPtr = (struct timeval*)0;
@@ -841,9 +852,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
* next timer expires.
*/
if (timerPending()) {
milliseconds = msToNextTimerEvent();
timeout.tv_sec = milliseconds / 1000;
timeout.tv_usec = (milliseconds % 1000) * 1000;
delayUntilNextTimerEvent(&timeout);
timeoutOrInfty = &timeout;
} else {
timeoutOrInfty = (struct timeval*)0;

View File

@@ -243,6 +243,9 @@ WMGetSavePanel(WMScreen *scrPtr)
void
WMFreeFilePanel(WMFilePanel *panel)
{
if (panel == WMWidgetScreen(panel->win)->sharedSavePanel) {
WMWidgetScreen(panel->win)->sharedSavePanel = NULL;
}
if (panel == WMWidgetScreen(panel->win)->sharedOpenPanel) {
WMWidgetScreen(panel->win)->sharedOpenPanel = NULL;
}
@@ -501,8 +504,12 @@ getCurrentFileName(WMFilePanel *panel)
if (path[len-1]=='/') {
file = WMGetTextFieldText(panel->fileField);
tmp = wmalloc(strlen(path)+strlen(file)+8);
strcpy(tmp, path);
strcat(tmp, file);
if (file[0]!='/') {
strcpy(tmp, path);
strcat(tmp, file);
} else
strcpy(tmp, file);
free(file);
free(path);
return tmp;

View File

@@ -421,7 +421,8 @@ loadPixmaps(WMScreen *scr)
image = RLoadImage(scr->rcontext, WINGS_IMAGES_FILE, 0);
if (!image) {
wwarning("WINGs: could not load widget images file: %s", RErrorString);
wwarning("WINGs: could not load widget images file: %s",
RMessageForError(RErrorCode));
return False;
}
/* make it have a gray background */
@@ -653,6 +654,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->rootView = W_CreateRootView(scrPtr);
W_InitApplication(scrPtr);
return scrPtr;
}
@@ -886,6 +889,13 @@ WMScreenDisplay(WMScreen *scr)
}
int
WMScreenDepth(WMScreen *scr)
{
return scr->depth;
}
void
WMRedisplayWidget(WMWidget *w)
{

View File

@@ -424,7 +424,7 @@ int main(int argc, char **argv)
*
* Put the testSomething() function you want to test here.
*/
#if 0
#if 1
testOpenFilePanel(scr);
testFontPanel(scr);
testList(scr);

View File

@@ -573,9 +573,9 @@ handleEvents(XEvent *event, void *data)
#endif
paintTextField(tPtr);
WMPostNotificationName(WMTextDidBeginEditingNotification, tPtr, NULL);
WMPostNotificationName(WMTextDidBeginEditingNotification, tPtr, NULL);
tPtr->flags.notIllegalMovement = 0;
tPtr->flags.notIllegalMovement = 0;
break;
case FocusOut:
@@ -588,8 +588,8 @@ handleEvents(XEvent *event, void *data)
paintTextField(tPtr);
if (!tPtr->flags.notIllegalMovement) {
WMPostNotificationName(WMTextDidEndEditingNotification, tPtr,
WMIllegalTextMovement);
WMPostNotificationName(WMTextDidEndEditingNotification, tPtr,
(void*)WMIllegalTextMovement);
}
break;
@@ -614,7 +614,6 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
int count, refresh = 0;
int control_pressed = 0;
int changed;
WMNotification *notif;
WMScreen *scr = tPtr->view->screen;
changed = 0;
@@ -629,29 +628,27 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
switch (ksym) {
case XK_Tab:
if (event->xkey.state & ShiftMask) {
notif = WMCreateNotification(WMTextDidEndEditingNotification,
tPtr, (void*)WMBacktabTextMovement);
if (tPtr->view->prevFocusChain) {
W_SetFocusOfTopLevel(W_TopLevelOfView(tPtr->view),
tPtr->view->prevFocusChain);
tPtr->flags.notIllegalMovement = 1;
}
WMPostNotificationName(WMTextDidEndEditingNotification, tPtr,
(void*)WMBacktabTextMovement);
} else {
notif = WMCreateNotification(WMTextDidEndEditingNotification,
tPtr, (void*)WMTabTextMovement);
if (tPtr->view->nextFocusChain) {
W_SetFocusOfTopLevel(W_TopLevelOfView(tPtr->view),
tPtr->view->nextFocusChain);
tPtr->flags.notIllegalMovement = 1;
}
WMPostNotificationName(WMTextDidEndEditingNotification,
tPtr, (void*)WMTabTextMovement);
}
WMPostNotification(notif);
WMReleaseNotification(notif);
break;
case XK_Return:
WMPostNotificationName(WMTextDidEndEditingNotification, tPtr,
(void*)WMReturnTextMovement);
WMPostNotificationName(WMTextDidEndEditingNotification, tPtr,
(void*)WMReturnTextMovement);
break;
case WM_EMACSKEY_LEFT:

View File

@@ -149,7 +149,6 @@ WMWindow*
WMCreateWindowWithStyle(WMScreen *screen, char *name, int style)
{
_Window *win;
static int initedApp = 0;
win = wmalloc(sizeof(_Window));
memset(win, 0, sizeof(_Window));
@@ -175,11 +174,6 @@ WMCreateWindowWithStyle(WMScreen *screen, char *name, int style)
W_ResizeView(win->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
if (!initedApp) {
W_InitApplication(screen);
initedApp = 1;
}
WMAddNotificationObserver(realizeObserver, win,
WMViewRealizedNotification, win->view);