From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 667A43858C50; Tue, 13 Feb 2024 14:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 667A43858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707835079; bh=iTcxvMjr9WiWYuO8I/WoH1NxsUQIHMI7d/fS+oxfi04=; h=From:To:Subject:Date:From; b=T5Rh20M30Gp6Y2XlZaPgLCtEZOYqUQJXkZG2dFUJaB/ospNpoppKbzLWrMzY43GP/ 8FC3Vck4WiyY/Y+eUUAOzoRqpkCL7My35KAtGRs0BcatXPg86N9qwbLgkqy6q1sS1l 9qDz+qPgXwMmRc/1YpLU7p4MqIZdPwLBopc4cQg0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix a problem that minor ID is incorrect in ConEmu. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_5-branch X-Git-Oldrev: 02f7f6543abc35a25fd024d8a58f374a86633846 X-Git-Newrev: 0795afd68eceb0d81501e81d92d7adce2b2f1a92 Message-Id: <20240213143759.667A43858C50@sourceware.org> Date: Tue, 13 Feb 2024 14:37:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D0795afd68ec= eb0d81501e81d92d7adce2b2f1a92 commit 0795afd68eceb0d81501e81d92d7adce2b2f1a92 Author: Takashi Yano Date: Tue Feb 13 11:45:36 2024 +0900 Cygwin: console: Fix a problem that minor ID is incorrect in ConEmu. =20 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. =20 Signed-off-by: Takashi Yano Diff: --- winsup/cygwin/autoload.cc | 2 ++ winsup/cygwin/devices.cc | 7 +++++++ winsup/cygwin/devices.in | 7 +++++++ winsup/cygwin/fhandler/console.cc | 14 ++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 7e610bdd0..65e906e8b 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -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) diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index 167b0e4b4..ca1fdf3be 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -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 =3D=3D GetClassName (hw, class_hw, sizeof (class_hw)) + && 0 =3D=3D strcmp (class_hw, "VirtualConsoleClass")) + EnumChildWindows (hw, enum_cons_dev, lp); + } return TRUE; } =20 diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index 48d3843fe..842f09c18 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -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 =3D=3D GetClassName (hw, class_hw, sizeof (class_hw)) + && 0 =3D=3D strcmp (class_hw, "VirtualConsoleClass")) + EnumChildWindows (hw, enum_cons_dev, lp); + } return TRUE; } =20 diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/con= sole.cc index b0907eb31..70824e694 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -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 =3D=3D GetClassName (hw, class_hw, sizeof (class_hw)) + && 0 =3D=3D strcmp (class_hw, "VirtualConsoleClass")) + EnumChildWindows (hw, enum_windows, lp); + } return TRUE; } =20 @@ -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 =3D=3D GetClassName (hw, class_hw, sizeof (class_hw)) + && 0 =3D=3D strcmp (class_hw, "VirtualConsoleClass")) + EnumChildWindows (hw, scan_console, lp); + } return TRUE; }