Started a windows/areautil.c for miscellaneous functions, mostly (completely for now) having to do with coordinates and sizes. Right now it only has renderTargetGetSize().
This commit is contained in:
parent
444a7d3045
commit
5e90cbcb93
|
@ -6,6 +6,7 @@ CFILES += \
|
||||||
windows/areadraw.c \
|
windows/areadraw.c \
|
||||||
windows/areaevents.c \
|
windows/areaevents.c \
|
||||||
windows/areascroll.c \
|
windows/areascroll.c \
|
||||||
|
windows/areautil.c \
|
||||||
windows/box.c \
|
windows/box.c \
|
||||||
windows/button.c \
|
windows/button.c \
|
||||||
windows/checkbox.c \
|
windows/checkbox.c \
|
||||||
|
|
|
@ -7,22 +7,6 @@ uiWindowsDefineControl(
|
||||||
uiAreaType // type function
|
uiAreaType // type function
|
||||||
)
|
)
|
||||||
|
|
||||||
// I love COM interfaces that actually only work on C++
|
|
||||||
// ID2D1RenderTarget::GetSize is defined as returninig a structure
|
|
||||||
// with stdcall, this means it's an extra last argument
|
|
||||||
// the compiler tries to return it directly, and crashes
|
|
||||||
// I originally thought this was a bug in MinGW-w64, but it turns out it also affects MSVC! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384
|
|
||||||
// So we have to work around it.
|
|
||||||
// TODO is the return type correct? or should we just use C++?
|
|
||||||
void renderTargetGetSize(ID2D1RenderTarget *rt, D2D1_SIZE_F *size)
|
|
||||||
{
|
|
||||||
typedef void (STDMETHODCALLTYPE *fptr)(ID2D1RenderTarget *, D2D1_SIZE_F *);
|
|
||||||
fptr f;
|
|
||||||
|
|
||||||
f = (fptr) (rt->lpVtbl->GetSize);
|
|
||||||
(*f)(rt, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
uiArea *a;
|
uiArea *a;
|
||||||
|
|
|
@ -27,9 +27,6 @@ struct uiArea {
|
||||||
ID2D1HwndRenderTarget *rt;
|
ID2D1HwndRenderTarget *rt;
|
||||||
};
|
};
|
||||||
|
|
||||||
// area.c
|
|
||||||
extern void renderTargetGetSize(ID2D1RenderTarget *rt, D2D1_SIZE_F *size);
|
|
||||||
|
|
||||||
// areadraw.h
|
// areadraw.h
|
||||||
extern BOOL areaDoDraw(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
extern BOOL areaDoDraw(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
||||||
extern void areaDrawOnResize(uiArea *, RECT *);
|
extern void areaDrawOnResize(uiArea *, RECT *);
|
||||||
|
@ -41,3 +38,6 @@ extern void areaUpdateScroll(uiArea *a);
|
||||||
// areaevents.c
|
// areaevents.c
|
||||||
extern BOOL areaDoEvents(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
extern BOOL areaDoEvents(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
|
||||||
extern void unregisterAreaFilter(void);
|
extern void unregisterAreaFilter(void);
|
||||||
|
|
||||||
|
// areautil.c
|
||||||
|
extern void renderTargetGetSize(ID2D1RenderTarget *rt, D2D1_SIZE_F *size);
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// 18 december 2015
|
||||||
|
#include "uipriv_windows.h"
|
||||||
|
#include "area.h"
|
||||||
|
|
||||||
|
// I love COM interfaces that actually only work on C++
|
||||||
|
// ID2D1RenderTarget::GetSize is defined as returninig a structure
|
||||||
|
// with stdcall, this means it's an extra last argument
|
||||||
|
// the compiler tries to return it directly, and crashes
|
||||||
|
// I originally thought this was a bug in MinGW-w64, but it turns out it also affects MSVC! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384
|
||||||
|
// So we have to work around it.
|
||||||
|
// TODO is the return type correct? or should we just use C++?
|
||||||
|
void renderTargetGetSize(ID2D1RenderTarget *rt, D2D1_SIZE_F *size)
|
||||||
|
{
|
||||||
|
typedef void (STDMETHODCALLTYPE *fptr)(ID2D1RenderTarget *, D2D1_SIZE_F *);
|
||||||
|
fptr f;
|
||||||
|
|
||||||
|
f = (fptr) (rt->lpVtbl->GetSize);
|
||||||
|
(*f)(rt, size);
|
||||||
|
}
|
Loading…
Reference in New Issue