Add "type" option to change window type

This commit is contained in:
Cheng Zhao 2015-02-11 12:12:22 +08:00
parent 6b37f30bd6
commit f0924df68a
5 changed files with 29 additions and 0 deletions

View file

@ -4,6 +4,9 @@
#include "atom/browser/ui/x/x_window_utils.h"
#include <X11/Xatom.h>
#include "base/strings/string_util.h"
#include "ui/base/x/x11_util.h"
namespace atom {
@ -31,4 +34,16 @@ void SetWMSpecState(::Window xwindow, bool enabled, ::Atom state) {
&xclient);
}
void SetWindowType(::Window xwindow, const std::string& type) {
XDisplay* xdisplay = gfx::GetXDisplay();
std::string type_prefix = "_NET_WM_WINDOW_TYPE_";
::Atom window_type = XInternAtom(
xdisplay, (type_prefix + StringToUpperASCII(type)).c_str(), False);
XChangeProperty(xdisplay, xwindow,
XInternAtom(xdisplay, "_NET_WM_WINDOW_TYPE", False),
XA_ATOM,
32, PropModeReplace,
reinterpret_cast<unsigned char*>(&window_type), 1);
}
} // namespace atom