Skip to content

Commit

Permalink
make code clear
Browse files Browse the repository at this point in the history
  • Loading branch information
poderosaproject committed Aug 18, 2024
1 parent 80ea5db commit 21095e5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions TerminalEmulator/TerminalBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,26 @@ public void CommitScrollBar(VScrollBar sb, bool dirty_only) {
_scrollBarValues.Dirty = false;
}

//ドキュメントロック中でないと呼んではだめ
public void IndicateBell() {
IPoderosaMainWindow window = _session.OwnerWindow;
if (window != null) {
Debug.Assert(window.AsForm().InvokeRequired);
Monitor.Exit(GetDocument());
// If this thread is not a GUI thread, SetStatusIcon() calls Form.Invoke() and waits for completion of the task in the GUI thread.
// However, if a document lock has already been acquired by this thread, a deadlock will occur, because the GUI thread will also
// wait for the acquisition of the document lock to redraw the screen.
var document = GetDocument();
bool isLocked = Monitor.IsEntered(document);
if (isLocked) {
Monitor.Exit(document);
}
window.StatusBar.SetStatusIcon(Poderosa.TerminalEmulator.Properties.Resources.Bell16x16);
Monitor.Enter(GetDocument());
if (isLocked) {
Monitor.Enter(document);
}
}
if (GEnv.Options.BeepOnBellChar)

if (GEnv.Options.BeepOnBellChar) {
Win32.MessageBeep(-1);
}
}

protected void SetDocumentCursor(Cursor cursor) {
Expand Down

0 comments on commit 21095e5

Please sign in to comment.