summaryrefslogtreecommitdiff
path: root/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-11-09 16:04:18 -0500
committerB. Stack <bgstack15@gmail.com>2022-11-09 16:04:18 -0500
commitf183cfec8b565beeafd93f8f8b76a23fa71e78ff (patch)
tree654464b353c105428b65355a80d1322a2301483c /fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
parentMerge branch 'freefilesync-bump' into 'master' (diff)
downloadstackrpms-f183cfec8b565beeafd93f8f8b76a23fa71e78ff.tar.gz
stackrpms-f183cfec8b565beeafd93f8f8b76a23fa71e78ff.tar.bz2
stackrpms-f183cfec8b565beeafd93f8f8b76a23fa71e78ff.zip
add fluxbox
Diffstat (limited to 'fluxbox/debian/patches/add-clientmachine-if-forwarded.patch')
-rw-r--r--fluxbox/debian/patches/add-clientmachine-if-forwarded.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
new file mode 100644
index 0000000..5191173
--- /dev/null
+++ b/fluxbox/debian/patches/add-clientmachine-if-forwarded.patch
@@ -0,0 +1,134 @@
+Author: bgstack15
+Date: 2022-11-09
+Version: fluxbox 1.4.0
+Source: original
+Summary: Add "(on $CLIENT)" to titlebar for forwarded windows
+Message:
+Inspired by xfwm4's ability to display the remote host running an X11 window. This fails on xfe which somehow lacks the WM_CLIENT_MACHINE property.
+--- a/src/Xutil.cc
++++ b/src/Xutil.cc
+@@ -43,6 +43,51 @@ using std::endl;
+
+ namespace Xutil {
+
++FbTk::FbString getWMClientMachine(Window window) {
++
++ if (window == None)
++ return FbTk::FbString("");
++
++ Display *display = FbTk::App::instance()->display();
++
++ XTextProperty text_prop;
++ text_prop.value = 0;
++ char **list = 0;
++ int num = 0;
++ _FB_USES_NLS;
++ FbTk::FbString name;
++
++ if (XGetWMClientMachine(display, window, &text_prop)) {
++ if (text_prop.value && text_prop.nitems > 0) {
++ if (text_prop.encoding != XA_STRING) {
++
++ text_prop.nitems = strlen((char *) text_prop.value);
++ XmbTextPropertyToTextList(display, &text_prop, &list, &num);
++
++ if (num > 0 && list != 0)
++ name = FbTk::FbStringUtil::LocaleStrToFb(static_cast<char *>(*list));
++ else
++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
++
++ if (list)
++ XFreeStringList(list);
++
++ } else
++ name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
++
++ XFree(text_prop.value);
++
++ } else { // default name
++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME");
++ }
++ } else {
++ // default name
++ name = _FB_XTEXT(Window, Unnamed, "Unnamed", "Default name for a window without a WM_NAME");
++ }
++
++ return name;
++}
++
+ FbTk::FbString getWMName(Window window) {
+
+ if (window == None)
+--- a/src/Xutil.hh
++++ b/src/Xutil.hh
+@@ -28,6 +28,7 @@
+
+ namespace Xutil {
+
++FbTk::FbString getWMClientMachine(Window window);
+ FbTk::FbString getWMName(Window window);
+
+ FbTk::FbString getWMClassName(Window win);
+--- a/src/WinClient.cc
++++ b/src/WinClient.cc
+@@ -49,6 +49,7 @@
+ #else
+ #include <string.h>
+ #endif
++#include<unistd.h>
+
+ using std::string;
+ using std::list;
+@@ -217,6 +218,10 @@ bool WinClient::getAttrib(XWindowAttribu
+ return XGetWindowAttributes(display(), window(), &attr);
+ }
+
++bool WinClient::getWMClientMachine(XTextProperty &textprop) const {
++ return XGetWMClientMachine(display(), window(), &textprop);
++}
++
+ bool WinClient::getWMName(XTextProperty &textprop) const {
+ return XGetWMName(display(), window(), &textprop);
+ }
+@@ -319,7 +324,14 @@ 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 + ")";
++ }
++ m_title.setLogical(fullname);
+ m_title_update_timer.start();
+ }
+
+@@ -328,7 +340,14 @@ 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 + ")";
++ }
++ m_title.setLogical(fullname);
+ m_title_override = true;
+ m_title_update_timer.start();
+ }
+--- a/src/WinClient.hh
++++ b/src/WinClient.hh
+@@ -91,6 +91,7 @@ public:
+ //
+
+ bool getAttrib(XWindowAttributes &attr) const;
++ bool getWMClientMachine(XTextProperty &textprop) const;
+ bool getWMName(XTextProperty &textprop) const;
+ bool getWMIconName(XTextProperty &textprop) const;
+ std::string getWMRole() const;
bgstack15