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

fixed some Bool flags passed to WINgs functions to always set 1 or 0 values internally

This commit is contained in:
dan
2002-03-28 04:20:30 +00:00
parent 208ee16849
commit e4a53ba71e
21 changed files with 36 additions and 27 deletions

View File

@@ -13,6 +13,8 @@ Changes since wmaker 0.80.0:
- Fixed WMGetViewScreenPosition() to consider the window decorations. - Fixed WMGetViewScreenPosition() to consider the window decorations.
- Added ability to enable/disable individual WMTableViewItems. - Added ability to enable/disable individual WMTableViewItems.
- Fixed textfields regarding interpretation of special keys with modifiers. - Fixed textfields regarding interpretation of special keys with modifiers.
- Fixed some functions that accept a boolean flag as a paramater, to set only
1 or 0 for the flag value, not the flag passed by the user.
Changes since wmaker 0.70.0: Changes since wmaker 0.70.0:

View File

@@ -106,7 +106,7 @@ void WMSetTableColumnConstraints(WMTableColumn *column,
void WMSetTableColumnEditable(WMTableColumn *column, Bool flag) void WMSetTableColumnEditable(WMTableColumn *column, Bool flag)
{ {
column->editable = flag; column->editable = ((flag==0) ? 0 : 1);
} }

View File

@@ -1650,7 +1650,7 @@ int WMGetTextInsertType(WMText *tPtr);
//int WMGetCurrentTextBlock(WMText *tPtr); //int WMGetCurrentTextBlock(WMText *tPtr);
//void WMPrependTextBlock(WMText *tPtr, void *vtb); void WMPrependTextBlock(WMText *tPtr, void *vtb);
void WMAppendTextBlock(WMText *tPtr, void *vtb); void WMAppendTextBlock(WMText *tPtr, void *vtb);

View File

@@ -925,6 +925,8 @@ WMSetConnectionNonBlocking(WMConnection *cPtr, Bool flag)
{ {
wassertrv(cPtr!=NULL && cPtr->sock>=0, False); wassertrv(cPtr!=NULL && cPtr->sock>=0, False);
flag = ((flag==0) ? 0 : 1);
if (cPtr->isNonBlocking == flag) if (cPtr->isNonBlocking == flag)
return True; return True;
@@ -942,7 +944,7 @@ WMSetConnectionCloseOnExec(WMConnection *cPtr, Bool flag)
{ {
wassertrv(cPtr!=NULL && cPtr->sock>=0, False); wassertrv(cPtr!=NULL && cPtr->sock>=0, False);
if (fcntl(cPtr->sock, F_SETFD, (flag ? FD_CLOEXEC : 0)) < 0) { if (fcntl(cPtr->sock, F_SETFD, ((flag==0) ? 0 : FD_CLOEXEC)) < 0) {
return False; return False;
} }

View File

@@ -213,7 +213,7 @@ WMReleaseHost(WMHost *hPtr)
void void
WMSetHostCacheEnabled(Bool flag) WMSetHostCacheEnabled(Bool flag)
{ {
hostCacheEnabled = flag; hostCacheEnabled = ((flag==0) ? 0 : 1);
} }

View File

@@ -120,7 +120,7 @@ WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color)
void void
WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag) WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
{ {
scr->aflags.hasAppIcon = flag; scr->aflags.hasAppIcon = ((flag==0) ? 0 : 1);
} }

View File

@@ -151,7 +151,7 @@ WMSetBalloonDelay(WMScreen *scr, int delay)
void void
WMSetBalloonEnabled(WMScreen *scr, Bool flag) WMSetBalloonEnabled(WMScreen *scr, Bool flag)
{ {
scr->balloon->flags.enabled = flag; scr->balloon->flags.enabled = ((flag==0) ? 0 : 1);
W_UnmapView(scr->balloon->view); W_UnmapView(scr->balloon->view);
} }

View File

@@ -156,7 +156,7 @@ WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag)
{ {
int i; int i;
bPtr->flags.allowMultipleSelection = flag ? 1 : 0; bPtr->flags.allowMultipleSelection = ((flag==0) ? 0 : 1);
for (i=0; i<bPtr->columnCount; i++) { for (i=0; i<bPtr->columnCount; i++) {
WMSetListAllowMultipleSelection(bPtr->columns[i], flag); WMSetListAllowMultipleSelection(bPtr->columns[i], flag);
} }
@@ -168,7 +168,7 @@ WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag)
{ {
int i; int i;
bPtr->flags.allowEmptySelection = flag ? 1 : 0; bPtr->flags.allowEmptySelection = ((flag==0) ? 0 : 1);
for (i=0; i<bPtr->columnCount; i++) { for (i=0; i<bPtr->columnCount; i++) {
WMSetListAllowEmptySelection(bPtr->columns[i], flag); WMSetListAllowEmptySelection(bPtr->columns[i], flag);
} }
@@ -423,6 +423,8 @@ WMSetBrowserTitled(WMBrowser *bPtr, Bool flag)
int i; int i;
int columnX, columnY; int columnX, columnY;
flag = ((flag==0) ? 0 : 1);
if (bPtr->flags.isTitled == flag) if (bPtr->flags.isTitled == flag)
return; return;

View File

@@ -453,7 +453,7 @@ WMSetButtonFont(WMButton *bPtr, WMFont *font)
void void
WMSetButtonEnabled(WMButton *bPtr, Bool flag) WMSetButtonEnabled(WMButton *bPtr, Bool flag)
{ {
bPtr->flags.enabled = flag ? 1 : 0; bPtr->flags.enabled = ((flag==0) ? 0 : 1);
if (bPtr->view->flags.mapped) { if (bPtr->view->flags.mapped) {
paintButton(bPtr); paintButton(bPtr);
@@ -560,7 +560,7 @@ WMGroupButtons(WMButton *bPtr, WMButton *newMember)
void void
WMSetButtonContinuous(WMButton *bPtr, Bool flag) WMSetButtonContinuous(WMButton *bPtr, Bool flag)
{ {
bPtr->flags.continuous = flag; bPtr->flags.continuous = ((flag==0) ? 0 : 1);
if (bPtr->timer) { if (bPtr->timer) {
WMDeleteTimerHandler(bPtr->timer); WMDeleteTimerHandler(bPtr->timer);
bPtr->timer = NULL; bPtr->timer = NULL;

View File

@@ -229,6 +229,7 @@ WMGetColorWellColor(WMColorWell *cPtr)
void void
WSetColorWellBordered(WMColorWell *cPtr, Bool flag) WSetColorWellBordered(WMColorWell *cPtr, Bool flag)
{ {
flag = ((flag==0) ? 0 : 1);
if (cPtr->flags.bordered != flag) { if (cPtr->flags.bordered != flag) {
cPtr->flags.bordered = flag; cPtr->flags.bordered = flag;
W_ResizeView(cPtr->view, cPtr->view->size.width, cPtr->view->size.height); W_ResizeView(cPtr->view, cPtr->view->size.width, cPtr->view->size.height);

View File

@@ -451,20 +451,20 @@ WMSetFilePanelDirectory(WMFilePanel *panel, char *path)
void void
WMSetFilePanelCanChooseDirectories(WMFilePanel *panel, Bool flag) WMSetFilePanelCanChooseDirectories(WMFilePanel *panel, Bool flag)
{ {
panel->flags.canChooseDirectories = flag; panel->flags.canChooseDirectories = ((flag==0) ? 0 : 1);
} }
void void
WMSetFilePanelCanChooseFiles(WMFilePanel *panel, Bool flag) WMSetFilePanelCanChooseFiles(WMFilePanel *panel, Bool flag)
{ {
panel->flags.canChooseFiles = flag; panel->flags.canChooseFiles = ((flag==0) ? 0 : 1);
} }
void void
WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag) WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag)
{ {
panel->flags.autoCompletion = flag; panel->flags.autoCompletion = ((flag==0) ? 0 : 1);
} }

View File

@@ -192,6 +192,7 @@ WMSetLabelTextColor(WMLabel *lPtr, WMColor *color)
void void
WMSetLabelWraps(WMLabel *lPtr, Bool flag) WMSetLabelWraps(WMLabel *lPtr, Bool flag)
{ {
flag = ((flag==0) ? 0 : 1);
if (lPtr->flags.noWrap != !flag) { if (lPtr->flags.noWrap != !flag) {
lPtr->flags.noWrap = !flag; lPtr->flags.noWrap = !flag;
if (lPtr->view->flags.realized) if (lPtr->view->flags.realized)

View File

@@ -145,14 +145,14 @@ WMCreateList(WMWidget *parent)
void void
WMSetListAllowMultipleSelection(WMList *lPtr, Bool flag) WMSetListAllowMultipleSelection(WMList *lPtr, Bool flag)
{ {
lPtr->flags.allowMultipleSelection = flag ? 1 : 0; lPtr->flags.allowMultipleSelection = ((flag==0) ? 0 : 1);
} }
void void
WMSetListAllowEmptySelection(WMList *lPtr, Bool flag) WMSetListAllowEmptySelection(WMList *lPtr, Bool flag)
{ {
lPtr->flags.allowEmptySelection = flag ? 1 : 0; lPtr->flags.allowEmptySelection = ((flag==0) ? 0 : 1);
} }

View File

@@ -96,7 +96,7 @@ WMGetMenuItemEnabled(WMMenuItem *item)
void void
WMSetMenuItemEnabled(WMMenuItem *item, Bool flag) WMSetMenuItemEnabled(WMMenuItem *item, Bool flag)
{ {
item->flags.enabled = flag; item->flags.enabled = ((flag==0) ? 0 : 1);
} }

View File

@@ -192,7 +192,7 @@ WMRemovePopUpButtonItem(WMPopUpButton *bPtr, int index)
void void
WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag) WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag)
{ {
bPtr->flags.enabled = flag; bPtr->flags.enabled = ((flag==0) ? 0 : 1);
if (bPtr->view->flags.mapped) if (bPtr->view->flags.mapped)
paintPopUpButton(bPtr); paintPopUpButton(bPtr);
} }
@@ -252,7 +252,7 @@ WMSetPopUpButtonText(WMPopUpButton *bPtr, char *text)
void void
WMSetPopUpButtonItemEnabled(WMPopUpButton *bPtr, int index, Bool flag) WMSetPopUpButtonItemEnabled(WMPopUpButton *bPtr, int index, Bool flag)
{ {
WMSetMenuItemEnabled(WMGetFromArray(bPtr->items, index), flag); WMSetMenuItemEnabled(WMGetFromArray(bPtr->items, index), (flag ? 1 : 0));
} }
@@ -266,7 +266,7 @@ WMGetPopUpButtonItemEnabled(WMPopUpButton *bPtr, int index)
void void
WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag) WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag)
{ {
bPtr->flags.pullsDown = flag; bPtr->flags.pullsDown = ((flag==0) ? 0 : 1);
if (flag) { if (flag) {
bPtr->selectedItemIndex = -1; bPtr->selectedItemIndex = -1;
} }

View File

@@ -219,7 +219,7 @@ WMSetSliderContinuous(WMSlider *slider, Bool flag)
{ {
CHECK_CLASS(slider, WC_Slider); CHECK_CLASS(slider, WC_Slider);
slider->flags.continuous = flag; slider->flags.continuous = ((flag==0) ? 0 : 1);
} }

View File

@@ -837,7 +837,7 @@ WMSetSplitViewVertical(WMSplitView *sPtr, Bool flag)
CHECK_CLASS(sPtr, WC_SplitView); CHECK_CLASS(sPtr, WC_SplitView);
vertical = (flag) ? 1 : 0; vertical = ((flag==0) ? 0 : 1);
if (sPtr->flags.vertical == vertical) if (sPtr->flags.vertical == vertical)
return; return;

View File

@@ -276,7 +276,7 @@ WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item)
void void
WMSetTabViewEnabled(WMTabView *tPtr, Bool flag) WMSetTabViewEnabled(WMTabView *tPtr, Bool flag)
{ {
tPtr->flags.enabled = (flag ? 1 : 0); tPtr->flags.enabled = ((flag==0) ? 0 : 1);
if (W_VIEW_REALIZED(tPtr->view)) if (W_VIEW_REALIZED(tPtr->view))
paintTabView(tPtr); paintTabView(tPtr);
} }
@@ -969,7 +969,7 @@ WMCreateTabViewItem(int identifier, char *label)
void void
WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag) WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag)
{ {
tPtr->flags.enabled = (flag ? 1 : 0); tPtr->flags.enabled = ((flag==0) ? 0 : 1);
if (tPtr->tabView && W_VIEW_REALIZED(tPtr->tabView->view)) if (tPtr->tabView && W_VIEW_REALIZED(tPtr->tabView->view))
paintTabView(tPtr->tabView); paintTabView(tPtr->tabView);
} }

View File

@@ -527,7 +527,7 @@ WMSetTextFieldBeveled(WMTextField *tPtr, Bool flag)
{ {
CHECK_CLASS(tPtr, WC_TextField); CHECK_CLASS(tPtr, WC_TextField);
tPtr->flags.beveled = flag; tPtr->flags.beveled = ((flag==0) ? 0 : 1);
if (tPtr->view->flags.realized) { if (tPtr->view->flags.realized) {
paintTextField(tPtr); paintTextField(tPtr);
@@ -541,7 +541,7 @@ WMSetTextFieldSecure(WMTextField *tPtr, Bool flag)
{ {
CHECK_CLASS(tPtr, WC_TextField); CHECK_CLASS(tPtr, WC_TextField);
tPtr->flags.secure = flag; tPtr->flags.secure = ((flag==0) ? 0 : 1);
if (tPtr->view->flags.realized) { if (tPtr->view->flags.realized) {
paintTextField(tPtr); paintTextField(tPtr);
@@ -563,7 +563,7 @@ WMSetTextFieldEditable(WMTextField *tPtr, Bool flag)
{ {
CHECK_CLASS(tPtr, WC_TextField); CHECK_CLASS(tPtr, WC_TextField);
tPtr->flags.enabled = flag; tPtr->flags.enabled = ((flag==0) ? 0 : 1);
if (tPtr->view->flags.realized) { if (tPtr->view->flags.realized) {
paintTextField(tPtr); paintTextField(tPtr);

View File

@@ -708,7 +708,7 @@ WMGetViewPosition(WMView *view)
void void
WMSetViewNotifySizeChanges(WMView *view, Bool flag) WMSetViewNotifySizeChanges(WMView *view, Bool flag)
{ {
view->flags.notifySizeChanged = flag; view->flags.notifySizeChanged = ((flag==0) ? 0 : 1);
} }

View File

@@ -554,6 +554,7 @@ WMSetWindowLevel(WMWindow *win, int level)
void void
WMSetWindowDocumentEdited(WMWindow *win, Bool flag) WMSetWindowDocumentEdited(WMWindow *win, Bool flag)
{ {
flag = ((flag==0) ? 0 : 1);
if (win->flags.documentEdited != flag) { if (win->flags.documentEdited != flag) {
win->flags.documentEdited = flag; win->flags.documentEdited = flag;
if (win->view->flags.realized) if (win->view->flags.realized)