Index: ui/base/x/x11_util.cc |
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
index b2b5ef4b82ac39f9abdd21520b7526864eccaf99..41b4055c35363acdb9b3e4fad1b89b6fb1bc5d4a 100644 |
--- a/ui/base/x/x11_util.cc |
+++ b/ui/base/x/x11_util.cc |
@@ -216,14 +216,6 @@ class XCustomCursorCache { |
DISALLOW_COPY_AND_ASSIGN(XCustomCursorCache); |
}; |
-bool IsShapeAvailable() { |
- int dummy; |
- static bool is_shape_available = |
- XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); |
- return is_shape_available; |
- |
-} |
- |
} // namespace |
bool IsXInput2Available() { |
@@ -459,6 +451,44 @@ void HideHostCursor() { |
return invisible_cursor; |
} |
+void SetUseOSWindowFrame(XID window, bool use_os_window_frame) { |
+ // This data structure represents additional hints that we send to the window |
+ // manager and has a direct lineage back to Motif, which defined this de facto |
+ // standard. This struct doesn't seem 64-bit safe though, but it's what GDK |
+ // does. |
+ typedef struct { |
+ unsigned long flags; |
+ unsigned long functions; |
+ unsigned long decorations; |
+ long input_mode; |
+ unsigned long status; |
+ } MotifWmHints; |
+ |
+ MotifWmHints motif_hints; |
+ memset(&motif_hints, 0, sizeof(motif_hints)); |
+ // Signals that the reader of the _MOTIF_WM_HINTS property should pay |
+ // attention to the value of |decorations|. |
+ motif_hints.flags = (1L << 1); |
+ motif_hints.decorations = use_os_window_frame ? 1 : 0; |
+ |
+ ::Atom hint_atom = GetAtom("_MOTIF_WM_HINTS"); |
+ XChangeProperty(gfx::GetXDisplay(), |
+ window, |
+ hint_atom, |
+ hint_atom, |
+ 32, |
+ PropModeReplace, |
+ reinterpret_cast<unsigned char*>(&motif_hints), |
+ sizeof(MotifWmHints)/sizeof(long)); |
+} |
+ |
+bool IsShapeExtensionAvailable() { |
+ int dummy; |
+ static bool is_shape_available = |
+ XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy); |
+ return is_shape_available; |
+} |
+ |
XID GetX11RootWindow() { |
return DefaultRootWindow(gfx::GetXDisplay()); |
} |
@@ -567,7 +597,7 @@ bool WindowContainsPoint(XID window, gfx::Point screen_loc) { |
if (!window_rect.Contains(screen_loc)) |
return false; |
- if (!IsShapeAvailable()) |
+ if (!IsShapeExtensionAvailable()) |
return true; |
// According to http://www.x.org/releases/X11R7.6/doc/libXext/shapelib.html, |
@@ -844,6 +874,14 @@ bool SetIntArrayProperty(XID window, |
return !err_tracker.FoundNewError(); |
} |
+bool SetAtomProperty(XID window, |
+ const std::string& name, |
+ const std::string& type, |
+ Atom value) { |
+ std::vector<Atom> values(1, value); |
+ return SetAtomArrayProperty(window, name, type, values); |
+} |
+ |
bool SetAtomArrayProperty(XID window, |
const std::string& name, |
const std::string& type, |