summaryrefslogtreecommitdiffstats
path: root/chrome/common/x11_util.cc
diff options
context:
space:
mode:
authordpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 06:44:38 +0000
committerdpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 06:44:38 +0000
commitfb6ce9a0cbf90c88f5820f1cc0dc2a9c091c80ee (patch)
treebdaa8f441172783639479ee62ad5938f29e1106b /chrome/common/x11_util.cc
parent0ede01dae033abeb7b0f4f38675b2bb3fe30df90 (diff)
downloadchromium_src-fb6ce9a0cbf90c88f5820f1cc0dc2a9c091c80ee.zip
chromium_src-fb6ce9a0cbf90c88f5820f1cc0dc2a9c091c80ee.tar.gz
chromium_src-fb6ce9a0cbf90c88f5820f1cc0dc2a9c091c80ee.tar.bz2
Move options dialog to the desktop of last active browser window.
Prevent moving options dialog out of monitor boundaries. BUG=1143 TEST=Tested on Linux with multiple desktops. Review URL: http://codereview.chromium.org/555151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/x11_util.cc')
-rw-r--r--chrome/common/x11_util.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/common/x11_util.cc b/chrome/common/x11_util.cc
index 12c9c6c..d857870 100644
--- a/chrome/common/x11_util.cc
+++ b/chrome/common/x11_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -632,4 +632,23 @@ void GrabWindowSnapshot(GtkWindow* gtk_window,
cairo_surface_destroy(surface);
}
+bool ChangeWindowDesktop(XID window, XID destination) {
+ int desktop;
+ if (!GetIntProperty(destination, "_NET_WM_DESKTOP", &desktop))
+ return false;
+
+ XEvent event;
+ event.xclient.type = ClientMessage;
+ event.xclient.window = window;
+ event.xclient.message_type = gdk_x11_get_xatom_by_name_for_display(
+ gdk_display_get_default(), "_NET_WM_DESKTOP");
+ event.xclient.format = 32;
+ event.xclient.data.l[0] = desktop;
+ event.xclient.data.l[1] = 1; // source indication
+
+ int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False,
+ SubstructureNotifyMask, &event);
+ return result == Success;
+}
+
} // namespace x11_util