Permalink
Browse files

XSetWMName, and use it it TopLevelWindow instead of XStoreName

  • Loading branch information...
1 parent fc99865 commit be4bb2582d12ef0d9e14e53b8c55d465b8b9662f @NotFound committed Dec 22, 2011
Showing with 45 additions and 1 deletion.
  1. +14 −1 src/Guitor.winxed
  2. +31 −0 src/GuitorNci.winxed
View
@@ -43,6 +43,8 @@ extern function getselectionclearview;
extern function getselectionrequestview;
extern function getselectionview;
extern function getclientview;
+extern function gettextpropertyview;
+extern function textpropertyfromstring;
extern function getxcolorview;
extern function getxftcolorview;
extern function getxftfontview;
@@ -1516,6 +1518,17 @@ class Window : Drawable
getfun("XStoreName")(self.display.xdisplay, self.xdrawable,
str_to_cstring(name));
}
+ function SetWMName(string name)
+ {
+ __DEBUG__ && cry(__FUNCTION__);
+ int xdrawable = self.xdrawable;
+ if (xdrawable != None) {
+ // Not sure if using UTF8_STRING is correct, but works for a now
+ var prop = textpropertyfromstring(name,
+ self.InternAtom("UTF8_STRING"));
+ getfun("XSetWMName")(self.display.xdisplay, self.xdrawable, prop);
+ }
+ }
function SetWMProtocols(names)
{
self.display.SetWMProtocols(self, names);
@@ -1958,7 +1971,7 @@ class TopLevelWindow : ListenerWindow
}
self.xdrawable = display.CreateSimpleWindow(x, y, width, height,
0, 0, background);
- self.StoreName(title);
+ self.SetWMName(title);
self.ListenerWindow(controller);
}
}
View
@@ -33,6 +33,7 @@ const string
SELECTIONVIEW = "selectionview",
SELECTIONREQUESTVIEW = "selectionrequestview",
CLIENTVIEW = "clientview",
+ XTEXTPROPERTY = "xtextproperty",
XAWMHINTSVIEW = "xawmhintsview",
ATOMVIEW = "atomview",
XCOLORVIEW = "xcolorview",
@@ -435,6 +436,33 @@ function getatomview(int n)
return new ["StructView"] (init);
}
+function gettextpropertyview()
+{
+ var ns = namespace Xlib__nci;
+ var st = ns[XTEXTPROPERTY];
+ if (st == null)
+ ns[XTEXTPROPERTY] = st = new ["StructView"]( [ DATATYPE_STRUCT, 4,
+ DATATYPE_PTR, // value
+ XLIB_Atom, // encoding
+ DATATYPE_INT, // format
+ DATATYPE_LONG // nitems
+ ] );
+ return st;
+}
+
+function textpropertyfromstring(string str, int encoding)
+{
+ var view = gettextpropertyview();
+ var prop = view.alloc();
+ var pstr = str_to_achar_utf8(str);
+ int l = elements(pstr);
+ view[prop, 0] = pstr;
+ view[prop, 1] = encoding;
+ view[prop, 2] = 8;
+ view[prop, 3] = l;
+ return prop;
+}
+
function getxawmhints()
{
var ns = namespace Xlib__nci;
@@ -656,6 +684,9 @@ function create_function(string funcname)
case "XStoreName":
sig = "ipip";
break;
+ case "XSetWMName":
+ sig = "vpip";
+ break;
case "XDrawPoint":
sig = "ipipii";
break;

0 comments on commit be4bb25

Please sign in to comment.