diff options
| author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-24 17:18:26 +0000 |
|---|---|---|
| committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-24 17:18:26 +0000 |
| commit | 9052745343f2a8a231150977cfad3afec687daf1 (patch) | |
| tree | 976b3b816ee908c68f65eb39ca883151abdba79e /chrome/views | |
| parent | 2d507dc02c5b70fe241ac353de7cd57635e28bc5 (diff) | |
| download | chromium_src-9052745343f2a8a231150977cfad3afec687daf1.zip chromium_src-9052745343f2a8a231150977cfad3afec687daf1.tar.gz chromium_src-9052745343f2a8a231150977cfad3afec687daf1.tar.bz2 | |
Makes our tables (task manager, keywords ...) not flicker when
resizing by doing nothing when we get erase background.
BUG=804753
TEST=make sure you don't get any painting artifacts in the task
manager and keyword editor.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
| -rw-r--r-- | chrome/views/table_view.cc | 29 | ||||
| -rw-r--r-- | chrome/views/table_view.h | 14 |
2 files changed, 38 insertions, 5 deletions
diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc index d70576e..a0d9fba 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -49,8 +49,8 @@ TableView::TableView(TableModel* model, autosize_columns_(autosize_columns), resizable_columns_(resizable_columns), list_view_(NULL), - list_view_original_handler_(NULL), header_original_handler_(NULL), + original_handler_(NULL), table_view_wrapper_(this), custom_cell_font_(NULL), content_offset_(0) { @@ -393,6 +393,28 @@ bool TableView::GetCellColors(int row, return false; } +LRESULT CALLBACK TableView::TableWndProc(HWND window, + UINT message, + WPARAM w_param, + LPARAM l_param) { + TableView* table_view = reinterpret_cast<TableViewWrapper*>( + GetWindowLongPtr(window, GWLP_USERDATA))->table_view; + + switch (message) { + case WM_ERASEBKGND: + // We make WM_ERASEBKGND do nothing (returning 1 indicates we handled + // the request). We do this so that the table view doesn't flicker during + // resizing. + return 1; + + default: + break; + } + DCHECK(table_view->original_handler_); + return CallWindowProc(table_view->original_handler_, window, message, w_param, + l_param); +} + LRESULT CALLBACK TableView::TableHeaderWndProc(HWND window, UINT message, WPARAM w_param, LPARAM l_param) { TableView* table_view = reinterpret_cast<TableViewWrapper*>( @@ -512,6 +534,11 @@ HWND TableView::CreateNativeControl(HWND parent_container) { &TableView::TableHeaderWndProc); } + SetWindowLongPtr(list_view_, GWLP_USERDATA, + reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); + original_handler_ = + win_util::SetWindowProc(list_view_, &TableView::TableWndProc); + // Bug 964884: detach the IME attached to this window. // We should attach IMEs only when we need to input CJK strings. ::ImmAssociateContextEx(list_view_, NULL, 0); diff --git a/chrome/views/table_view.h b/chrome/views/table_view.h index bcc74d3..0668120 100644 --- a/chrome/views/table_view.h +++ b/chrome/views/table_view.h @@ -416,6 +416,13 @@ class TableView : public NativeControl, // The TableColumn visible at position pos. const TableColumn& GetColumnAtPosition(int pos); + // Window procedure of the list view class. We subclass the list view to + // ignore WM_ERASEBKGND, which gives smoother painting during resizing. + static LRESULT CALLBACK TableWndProc(HWND window, + UINT message, + WPARAM w_param, + LPARAM l_param); + // Window procedure of the header class. We subclass the header of the table // to disable resizing of columns. static LRESULT CALLBACK TableHeaderWndProc(HWND window, UINT message, @@ -468,14 +475,13 @@ class TableView : public NativeControl, // a wrapper around the List-View window. HWND list_view_; - // The list view original proc handler. It is required when subclassing the - // list view. - WNDPROC list_view_original_handler_; - // The list view's header original proc handler. It is required when // subclassing. WNDPROC header_original_handler_; + // Window procedure of the listview before we subclassed it. + WNDPROC original_handler_; + // A wrapper around 'this' used when "subclassing" the list view and header. TableViewWrapper table_view_wrapper_; |
