Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2523)

Unified Diff: app/x11_util.cc

Issue 661237: This adds in the ability for Chrome to generate windows with snapshots of all... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/x11_util.h ('k') | base/file_descriptor_posix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/x11_util.cc
===================================================================
--- app/x11_util.cc (revision 45523)
+++ app/x11_util.cc (working copy)
@@ -229,6 +229,44 @@
return true;
}
+bool GetIntArrayProperty(XID window,
+ const std::string& property_name,
+ std::vector<int>* value) {
+ Atom property_atom = gdk_x11_get_xatom_by_name_for_display(
+ gdk_display_get_default(), property_name.c_str());
+
+ Atom type = None;
+ int format = 0; // size in bits of each item in 'property'
+ long unsigned int num_items = 0, remaining_bytes = 0;
+ unsigned char* properties = NULL;
+
+ int result = XGetWindowProperty(GetXDisplay(),
+ window,
+ property_atom,
+ 0, // offset into property data to read
+ (~0L), // max length to get (all of them)
+ False, // deleted
+ AnyPropertyType,
+ &type,
+ &format,
+ &num_items,
+ &remaining_bytes,
+ &properties);
+ if (result != Success)
+ return false;
+
+ if (format != 32) {
+ XFree(properties);
+ return false;
+ }
+
+ int* int_properties = reinterpret_cast<int*>(properties);
+ value->clear();
+ value->insert(value->begin(), int_properties, int_properties + num_items);
+ XFree(properties);
+ return true;
+}
+
bool GetStringProperty(
XID window, const std::string& property_name, std::string* value) {
Atom property_atom = gdk_x11_get_xatom_by_name_for_display(
« no previous file with comments | « app/x11_util.h ('k') | base/file_descriptor_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698