From 21b2d9ce706eb66b015232c05e49d480f58f080e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 1 Sep 2019 13:12:25 +1000 Subject: [PATCH] less compiler warnings --- src/Widgets.c | 22 +++++++++++----------- src/Widgets.h | 10 +++++----- src/Window.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Widgets.c b/src/Widgets.c index b84e584e7..887e47cea 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -58,7 +58,7 @@ void TextWidget_Make(struct TextWidget* w, cc_uint8 horAnchor, cc_uint8 verAncho Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset); } -void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontDesc* font) { +void TextWidget_Set(struct TextWidget* w, const String* text, struct FontDesc* font) { struct DrawTextArgs args; Gfx_DeleteTexture(&w->tex.ID); @@ -78,7 +78,7 @@ void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontD Widget_Reposition(w); } -void TextWidget_SetConst(struct TextWidget* w, const char* text, const struct FontDesc* font) { +void TextWidget_SetConst(struct TextWidget* w, const char* text, struct FontDesc* font) { String str = String_FromReadonly(text); TextWidget_Set(w, &str, font); } @@ -161,7 +161,7 @@ void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick on Widget_SetLocation(w, horAnchor, verAnchor, xOffset, yOffset); } -void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct FontDesc* font) { +void ButtonWidget_Set(struct ButtonWidget* w, const String* text, struct FontDesc* font) { struct DrawTextArgs args; Gfx_DeleteTexture(&w->tex.ID); @@ -178,7 +178,7 @@ void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct F Widget_Reposition(w); } -void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, const struct FontDesc* font) { +void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, struct FontDesc* font) { String str = String_FromReadonly(text); ButtonWidget_Set(w, &str, font); } @@ -2551,7 +2551,7 @@ static void SpecialInputWidget_IntersectsBody(struct SpecialInputWidget* w, int int i; y -= w->titleHeight; - x /= w->elementSize.Width; y /= w->elementSize.Height; + x /= w->elementWidth; y /= w->elementHeight; i = (x + y * e.itemsPerRow) * e.charsPerItem; if (i >= e.contents.length) return; @@ -2645,12 +2645,12 @@ static Size2D SpecialInputWidget_MeasureContent(struct SpecialInputWidget* w, st maxWidth = max(maxWidth, size.Width); } - w->elementSize.Width = maxWidth + SPECIAL_CONTENT_SPACING; - w->elementSize.Height = size.Height + SPECIAL_CONTENT_SPACING; + w->elementWidth = maxWidth + SPECIAL_CONTENT_SPACING; + w->elementHeight = size.Height + SPECIAL_CONTENT_SPACING; rows = Math_CeilDiv(tab->contents.length / tab->charsPerItem, tab->itemsPerRow); - size.Width = w->elementSize.Width * tab->itemsPerRow; - size.Height = w->elementSize.Height * rows; + size.Width = w->elementWidth * tab->itemsPerRow; + size.Height = w->elementHeight * rows; return size; } @@ -2666,8 +2666,8 @@ static void SpecialInputWidget_DrawContent(struct SpecialInputWidget* w, struct args.text.buffer = &tab->contents.buffer[i]; item = i / tab->charsPerItem; - x = (item % wrap) * w->elementSize.Width; - y = (item / wrap) * w->elementSize.Height + yOffset; + x = (item % wrap) * w->elementWidth; + y = (item / wrap) * w->elementHeight + yOffset; Drawer2D_DrawText(bmp, &args, x, y); } } diff --git a/src/Widgets.h b/src/Widgets.h index 7dfe7b103..9ff55adb3 100644 --- a/src/Widgets.h +++ b/src/Widgets.h @@ -20,9 +20,9 @@ struct TextWidget { CC_NOINLINE void TextWidget_Make(struct TextWidget* w, cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset); /* Draws the given text into a texture, then updates the position and size of this widget. */ -CC_NOINLINE void TextWidget_Set(struct TextWidget* w, const String* text, const struct FontDesc* font); +CC_NOINLINE void TextWidget_Set(struct TextWidget* w, const String* text, struct FontDesc* font); /* Shorthand for TextWidget_Set using String_FromReadonly */ -CC_NOINLINE void TextWidget_SetConst(struct TextWidget* w, const char* text, const struct FontDesc* font); +CC_NOINLINE void TextWidget_SetConst(struct TextWidget* w, const char* text, struct FontDesc* font); typedef void (*Button_Get)(String* raw); @@ -40,9 +40,9 @@ struct ButtonWidget { CC_NOINLINE void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick onClick, cc_uint8 horAnchor, cc_uint8 verAnchor, int xOffset, int yOffset); /* Draws the given text into a texture, then updates the position and size of this widget. */ -CC_NOINLINE void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const struct FontDesc* font); +CC_NOINLINE void ButtonWidget_Set(struct ButtonWidget* w, const String* text, struct FontDesc* font); /* Shorthand for ButtonWidget_Set using String_FromReadonly */ -CC_NOINLINE void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, const struct FontDesc* font); +CC_NOINLINE void ButtonWidget_SetConst(struct ButtonWidget* w, const char* text, struct FontDesc* font); /* Clickable and draggable scrollbar. */ struct ScrollbarWidget { @@ -259,7 +259,7 @@ struct SpecialInputTab { struct SpecialInputWidget { Widget_Layout - Size2D elementSize; + int elementWidth, elementHeight; int selectedIndex; bool pendingRedraw; struct InputWidget* target; diff --git a/src/Window.c b/src/Window.c index 05bb5b1d2..13d743c3d 100644 --- a/src/Window.c +++ b/src/Window.c @@ -112,11 +112,11 @@ static void Window_UpdateTouch(long id, int x, int y) { int i; for (i = 0; i < touchesCount; i++) { if (touches[i].id != id) continue; - Mouse_SetPosition(x, y); - + if (win_rawMouse) { - Event_RaiseMouseMove(&MouseEvents.RawMoved, x - touches[i].x, y - touches[i].y); + Event_RaiseMove(&PointerEvents.RawMoved, i, x - touches[i].x, y - touches[i].y); } + Mouse_SetPosition(x, y); touches[i].x = x; touches[i].y = y; @@ -1418,7 +1418,7 @@ static void X11_MessageBox(const char* title, const char* text, X11Window* w) { /* However this causes issues as that removes events that */ /* should have been delivered to the main game window. */ /* (e.g. breaks initial window resize with i3 WM) */ - XIfEvent(dpy, &e, X11_FilterEvent, w->win); + XIfEvent(dpy, &e, X11_FilterEvent, (XPointer)w->win); switch (e.type) {