summaryrefslogtreecommitdiffstats
path: root/chrome/common/x11_util.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 00:48:16 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 00:48:16 +0000
commit4d023b86e67eea53d3a07dda4a516a1e74eeb69d (patch)
treeaab34aa24c601d55c2d52df1704e887d853b12b2 /chrome/common/x11_util.cc
parent2d4f7dd2730272ae457e5ef10449a747fdd96a84 (diff)
downloadchromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.zip
chromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.tar.gz
chromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.tar.bz2
Linux: Make InfoBubble use an override-redirect (popup) window.
This makes it work correctly in ion3 and other window managers that don't expect clients to try to move top-level windows themselves. This implementation grabs the pointer and keyboard. By doing this and using an override-redirect window, we should be able to avoid worrying about interactions with different window managers. The only downside (alluded to in the previous code) is that window manager keybindings don't make it through until the user dismisses the bubble by clicking outside of it or hitting Enter or Escape. I don't think this will be a problem; it's no different from what happens when you open a context menu in an app. BUG=20523 TEST=tested first-run and bookmark bubbles in Metacity, ion3, Fluxbox, KDE4, and the WM that I'm working on Review URL: http://codereview.chromium.org/198016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/x11_util.cc')
-rw-r--r--chrome/common/x11_util.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/common/x11_util.cc b/chrome/common/x11_util.cc
index eb8d1b4..1905d2c 100644
--- a/chrome/common/x11_util.cc
+++ b/chrome/common/x11_util.cc
@@ -263,6 +263,28 @@ bool GetStringProperty(
return true;
}
+XID GetParentWindow(XID window) {
+ XID root = None;
+ XID parent = None;
+ XID* children = NULL;
+ unsigned int num_children = 0;
+ XQueryTree(GetXDisplay(), window, &root, &parent, &children, &num_children);
+ if (children)
+ XFree(children);
+ return parent;
+}
+
+XID GetHighestAncestorWindow(XID window, XID root) {
+ while (true) {
+ XID parent = x11_util::GetParentWindow(window);
+ if (parent == None)
+ return None;
+ if (parent == root)
+ return window;
+ window = parent;
+ }
+}
+
// Returns true if |window| is a named window.
bool IsWindowNamed(XID window) {
XTextProperty prop;
@@ -358,6 +380,13 @@ bool GetXWindowStack(std::vector<XID>* windows) {
return result;
}
+void RestackWindow(XID window, XID sibling, bool above) {
+ XWindowChanges changes;
+ changes.sibling = sibling;
+ changes.stack_mode = above ? Above : Below;
+ XConfigureWindow(GetXDisplay(), window, CWSibling | CWStackMode, &changes);
+}
+
XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual) {
DCHECK(QueryRenderSupport(dpy));