File: doc.go

package info (click to toggle)
golang-golang-x-exp 0.0~git20230522.2e198f4-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 6,404 kB
  • sloc: ansic: 1,900; objc: 276; sh: 272; asm: 48; makefile: 26
file content (44 lines) | stat: -rw-r--r-- 1,666 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package windriver provides the Windows driver for accessing a screen.
package windriver // import "golang.org/x/exp/shiny/driver/windriver"

/*
Implementation Details

On Windows, GUI is managed via user code and OS sending messages to
a window. These messages include paint events, input events and others.
Any thread that hosts GUI must handle incoming window messages through
a "message loop".

windriver designates the thread that calls Main as the GUI thread.
It locks this thread, creates a special window to handle screen.Screen
calls and runs message loop. All new windows are created by the
same thread, so message loop above handles all their window messages.

Some general Windows rules about thread affinity of GUI objects:

part 1: Window handles
https://blogs.msdn.microsoft.com/oldnewthing/20051010-09/?p=33843

part 2: Device contexts
https://blogs.msdn.microsoft.com/oldnewthing/20051011-10/?p=33823

part 3: Menus, icons, cursors, and accelerator tables
https://blogs.msdn.microsoft.com/oldnewthing/20051012-00/?p=33803

part 4: GDI objects and other notes on affinity
https://blogs.msdn.microsoft.com/oldnewthing/20051013-11/?p=33783

part 5: Object clean-up
https://blogs.msdn.microsoft.com/oldnewthing/20051014-19/?p=33763

How to build Windows GUI articles:

http://www.codeproject.com/Articles/1988/Guide-to-WIN-Paint-for-Beginners
http://www.codeproject.com/Articles/2078/Guide-to-WIN-Paint-for-Intermediates
http://www.codeproject.com/Articles/224754/Guide-to-Win-Memory-DC

*/