diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:29:50 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:29:50 +0000 |
commit | c280bfdd4f944ed9c33f4306efa6d388d82a804a (patch) | |
tree | b484c60677240261fbb04a554ac6efb49270e504 /views | |
parent | 371d04994828cbb44f679f2191bbe515ded93809 (diff) | |
download | chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.zip chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.tar.gz chromium_src-c280bfdd4f944ed9c33f4306efa6d388d82a804a.tar.bz2 |
Move compact navigation bar('s entry view) to main menu.
* Chagned main menu to use TYPE_WINDOW instead of POPUP.
* Added hooks to close main menu when a user clicked non content area. (see MainMenuContainer::OnMousePressed and MainMenu::ActiveWindowChanged)
* removed entry view from CompactNavigationBar view. We probably should rename this class (later).
* Fixed a mouse coordinates issue in WidgetGtk: A location in the mouse event may not be in its gdk_window when it's originated from child gdk_window.
* UIStyle's enum has to start with 0 * removed DLOG thas I checked in by accident.
BUG=31766
TEST=manual: switch to compact navigation bar using ctrl-shift-c and confirm that no navigation entry in title bar.
main menu has the navigation entry instead.
Review URL: http://codereview.chromium.org/604015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_gtk.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 44bc82d..c437f70 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -438,7 +438,6 @@ void WidgetGtk::MoveAbove(Widget* widget) { void WidgetGtk::SetShape(gfx::NativeRegion region) { DCHECK(widget_); DCHECK(widget_->window); - gdk_window_shape_combine_region(widget_->window, region, 0, 0); gdk_region_destroy(region); } @@ -473,8 +472,11 @@ void WidgetGtk::Show() { } void WidgetGtk::Hide() { - if (widget_) + if (widget_) { gtk_widget_hide(widget_); + if (widget_->window) + gdk_window_lower(widget_->window); + } } gfx::NativeView WidgetGtk::GetNativeView() const { @@ -669,7 +671,6 @@ void WidgetGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { gfx::Size new_size(allocation->width, allocation->height); if (new_size == size_) return; - size_ = new_size; root_view_->SetBounds(0, 0, allocation->width, allocation->height); root_view_->SchedulePaint(); @@ -923,9 +924,22 @@ bool WidgetGtk::ProcessMousePressed(GdkEventButton* event) { return true; } + // An event may come from a child widget which has its own gdk window. + // Translate it to the widget's cooridnate. + int x = event->x; + int y = event->y; + GdkWindow* dest = GTK_WIDGET(window_contents_)->window; + if (event->window != dest) { + int dest_x, dest_y; + gdk_window_get_root_origin(dest, &dest_x, &dest_y); + x = event->x_root - dest_x; + y = event->y_root - dest_y; + } + last_mouse_event_was_move_ = false; - MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, event->x, event->y, + MouseEvent mouse_pressed(Event::ET_MOUSE_PRESSED, x, y, GetFlagsForEventButton(*event)); + if (root_view_->OnMousePressed(mouse_pressed)) { is_mouse_down_ = true; if (!has_capture_) |