ソースを参照

Merge new changes from BBS.

Steve Thielemann 2 年 前
コミット
db0d4dde3d
1 ファイル変更41 行追加0 行削除
  1. 41 0
      door/door.go

+ 41 - 0
door/door.go

@@ -93,6 +93,7 @@ type Door struct {
 	Config         DropfileConfig
 	READFD         int
 	WRITEFD        int
+<<<<<<< Updated upstream
 	Disconnected   bool        // int32         // atomic bool      // Has User disconnected/Hung up?
 	TimeOut        time.Time   // Fixed point in time, when time expires
 	StartTime      time.Time   // Time when User started door
@@ -140,6 +141,46 @@ func (d *Door) GetCursorPos() (CursorPos, bool) {
 	return ArrayDelete(&d.LastCursor, 0)
 }
 
+func (d *Door) ClearMouseCursor() {
+	d.mcMutex.Lock()
+	defer d.mcMutex.Unlock()
+	d.LastMouse = make([]Mouse, 0, 2)
+	d.LastCursor = make([]CursorPos, 0, 3)
+=======
+	Disconnected   int32      // atomic bool      // Has User disconnected/Hung up?
+	TimeOut        time.Time  // Fixed point in time, when time expires
+	StartTime      time.Time  // Time when User started door
+	Pushback       FIFOBuffer // Key buffer
+	MouseOn        int
+	LastMouse      []Mouse
+	LastCursor     []CursorPos
+	mcMutex        sync.Mutex    // Mouse Locking
+	LastColor      []int         // Track the last color sent for restore color
+	readerChannel  chan byte     // Reading from the User
+	ReaderCanClose bool          // We can close the reader (in tests)
+	writerChannel  chan string   // Writing to the User
+	closeChannel   chan struct{} // Closing
+	wg             sync.WaitGroup
+>>>>>>> Stashed changes
+}
+
+func (d *Door) AddMouse(mouse Mouse) {
+	d.mcMutex.Lock()
+	defer d.mcMutex.Unlock()
+	d.LastMouse = append(d.LastMouse, mouse)
+}
+func (d *Door) GetMouse() (Mouse, bool) {
+	d.mcMutex.Lock()
+	defer d.mcMutex.Unlock()
+	return ArrayDelete(&d.LastMouse, 0)
+}
+
+func (d *Door) GetCursorPos() (CursorPos, bool) {
+	d.mcMutex.Lock()
+	defer d.mcMutex.Unlock()
+	return ArrayDelete(&d.LastCursor, 0)
+}
+
 func (d *Door) ClearMouseCursor() {
 	d.mcMutex.Lock()
 	defer d.mcMutex.Unlock()