1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

wmaker: Fix compiler warnings about pointer <--> integer conversion

There may be issues with running applications in 64-bit mode when
they were written with tacit assumptions about 32-bit platforms.
For example,

    * Assuming that a pointer can be cast back and forth to an integer

The reason is that the size of the integer and pointer may be different.
See the description of "[PATCH] Warn when casting a pointer (constant)
to an integer of different size." in the gcc mailing list

http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01881.html

where it was also suggested the use of casts to uintptr_t. This is
what this patch does.

As a result the following warnings are fixed, leaving us with an
almost warning-free compilation in 64-bit platforms:

defaults.c:1446: warning: cast to pointer from integer of different size
defaults.c:1457: warning: cast to pointer from integer of different size
defaults.c:1471: warning: cast to pointer from integer of different size
defaults.c:1486: warning: cast to pointer from integer of different size
icon.c:67: warning: cast from pointer to integer of different size
menu.c:112: warning: cast from pointer to integer of different size
switchmenu.c:452: warning: cast from pointer to integer of different size
window.c:140: warning: cast from pointer to integer of different size
window.c:2217: warning: cast to pointer from integer of different size
workspace.c:135: warning: cast to pointer from integer of different size
workspace.c:214: warning: cast to pointer from integer of different size
workspace.c:634: warning: cast to pointer from integer of different size
workspace.c:1330: warning: cast to pointer from integer of different size
workspace.c:1514: warning: cast to pointer from integer of different size
wfilepanel.c:135: warning: cast from pointer to integer of different size
wfilepanel.c:171: warning: cast from pointer to integer of different size
wfontpanel.c:499: warning: cast to pointer from integer of different size
wfontpanel.c:500: warning: cast to pointer from integer of different size
wfontpanel.c:505: warning: cast to pointer from integer of different size
wfontpanel.c:506: warning: cast to pointer from integer of different size
wfontpanel.c:776: warning: cast from pointer to integer of different size
wfontpanel.c:777: warning: cast from pointer to integer of different size
wfontpanel.c:877: warning: cast from pointer to integer of different size
wfontpanel.c:878: warning: cast from pointer to integer of different size
wpanel.c:363: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:90: warning: cast to pointer from integer of different size
puzzle.c:138: warning: cast from pointer to integer of different size
puzzle.c:225: warning: cast to pointer from integer of different size
wtableview.c:1031: warning: cast to pointer from integer of different size
wtableview.c:1067: warning: cast to pointer from integer of different size
wtableview.c:1069: warning: cast to pointer from integer of different size
wtableview.c:1074: warning: cast to pointer from integer of different size
wtabledelegates.c:234: warning: cast from pointer to integer of different size
wtabledelegates.c:250: warning: cast from pointer to integer of different size
wtabledelegates.c:265: warning: cast from pointer to integer of different size
wtabledelegates.c:287: warning: cast to pointer from integer of different size
wtabledelegates.c:351: warning: cast from pointer to integer of different size
wtabledelegates.c:372: warning: cast from pointer to integer of different size
wtabledelegates.c:393: warning: cast from pointer to integer of different size
wtabledelegates.c:410: warning: cast to pointer from integer of different size
test.c:44: warning: cast from pointer to integer of different size
test.c:47: warning: cast to pointer from integer of different size
test.c:55: warning: cast from pointer to integer of different size
test.c:58: warning: cast from pointer to integer of different size
This commit is contained in:
Carlos R. Mafra
2008-11-06 01:37:44 +01:00
parent 4339e446e4
commit 06f59b9928
15 changed files with 62 additions and 48 deletions

View File

@@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <WINGs/WINGs.h> #include <WINGs/WINGs.h>
#include <WINGs/WUtil.h> #include <WINGs/WUtil.h>
@@ -39,7 +40,8 @@ void show(WMWidget *self, void *data)
void *d; void *d;
WMLabel *l = (WMLabel*)data; WMLabel *l = (WMLabel*)data;
d = WMGetHangedData(self); d = WMGetHangedData(self);
sprintf(buf, "%i - 0x%x - 0%o", (int)d, (int)d, (int)d); sprintf(buf, "%i - 0x%x - 0%o", (int)(uintptr_t)d, (int)(uintptr_t)d,
(int)(uintptr_t)d);
WMSetLabelText(l, buf); WMSetLabelText(l, buf);
} }
@@ -87,7 +89,7 @@ main(int argc, char **argv)
sprintf(buf, "%c", c); sprintf(buf, "%c", c);
WMSetButtonText(lab, buf); WMSetButtonText(lab, buf);
WMSetButtonAction(lab, show, pos); WMSetButtonAction(lab, show, pos);
WMHangData(lab, (void*)c); WMHangData(lab, (void*)(uintptr_t)c);
if (c>0) { if (c>0) {
WMGroupButtons(l0, lab); WMGroupButtons(l0, lab);
} else { } else {

View File

@@ -4,7 +4,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <WINGs/WINGs.h> #include <WINGs/WINGs.h>
#include <stdint.h>
#define MAX_SIZE 10*10 #define MAX_SIZE 10*10
@@ -135,7 +135,7 @@ void buttonClick(WMWidget *w, void *ptr)
{ {
char buffer[300]; char buffer[300];
if (SlideButton((int)ptr)) { if (SlideButton((int)(uintptr_t)ptr)) {
MoveCount++; MoveCount++;
if (CheckWin()) { if (CheckWin()) {
@@ -222,7 +222,7 @@ int main(int argc, char **argv)
Button[i] = WMCreateButton(win, WBTMomentaryLight); Button[i] = WMCreateButton(win, WBTMomentaryLight);
WMSetWidgetBackgroundColor(Button[i], color); WMSetWidgetBackgroundColor(Button[i], color);
WMReleaseColor(color); WMReleaseColor(color);
WMSetButtonAction(Button[i], buttonClick, (void*)i); WMSetButtonAction(Button[i], buttonClick, (void*)(uintptr_t)i);
WMResizeWidget(Button[i], WinSize/Size, WinSize/Size); WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size)); WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
sprintf(buf, "%i", i+1); sprintf(buf, "%i", i+1);

View File

@@ -2,6 +2,7 @@
#include <WINGs/WINGs.h> #include <WINGs/WINGs.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include "wtableview.h" #include "wtableview.h"
#include "wtabledelegates.h" #include "wtabledelegates.h"
@@ -41,10 +42,10 @@ valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
col2[i] = 0; col2[i] = 0;
} }
} }
if ((int)WMGetTableColumnId(column) == 1) if ((int)(uintptr_t)WMGetTableColumnId(column) == 1)
return col1[row]; return col1[row];
else else
return (void*)col2[row]; return (void*)(uintptr_t)col2[row];
} }
@@ -52,10 +53,10 @@ void
setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row, setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row,
void *data) void *data)
{ {
if ((int)WMGetTableColumnId(column) == 1) if ((int)(uintptr_t)WMGetTableColumnId(column) == 1)
col1[row] = data; col1[row] = data;
else else
col2[row] = (int)data; col2[row] = (int)(uintptr_t)data;
} }

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <WINGs/WINGsP.h> #include <WINGs/WINGsP.h>
#include "wtableview.h" #include "wtableview.h"
@@ -231,7 +231,7 @@ ESCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
{ {
EnumSelectorData *strdata = (EnumSelectorData*)self->data; EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column); WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row); int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
stringDraw(WMWidgetScreen(table), d, stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font, strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
@@ -247,7 +247,7 @@ selectedESCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
{ {
EnumSelectorData *strdata = (EnumSelectorData*)self->data; EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column); WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row); int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
stringDraw(WMWidgetScreen(table), d, stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font, strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
@@ -262,7 +262,7 @@ beginESCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
{ {
EnumSelectorData *strdata = (EnumSelectorData*)self->data; EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row); WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
int data = (int)WMTableViewDataForCell(strdata->table, column, row); int data = (int)(uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
wassertr(data < strdata->count); wassertr(data < strdata->count);
@@ -284,7 +284,7 @@ endESCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
WMUnmapWidget(strdata->widget); WMUnmapWidget(strdata->widget);
option = WMGetPopUpButtonSelectedItem(strdata->widget); option = WMGetPopUpButtonSelectedItem(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void*)option); WMSetTableViewDataForCell(strdata->table, column, row, (void*)(uintptr_t)option);
} }
@@ -348,7 +348,7 @@ BSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
{ {
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data; BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column); WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row); int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table); WMScreen *scr = WMWidgetScreen(table);
if (i) { if (i) {
@@ -369,7 +369,7 @@ selectedBSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
{ {
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data; BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column); WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row); int i = (int)(uintptr_t)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table); WMScreen *scr = WMWidgetScreen(table);
if (i) { if (i) {
@@ -390,7 +390,7 @@ beginBSCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
{ {
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data; BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row); WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
int data = (int)WMTableViewDataForCell(strdata->table, column, row); int data = (int)(uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
WMSetButtonSelected(strdata->widget, data); WMSetButtonSelected(strdata->widget, data);
WMMoveWidget(strdata->widget, rect.pos.x+1, rect.pos.y+1); WMMoveWidget(strdata->widget, rect.pos.x+1, rect.pos.y+1);
@@ -407,7 +407,7 @@ endBSCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
int value; int value;
value = WMGetButtonSelected(strdata->widget); value = WMGetButtonSelected(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void*)value); WMSetTableViewDataForCell(strdata->table, column, row, (void*)(uintptr_t)value);
WMUnmapWidget(strdata->widget); WMUnmapWidget(strdata->widget);
} }

View File

@@ -2,6 +2,7 @@
#include <WINGs/WINGsP.h> #include <WINGs/WINGsP.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <stdint.h>
#include "wtableview.h" #include "wtableview.h"
@@ -1028,7 +1029,7 @@ drawRow(WMTableView *table, int row, WMRect clipRect)
if (!column->delegate || !column->delegate->drawCell) if (!column->delegate || !column->delegate->drawCell)
continue; continue;
if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound) if (WMFindInArray(table->selectedRows, NULL, (void*)(uintptr_t)row) != WANotFound)
(*column->delegate->drawSelectedCell)(column->delegate, column, row, d); (*column->delegate->drawSelectedCell)(column->delegate, column, row, d);
else else
(*column->delegate->drawCell)(column->delegate, column, row, d); (*column->delegate->drawCell)(column->delegate, column, row, d);
@@ -1064,14 +1065,14 @@ setRowSelected(WMTableView *table, unsigned row, Bool flag)
{ {
int repaint = 0; int repaint = 0;
if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound) { if (WMFindInArray(table->selectedRows, NULL, (void*)(uintptr_t)row) != WANotFound) {
if (!flag) { if (!flag) {
WMRemoveFromArray(table->selectedRows, (void*)row); WMRemoveFromArray(table->selectedRows, (void*)(uintptr_t)row);
repaint = 1; repaint = 1;
} }
} else { } else {
if (flag) { if (flag) {
WMAddToArray(table->selectedRows, (void*)row); WMAddToArray(table->selectedRows, (void*)(uintptr_t)row);
repaint = 1; repaint = 1;
} }
} }

View File

@@ -8,6 +8,7 @@
#include <dirent.h> #include <dirent.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <stdint.h>
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX 1024 #define PATH_MAX 1024
@@ -132,7 +133,7 @@ textChangedObserver(void *observerData, WMNotification *notification)
return; return;
text = WMGetTextFieldText(panel->fileField); text = WMGetTextFieldText(panel->fileField);
textEvent = (int)WMGetNotificationClientData(notification); textEvent = (int)(uintptr_t)WMGetNotificationClientData(notification);
if (panel->flags.autoCompletion && textEvent!=WMDeleteTextEvent) if (panel->flags.autoCompletion && textEvent!=WMDeleteTextEvent)
i = closestListItem(list, text, False); i = closestListItem(list, text, False);
@@ -168,7 +169,7 @@ textEditedObserver(void *observerData, WMNotification *notification)
{ {
W_FilePanel *panel = (W_FilePanel*)observerData; W_FilePanel *panel = (W_FilePanel*)observerData;
if ((int)WMGetNotificationClientData(notification)==WMReturnTextMovement) { if ((int)(uintptr_t)WMGetNotificationClientData(notification)==WMReturnTextMovement) {
WMPerformButtonClick(panel->okButton); WMPerformButtonClick(panel->okButton);
} }
} }

View File

@@ -8,6 +8,7 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
@@ -496,14 +497,14 @@ addSizeToTypeface(Typeface *face, int size)
for (j = 0; j < sizeof(scalableFontSizes)/sizeof(int); j++) { for (j = 0; j < sizeof(scalableFontSizes)/sizeof(int); j++) {
size = scalableFontSizes[j]; size = scalableFontSizes[j];
if (!WMCountInArray(face->sizes, (void*)size)) { if (!WMCountInArray(face->sizes, (void*)(uintptr_t)size)) {
WMAddToArray(face->sizes, (void*)size); WMAddToArray(face->sizes, (void*)(uintptr_t)size);
} }
} }
WMSortArray(face->sizes, compare_int); WMSortArray(face->sizes, compare_int);
} else { } else {
if (!WMCountInArray(face->sizes, (void*)size)) { if (!WMCountInArray(face->sizes, (void*)(uintptr_t)size)) {
WMAddToArray(face->sizes, (void*)size); WMAddToArray(face->sizes, (void*)(uintptr_t)size);
WMSortArray(face->sizes, compare_int); WMSortArray(face->sizes, compare_int);
} }
} }
@@ -773,8 +774,8 @@ typefaceClick(WMWidget *w, void *data)
WMClearList(panel->sizLs); WMClearList(panel->sizLs);
WM_ITERATE_ARRAY(face->sizes, size, i) { WM_ITERATE_ARRAY(face->sizes, size, i) {
if ((int)size != 0) { if ((int)(uintptr_t)size != 0) {
sprintf(buffer, "%i", (int)size); sprintf(buffer, "%i", (int)(uintptr_t)size);
WMAddListItem(panel->sizLs, buffer); WMAddListItem(panel->sizLs, buffer);
} }
@@ -874,8 +875,8 @@ setFontPanelFontName(FontPanel *panel, char *family, char *style, double size)
WM_ITERATE_ARRAY(face->sizes, vsize, i) { WM_ITERATE_ARRAY(face->sizes, vsize, i) {
char buffer[32]; char buffer[32];
if ((int)vsize != 0) { if ((int)(uintptr_t)vsize != 0) {
sprintf(buffer, "%i", (int)vsize); sprintf(buffer, "%i", (int)(uintptr_t)vsize);
WMAddListItem(panel->sizLs, buffer); WMAddListItem(panel->sizLs, buffer);
} }

View File

@@ -3,6 +3,7 @@
#include "WINGsP.h" #include "WINGsP.h"
#include <X11/keysym.h> #include <X11/keysym.h>
#include <stdint.h>
@@ -360,7 +361,7 @@ endedEditingObserver(void *observerData, WMNotification *notification)
{ {
WMInputPanel *panel = (WMInputPanel*)observerData; WMInputPanel *panel = (WMInputPanel*)observerData;
switch ((int)WMGetNotificationClientData(notification)) { switch ((int)(uintptr_t)WMGetNotificationClientData(notification)) {
case WMReturnTextMovement: case WMReturnTextMovement:
if (panel->defBtn) if (panel->defBtn)
WMPerformButtonClick(panel->defBtn); WMPerformButtonClick(panel->defBtn);

View File

@@ -24,6 +24,7 @@
#include <WINGs/WINGsP.h> #include <WINGs/WINGsP.h>
#include <WINGs/WUtil.h> #include <WINGs/WUtil.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
@@ -969,7 +970,7 @@ textEndedEditing(struct WMTextFieldDelegate *self, WMNotification *notif)
if (!menu->flags.isEditing) if (!menu->flags.isEditing)
return; return;
reason = (int)WMGetNotificationClientData(notif); reason = (int)(uintptr_t)WMGetNotificationClientData(notif);
switch (reason) { switch (reason) {
case WMEscapeTextMovement: case WMEscapeTextMovement:

View File

@@ -24,6 +24,7 @@
#include "wconfig.h" #include "wconfig.h"
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
@@ -1443,7 +1444,7 @@ wReadDefaults(WScreen *scr, WMPropList *new_dict)
foo |= WColorSettings; foo |= WColorSettings;
if (foo) if (foo)
WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged, NULL, WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged, NULL,
(void*)foo); (void*)(uintptr_t)foo);
foo = 0; foo = 0;
if (needs_refresh & REFRESH_MENU_TEXTURE) if (needs_refresh & REFRESH_MENU_TEXTURE)
@@ -1454,7 +1455,7 @@ wReadDefaults(WScreen *scr, WMPropList *new_dict)
foo |= WColorSettings; foo |= WColorSettings;
if (foo) if (foo)
WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL, WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL,
(void*)foo); (void*)(uintptr_t)foo);
foo = 0; foo = 0;
if (needs_refresh & REFRESH_WINDOW_FONT) { if (needs_refresh & REFRESH_WINDOW_FONT) {
@@ -1468,7 +1469,7 @@ wReadDefaults(WScreen *scr, WMPropList *new_dict)
} }
if (foo) if (foo)
WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL, WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL,
(void*)foo); (void*)(uintptr_t)foo);
if (!(needs_refresh & REFRESH_ICON_TILE)) { if (!(needs_refresh & REFRESH_ICON_TILE)) {
foo = 0; foo = 0;
@@ -1483,7 +1484,7 @@ wReadDefaults(WScreen *scr, WMPropList *new_dict)
} }
if (foo) if (foo)
WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL, WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL,
(void*)foo); (void*)(uintptr_t)foo);
} }
if (needs_refresh & REFRESH_ICON_TILE) if (needs_refresh & REFRESH_ICON_TILE)
WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL); WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL);

View File

@@ -26,6 +26,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@@ -64,7 +65,7 @@ static void
appearanceObserver(void *self, WMNotification *notif) appearanceObserver(void *self, WMNotification *notif)
{ {
WIcon *icon = (WIcon*)self; WIcon *icon = (WIcon*)self;
int flags = (int)WMGetNotificationClientData(notif); int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
if (flags & WTextureSettings) { if (flags & WTextureSettings) {
icon->force_paint = 1; icon->force_paint = 1;

View File

@@ -29,6 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#if 0 #if 0
@@ -109,7 +110,7 @@ static void
appearanceObserver(void *self, WMNotification *notif) appearanceObserver(void *self, WMNotification *notif)
{ {
WMenu *menu = (WMenu*)self; WMenu *menu = (WMenu*)self;
int flags = (int)WMGetNotificationClientData(notif); int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
if (!menu->flags.realized) if (!menu->flags.realized)
return; return;

View File

@@ -28,6 +28,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@@ -449,7 +450,7 @@ wsobserver(void *self, WMNotification *notif)
void *data = WMGetNotificationClientData(notif); void *data = WMGetNotificationClientData(notif);
if (strcmp(name, WMNWorkspaceNameChanged) == 0) { if (strcmp(name, WMNWorkspaceNameChanged) == 0) {
UpdateSwitchMenuWorkspace(scr, (int)data); UpdateSwitchMenuWorkspace(scr, (int)(uintptr_t)data);
} else if (strcmp(name, WMNWorkspaceChanged) == 0) { } else if (strcmp(name, WMNWorkspaceChanged) == 0) {
} }

View File

@@ -33,6 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdint.h>
/* For getting mouse wheel mappings from WINGs */ /* For getting mouse wheel mappings from WINGs */
#include <WINGs/WINGsP.h> #include <WINGs/WINGsP.h>
@@ -137,7 +138,7 @@ static void
appearanceObserver(void *self, WMNotification *notif) appearanceObserver(void *self, WMNotification *notif)
{ {
WWindow *wwin = (WWindow*)self; WWindow *wwin = (WWindow*)self;
int flags = (int)WMGetNotificationClientData(notif); int flags = (int)(uintptr_t)WMGetNotificationClientData(notif);
if (!wwin->frame || (!wwin->frame->titlebar && !wwin->frame->resizebar)) if (!wwin->frame || (!wwin->frame->titlebar && !wwin->frame->resizebar))
return; return;
@@ -2214,7 +2215,7 @@ wWindowChangeWorkspace(WWindow *wwin, int workspace)
wwin->frame->workspace = workspace; wwin->frame->workspace = workspace;
WMPostNotificationName(WMNChangedWorkspace, wwin, (void*)oldWorkspace); WMPostNotificationName(WMNChangedWorkspace, wwin, (void*)(uintptr_t)oldWorkspace);
} }
if (unmap) { if (unmap) {

View File

@@ -29,6 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@@ -132,7 +133,7 @@ wWorkspaceNew(WScreen *scr)
#endif #endif
WMPostNotificationName(WMNWorkspaceCreated, scr, WMPostNotificationName(WMNWorkspaceCreated, scr,
(void*)(scr->workspace_count-1)); (void*)(uintptr_t)(scr->workspace_count-1));
XFlush(dpy); XFlush(dpy);
return scr->workspace_count-1; return scr->workspace_count-1;
@@ -211,7 +212,7 @@ wWorkspaceDelete(WScreen *scr, int workspace)
#endif #endif
WMPostNotificationName(WMNWorkspaceDestroyed, scr, WMPostNotificationName(WMNWorkspaceDestroyed, scr,
(void*)(scr->workspace_count-1)); (void*)(uintptr_t)(scr->workspace_count-1));
if (scr->current_workspace >= scr->workspace_count) if (scr->current_workspace >= scr->workspace_count)
wWorkspaceChange(scr, scr->workspace_count-1); wWorkspaceChange(scr, scr->workspace_count-1);
@@ -631,7 +632,7 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
showWorkspaceName(scr, workspace); showWorkspaceName(scr, workspace);
WMPostNotificationName(WMNWorkspaceChanged, scr, (void*)workspace); WMPostNotificationName(WMNWorkspaceChanged, scr, (void*)(uintptr_t)workspace);
/* XSync(dpy, False); */ /* XSync(dpy, False); */
} }
@@ -1327,7 +1328,7 @@ wWorkspaceRename(WScreen *scr, int workspace, char *name)
if (scr->clip_icon) if (scr->clip_icon)
wClipIconPaint(scr->clip_icon); wClipIconPaint(scr->clip_icon);
WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)workspace); WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)(uintptr_t)workspace);
} }
@@ -1511,7 +1512,7 @@ wWorkspaceRestoreState(WScreen *scr)
} }
} }
WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)i); WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void*)(uintptr_t)i);
} }
} }