Fixed the other build errors. Awesome, Go's linker won't recognize the COM IIDs in uuid.dll; guess we're bumping the minimum required version of Go, maybe?...
This commit is contained in:
parent
56042ac3b3
commit
1fd265135d
|
@ -28,7 +28,7 @@ HBITMAP toBitmap(void *i, intptr_t dx, intptr_t dy)
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeBitmap(void *bitmap)
|
void freeBitmap(uintptr_t bitmap)
|
||||||
{
|
{
|
||||||
if (DeleteObject((HBITMAP) bitmap) == 0)
|
if (DeleteObject((HBITMAP) bitmap) == 0)
|
||||||
xpanic("error deleting bitmap in freeBitmap()", GetLastError());
|
xpanic("error deleting bitmap in freeBitmap()", GetLastError());
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"sync"
|
"sync"
|
||||||
|
"image"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "winapi_windows.h"
|
// #include "winapi_windows.h"
|
||||||
|
@ -19,7 +20,7 @@ type table struct {
|
||||||
colcount C.int
|
colcount C.int
|
||||||
selected *event
|
selected *event
|
||||||
chainresize func(x int, y int, width int, height int, d *sizing)
|
chainresize func(x int, y int, width int, height int, d *sizing)
|
||||||
freeTexts map[C.uintptr_t]bool
|
free map[C.uintptr_t]bool
|
||||||
freeLock sync.Mutex
|
freeLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
||||||
C.setTableSubclass(t.hwnd, unsafe.Pointer(t))
|
C.setTableSubclass(t.hwnd, unsafe.Pointer(t))
|
||||||
for i := 0; i < ty.NumField(); i++ {
|
for i := 0; i < ty.NumField(); i++ {
|
||||||
coltype := C.WPARAM(C.tableColumnText)
|
coltype := C.WPARAM(C.tableColumnText)
|
||||||
switch ty.Field(i).Type {
|
switch {
|
||||||
case ty.Field(i).Type == reflect.TypeOf((*image.RGBA)(nil)):
|
case ty.Field(i).Type == reflect.TypeOf((*image.RGBA)(nil)):
|
||||||
coltype = C.tableColumnImage
|
coltype = C.tableColumnImage
|
||||||
case ty.Field(i).Type.Kind() == reflect.Bool:
|
case ty.Field(i).Type.Kind() == reflect.Bool:
|
||||||
|
@ -89,16 +90,15 @@ func tableGetCell(data unsafe.Pointer, tnm *C.tableNM) C.LRESULT {
|
||||||
defer t.RUnlock()
|
defer t.RUnlock()
|
||||||
d := reflect.Indirect(reflect.ValueOf(t.data))
|
d := reflect.Indirect(reflect.ValueOf(t.data))
|
||||||
datum := d.Index(int(tnm.row)).Field(int(tnm.column))
|
datum := d.Index(int(tnm.row)).Field(int(tnm.column))
|
||||||
isText := true
|
|
||||||
switch {
|
switch {
|
||||||
case datum.Type() == reflect.TypeOf((*image.RGBA)(nil)):
|
case datum.Type() == reflect.TypeOf((*image.RGBA)(nil)):
|
||||||
i := datum.Interface().(*image.RGBA)
|
i := datum.Interface().(*image.RGBA)
|
||||||
hbitmap := C.toBitmap(unsafe.Pointer(i), C.intptr_t(i.Dx()), C.intptr_t(i.Dy()))
|
hbitmap := C.toBitmap(unsafe.Pointer(i), C.intptr_t(i.Rect.Dx()), C.intptr_t(i.Rect.Dy()))
|
||||||
bitmap := C.uintptr_t(uintptr(unsafe.Pointer(hbitmap)))
|
bitmap := C.uintptr_t(uintptr(unsafe.Pointer(hbitmap)))
|
||||||
t.freeLock.Lock()
|
t.freeLock.Lock()
|
||||||
t.free[bitmap] = true // bitmap freed with C.freeBitmap()
|
t.free[bitmap] = true // bitmap freed with C.freeBitmap()
|
||||||
t.freeLock.Unlock()
|
t.freeLock.Unlock()
|
||||||
return C.LRESULT(bmp)
|
return C.LRESULT(bitmap)
|
||||||
case datum.Kind() == reflect.Bool:
|
case datum.Kind() == reflect.Bool:
|
||||||
if datum.Bool() == true {
|
if datum.Bool() == true {
|
||||||
return C.TRUE
|
return C.TRUE
|
||||||
|
@ -124,7 +124,7 @@ func tableFreeCellData(gotable unsafe.Pointer, data C.uintptr_t) {
|
||||||
panic(fmt.Errorf("undefined data %p in tableFreeData()", data))
|
panic(fmt.Errorf("undefined data %p in tableFreeData()", data))
|
||||||
}
|
}
|
||||||
if b == false {
|
if b == false {
|
||||||
C.free(data)
|
C.free(unsafe.Pointer(uintptr(data)))
|
||||||
} else {
|
} else {
|
||||||
C.freeBitmap(data)
|
C.freeBitmap(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ extern void areaMarkTextFieldDone(HWND);
|
||||||
|
|
||||||
// image_windows.c
|
// image_windows.c
|
||||||
extern HBITMAP toBitmap(void *, intptr_t, intptr_t);
|
extern HBITMAP toBitmap(void *, intptr_t, intptr_t);
|
||||||
extern void freeBitmap(void *);
|
extern void freeBitmap(uintptr_t);
|
||||||
|
|
||||||
// dialog_windows.c
|
// dialog_windows.c
|
||||||
extern void openFile(HWND, void *);
|
extern void openFile(HWND, void *);
|
||||||
|
|
Loading…
Reference in New Issue