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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 2838753002: x11: Use opaque window for dnd without composite. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 10
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 xev.xclient.data.l[2] = CurrentTime; 1312 xev.xclient.data.l[2] = CurrentTime;
1313 xev.xclient.data.l[3] = None; 1313 xev.xclient.data.l[3] = None;
1314 xev.xclient.data.l[4] = None; 1314 xev.xclient.data.l[4] = None;
1315 SendXClientEvent(dest_window, &xev); 1315 SendXClientEvent(dest_window, &xev);
1316 } 1316 }
1317 1317
1318 void DesktopDragDropClientAuraX11::CreateDragWidget( 1318 void DesktopDragDropClientAuraX11::CreateDragWidget(
1319 const gfx::ImageSkia& image) { 1319 const gfx::ImageSkia& image) {
1320 Widget* widget = new Widget; 1320 Widget* widget = new Widget;
1321 Widget::InitParams params(Widget::InitParams::TYPE_DRAG); 1321 Widget::InitParams params(Widget::InitParams::TYPE_DRAG);
1322 params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW; 1322 if (ui::IsCompositingManagerPresent())
1323 params.opacity = Widget::InitParams::TRANSLUCENT_WINDOW;
1324 else
1325 params.opacity = Widget::InitParams::OPAQUE_WINDOW;
1323 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 1326 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1324 params.accept_events = false; 1327 params.accept_events = false;
1325 1328
1326 gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint() - 1329 gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint() -
1327 drag_widget_offset_; 1330 drag_widget_offset_;
1328 params.bounds = gfx::Rect(location, image.size()); 1331 params.bounds = gfx::Rect(location, image.size());
1329 widget->set_focus_on_creation(false); 1332 widget->set_focus_on_creation(false);
1330 widget->set_frame_type(Widget::FRAME_TYPE_FORCE_NATIVE); 1333 widget->set_frame_type(Widget::FRAME_TYPE_FORCE_NATIVE);
1331 widget->Init(params); 1334 widget->Init(params);
1332 widget->SetOpacity(kDragWidgetOpacity); 1335 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW)
1336 widget->SetOpacity(kDragWidgetOpacity);
1333 widget->GetNativeWindow()->SetName("DragWindow"); 1337 widget->GetNativeWindow()->SetName("DragWindow");
1334 1338
1335 drag_image_size_ = image.size(); 1339 drag_image_size_ = image.size();
1336 ImageView* image_view = new ImageView(); 1340 ImageView* image_view = new ImageView();
1337 image_view->SetImage(image); 1341 image_view->SetImage(image);
1338 image_view->SetBoundsRect(gfx::Rect(drag_image_size_)); 1342 image_view->SetBoundsRect(gfx::Rect(drag_image_size_));
1339 widget->SetContentsView(image_view); 1343 widget->SetContentsView(image_view);
1340 widget->Show(); 1344 widget->Show();
1341 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false); 1345 widget->GetNativeWindow()->layer()->SetFillsBoundsOpaquely(false);
1342 1346
(...skipping 16 matching lines...) Expand all
1359 for (int x = 0; x < in_bitmap->width(); ++x) { 1363 for (int x = 0; x < in_bitmap->width(); ++x) {
1360 if (SkColorGetA(in_row[x]) > kMinAlpha) 1364 if (SkColorGetA(in_row[x]) > kMinAlpha)
1361 return true; 1365 return true;
1362 } 1366 }
1363 } 1367 }
1364 1368
1365 return false; 1369 return false;
1366 } 1370 }
1367 1371
1368 } // namespace views 1372 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698