Commit Graph

46 Commits

Author SHA1 Message Date
Pietro Gagliardi 1238936a16 Added Post() and implemented it on Windows. 2014-07-03 11:04:07 -04:00
Pietro Gagliardi 9eb9aa82c0 Removed uitask and made the Window creation functions only callable from the main thread. This si the first part in the real major change, which bans all concurrent use of the API and provides a Post() function for communication. I don't like this, but it's the only way. Untested. 2014-07-03 10:02:27 -04:00
Pietro Gagliardi 8a81650b3d Moved it all back; the preemptive multitaksing during an event handler kills us on all platforms. Going to have to restrict ALL GUI accss to happening from one t hread, so going to need to drop uitask entirely and have just a start() callback for startup code and a post() function for posting requests to windows (like channel sends but into a perpetual buffer). 2014-07-02 22:53:03 -04:00
Pietro Gagliardi 5d339e656b Moved everything out of the way pending rewrite. 2014-07-02 17:13:40 -04:00
Pietro Gagliardi 607e710459 Restructured uitask to accept a limited range of actions. Implemented this on the Windows backend. 2014-07-01 11:55:57 -04:00
Pietro Gagliardi ffa1bbe0b9 Restored the previous new API. I'm going to change it so that events are callbacks rather than using a window handler, but other than that... yeah. 2014-06-30 22:48:12 -04:00
Pietro Gagliardi 990d50e9a1 Rolled back all those changes; I'm stupid. 2014-06-30 22:42:48 -04:00
Pietro Gagliardi 46ba0049cb Converted the Windows backend to make uitask a function that runs the func() passed into it, rather than a channel that sends the function to another dispatcher. Windows lets us, since SendMessage() will switch threads if called form another thread. This gets rid of one goroutine and makes things cleaner. Mac OS X has the same optimization avaialble (performSelectorOnMainThread:); GTK+... doesn't seem to... 2014-06-30 20:55:42 -04:00
Pietro Gagliardi 33155f7496 Reverted everything back to the old API. 2014-06-30 09:57:44 -04:00
Pietro Gagliardi affc65a5a4 Fixed the build. New API works on Windows! Also removed TODO on dialogs in Windows since I can't reproduce the weird behavior anymore; I guess the new code fixes it. 2014-06-28 16:37:55 -04:00
Pietro Gagliardi 98e701cd3b Migrated uitask_windows.go to the new API. 2014-06-28 10:49:23 -04:00
Pietro Gagliardi 5c002e3d0f Allowed tab stops on Windows; see http://blogs.msdn.com/b/oldnewthing/archive/2003/10/21/55384.aspx. Fixes #13 2014-06-26 20:20:00 -04:00
Pietro Gagliardi fc18ecc3d8 Added the scaffolding that will allow us to change uitask on Windows to take a func(). Right now it accepts both; this will allow me to do piecewise conversion. 2014-06-12 09:42:45 -04:00
Pietro Gagliardi 43b3f1c2a8 Partial go fmt. Will do the rest over the next few commits. While I'm not too happy about it, everyone else uses go fmt, and pull requests will be more convenient if I just do it. (Also do it now, because when I change the Windows backend things are going to change...) 2014-06-10 09:55:14 -04:00
Pietro Gagliardi caeff5bb88 Implemented RepaintAll() on Windows. 2014-06-09 22:26:37 -04:00
Pietro Gagliardi 05828236ec Migrated uitask_windows.go to the new string handling. 2014-06-03 10:48:21 -04:00
Pietro Gagliardi c543f5639b Normalized DefWindowProc() handling across the Windows files; the syscall.LazyProc now has the normalized name _defWindowProc and defWindowProc() is a convenience function that calls _defWindowProc properly. This will also be important for the switch to a single window class per Window/Area. 2014-05-30 14:15:32 -04:00
Pietro Gagliardi 029465e814 Decided not to use SendMessage() in the Windows uitask() as we're already waiting for an event return anyway. Decided not to move the message-only window to an init file, as the message-only window is for uitask(). 2014-05-29 19:36:33 -04:00
Pietro Gagliardi 2e6254ec61 Finished migrating the Windows code to using the pregenerated constants. 2014-05-25 15:23:11 -04:00
Pietro Gagliardi 2ce95f3937 Removed CW_USEDEFAULT variable definition. It won't compile right now, but our cgo-based generator will make sure that isn't a problem. 2014-05-25 12:31:38 -04:00
Pietro Gagliardi eb0188a099 Changed most instances of var to const in the Windows code. Only one left... 2014-05-25 11:31:57 -04:00
Pietro Gagliardi 9ed8d9c816 Consistency change: all Windows API structure field names now match case-wise (some were forcibly exported in the past for historical reasons: I originally started package ui by trying to write a Windows API wrapper, but decided to ditch that and just use the Windows API directly from package ui). Also more TODOs. 2014-05-11 11:11:57 -04:00
Pietro Gagliardi 92d3f38811 Added a note to uitask_windows.go that scrolling is a modal loop; that solves that mystery from ages ago. 2014-04-30 14:35:33 -04:00
Pietro Gagliardi 7f89f4afb9 More Windows TODO cleanup/removal and future plans. The message-only window in uitask_windows.go now has a title. 2014-04-28 13:06:24 -04:00
Pietro Gagliardi 34c84ce659 More future plans and a clarification in the block comment at the top of uitask_windows.go. 2014-04-27 21:34:42 -04:00
Pietro Gagliardi ac633a8694 Removed the GDI+ dependency on Windows since we no longer use it. 2014-04-12 15:42:13 -04:00
Pietro Gagliardi 49103abe7c As it turns out, Windows does have a facility for windows that only serve as message dispatches; let's use it for our message handler. (I only found this out while looking up SetParent() for the previous commit). 2014-04-09 11:13:35 -04:00
Pietro Gagliardi df087d0ea5 Fixed the Windows stalling when scrolling an Area problem: messages were getting lost because (I assume) scrolling is done in a modal event loop. Alas, we have to change to using a dummy window to handle events. Also altered the respective TODO to document bugs now exposed by this fix. 2014-04-01 19:10:30 -04:00
Pietro Gagliardi 593ded848b Removed a stray TODO comment whose purpose is long forgotten. 2014-04-01 15:16:29 -04:00
Pietro Gagliardi b2f0fe1956 Reordered each part of the Windows uitask so that it does things in the same order and with the same goroutine setup as the other platforms; this gets rid of a few channels. Also panics on more errors (gets rid of a few more channels) and removed some stray TODOs. 2014-04-01 15:14:57 -04:00
Pietro Gagliardi a94d154e1b Implemented Area.SetSize() on Windows. 2014-03-29 18:51:22 -04:00
Pietro Gagliardi cfcac03df7 Added GDI+ to the package's Windows version: DLL loaded, initialized, and shut down. It will be used for drawing to Areas because using GDI itself is more complex than it needs to be. 2014-03-24 17:01:33 -04:00
Pietro Gagliardi 34ce16d586 Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
Pietro Gagliardi c0c1e09186 Have ui.Go() return on main() return on Windows. 2014-03-05 13:21:45 -05:00
Pietro Gagliardi be5458c0a3 Major code restructure to allow Cocoa to work correctly. Cocoa requires that the application loop run on the very first OS thread created, not just an any ordinary thread. To support this, your code must now be run by the UI init code. Windows and Unix builds still work fine; Mac OS X fails for reasons I now have to debug. 2014-03-01 15:18:29 -05:00
Pietro Gagliardi bd51e3e9a7 Got rid of my Windows input lag problems on Windows (triggered by the switch to the concurrent garbage collector sweep routine in the Go runtime) by treating <-uitask as a Windows message itself posted to the message loop thread and not making the message loop a CPU waster. 2014-02-19 22:59:48 -05:00
Pietro Gagliardi fb82e651a4 Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
Pietro Gagliardi b1b05c2b1f Removed all //package ui comments. 2014-02-17 18:01:32 -05:00
Pietro Gagliardi 355016de05 More error/TODO reduction. 2014-02-15 14:11:54 -05:00
Pietro Gagliardi 6da43e8bb7 Fixed the PeekMessage() call as per http://blogs.msdn.com/b/oldnewthing/archive/2006/02/10/529525.aspx 2014-02-11 22:38:46 -05:00
Pietro Gagliardi 08ba4a1074 Fixed the wndproc not responding: turns out I have to have message dispatch in the UI thread... 2014-02-11 22:18:14 -05:00
Pietro Gagliardi 73fa611b37 All build errors resolved. Now to test... 2014-02-11 19:18:03 -05:00
Pietro Gagliardi bbff3d4f62 Locked the Windows message loop goroutine to the OS thread. 2014-02-11 18:32:07 -05:00
Pietro Gagliardi a1344512aa Added the Windows message loop. 2014-02-11 18:31:24 -05:00
Pietro Gagliardi b727a972ad Set up initialization on Windows (2/2). 2014-02-11 16:25:27 -05:00
Pietro Gagliardi 9794814e93 Started implementing the public API: added the Window and Control types and the skeleton of the Windows implementation. 2014-02-11 16:14:15 -05:00