Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/platform/window_manager/panel_bar.cc

Issue 527005: wm: Make WM_MOVE_PANEL use top-right coordinates. (Closed)
Patch Set: fix a poorly-worded sentence Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "window_manager/panel_bar.h" 5 #include "window_manager/panel_bar.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <gflags/gflags.h> 9 #include <gflags/gflags.h>
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 << "window " << win->xid_str(); 336 << "window " << win->xid_str();
337 return true; 337 return true;
338 } 338 }
339 if (msg.param(1)) { 339 if (msg.param(1)) {
340 ExpandPanel(panel, true); // create_anchor 340 ExpandPanel(panel, true); // create_anchor
341 } else { 341 } else {
342 CollapsePanel(panel); 342 CollapsePanel(panel);
343 } 343 }
344 break; 344 break;
345 } 345 }
346 case WmIpc::Message::WM_MOVE_PANEL: { 346 case WmIpc::Message::WM_NOTIFY_PANEL_DRAGGED: {
347 XWindow xid = msg.param(0); 347 XWindow xid = msg.param(0);
348 Window* win = wm_->GetWindow(xid); 348 Window* win = wm_->GetWindow(xid);
349 if (!win) { 349 if (!win) {
350 LOG(WARNING) << "Ignoring WM_MOVE_PANEL message for unknown window " 350 LOG(WARNING) << "Ignoring WM_NOTIFY_PANEL_DRAGGED message for unknown "
351 << XidStr(xid); 351 << "window " << XidStr(xid);
352 return true; 352 return true;
353 } 353 }
354 int x = msg.param(1); 354 int x = msg.param(1);
355 int y = msg.param(2); 355 int y = msg.param(2);
356 StorePanelPosition(win, x, y); 356 StorePanelPosition(win, x, y);
357 break; 357 break;
358 } 358 }
359 case WmIpc::Message::WM_NOTIFY_PANEL_DRAG_COMPLETE: { 359 case WmIpc::Message::WM_NOTIFY_PANEL_DRAG_COMPLETE: {
360 XWindow xid = msg.param(0); 360 XWindow xid = msg.param(0);
361 Window* win = wm_->GetWindow(xid); 361 Window* win = wm_->GetWindow(xid);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 if (dragged_panel_event_coalescer_.IsRunning()) 514 if (dragged_panel_event_coalescer_.IsRunning())
515 dragged_panel_event_coalescer_.Stop(); 515 dragged_panel_event_coalescer_.Stop();
516 } 516 }
517 517
518 void PanelBar::MoveDraggedPanel() { 518 void PanelBar::MoveDraggedPanel() {
519 if (!dragged_panel_) 519 if (!dragged_panel_)
520 return; 520 return;
521 521
522 const int drag_x = dragged_panel_event_coalescer_.x(); 522 const int drag_x = dragged_panel_event_coalescer_.x();
523 dragged_panel_->MoveX(drag_x + dragged_panel_->titlebar_width(), false, 0); 523 dragged_panel_->MoveX((wm_->wm_ipc_version() >= 1) ?
524 drag_x :
525 drag_x + dragged_panel_->titlebar_width(),
526 false, 0);
524 527
525 // When an expanded panel is being dragged, we don't move the other 528 // When an expanded panel is being dragged, we don't move the other
526 // panels to make room for it until the drag is done. 529 // panels to make room for it until the drag is done.
527 if (GetPanelInfoOrDie(dragged_panel_)->is_expanded) 530 if (GetPanelInfoOrDie(dragged_panel_)->is_expanded)
528 return; 531 return;
529 532
530 // For collapsed panels, we first find the position of the dragged panel. 533 // For collapsed panels, we first find the position of the dragged panel.
531 Panels::iterator dragged_it = FindPanelInVectorByWindow( 534 Panels::iterator dragged_it = FindPanelInVectorByWindow(
532 collapsed_panels_, *(dragged_panel_->content_win())); 535 collapsed_panels_, *(dragged_panel_->content_win()));
533 CHECK(dragged_it != collapsed_panels_.end()); 536 CHECK(dragged_it != collapsed_panels_.end());
534 537
535 // Next, check if the center of the panel has moved over another panel. 538 // Next, check if the center of the panel has moved over another panel.
536 const int center_x = drag_x + 0.5 * dragged_panel_->titlebar_width(); 539 const int center_x = (wm_->wm_ipc_version() >= 1) ?
540 drag_x - 0.5 * dragged_panel_->titlebar_width() :
541 drag_x + 0.5 * dragged_panel_->titlebar_width();
537 Panels::iterator it = collapsed_panels_.begin(); 542 Panels::iterator it = collapsed_panels_.begin();
538 for (; it != collapsed_panels_.end(); ++it) { 543 for (; it != collapsed_panels_.end(); ++it) {
539 int snapped_left = 0, snapped_right = 0; 544 int snapped_left = 0, snapped_right = 0;
540 if (it->get() == dragged_panel_) { 545 if (it->get() == dragged_panel_) {
541 // If we're comparing against ourselves, use our original position 546 // If we're comparing against ourselves, use our original position
542 // rather than wherever we've currently been dragged by the user. 547 // rather than wherever we've currently been dragged by the user.
543 PanelInfo* info = GetPanelInfoOrDie(dragged_panel_); 548 PanelInfo* info = GetPanelInfoOrDie(dragged_panel_);
544 snapped_left = info->snapped_right - dragged_panel_->titlebar_width(); 549 snapped_left = info->snapped_right - dragged_panel_->titlebar_width();
545 snapped_right = info->snapped_right; 550 snapped_right = info->snapped_right;
546 } else { 551 } else {
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 1019
1015 void PanelBar::MoveExpandedPanelOnscreen(Panel* panel, int anim_ms) { 1020 void PanelBar::MoveExpandedPanelOnscreen(Panel* panel, int anim_ms) {
1016 CHECK(GetPanelInfoOrDie(panel)->is_expanded); 1021 CHECK(GetPanelInfoOrDie(panel)->is_expanded);
1017 if (panel->content_x() < x_) 1022 if (panel->content_x() < x_)
1018 panel->MoveX(x_ + panel->content_width(), true, anim_ms); 1023 panel->MoveX(x_ + panel->content_width(), true, anim_ms);
1019 else if (panel->right() > x_ + width_) 1024 else if (panel->right() > x_ + width_)
1020 panel->MoveX(x_ + width_, true, anim_ms); 1025 panel->MoveX(x_ + width_, true, anim_ms);
1021 } 1026 }
1022 1027
1023 } // namespace window_manager 1028 } // namespace window_manager
OLDNEW
« no previous file with comments | « src/platform/window_manager/mock_chrome.cc ('k') | src/platform/window_manager/window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698