1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

- put back wmksize(), wmkrange() and wmkpoint() as functions instead of macros

- fixed some compilation warnings with -Wall
- some code cleanup
This commit is contained in:
dan
2001-04-19 01:04:48 +00:00
parent 03824d5324
commit 648d75c299
21 changed files with 91 additions and 50 deletions

View File

@@ -592,6 +592,7 @@ removeConnection(void *observer, WMNotification *notification)
}
#if 0
static Bool
isDifferent(char *str1, char *str2) /*FOLD00*/
{
@@ -600,6 +601,7 @@ isDifferent(char *str1, char *str2) /*FOLD00*/
return True;
}
#endif
int

View File

@@ -26,7 +26,7 @@ int numberOfRows(WMTableViewDelegate *self, WMTableView *table)
void *valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
{
WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column);
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column);*/
int i;
if (col1[0] == 0) {
for (i = 0; i < 20; i++) {
@@ -90,7 +90,7 @@ main(int argc, char **argv)
table = WMCreateTableView(win);
WMResizeWidget(table, 400, 200);
WMSetTableViewBackgroundColor(table, WMWhiteColor(scr));
// WMSetTableViewGridColor(table, WMGrayColor(scr));
/*WMSetTableViewGridColor(table, WMGrayColor(scr));*/
WMSetTableViewHeaderHeight(table, 20);
WMSetTableViewDelegate(table, &delegate);
WMSetTableViewAction(table, clickedTable, table);

View File

@@ -381,10 +381,7 @@ WMTableView *WMCreateTableView(WMWidget *parent)
void WMAddTableViewColumn(WMTableView *table, WMTableColumn *column)
{
int width;
int i;
WMScreen *scr = WMWidgetScreen(table);
int count;
column->table = table;
@@ -952,7 +949,7 @@ static void rearrangeHeader(WMTableView *table)
int width;
int count;
int i;
WMRect rect = WMGetScrollViewVisibleRect(table->scrollView);
/*WMRect rect = WMGetScrollViewVisibleRect(table->scrollView);*/
width = 0;

View File

@@ -34,6 +34,7 @@ libWINGs_a_SOURCES = \
host.c \
international.c \
memory.c \
misc.c \
notification.c \
selection.c \
string.c \
@@ -87,6 +88,7 @@ libWUtil_a_SOURCES = \
host.c \
international.c \
memory.c \
misc.c \
notification.c \
string.c \
tree.c \

View File

@@ -194,11 +194,7 @@ singleClick(WMWidget *self, void *data)
static void
doubleClick(WMWidget *self, void *data)
{
WMLabel *label = (WMLabel*)data;
WMList *lPtr = (WMList*)self;
char buf[255];
WMSelectAllListItems(lPtr);
WMSelectAllListItems((WMList*)self);
}

View File

@@ -36,9 +36,6 @@ typedef struct {
WMSize size;
} WMRect;
#define wmksize(width, height) (WMSize){(width), (height)}
#define wmkpoint(x, y) (WMPoint){(x), (y)}
#define wmkrect(pos, size) (WMRect){(pos), (size)}
@@ -577,6 +574,17 @@ typedef struct W_DragDestinationProcs {
/* ...................................................................... */
WMPoint wmkpoint(int x, int y);
WMSize wmksize(unsigned int width, unsigned int height);
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
#define wmksize(width, height) (WMSize){(width), (height)}
#define wmkpoint(x, y) (WMPoint){(x), (y)}
#endif
/* ....................................................................... */

View File

@@ -154,8 +154,6 @@ typedef struct {
int count;
} WMRange;
#define wmkrange(position, count) (WMRange){(position), (count)}
/* DO NOT ACCESS THE CONTENTS OF THIS STRUCT */
@@ -277,6 +275,11 @@ void wtokenfree(char **tokens, int count);
char* wtrimspace(char *s);
WMRange wmkrange(int start, int count);
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
#define wmkrange(position, count) (WMRange){(position), (count)}
#endif
char* wusergnusteppath();

View File

@@ -195,7 +195,7 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
if (cPtr->state == WCInProgress) {
Bool failed;
int result;
int len = sizeof(result);
socklen_t len = sizeof(result);
WCErrorCode = 0;
if (getsockopt(cPtr->sock, SOL_SOCKET, SO_ERROR,
@@ -393,7 +393,8 @@ WMCreateConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
{
WMConnection *cPtr;
struct sockaddr_in clientname;
int size, n;
socklen_t size;
int n;
cPtr = createConnectionWithSocket(sock, closeOnRelease);
cPtr->wasNonBlocking = WMIsConnectionNonBlocking(cPtr);
@@ -441,7 +442,8 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
{
WMConnection *cPtr;
struct sockaddr_in *socketaddr;
int sock, size, on;
int sock, on;
socklen_t size;
WCErrorCode = 0;
@@ -652,7 +654,7 @@ WMConnection*
WMAcceptConnection(WMConnection *listener) /*FOLD00*/
{
struct sockaddr_in clientname;
int size;
socklen_t size;
int newSock;
WMConnection *newConnection;

View File

@@ -189,8 +189,8 @@ receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
Bool WMRequestDroppedData(WMView *view, WMDraggingInfo *info, char *type,
WMDropDataCallback *callback)
{
WMScreen *scr = W_VIEW_SCREEN(view);
#if 0
WMScreen *scr = W_VIEW_SCREEN(view);
if (info->finished) {
return False;
}

View File

@@ -260,7 +260,6 @@ void
WMDeleteIdleHandler(WMHandlerID handlerID)
{
IdleHandler *handler = (IdleHandler*)handlerID;
int pos;
if (!handler || !idleHandler)
return;
@@ -295,7 +294,6 @@ void
WMDeleteInputHandler(WMHandlerID handlerID)
{
InputHandler *handler = (InputHandler*)handlerID;
int pos;
if (!handler || !inputHandler)
return;

View File

@@ -193,8 +193,6 @@ WMRetainHost(WMHost *hPtr)
void
WMReleaseHost(WMHost *hPtr)
{
int i;
hPtr->refCount--;
if (hPtr->refCount > 0)

View File

@@ -750,7 +750,7 @@ handleActionEvents(XEvent *event, void *data)
if (event->xbutton.button == Button1) {
if (bPtr->flags.pushed) {
if (bPtr->groupIndex==0 ||
bPtr->flags.selected && bPtr->groupIndex > 0)
(bPtr->flags.selected && bPtr->groupIndex > 0))
doclick = 1;
dopaint = 1;
if (bPtr->flags.springLoaded) {

View File

@@ -284,6 +284,12 @@ enum {
#define MAX_LENGTH 1024
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
static int fetchFile(char* toPath, char *imageSrcFile,
char *imageDestFileName);
char *generateNewFilename(char *curName);

View File

@@ -208,7 +208,7 @@ int
WMHandleEvent(XEvent *event)
{
W_EventHandler *hPtr;
W_View *view, *vPtr, *toplevel;
W_View *view, *toplevel;
unsigned long mask;
Window window;
WMArrayIterator iter;

View File

@@ -370,7 +370,6 @@ WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
char *path, char *name, char **fileTypes)
{
WMScreen *scr = WMWidgetScreen(panel->win);
XEvent event;
if (name && !owner) {
WMSetWindowTitle(panel->win, name);

View File

@@ -316,5 +316,31 @@ W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,
WMPoint
wmkpoint(int x, int y)
{
WMPoint point;
point.x = x;
point.y = y;
return point;
}
WMSize
wmksize(unsigned int width, unsigned int height)
{
WMSize size;
size.width = width;
size.height = height;
return size;
}

View File

@@ -782,8 +782,6 @@ handleActionEvents(XEvent *event, void *data)
static void
destroyPopUpButton(PopUpButton *bPtr)
{
WMMenuItem *item;
if (bPtr->timer) {
WMDeleteTimerHandler(bPtr->timer);
}

View File

@@ -378,7 +378,6 @@ WMTabViewItem*
WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y)
{
int i;
int offset;
int count = tPtr->visibleTabs;
int first = tPtr->firstVisible;
@@ -526,7 +525,7 @@ static void
recalcTabWidth(TabView *tPtr)
{
int i;
int twidth = W_VIEW(tPtr)->size.width;
/*int twidth = W_VIEW(tPtr)->size.width;*/
int width;
if (tPtr->flags.uniformTabs) {
@@ -679,7 +678,7 @@ paintTabView(TabView *tPtr)
int moreAtLeft;
int moreAtRight;
int selectedIsVisible;
int tx, ty;
int ty;
int twidth, theight;
ty = 2;

View File

@@ -178,16 +178,21 @@ typedef struct W_Text {
#define TYPETEXT 0
#if 0
/* just to print blocks of text not terminated by \0 */
static void
output(char *ptr, int len)
{
char s[len+1];
char *s;
s = wmalloc(len+1);
memcpy(s, ptr, len);
s[len] = 0;
/* printf(" s is [%s] (%d)\n", s, strlen(s)); */
printf("[%s]\n", s);
wfree(s);
}
#endif
#if DO_BLINK
@@ -829,7 +834,7 @@ _getSibling:
tb->selected = True;
XFillRectangle(dpy, d, tPtr->stippledGC,
//XFillRectangle(dpy, tPtr->db, tPtr->stippledGC,
/*XFillRectangle(dpy, tPtr->db, tPtr->stippledGC,*/
rect.x, rect.y, rect.width, rect.height);
}
}
@@ -2025,20 +2030,22 @@ insertTextInteractively(Text *tPtr, char *text, int len)
if ((newline = strchr(text, '\n'))) {
int nlen = (int)(newline-text);
int s = tb->used - tPtr->tpos;
char save[s];
if (!tb->blank && nlen>0) {
char *save;
if (s > 0) {
save = wmalloc(s);
memcpy(save, &tb->text[tPtr->tpos], s);
tb->used -= (tb->used - tPtr->tpos);
}
insertTextInteractively(tPtr, text, nlen);
newline++;
WMAppendTextStream(tPtr, newline);
if (s>0)
if (s>0) {
insertTextInteractively(tPtr, save, s);
wfree(save);
}
} else {
if (tPtr->tpos>0 && tPtr->tpos < tb->used
&& !tb->graphic && tb->text) {
@@ -2079,7 +2086,6 @@ insertTextInteractively(Text *tPtr, char *text, int len)
tPtr->currentTextBlock = tPtr->currentTextBlock->next;
}
}
} else {
if (tb->used + len >= tb->allocated) {
tb->allocated = reqBlockSize(tb->used+len);
@@ -2589,13 +2595,14 @@ handleActionEvents(XEvent *event, void *data)
tPtr->lastClickTime = event->xbutton.time;
if(tb && tb->graphic && !tb->object) {
char desc[tb->used+1];
if(tPtr->delegate && tPtr->delegate->didDoubleClickOnPicture) {
char *desc;
desc = wmalloc(tb->used+1);
memcpy(desc, tb->text, tb->used);
desc[tb->used] = 0;
if(tPtr->delegate) {
if(tPtr->delegate->didDoubleClickOnPicture)
(*tPtr->delegate->didDoubleClickOnPicture)
(tPtr->delegate, desc);
(*tPtr->delegate->didDoubleClickOnPicture)(tPtr->delegate, desc);
wfree(desc);
}
} else {
autoSelectText(tPtr, 2);

View File

@@ -30,7 +30,7 @@
#include <math.h>
#ifndef PI
#define PI 3.141592654
#define PI 3.14159265358979323846
#endif

View File

@@ -29,7 +29,7 @@
#include <math.h>
#ifndef PI
#define PI 3.141592
#define PI 3.14159265358979323846
#endif
#include <assert.h>