From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Cc: Takashi Yano <takashi.yano@nifty.ne.jp>
Subject: [PATCH] Cygwin: console: Fix a problem that minor ID is incorrect in ConEmu.
Date: Tue, 13 Feb 2024 23:32:59 +0900 [thread overview]
Message-ID: <20240213143310.1921-1-takashi.yano@nifty.ne.jp> (raw)
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>
---
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 == GetClassName (hw, class_hw, sizeof (class_hw))
+ && 0 == strcmp (class_hw, "VirtualConsoleClass"))
+ EnumChildWindows (hw, enum_cons_dev, lp);
+ }
return TRUE;
}
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 == GetClassName (hw, class_hw, sizeof (class_hw))
+ && 0 == strcmp (class_hw, "VirtualConsoleClass"))
+ EnumChildWindows (hw, enum_cons_dev, lp);
+ }
return TRUE;
}
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.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 == GetClassName (hw, class_hw, sizeof (class_hw))
+ && 0 == strcmp (class_hw, "VirtualConsoleClass"))
+ EnumChildWindows (hw, enum_windows, lp);
+ }
return TRUE;
}
@@ -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;
}
--
2.43.0
reply other threads:[~2024-02-13 14:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240213143310.1921-1-takashi.yano@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).