Add MessageHandlerDelegate
This commit is contained in:
parent
f740684f41
commit
d175a68586
7 changed files with 66 additions and 10 deletions
|
@ -221,11 +221,11 @@ NativeWindowViews::NativeWindowViews(
|
|||
params.native_widget =
|
||||
new views::DesktopNativeWidgetAura(window_.get());
|
||||
atom_desktop_window_tree_host_win_ = new AtomDesktopWindowTreeHostWin(
|
||||
this,
|
||||
window_.get(),
|
||||
static_cast<views::DesktopNativeWidgetAura*>(params.native_widget));
|
||||
params.desktop_window_tree_host = atom_desktop_window_tree_host_win_;
|
||||
#endif
|
||||
#if defined(USE_X11)
|
||||
#elif defined(USE_X11)
|
||||
std::string name = Browser::Get()->GetName();
|
||||
// Set WM_WINDOW_ROLE.
|
||||
params.wm_role_name = "browser-window";
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "ui/views/widget/widget_delegate.h"
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "atom/browser/ui/win/message_handler_delegate.h"
|
||||
#endif
|
||||
|
||||
namespace views {
|
||||
class UnhandledKeyboardEventHandler;
|
||||
}
|
||||
|
@ -28,6 +32,9 @@ class AtomDesktopWindowTreeHostWin;
|
|||
#endif
|
||||
|
||||
class NativeWindowViews : public NativeWindow,
|
||||
#if defined(OS_WIN)
|
||||
public MessageHandlerDelegate,
|
||||
#endif
|
||||
public views::WidgetDelegateView,
|
||||
public views::WidgetObserver {
|
||||
public:
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
namespace atom {
|
||||
|
||||
AtomDesktopWindowTreeHostWin::AtomDesktopWindowTreeHostWin(
|
||||
MessageHandlerDelegate* delegate,
|
||||
views::internal::NativeWidgetDelegate* native_widget_delegate,
|
||||
views::DesktopNativeWidgetAura* desktop_native_widget_aura)
|
||||
: views::DesktopWindowTreeHostWin(native_widget_delegate,
|
||||
desktop_native_widget_aura) {
|
||||
desktop_native_widget_aura),
|
||||
delegate_(delegate) {
|
||||
}
|
||||
|
||||
AtomDesktopWindowTreeHostWin::~AtomDesktopWindowTreeHostWin() {
|
||||
|
|
|
@ -16,25 +16,30 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
class MessageHandlerDelegate;
|
||||
|
||||
class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
|
||||
public:
|
||||
AtomDesktopWindowTreeHostWin(
|
||||
MessageHandlerDelegate* delegate,
|
||||
views::internal::NativeWidgetDelegate* native_widget_delegate,
|
||||
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
|
||||
~AtomDesktopWindowTreeHostWin();
|
||||
~AtomDesktopWindowTreeHostWin() override;
|
||||
|
||||
bool SetThumbarButtons(
|
||||
HWND window,
|
||||
const std::vector<NativeWindow::ThumbarButton>& buttons);
|
||||
|
||||
protected:
|
||||
bool PreHandleMSG(UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param,
|
||||
LRESULT* result) override;
|
||||
bool PreHandleMSG(
|
||||
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override;
|
||||
|
||||
private:
|
||||
MessageHandlerDelegate* delegate_; // weak ref
|
||||
|
||||
scoped_ptr<ThumbarHost> thumbar_host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomDesktopWindowTreeHostWin);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
|
14
atom/browser/ui/win/message_handler_delegate.cc
Normal file
14
atom/browser/ui/win/message_handler_delegate.cc
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/win/message_handler_delegate.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
bool MessageHandlerDelegate::PreHandleMSG(
|
||||
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace atom
|
26
atom/browser/ui/win/message_handler_delegate.h
Normal file
26
atom/browser/ui/win/message_handler_delegate.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_
|
||||
#define ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
namespace atom {
|
||||
|
||||
class MessageHandlerDelegate {
|
||||
public:
|
||||
// Catch-all message handling and filtering. Called before
|
||||
// HWNDMessageHandler's built-in handling, which may pre-empt some
|
||||
// expectations in Views/Aura if messages are consumed. Returns true if the
|
||||
// message was consumed by the delegate and should not be processed further
|
||||
// by the HWNDMessageHandler. In this case, |result| is returned. |result| is
|
||||
// not modified otherwise.
|
||||
virtual bool PreHandleMSG(
|
||||
UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_UI_WIN_MESSAGE_HANDLER_DELEGATE_H_
|
|
@ -202,8 +202,10 @@
|
|||
'atom/browser/ui/views/submenu_button.h',
|
||||
'atom/browser/ui/views/win_frame_view.cc',
|
||||
'atom/browser/ui/views/win_frame_view.h',
|
||||
"atom/browser/ui/win/atom_desktop_window_tree_host_win.cc",
|
||||
"atom/browser/ui/win/atom_desktop_window_tree_host_win.h",
|
||||
'atom/browser/ui/win/atom_desktop_window_tree_host_win.cc',
|
||||
'atom/browser/ui/win/atom_desktop_window_tree_host_win.h',
|
||||
'atom/browser/ui/win/message_handler_delegate.cc',
|
||||
'atom/browser/ui/win/message_handler_delegate.h',
|
||||
'atom/browser/ui/win/notify_icon_host.cc',
|
||||
'atom/browser/ui/win/notify_icon_host.h',
|
||||
'atom/browser/ui/win/notify_icon.cc',
|
||||
|
|
Loading…
Reference in a new issue