summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-09 01:44:57 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-09 01:44:57 +0000
commit4151d45b12283276609749e857724849100f753c (patch)
treea547334ff68beca01e258888f4afad6bd128c92d /chrome
parent748aba86a29c9db603cd46bdfc5cce8d6bfee17e (diff)
downloadchromium_src-4151d45b12283276609749e857724849100f753c.zip
chromium_src-4151d45b12283276609749e857724849100f753c.tar.gz
chromium_src-4151d45b12283276609749e857724849100f753c.tar.bz2
Update Chrome OS build to support panel-dragging change.
The window manager side of this change (already committed) is described at http://codereview.chromium.org/527005. This change also makes Chrome report the version of the IPC messages that it's using to the window manager at startup. TEST=built and tested that panel-dragging works as expected BUG=none Review URL: http://codereview.chromium.org/521070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/panel_controller.cc12
-rw-r--r--chrome/browser/views/tabs/tab_overview_types.cc8
-rw-r--r--chrome/browser/views/tabs/tab_overview_types.h56
3 files changed, 65 insertions, 11 deletions
diff --git a/chrome/browser/chromeos/panel_controller.cc b/chrome/browser/chromeos/panel_controller.cc
index 79e344e..0fbcbd8 100644
--- a/chrome/browser/chromeos/panel_controller.cc
+++ b/chrome/browser/chromeos/panel_controller.cc
@@ -153,11 +153,18 @@ bool PanelController::TitleMousePressed(const views::MouseEvent& event) {
NOTREACHED();
return false;
}
+
+ // Get the last titlebar width that we saw in a ConfigureNotify event -- we
+ // need to give drag positions in terms of the top-right corner of the
+ // titlebar window. See WM_NOTIFY_PANEL_DRAGGED's declaration for details.
+ gint title_width = 1;
+ gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL);
+
GdkEventButton last_button_event = gdk_event->button;
mouse_down_ = true;
mouse_down_abs_x_ = last_button_event.x_root;
mouse_down_abs_y_ = last_button_event.y_root;
- mouse_down_offset_x_ = event.x();
+ mouse_down_offset_x_ = event.x() - title_width;
mouse_down_offset_y_ = event.y();
dragging_ = false;
gdk_event_free(gdk_event);
@@ -210,7 +217,8 @@ bool PanelController::TitleMouseDragged(const views::MouseEvent& event) {
}
}
if (dragging_) {
- TabOverviewTypes::Message msg(TabOverviewTypes::Message::WM_MOVE_PANEL);
+ TabOverviewTypes::Message msg(
+ TabOverviewTypes::Message::WM_NOTIFY_PANEL_DRAGGED);
msg.set_param(0, panel_xid_);
msg.set_param(1, last_motion_event.x_root - mouse_down_offset_x_);
msg.set_param(2, last_motion_event.y_root - mouse_down_offset_y_);
diff --git a/chrome/browser/views/tabs/tab_overview_types.cc b/chrome/browser/views/tabs/tab_overview_types.cc
index fac9926..aec1f02 100644
--- a/chrome/browser/views/tabs/tab_overview_types.cc
+++ b/chrome/browser/views/tabs/tab_overview_types.cc
@@ -214,4 +214,12 @@ TabOverviewTypes::TabOverviewTypes() {
wm_message_atom_ = type_to_atom_[ATOM_CHROME_WM_MESSAGE];
wm_ = XGetSelectionOwner(x11_util::GetXDisplay(), type_to_atom_[ATOM_WM_S0]);
+
+ // Let the window manager know which version of the IPC messages we support.
+ Message msg(Message::WM_NOTIFY_IPC_VERSION);
+ // TODO: The version number is the latest listed in tab_overview_types.h --
+ // ideally, once this header is shared between Chrome and the Chrome OS window
+ // manager, we'll just define the version statically in the header.
+ msg.set_param(0, 1);
+ SendMessage(msg);
}
diff --git a/chrome/browser/views/tabs/tab_overview_types.h b/chrome/browser/views/tabs/tab_overview_types.h
index f88e364..44b5f15 100644
--- a/chrome/browser/views/tabs/tab_overview_types.h
+++ b/chrome/browser/views/tabs/tab_overview_types.h
@@ -78,6 +78,8 @@ class TabOverviewTypes {
struct Message {
public:
+ // NOTE: Don't remove values from this enum; it is shared between
+ // Chrome and the window manager.
enum Type {
UNKNOWN = 0,
@@ -122,19 +124,30 @@ class TabOverviewTypes {
// param[2]: Y coordinate
WM_MOVE_FLOATING_TAB,
- // Instruct the WM to move a panel.
- // param[0]: X ID of the panel window
- // param[1]: X coordinate to which the panel should be moved
- // param[2]: Y coordinate
- WM_MOVE_PANEL,
+ // Notify the WM that a panel has been dragged.
+ // param[0]: X ID of the panel's content window
+ // param[1]: X coordinate to which the upper-right corner of the
+ // panel's titlebar window was dragged
+ // param[2]: Y coordinate to which the upper-right corner of the
+ // panel's titlebar window was dragged
+ // Note: The point given is actually that of one pixel to the right
+ // of the upper-right corner of the titlebar window. For example, a
+ // no-op move message for a 10-pixel wide titlebar whose upper-left
+ // point is at (0, 0) would contain the X and Y paremeters (10, 0):
+ // in other words, the position of the titlebar's upper-left point
+ // plus its width. This is intended to make both the Chrome and WM
+ // side of things simpler and to avoid some easy-to-make off-by-one
+ // errors.
+ WM_NOTIFY_PANEL_DRAGGED,
// Notify the WM that the panel drag is complete (that is, the mouse
// button has been released).
- // param[0]: X ID of the panel window
+ // param[0]: X ID of the panel's content window
WM_NOTIFY_PANEL_DRAG_COMPLETE,
- // Instruct the WM to focus a window. This is used when a tab is
- // clicked in a tab overview window.
+ // Instruct the WM to focus a window (either top-level or a panel).
+ // This is used when a tab is clicked in a tab overview window, or
+ // when the user clicks on a panel's titlebar to expand it.
// param[0]: X ID of the window to focus
WM_FOCUS_WINDOW,
@@ -144,9 +157,34 @@ class TabOverviewTypes {
CHROME_NOTIFY_LAYOUT_MODE,
// Instruct the WM to enter overview mode.
- // param[0]: X ID of the window show the tab overview for.
+ // param[0]: X ID of the window to show the tab overview for.
WM_SWITCH_TO_OVERVIEW_MODE,
+ // Let the WM know which version of this file Chrome is using. It's
+ // difficult to make changes synchronously to Chrome and the WM (our
+ // build scripts can use a locally-built Chromium, the latest one
+ // from the buildbot, or an older hardcoded version), so it's useful
+ // to be able to maintain compatibility in the WM with versions of
+ // Chrome that exhibit older behavior.
+ //
+ // Chrome should send a message to the WM at startup containing the
+ // latest version from the list below. For backwards compatibility,
+ // the WM assumes version 0 if it doesn't receive a message. Here
+ // are the changes that have been made in successive versions of the
+ // protocol:
+ //
+ // 1: WM_NOTIFY_PANEL_DRAGGED contains the position of the
+ // upper-right, rather than upper-left, corner of of the titlebar
+ // window
+ //
+ // TODO: The latest version should be hardcoded in this file once the
+ // file is being shared between Chrome and the WM so Chrome can just
+ // pull it from there. Better yet, the message could be sent
+ // automatically in WmIpc's c'tor.
+ //
+ // param[0]: version of this protocol currently supported
+ WM_NOTIFY_IPC_VERSION,
+
kNumTypes,
};