mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-28 17:32:29 +01:00
WINGs: Added 'const' attribute to functions in dragdestination, wtext
This makes both the API and local function const-correct on their input parameters.
This commit is contained in:
committed by
Carlos R. Mafra
parent
72108875aa
commit
75a0beffeb
@@ -1607,9 +1607,9 @@ void WMSetTextBackgroundColor(WMText *tPtr, WMColor *color);
|
|||||||
|
|
||||||
void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap);
|
void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap);
|
||||||
|
|
||||||
void WMPrependTextStream(WMText *tPtr, char *text);
|
void WMPrependTextStream(WMText *tPtr, const char *text);
|
||||||
|
|
||||||
void WMAppendTextStream(WMText *tPtr, char *text);
|
void WMAppendTextStream(WMText *tPtr, const char *text);
|
||||||
|
|
||||||
#define WMClearText(tPtr) WMAppendTextStream \
|
#define WMClearText(tPtr) WMAppendTextStream \
|
||||||
((tPtr), (NULL))
|
((tPtr), (NULL))
|
||||||
@@ -1640,23 +1640,24 @@ int WMGetTextSelectionUnderlined(WMText *tPtr);
|
|||||||
|
|
||||||
void WMSetTextAlignment(WMText *tPtr, WMAlignment alignment);
|
void WMSetTextAlignment(WMText *tPtr, WMAlignment alignment);
|
||||||
|
|
||||||
Bool WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
Bool WMFindInTextStream(WMText *tPtr, const char *needle, Bool direction,
|
||||||
Bool caseSensitive);
|
Bool caseSensitive);
|
||||||
|
|
||||||
|
/* Warning: replacement can be modified by the function */
|
||||||
Bool WMReplaceTextSelection(WMText *tPtr, char *replacement);
|
Bool WMReplaceTextSelection(WMText *tPtr, char *replacement);
|
||||||
|
|
||||||
|
|
||||||
/* parser related stuff... use only if implementing a new parser */
|
/* parser related stuff... use only if implementing a new parser */
|
||||||
|
|
||||||
void* WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, char *description,
|
void* WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, const char *description,
|
||||||
WMColor *color, unsigned short first,
|
WMColor *color, unsigned short first,
|
||||||
unsigned short extraInfo);
|
unsigned short extraInfo);
|
||||||
|
|
||||||
void* WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, char *description,
|
void* WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, const char *description,
|
||||||
WMColor *color, unsigned short first,
|
WMColor *color, unsigned short first,
|
||||||
unsigned short extraInfo);
|
unsigned short extraInfo);
|
||||||
|
|
||||||
void* WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font,
|
void* WMCreateTextBlockWithText(WMText *tPtr, const char *text, WMFont *font,
|
||||||
WMColor *color, unsigned short first,
|
WMColor *color, unsigned short first,
|
||||||
unsigned short length);
|
unsigned short length);
|
||||||
|
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ storeDropData(WMView * destView, Atom selection, Atom target, Time timestamp, vo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool requestDropDataInSelection(WMView * destView, char *type)
|
Bool requestDropDataInSelection(WMView * destView, const char *type)
|
||||||
{
|
{
|
||||||
WMScreen *scr = W_VIEW_SCREEN(destView);
|
WMScreen *scr = W_VIEW_SCREEN(destView);
|
||||||
|
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ static void paintText(Text * tPtr)
|
|||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
char *text;
|
const char *text;
|
||||||
int len, y, c, s, done = False, dir /* 1 = down */ ;
|
int len, y, c, s, done = False, dir /* 1 = down */ ;
|
||||||
WMScreen *scr = tPtr->view->screen;
|
WMScreen *scr = tPtr->view->screen;
|
||||||
Display *dpy = tPtr->view->screen->display;
|
Display *dpy = tPtr->view->screen->display;
|
||||||
@@ -960,7 +960,7 @@ static void cursorToTextPosition(Text * tPtr, int x, int y)
|
|||||||
{
|
{
|
||||||
TextBlock *tb = NULL;
|
TextBlock *tb = NULL;
|
||||||
int done = False, s, pos, len, _w, _y, dir = 1; /* 1 == "down" */
|
int done = False, s, pos, len, _w, _y, dir = 1; /* 1 == "down" */
|
||||||
char *text;
|
const char *text;
|
||||||
|
|
||||||
if (tPtr->flags.needsLayOut)
|
if (tPtr->flags.needsLayOut)
|
||||||
layOutDocument(tPtr);
|
layOutDocument(tPtr);
|
||||||
@@ -1372,7 +1372,7 @@ static int layOutLine(Text * tPtr, myLineItems * items, int nitems, int x, int y
|
|||||||
{
|
{
|
||||||
int i, j = 0, lw = 0, line_height = 0, max_d = 0, len, n;
|
int i, j = 0, lw = 0, line_height = 0, max_d = 0, len, n;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
char *text;
|
const char *text;
|
||||||
TextBlock *tb, *tbsame = NULL;
|
TextBlock *tb, *tbsame = NULL;
|
||||||
|
|
||||||
if (!items || nitems == 0)
|
if (!items || nitems == 0)
|
||||||
@@ -1472,7 +1472,7 @@ static void layOutDocument(Text * tPtr)
|
|||||||
unsigned int itemsSize = 0, nitems = 0, begin, end;
|
unsigned int itemsSize = 0, nitems = 0, begin, end;
|
||||||
WMFont *font;
|
WMFont *font;
|
||||||
unsigned int x, y = 0, lw = 0, width = 0, bmargin;
|
unsigned int x, y = 0, lw = 0, width = 0, bmargin;
|
||||||
char *start = NULL, *mark = NULL;
|
const char *start = NULL, *mark = NULL;
|
||||||
|
|
||||||
if (tPtr->flags.frozen || (!(tb = tPtr->firstTextBlock)))
|
if (tPtr->flags.frozen || (!(tb = tPtr->firstTextBlock)))
|
||||||
return;
|
return;
|
||||||
@@ -2640,9 +2640,9 @@ static void handleEvents(XEvent * event, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insertPlainText(Text * tPtr, char *text)
|
static void insertPlainText(Text * tPtr, const char *text)
|
||||||
{
|
{
|
||||||
char *start, *mark;
|
const char *start, *mark;
|
||||||
void *tb = NULL;
|
void *tb = NULL;
|
||||||
|
|
||||||
start = text;
|
start = text;
|
||||||
@@ -3060,7 +3060,7 @@ WMText *WMCreateTextForDocumentType(WMWidget * parent, WMAction * parser, WMActi
|
|||||||
return tPtr;
|
return tPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMPrependTextStream(WMText * tPtr, char *text)
|
void WMPrependTextStream(WMText * tPtr, const char *text)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
@@ -3085,7 +3085,7 @@ void WMPrependTextStream(WMText * tPtr, char *text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMAppendTextStream(WMText * tPtr, char *text)
|
void WMAppendTextStream(WMText * tPtr, const char *text)
|
||||||
{
|
{
|
||||||
CHECK_CLASS(tPtr, WC_Text);
|
CHECK_CLASS(tPtr, WC_Text);
|
||||||
|
|
||||||
@@ -3152,7 +3152,7 @@ void WMSetTextDelegate(WMText * tPtr, WMTextDelegate * delegate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *WMCreateTextBlockWithObject(WMText * tPtr, WMWidget * w,
|
void *WMCreateTextBlockWithObject(WMText * tPtr, WMWidget * w,
|
||||||
char *description, WMColor * color,
|
const char *description, WMColor * color,
|
||||||
unsigned short first, unsigned short extraInfo)
|
unsigned short first, unsigned short extraInfo)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
@@ -3185,7 +3185,7 @@ void *WMCreateTextBlockWithObject(WMText * tPtr, WMWidget * w,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *WMCreateTextBlockWithPixmap(WMText * tPtr, WMPixmap * p,
|
void *WMCreateTextBlockWithPixmap(WMText * tPtr, WMPixmap * p,
|
||||||
char *description, WMColor * color,
|
const char *description, WMColor * color,
|
||||||
unsigned short first, unsigned short extraInfo)
|
unsigned short first, unsigned short extraInfo)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
@@ -3217,7 +3217,7 @@ void *WMCreateTextBlockWithPixmap(WMText * tPtr, WMPixmap * p,
|
|||||||
return tb;
|
return tb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *WMCreateTextBlockWithText(WMText * tPtr, char *text, WMFont * font, WMColor * color,
|
void *WMCreateTextBlockWithText(WMText * tPtr, const char *text, WMFont * font, WMColor * color,
|
||||||
unsigned short first, unsigned short len)
|
unsigned short first, unsigned short len)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
@@ -3814,9 +3814,9 @@ void WMThawText(WMText * tPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find first occurence of a string */
|
/* find first occurence of a string */
|
||||||
static char *mystrstr(char *haystack, char *needle, unsigned short len, char *end, Bool caseSensitive)
|
static const char *mystrstr(const char *haystack, const char *needle, unsigned short len, const char *end, Bool caseSensitive)
|
||||||
{
|
{
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
if (!haystack || !needle || !end)
|
if (!haystack || !needle || !end)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3836,9 +3836,9 @@ static char *mystrstr(char *haystack, char *needle, unsigned short len, char *en
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find last occurence of a string */
|
/* find last occurence of a string */
|
||||||
static char *mystrrstr(char *haystack, char *needle, unsigned short len, char *end, Bool caseSensitive)
|
static const char *mystrrstr(const char *haystack, const char *needle, unsigned short len, const char *end, Bool caseSensitive)
|
||||||
{
|
{
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
if (!haystack || !needle || !end)
|
if (!haystack || !needle || !end)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3856,10 +3856,10 @@ static char *mystrrstr(char *haystack, char *needle, unsigned short len, char *e
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool WMFindInTextStream(WMText * tPtr, char *needle, Bool direction, Bool caseSensitive)
|
Bool WMFindInTextStream(WMText * tPtr, const char *needle, Bool direction, Bool caseSensitive)
|
||||||
{
|
{
|
||||||
TextBlock *tb;
|
TextBlock *tb;
|
||||||
char *mark = NULL;
|
const char *mark = NULL;
|
||||||
unsigned short pos;
|
unsigned short pos;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
Reference in New Issue
Block a user