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

Unified Diff: ui/base/x/selection_requestor.cc

Issue 16271006: Drag on linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Document Created 7 years, 6 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 | « ui/base/x/selection_owner.cc ('k') | ui/base/x/selection_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/selection_requestor.cc
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc
index ce3a40ce0087b9eb235db4ca204ae618310e6cba..004a86d5a10698d430d2fb4be187b295b8ec08e9 100644
--- a/ui/base/x/selection_requestor.cc
+++ b/ui/base/x/selection_requestor.cc
@@ -7,6 +7,7 @@
#include "base/message_pump_aurax11.h"
#include "base/run_loop.h"
#include "ui/base/x/selection_utils.h"
+#include "ui/base/x/x11_util.h"
namespace ui {
@@ -67,54 +68,9 @@ bool SelectionRequestor::PerformBlockingConvertSelection(
if (returned_property_ != property_to_set)
return false;
- // Retrieve the data from our window.
- unsigned long nitems = 0;
- unsigned long nbytes = 0;
- Atom prop_type = None;
- int prop_format = 0;
- unsigned char* property_data = NULL;
- if (XGetWindowProperty(x_display_,
- x_window_,
- returned_property_,
- 0, 0x1FFFFFFF /* MAXINT32 / 4 */, False,
- AnyPropertyType, &prop_type, &prop_format,
- &nitems, &nbytes, &property_data) != Success) {
- return false;
- }
-
- if (prop_type == None)
- return false;
-
- if (out_data)
- *out_data = property_data;
-
- if (out_data_bytes) {
- // So even though we should theoretically have nbytes (and we can't
- // pass NULL there), we need to manually calculate the byte length here
- // because nbytes always returns zero.
- switch (prop_format) {
- case 8:
- *out_data_bytes = nitems;
- break;
- case 16:
- *out_data_bytes = sizeof(short) * nitems;
- break;
- case 32:
- *out_data_bytes = sizeof(long) * nitems;
- break;
- default:
- NOTREACHED();
- break;
- }
- }
-
- if (out_data_items)
- *out_data_items = nitems;
-
- if (out_type)
- *out_type = prop_type;
-
- return true;
+ return ui::GetRawBytesOfProperty(x_window_, returned_property_,
+ out_data, out_data_bytes, out_data_items,
+ out_type);
}
scoped_ptr<SelectionData> SelectionRequestor::RequestAndWaitForTypes(
@@ -130,7 +86,7 @@ scoped_ptr<SelectionData> SelectionRequestor::RequestAndWaitForTypes(
NULL,
&type) &&
type == *it) {
- scoped_ptr<SelectionData> data_out(new SelectionData(x_display_));
+ scoped_ptr<SelectionData> data_out(new SelectionData);
data_out->Set(type, (char*)data, data_bytes, true);
return data_out.Pass();
}
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/base/x/selection_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698