Removed uiAreaHandler.RedrawOnResize(); Direct2D requires us to always redraw on resize (see previous commit). Added windows/amd64 to the example makefiles and updated them to use libui.xxx instead of new.xxx.
This commit is contained in:
parent
c2100a19be
commit
8084041139
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
3
ui.h
3
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 *);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue