summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-11-26 08:24:06 -0500
committerB. Stack <bgstack15@gmail.com>2022-11-26 08:24:06 -0500
commit086fb1135186d4c8c4ae16d6e969dc3be0fb8a02 (patch)
tree6507581152230770fda838a461f94288a31b09bf
parentadd upstream link (diff)
downloadstackrpms-086fb1135186d4c8c4ae16d6e969dc3be0fb8a02.tar.gz
stackrpms-086fb1135186d4c8c4ae16d6e969dc3be0fb8a02.tar.bz2
stackrpms-086fb1135186d4c8c4ae16d6e969dc3be0fb8a02.zip
store local hostname on WinClient instance
so we do not have to run gethostname() for all title changes, just at each new window instantiation.
-rw-r--r--fluxbox/debian/patches/add-clientmachine-if-forwarded.patch49
1 files changed, 41 insertions, 8 deletions
diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
index 5191173..f8a7f27 100644
--- a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
+++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
@@ -79,7 +79,27 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th
using std::string;
using std::list;
-@@ -217,6 +218,10 @@ bool WinClient::getAttrib(XWindowAttribu
+@@ -58,8 +59,10 @@ using std::cerr;
+ using std::hex;
+ using std::dec;
+
++
+ namespace {
+
++
+ void sendMessage(const WinClient& win, Atom atom, Time time) {
+ XEvent ce;
+ ce.xclient.type = ClientMessage;
+@@ -104,6 +107,8 @@ WinClient::WinClient(Window win, BScreen
+ updateWMHints();
+ updateWMNormalHints();
+ updateWMClassHint();
++ gethostname(hostname_char, 512);
++ hostname = FbTk::FbString(hostname_char);
+ updateTitle();
+ Fluxbox::instance()->saveWindowSearch(win, this);
+ if (window_group != None)
+@@ -217,6 +222,10 @@ bool WinClient::getAttrib(XWindowAttribu
return XGetWindowAttributes(display(), window(), &attr);
}
@@ -90,15 +110,13 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th
bool WinClient::getWMName(XTextProperty &textprop) const {
return XGetWMName(display(), window(), &textprop);
}
-@@ -319,7 +324,14 @@ void WinClient::updateTitle() {
+@@ -319,7 +328,12 @@ void WinClient::updateTitle() {
if (m_title_override)
return;
- m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512));
+ FbTk::FbString fullname = FbTk::FbString(Xutil::getWMName(window()), 0, 512);
+ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512);
-+ char *host = new char[512]; gethostname(host, 512);
-+ FbTk::FbString hostname = FbTk::FbString(host);
+ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) {
+ fullname += " (on " + clientmachine + ")";
+ }
@@ -106,15 +124,13 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th
m_title_update_timer.start();
}
-@@ -328,7 +340,14 @@ void WinClient::emitTitleSig() {
+@@ -328,7 +342,12 @@ void WinClient::emitTitleSig() {
}
void WinClient::setTitle(const FbTk::FbString &title) {
- m_title.setLogical(title);
+ FbTk::FbString fullname = title;
+ FbTk::FbString clientmachine = FbTk::FbString(Xutil::getWMClientMachine(window()), 0, 512);
-+ char *host = new char[512]; gethostname(host, 512);
-+ FbTk::FbString hostname = FbTk::FbString(host);
+ if (clientmachine != "Unnamed" && clientmachine != "" && clientmachine != hostname) {
+ fullname += " (on " + clientmachine + ")";
+ }
@@ -124,7 +140,15 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th
}
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
-@@ -91,6 +91,7 @@ public:
+@@ -31,6 +31,7 @@
+ class BScreen;
+ class Strut;
+
++
+ /// Holds client window info
+ class WinClient: public Focusable, public FbTk::FbWindow {
+ public:
+@@ -91,6 +92,7 @@ public:
//
bool getAttrib(XWindowAttributes &attr) const;
@@ -132,3 +156,12 @@ Inspired by xfwm4's ability to display the remote host running an X11 window. Th
bool getWMName(XTextProperty &textprop) const;
bool getWMIconName(XTextProperty &textprop) const;
std::string getWMRole() const;
+@@ -141,6 +143,8 @@ public:
+ unsigned long initial_state, normal_hint_flags, wm_hint_flags;
+
+ private:
++ char hostname_char[512];
++ FbTk::FbString hostname;
+ /// removes client from any waiting list and clears empty waiting lists
+ void removeTransientFromWaitingList();
+
bgstack15