More go fmt.

This commit is contained in:
Pietro Gagliardi 2014-06-10 15:31:55 -04:00
parent 1e66637cd2
commit 380afbf755
1 changed files with 176 additions and 176 deletions

View File

@ -4,9 +4,9 @@ package ui
import (
"fmt"
"image"
"syscall"
"unsafe"
"image"
)
const (
@ -110,8 +110,8 @@ func paintArea(s *sysData) {
// thanks to David Heffernan in http://stackoverflow.com/questions/23033636/winapi-gdi-fillrectcolor-btnface-fills-with-strange-grid-like-brush-on-window
r1, _, err = _createCompatibleBitmap.Call(
uintptr(hdc),
uintptr(xrect.right - xrect.left),
uintptr(xrect.bottom - xrect.top))
uintptr(xrect.right-xrect.left),
uintptr(xrect.bottom-xrect.top))
if r1 == 0 { // failure
panic(fmt.Errorf("error creating off-screen rendering bitmap: %v", err))
}
@ -170,7 +170,7 @@ func paintArea(s *sysData) {
// the pixels are arranged in RGBA order, but GDI requires BGRA
// this turns out to be just ARGB in little endian; let's convert into this memory
// the bitmap Windows gives us has a stride == width
toARGB(i, ppvBits, i.Rect.Dx() * 4)
toARGB(i, ppvBits, i.Rect.Dx()*4)
// the second thing is... make a device context for the bitmap :|
// Ninjifox just makes another compatible DC; we'll do the same
@ -215,8 +215,8 @@ func paintArea(s *sysData) {
uintptr(hdc),
uintptr(xrect.left),
uintptr(xrect.top),
uintptr(xrect.right - xrect.left),
uintptr(xrect.bottom - xrect.top),
uintptr(xrect.right-xrect.left),
uintptr(xrect.bottom-xrect.top),
uintptr(rdc),
uintptr(0), // from the rdc's origin
uintptr(0),
@ -342,7 +342,7 @@ func scrollArea(s *sysData, wparam _WPARAM, which uintptr) {
uintptr(0),
uintptr(0),
uintptr(0),
uintptr(_SW_INVALIDATE | _SW_ERASE)) // mark the remaining rect as needing redraw and erase...
uintptr(_SW_INVALIDATE|_SW_ERASE)) // mark the remaining rect as needing redraw and erase...
if r1 == _ERROR { // failure
panic(fmt.Errorf("error scrolling Area: %v", err))
}
@ -470,23 +470,23 @@ func areaMouseEvent(s *sysData, button uint, up bool, wparam _WPARAM, lparam _LP
xdist, _, _ := _getSystemMetrics.Call(_SM_CXDOUBLECLK)
ydist, _, _ := _getSystemMetrics.Call(_SM_CYDOUBLECLK)
me.Count = s.clickCounter.click(button, me.Pos.X, me.Pos.Y,
time, maxTime, int(xdist / 2), int(ydist / 2))
time, maxTime, int(xdist/2), int(ydist/2))
}
// though wparam will contain control and shift state, let's use just one function to get modifiers for both keyboard and mouse events; it'll work the same anyway since we have to do this for alt and windows key (super)
me.Modifiers = getModifiers()
if button != 1 && (wparam & _MK_LBUTTON) != 0 {
if button != 1 && (wparam&_MK_LBUTTON) != 0 {
me.Held = append(me.Held, 1)
}
if button != 2 && (wparam & _MK_MBUTTON) != 0 {
if button != 2 && (wparam&_MK_MBUTTON) != 0 {
me.Held = append(me.Held, 2)
}
if button != 3 && (wparam & _MK_RBUTTON) != 0 {
if button != 3 && (wparam&_MK_RBUTTON) != 0 {
me.Held = append(me.Held, 3)
}
if button != 4 && (wparam & _MK_XBUTTON1) != 0 {
if button != 4 && (wparam&_MK_XBUTTON1) != 0 {
me.Held = append(me.Held, 4)
}
if button != 5 && (wparam & _MK_XBUTTON2) != 0 {
if button != 5 && (wparam&_MK_XBUTTON2) != 0 {
me.Held = append(me.Held, 5)
}
repaint := s.handler.Mouse(me)
@ -672,11 +672,11 @@ func areaWndProc(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM) _LRESU
areaMouseEvent(s, 3, true, wParam, lParam)
return 0
case _WM_XBUTTONDOWN:
which := uint((wParam >> 16) & 0xFFFF) + 3 // values start at 1; we want them to start at 4
which := uint((wParam>>16)&0xFFFF) + 3 // values start at 1; we want them to start at 4
areaMouseEvent(s, which, false, wParam, lParam)
return _LRESULT(_TRUE) // XBUTTON messages are different!
case _WM_XBUTTONUP:
which := uint((wParam >> 16) & 0xFFFF) + 3
which := uint((wParam>>16)&0xFFFF) + 3
areaMouseEvent(s, which, true, wParam, lParam)
return _LRESULT(_TRUE)
case _WM_KEYDOWN: