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

Side by Side Diff: chrome/browser/notifications/balloon_collection_linux.cc

Issue 2915003: position the balloons after closing in a way that will keep the next one's cl... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/notifications/balloon_collection_impl.h" 5 #include "chrome/browser/notifications/balloon_collection_impl.h"
6 6
7 #include "chrome/browser/notifications/balloon.h" 7 #include "chrome/browser/notifications/balloon.h"
8 #include "chrome/browser/views/notifications/balloon_view.h" 8 #include "chrome/browser/views/notifications/balloon_view.h"
9 #include "gfx/size.h" 9 #include "gfx/size.h"
10 10
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const { 25 int BalloonCollectionImpl::Layout::HorizontalEdgeMargin() const {
26 return 5; 26 return 5;
27 } 27 }
28 28
29 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const { 29 int BalloonCollectionImpl::Layout::VerticalEdgeMargin() const {
30 return 5; 30 return 5;
31 } 31 }
32 32
33 void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) {
34 switch (event->type) {
35 case GDK_MOTION_NOTIFY:
36 case GDK_LEAVE_NOTIFY:
37 HandleMouseMoveEvent();
38 break;
39 default:
40 break;
41 }
42 }
43
44 bool BalloonCollectionImpl::IsCursorInBalloonCollection() const {
45 if (balloons_.empty())
46 return false;
47
48 gfx::Point upper_left = balloons_[balloons_.size() - 1]->GetPosition();
49 gfx::Point lower_right = layout_.GetLayoutOrigin();
50
51 gfx::Rect bounds = gfx::Rect(upper_left.x(),
52 upper_left.y(),
53 lower_right.x() - upper_left.x(),
54 lower_right.y() - upper_left.y());
55
56 GdkScreen* screen = gdk_screen_get_default();
57 GdkDisplay* display = gdk_screen_get_display(screen);
58 gint x, y;
59 gdk_display_get_pointer(display, NULL, &x, &y, NULL);
60 gfx::Point cursor(x, y);
61
62 return bounds.Contains(cursor);
63 }
64
33 // static 65 // static
34 BalloonCollection* BalloonCollection::Create() { 66 BalloonCollection* BalloonCollection::Create() {
35 return new BalloonCollectionImpl(); 67 return new BalloonCollectionImpl();
36 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/balloon_collection_impl.h ('k') | chrome/browser/notifications/balloon_collection_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698