| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_popup_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 506 |
| 507 gboolean AutocompletePopupViewGtk::HandleMotion(GtkWidget* widget, | 507 gboolean AutocompletePopupViewGtk::HandleMotion(GtkWidget* widget, |
| 508 GdkEventMotion* event) { | 508 GdkEventMotion* event) { |
| 509 // TODO(deanm): Windows has a bunch of complicated logic here. | 509 // TODO(deanm): Windows has a bunch of complicated logic here. |
| 510 size_t line = LineFromY(static_cast<int>(event->y)); | 510 size_t line = LineFromY(static_cast<int>(event->y)); |
| 511 // There is both a hovered and selected line, hovered just means your mouse | 511 // There is both a hovered and selected line, hovered just means your mouse |
| 512 // is over it, but selected is what's showing in the location edit. | 512 // is over it, but selected is what's showing in the location edit. |
| 513 model_->SetHoveredLine(line); | 513 model_->SetHoveredLine(line); |
| 514 // Select the line if the user has the left mouse button down. | 514 // Select the line if the user has the left mouse button down. |
| 515 if (!ignore_mouse_drag_ && (event->state & GDK_BUTTON1_MASK)) | 515 if (!ignore_mouse_drag_ && (event->state & GDK_BUTTON1_MASK)) |
| 516 model_->SetSelectedLine(line, false); | 516 model_->SetSelectedLine(line, false, false); |
| 517 return TRUE; | 517 return TRUE; |
| 518 } | 518 } |
| 519 | 519 |
| 520 gboolean AutocompletePopupViewGtk::HandleButtonPress(GtkWidget* widget, | 520 gboolean AutocompletePopupViewGtk::HandleButtonPress(GtkWidget* widget, |
| 521 GdkEventButton* event) { | 521 GdkEventButton* event) { |
| 522 ignore_mouse_drag_ = false; | 522 ignore_mouse_drag_ = false; |
| 523 // Very similar to HandleMotion. | 523 // Very similar to HandleMotion. |
| 524 size_t line = LineFromY(static_cast<int>(event->y)); | 524 size_t line = LineFromY(static_cast<int>(event->y)); |
| 525 model_->SetHoveredLine(line); | 525 model_->SetHoveredLine(line); |
| 526 if (event->button == 1) | 526 if (event->button == 1) |
| 527 model_->SetSelectedLine(line, false); | 527 model_->SetSelectedLine(line, false, false); |
| 528 return TRUE; | 528 return TRUE; |
| 529 } | 529 } |
| 530 | 530 |
| 531 gboolean AutocompletePopupViewGtk::HandleButtonRelease(GtkWidget* widget, | 531 gboolean AutocompletePopupViewGtk::HandleButtonRelease(GtkWidget* widget, |
| 532 GdkEventButton* event) { | 532 GdkEventButton* event) { |
| 533 if (ignore_mouse_drag_) { | 533 if (ignore_mouse_drag_) { |
| 534 // See header comment about this flag. | 534 // See header comment about this flag. |
| 535 ignore_mouse_drag_ = false; | 535 ignore_mouse_drag_ = false; |
| 536 return TRUE; | 536 return TRUE; |
| 537 } | 537 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 (text_width - actual_content_width - | 665 (text_width - actual_content_width - |
| 666 (actual_description_width / PANGO_SCALE)), | 666 (actual_description_width / PANGO_SCALE)), |
| 667 content_y, layout_); | 667 content_y, layout_); |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 g_object_unref(gc); | 671 g_object_unref(gc); |
| 672 | 672 |
| 673 return TRUE; | 673 return TRUE; |
| 674 } | 674 } |
| OLD | NEW |