| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "chrome/browser/ui/gtk/gtk_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstdarg> | 10 #include <cstdarg> |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); | 510 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); |
| 511 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); | 511 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); |
| 512 if (pack_at_end) | 512 if (pack_at_end) |
| 513 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); | 513 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); |
| 514 else | 514 else |
| 515 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); | 515 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); |
| 516 | 516 |
| 517 return centering_vbox; | 517 return centering_vbox; |
| 518 } | 518 } |
| 519 | 519 |
| 520 void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate) { | |
| 521 std::vector<XID> stack; | |
| 522 if (!ui::GetXWindowStack(ui::GetX11RootWindow(), &stack)) { | |
| 523 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back | |
| 524 // to old school enumeration of all X windows. Some WMs parent 'top-level' | |
| 525 // windows in unnamed actual top-level windows (ion WM), so extend the | |
| 526 // search depth to all children of top-level windows. | |
| 527 const int kMaxSearchDepth = 1; | |
| 528 ui::EnumerateAllWindows(delegate, kMaxSearchDepth); | |
| 529 return; | |
| 530 } | |
| 531 | |
| 532 std::vector<XID>::iterator iter; | |
| 533 for (iter = stack.begin(); iter != stack.end(); iter++) { | |
| 534 if (delegate->ShouldStopIterating(*iter)) | |
| 535 return; | |
| 536 } | |
| 537 } | |
| 538 | |
| 539 void SetButtonClickableByMouseButtons(GtkWidget* button, | 520 void SetButtonClickableByMouseButtons(GtkWidget* button, |
| 540 bool left, bool middle, bool right) { | 521 bool left, bool middle, bool right) { |
| 541 gint button_mask = 0; | 522 gint button_mask = 0; |
| 542 if (left) | 523 if (left) |
| 543 button_mask |= 1 << 1; | 524 button_mask |= 1 << 1; |
| 544 if (middle) | 525 if (middle) |
| 545 button_mask |= 1 << 2; | 526 button_mask |= 1 << 2; |
| 546 if (right) | 527 if (right) |
| 547 button_mask |= 1 << 3; | 528 button_mask |= 1 << 3; |
| 548 void* userdata = GINT_TO_POINTER(button_mask); | 529 void* userdata = GINT_TO_POINTER(button_mask); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 | 1037 |
| 1057 void DoCopy(BrowserWindow* window) { | 1038 void DoCopy(BrowserWindow* window) { |
| 1058 DoCutCopyPaste(window, &RenderWidgetHost::Copy, "copy-clipboard"); | 1039 DoCutCopyPaste(window, &RenderWidgetHost::Copy, "copy-clipboard"); |
| 1059 } | 1040 } |
| 1060 | 1041 |
| 1061 void DoPaste(BrowserWindow* window) { | 1042 void DoPaste(BrowserWindow* window) { |
| 1062 DoCutCopyPaste(window, &RenderWidgetHost::Paste, "paste-clipboard"); | 1043 DoCutCopyPaste(window, &RenderWidgetHost::Paste, "paste-clipboard"); |
| 1063 } | 1044 } |
| 1064 | 1045 |
| 1065 } // namespace gtk_util | 1046 } // namespace gtk_util |
| OLD | NEW |