| 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package windriver provides the Windows driver for accessing a screen. |
| 6 | package windriver // import "golang.org/x/exp/shiny/driver/windriver" |
| 7 | |
| 8 | /* |
| 9 | Implementation Details |
| 10 | |
| 11 | On Windows, GUI is managed via user code and OS sending messages to |
| 12 | a window. These messages include paint events, input events and others. |
| 13 | Any thread that hosts GUI must handle incoming window messages through |
| 14 | a "message loop". |
| 15 | |
| 16 | windriver designates the thread that calls Main as the GUI thread. |
| 17 | It locks this thread, creates a special window to handle screen.Screen |
| 18 | calls and runs message loop. All new windows are created by the |
| 19 | same thread, so message loop above handles all their window messages. |
| 20 | |
| 21 | Some general Windows rules about thread affinity of GUI objects: |
| 22 | |
| 23 | part 1: Window handles |
| 24 | https://blogs.msdn.microsoft.com/oldnewthing/20051010-09/?p=33843 |
| 25 | |
| 26 | part 2: Device contexts |
| 27 | https://blogs.msdn.microsoft.com/oldnewthing/20051011-10/?p=33823 |
| 28 | |
| 29 | part 3: Menus, icons, cursors, and accelerator tables |
| 30 | https://blogs.msdn.microsoft.com/oldnewthing/20051012-00/?p=33803 |
| 31 | |
| 32 | part 4: GDI objects and other notes on affinity |
| 33 | https://blogs.msdn.microsoft.com/oldnewthing/20051013-11/?p=33783 |
| 34 | |
| 35 | part 5: Object clean-up |
| 36 | https://blogs.msdn.microsoft.com/oldnewthing/20051014-19/?p=33763 |
| 37 | |
| 38 | How to build Windows GUI articles: |
| 39 | |
| 40 | http://www.codeproject.com/Articles/1988/Guide-to-WIN-Paint-for-Beginners |
| 41 | http://www.codeproject.com/Articles/2078/Guide-to-WIN-Paint-for-Intermediates |
| 42 | http://www.codeproject.com/Articles/224754/Guide-to-Win-Memory-DC |
| 43 | |
| 44 | */ |