diff --git a/darwin/area.m b/darwin/area.m index 108ad586..90fe9523 100644 --- a/darwin/area.m +++ b/darwin/area.m @@ -505,8 +505,8 @@ int sendAreaEvents(NSEvent *e) [self hscrollTo:self->hscrollpos]; [self vscrollTo:self->vscrollpos]; - if ((*(self->libui_a->ah->RedrawOnResize))(self->libui_a->ah, self->libui_a)) - [self->drawingView setNeedsDisplay:YES]; + // we must redraw everything on resize because Windows requires it + [self->drawingView setNeedsDisplay:YES]; } - (IBAction)hscrollEvent:(id)sender diff --git a/examples/controlgallery/GNUmakefile b/examples/controlgallery/GNUmakefile index 32017fbc..438a5d12 100644 --- a/examples/controlgallery/GNUmakefile +++ b/examples/controlgallery/GNUmakefile @@ -3,14 +3,17 @@ OUT = controlgallery ifeq ($(OS),windows) -linkto = ../../out/new.dll +linkto = ../../out/libui.dll CC = i686-w64-mingw32-gcc +ifeq ($(ARCH),amd64) +CC = x86_64-w64-mingw32-gcc +endif OUT = controlgallery.exe else ifeq ($(OS),darwin) -linkto = ../../out/new.dylib +linkto = ../../out/libui.dylib else -linkto = ../../out/new.so +linkto = ../../out/libui.so endif endif diff --git a/examples/histogram/GNUmakefile b/examples/histogram/GNUmakefile index 5925ca51..32a09a74 100644 --- a/examples/histogram/GNUmakefile +++ b/examples/histogram/GNUmakefile @@ -3,14 +3,17 @@ OUT = histogram ifeq ($(OS),windows) -linkto = ../../out/new.dll +linkto = ../../out/libui.dll CC = i686-w64-mingw32-gcc +ifeq ($(ARCH),amd64) +CC = x86_64-w64-mingw32-gcc +endif OUT = histogram.exe else ifeq ($(OS),darwin) -linkto = ../../out/new.dylib +linkto = ../../out/libui.dylib else -linkto = ../../out/new.so +linkto = ../../out/libui.so endif endif diff --git a/examples/histogram/main.c b/examples/histogram/main.c index a3ebb778..bae0bdae 100644 --- a/examples/histogram/main.c +++ b/examples/histogram/main.c @@ -172,12 +172,6 @@ static uintmax_t handlerVScrollMax(uiAreaHandler *a, uiArea *area) return 0; } -static int handlerRedrawOnResize(uiAreaHandler *a, uiArea *area) -{ - // always redraw on resize; we don't scroll - return 1; -} - static int inPoint(double x, double y, double xtest, double ytest) { // TODO switch to using a matrix @@ -248,7 +242,6 @@ int main(void) handler.Draw = handlerDraw; handler.HScrollMax = handlerHScrollMax; handler.VScrollMax = handlerVScrollMax; - handler.RedrawOnResize = handlerRedrawOnResize; handler.MouseEvent = handlerMouseEvent; handler.DragBroken = handlerDragBroken; handler.KeyEvent = handlerKeyEvent; diff --git a/test/page6.c b/test/page6.c index bb9c01f4..a2e90f50 100644 --- a/test/page6.c +++ b/test/page6.c @@ -28,12 +28,6 @@ static uintmax_t handlerVScrollMax(uiAreaHandler *a, uiArea *area) return uiSpinboxValue(vamount); } -static int handlerRedrawOnResize(uiAreaHandler *a, uiArea *area) -{ - // TODO make a checkbox - return uiSpinboxValue(hamount) == 0 && uiSpinboxValue(vamount) == 0; -} - static void handlerMouseEvent(uiAreaHandler *a, uiArea *area, uiAreaMouseEvent *e) { printf("mouse (%d,%d):(%d,%d) down:%d up:%d count:%d mods:%x held:%x\n", @@ -97,7 +91,6 @@ uiBox *makePage6(void) handler.ah.Draw = handlerDraw; handler.ah.HScrollMax = handlerHScrollMax; handler.ah.VScrollMax = handlerVScrollMax; - handler.ah.RedrawOnResize = handlerRedrawOnResize; handler.ah.MouseEvent = handlerMouseEvent; handler.ah.DragBroken = handlerDragBroken; handler.ah.KeyEvent = handlerKeyEvent; diff --git a/test/page7.c b/test/page7.c index 3428b1fa..fe0d0ea8 100644 --- a/test/page7.c +++ b/test/page7.c @@ -72,11 +72,6 @@ static uintmax_t handlerVScrollMax(uiAreaHandler *a, uiArea *area) return 0; } -static int handlerRedrawOnResize(uiAreaHandler *a, uiArea *area) -{ - return 1; -} - static void handlerMouseEvent(uiAreaHandler *a, uiArea *area, uiAreaMouseEvent *e) { // do nothing @@ -111,7 +106,6 @@ uiBox *makePage7(void) handler.ah.Draw = handlerDraw; handler.ah.HScrollMax = handlerHScrollMax; handler.ah.VScrollMax = handlerVScrollMax; - handler.ah.RedrawOnResize = handlerRedrawOnResize; handler.ah.MouseEvent = handlerMouseEvent; handler.ah.DragBroken = handlerDragBroken; handler.ah.KeyEvent = handlerKeyEvent; diff --git a/ui.h b/ui.h index 33532dcf..6db88349 100644 --- a/ui.h +++ b/ui.h @@ -262,8 +262,7 @@ struct uiAreaHandler { void (*Draw)(uiAreaHandler *, uiArea *, uiAreaDrawParams *); uintmax_t (*HScrollMax)(uiAreaHandler *, uiArea *); uintmax_t (*VScrollMax)(uiAreaHandler *, uiArea *); - // TODO this mightneed to be made obsolete since Direct2D requires us to redraw the entire backbuffer on a resize - int (*RedrawOnResize)(uiAreaHandler *, uiArea *); + // TODO document that resizes cause a full redraw void (*MouseEvent)(uiAreaHandler *, uiArea *, uiAreaMouseEvent *); void (*DragBroken)(uiAreaHandler *, uiArea *); int (*KeyEvent)(uiAreaHandler *, uiArea *, uiAreaKeyEvent *); diff --git a/unix/area.c b/unix/area.c index 22aaada9..23088059 100644 --- a/unix/area.c +++ b/unix/area.c @@ -145,8 +145,8 @@ static void areaWidget_size_allocate(GtkWidget *w, GtkAllocation *allocation) ap->clientWidth = allocation->width; ap->clientHeight = allocation->height; updateScroll(areaWidget(w)); - if ((*(ap->ah->RedrawOnResize))(ap->ah, ap->a)) - gtk_widget_queue_resize(w); + // we must redraw everything on resize because Windows requires it + gtk_widget_queue_resize(w); } static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr) diff --git a/windows/area.c b/windows/area.c index ca4d905a..8889f9af 100644 --- a/windows/area.c +++ b/windows/area.c @@ -681,7 +681,7 @@ ATOM registerAreaClass(HICON hDefaultIcon, HCURSOR hDefaultCursor) wc.hIcon = hDefaultIcon; wc.hCursor = hDefaultCursor; wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); - // don't specify CS_HREDRAW or CS_VREDRAW; that's decided by the uiAreaHandler in RedrawOnResize() + // TODO specify CS_HREDRAW/CS_VREDRAW in addition to or instead of calling InvalidateRect(NULL) in WM_WINDOWPOSCHANGED above, or not at all? return RegisterClassW(&wc); }