| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef WINDOW_MANAGER_EVENT_CONSUMER_H_ | 5 #ifndef WINDOW_MANAGER_EVENT_CONSUMER_H_ |
| 6 #define WINDOW_MANAGER_EVENT_CONSUMER_H_ | 6 #define WINDOW_MANAGER_EVENT_CONSUMER_H_ |
| 7 | 7 |
| 8 #include "window_manager/geometry.h" |
| 8 #include "window_manager/wm_ipc.h" // for WmIpc::Message | 9 #include "window_manager/wm_ipc.h" // for WmIpc::Message |
| 9 #include "window_manager/x11/x_types.h" | 10 #include "window_manager/x11/x_types.h" |
| 10 | 11 |
| 11 namespace window_manager { | 12 namespace window_manager { |
| 12 | 13 |
| 13 class DestroyedWindow; | 14 class DestroyedWindow; |
| 14 class Window; | 15 class Window; |
| 15 | 16 |
| 16 // This is an interface for things that want to receive X events from the | 17 // This is an interface for things that want to receive X events from the |
| 17 // WindowManager class. | 18 // WindowManager class. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 79 |
| 79 // Handle a pixmap being fetched for a mapped window. A newly-mapped window | 80 // Handle a pixmap being fetched for a mapped window. A newly-mapped window |
| 80 // cannot be composited until its pixmap has been fetched for the first time | 81 // cannot be composited until its pixmap has been fetched for the first time |
| 81 // (Window::has_initial_pixmap() can be used to track this). When a window is | 82 // (Window::has_initial_pixmap() can be used to track this). When a window is |
| 82 // resized, a new pixmap must be fetched before it can be composited at the | 83 // resized, a new pixmap must be fetched before it can be composited at the |
| 83 // new size. Pixmaps are fetched automatically when needed; EventConsumers | 84 // new size. Pixmaps are fetched automatically when needed; EventConsumers |
| 84 // don't need to do anything to trigger it. | 85 // don't need to do anything to trigger it. |
| 85 virtual void HandleWindowPixmapFetch(Window* win) = 0; | 86 virtual void HandleWindowPixmapFetch(Window* win) = 0; |
| 86 | 87 |
| 87 // Handle a mapped window's request to be configured (unmapped windows' | 88 // Handle a mapped window's request to be configured (unmapped windows' |
| 88 // requests are applied automatically). If the consumer wants to | 89 // requests are applied automatically). If the consumer wants to configure |
| 89 // configure the window (possibly with different parameters than the | 90 // the window (possibly with different parameters than the requested ones), it |
| 90 // requested ones), it should call Window::MoveClient() and | 91 // should call Window::Move() and Resize(). Otherwise, if the consumer is |
| 91 // ResizeClient(). Otherwise, if the consumer is managing the window but | 92 // managing the window but chooses not to make any changes to it in response |
| 92 // chooses not to make any changes to it in response to the request, it | 93 // to the request, it should call Window::SendSyntheticConfigureNotify(). |
| 93 // should call Window::SendSyntheticConfigureNotify(). | |
| 94 virtual void HandleWindowConfigureRequest(Window* win, | 94 virtual void HandleWindowConfigureRequest(Window* win, |
| 95 int req_x, int req_y, | 95 const Rect& requested_bounds) = 0; |
| 96 int req_width, int req_height) = 0; | |
| 97 | 96 |
| 98 // Handle a button press or release on a window. The first position is | 97 // Handle a button press or release on a window. The first position is |
| 99 // relative to the upper-left corner of the window, while the second is | 98 // relative to the upper-left corner of the window, while the second is |
| 100 // absolute. | 99 // absolute. |
| 101 virtual void HandleButtonPress(XWindow xid, | 100 virtual void HandleButtonPress(XWindow xid, |
| 102 int x, int y, | 101 const Point& relative_pos, |
| 103 int x_root, int y_root, | 102 const Point& absolute_pos, |
| 104 int button, | 103 int button, |
| 105 XTime timestamp) = 0; | 104 XTime timestamp) = 0; |
| 106 virtual void HandleButtonRelease(XWindow xid, | 105 virtual void HandleButtonRelease(XWindow xid, |
| 107 int x, int y, | 106 const Point& relative_pos, |
| 108 int x_root, int y_root, | 107 const Point& absolute_pos, |
| 109 int button, | 108 int button, |
| 110 XTime timestamp) = 0; | 109 XTime timestamp) = 0; |
| 111 | 110 |
| 112 // Handle the pointer entering, leaving, or moving within an input window. | 111 // Handle the pointer entering, leaving, or moving within an input window. |
| 113 virtual void HandlePointerEnter(XWindow xid, | 112 virtual void HandlePointerEnter(XWindow xid, |
| 114 int x, int y, | 113 const Point& relative_pos, |
| 115 int x_root, int y_root, | 114 const Point& absolute_pos, |
| 116 XTime timestamp) = 0; | 115 XTime timestamp) = 0; |
| 117 virtual void HandlePointerLeave(XWindow xid, | 116 virtual void HandlePointerLeave(XWindow xid, |
| 118 int x, int y, | 117 const Point& relative_pos, |
| 119 int x_root, int y_root, | 118 const Point& absolute_pos, |
| 120 XTime timestamp) = 0; | 119 XTime timestamp) = 0; |
| 121 virtual void HandlePointerMotion(XWindow xid, | 120 virtual void HandlePointerMotion(XWindow xid, |
| 122 int x, int y, | 121 const Point& relative_pos, |
| 123 int x_root, int y_root, | 122 const Point& absolute_pos, |
| 124 XTime timestamp) = 0; | 123 XTime timestamp) = 0; |
| 125 | 124 |
| 126 // Handle a Chrome-specific message sent by a client app. Messages are | 125 // Handle a Chrome-specific message sent by a client app. Messages are |
| 127 // sent to consumers that have expressed interest in the messages' types | 126 // sent to consumers that have expressed interest in the messages' types |
| 128 // with WindowManager::RegisterEventConsumerForChromeMessages(). | 127 // with WindowManager::RegisterEventConsumerForChromeMessages(). |
| 129 virtual void HandleChromeMessage(const WmIpc::Message& msg) = 0; | 128 virtual void HandleChromeMessage(const WmIpc::Message& msg) = 0; |
| 130 | 129 |
| 131 // Handle a regular X ClientMessage event from a client app. | 130 // Handle a regular X ClientMessage event from a client app. |
| 132 // These events are sent to consumers that have expressed interest in | 131 // These events are sent to consumers that have expressed interest in |
| 133 // events on the window referenced in the event's |window| field. | 132 // events on the window referenced in the event's |window| field. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 150 // EventConsumerRegistrar::HandleDestroyedWindow(), since it refers to a | 149 // EventConsumerRegistrar::HandleDestroyedWindow(), since it refers to a |
| 151 // window that no longer exists (and the ID may soon be recycled for a | 150 // window that no longer exists (and the ID may soon be recycled for a |
| 152 // new window). | 151 // new window). |
| 153 virtual void OwnDestroyedWindow(DestroyedWindow* destroyed_win, | 152 virtual void OwnDestroyedWindow(DestroyedWindow* destroyed_win, |
| 154 XWindow xid) = 0; | 153 XWindow xid) = 0; |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 } // namespace window_manager | 156 } // namespace window_manager |
| 158 | 157 |
| 159 #endif // WINDOW_MANAGER_EVENT_CONSUMER_H_ | 158 #endif // WINDOW_MANAGER_EVENT_CONSUMER_H_ |
| OLD | NEW |