Skip to content

Commit

Permalink
Cygwin: console: Fix a problem that minor ID is incorrect in ConEmu.
Browse files Browse the repository at this point in the history
Previously, minor device number of console was not assigned correctly
in ConEmu environment. This is because console window of ConEmu is
not enumerated by EnumWindows(). This patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
  • Loading branch information
tyan0 committed Feb 13, 2024
1 parent ac92c4c commit 8aad3a7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions winsup/cygwin/autoload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ LoadDLLfunc (DefWindowProcW, user32)
LoadDLLfunc (DestroyWindow, user32)
LoadDLLfunc (DispatchMessageW, user32)
LoadDLLfunc (EmptyClipboard, user32)
LoadDLLfunc (EnumChildWindows, user32)
LoadDLLfunc (EnumWindows, user32)
LoadDLLfunc (GetClassNameA, user32)
LoadDLLfunc (GetClipboardData, user32)
LoadDLLfunc (GetDC, user32)
LoadDLLfunc (GetForegroundWindow, user32)
Expand Down
7 changes: 7 additions & 0 deletions winsup/cygwin/devices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ enum_cons_dev (HWND hw, LPARAM lp)
UnmapViewOfFile ((void *) cs);
CloseHandle (h);
}
else
{ /* Only for ConEmu */
char class_hw[32];
if (19 == GetClassName (hw, class_hw, sizeof (class_hw))
&& 0 == strcmp (class_hw, "VirtualConsoleClass"))
EnumChildWindows (hw, enum_cons_dev, lp);
}
return TRUE;
}

Expand Down
7 changes: 7 additions & 0 deletions winsup/cygwin/devices.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ enum_cons_dev (HWND hw, LPARAM lp)
UnmapViewOfFile ((void *) cs);
CloseHandle (h);
}
else
{ /* Only for ConEmu */
char class_hw[32];
if (19 == GetClassName (hw, class_hw, sizeof (class_hw))
&& 0 == strcmp (class_hw, "VirtualConsoleClass"))
EnumChildWindows (hw, enum_cons_dev, lp);
}
return TRUE;
}

Expand Down
14 changes: 14 additions & 0 deletions winsup/cygwin/fhandler/console.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ enum_windows (HWND hw, LPARAM lp)
UnmapViewOfFile ((void *) cs);
CloseHandle (h);
}
else
{ /* Only for ConEmu */
char class_hw[32];
if (19 == GetClassName (hw, class_hw, sizeof (class_hw))
&& 0 == strcmp (class_hw, "VirtualConsoleClass"))
EnumChildWindows (hw, enum_windows, lp);
}
return TRUE;
}

Expand Down Expand Up @@ -656,6 +663,13 @@ scan_console (HWND hw, LPARAM lp)
UnmapViewOfFile ((void *) cs);
CloseHandle (h);
}
else
{ /* Only for ConEmu */
char class_hw[32];
if (19 == GetClassName (hw, class_hw, sizeof (class_hw))
&& 0 == strcmp (class_hw, "VirtualConsoleClass"))
EnumChildWindows (hw, scan_console, lp);
}
return TRUE;
}

Expand Down

0 comments on commit 8aad3a7

Please sign in to comment.