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

Unified Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 10831226: Panels refactor: Support browserless panels on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove static initializer Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/gtk_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 38739a92f6907ed48463725be90088fab55510dd..8f106730388764997c736c0a6c1f208b36eab793 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
-#include <dlfcn.h>
#include <gdk/gdkkeysyms.h>
#include <algorithm>
@@ -61,6 +60,7 @@
#include "chrome/browser/ui/gtk/global_menu_bar.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
+#include "chrome/browser/ui/gtk/gtk_window_util.h"
#include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h"
#include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
@@ -152,24 +152,6 @@ const int kCustomFrameBackgroundVerticalOffset = 15;
// gtk_window_get_position() after the last GTK configure-event signal.
const int kDebounceTimeoutMilliseconds = 100;
-// Ubuntu patches their verrsion of GTK+ so that there is always a
-// gripper in the bottom right corner of the window. We dynamically
-// look up this symbol because it's a non-standard Ubuntu extension to
-// GTK+. We always need to disable this feature since we can't
-// communicate this to WebKit easily.
-typedef void (*gtk_window_set_has_resize_grip_func)(GtkWindow*, gboolean);
-gtk_window_set_has_resize_grip_func gtk_window_set_has_resize_grip_sym;
-
-void EnsureResizeGripFunction() {
- static bool resize_grip_looked_up = false;
- if (!resize_grip_looked_up) {
- resize_grip_looked_up = true;
- gtk_window_set_has_resize_grip_sym =
- reinterpret_cast<gtk_window_set_has_resize_grip_func>(
- dlsym(NULL, "gtk_window_set_has_resize_grip"));
- }
-}
-
// Using gtk_window_get_position/size creates a race condition, so only use
// this to get the initial bounds. After window creation, we pick up the
// normal bounds by connecting to the configure-event signal.
@@ -236,30 +218,6 @@ int GetPreHandleCommandId(GdkEventKey* event) {
return -1;
}
-GdkCursorType GdkWindowEdgeToGdkCursorType(GdkWindowEdge edge) {
- switch (edge) {
- case GDK_WINDOW_EDGE_NORTH_WEST:
- return GDK_TOP_LEFT_CORNER;
- case GDK_WINDOW_EDGE_NORTH:
- return GDK_TOP_SIDE;
- case GDK_WINDOW_EDGE_NORTH_EAST:
- return GDK_TOP_RIGHT_CORNER;
- case GDK_WINDOW_EDGE_WEST:
- return GDK_LEFT_SIDE;
- case GDK_WINDOW_EDGE_EAST:
- return GDK_RIGHT_SIDE;
- case GDK_WINDOW_EDGE_SOUTH_WEST:
- return GDK_BOTTOM_LEFT_CORNER;
- case GDK_WINDOW_EDGE_SOUTH:
- return GDK_BOTTOM_SIDE;
- case GDK_WINDOW_EDGE_SOUTH_EAST:
- return GDK_BOTTOM_RIGHT_CORNER;
- default:
- NOTREACHED();
- }
- return GDK_LAST_CURSOR;
-}
-
// A helper method for setting the GtkWindow size that should be used in place
// of calling gtk_window_resize directly. This is done to avoid a WM "feature"
// where setting the window size to the monitor size causes the WM to set the
@@ -381,9 +339,7 @@ void BrowserWindowGtk::Init() {
GDK_POINTER_MOTION_MASK);
// Disable the resize gripper on Ubuntu.
- EnsureResizeGripFunction();
- if (gtk_window_set_has_resize_grip_sym)
- gtk_window_set_has_resize_grip_sym(GTK_WINDOW(window_), FALSE);
+ gtk_window_util::DisableResizeGrip(window_);
// Add this window to its own unique window group to allow for
// window-to-parent modality.
@@ -1226,15 +1182,18 @@ void BrowserWindowGtk::ShowCreateChromeAppShortcutsDialog(
}
void BrowserWindowGtk::Cut() {
- gtk_util::DoCut(this);
+ gtk_window_util::DoCut(
+ window_, chrome::GetActiveWebContents(browser_.get()));
}
void BrowserWindowGtk::Copy() {
- gtk_util::DoCopy(this);
+ gtk_window_util::DoCopy(
+ window_, chrome::GetActiveWebContents(browser_.get()));
}
void BrowserWindowGtk::Paste() {
- gtk_util::DoPaste(this);
+ gtk_window_util::DoPaste(
+ window_, chrome::GetActiveWebContents(browser_.get()));
}
void BrowserWindowGtk::ShowInstant(TabContents* preview) {
@@ -2258,7 +2217,7 @@ gboolean BrowserWindowGtk::OnMouseMoveEvent(GtkWidget* widget,
static_cast<int>(event->y), &edge);
GdkCursorType new_cursor = GDK_LAST_CURSOR;
if (has_hit_edge)
- new_cursor = GdkWindowEdgeToGdkCursorType(edge);
+ new_cursor = gtk_window_util::GdkWindowEdgeToGdkCursorType(edge);
GdkCursorType last_cursor = GDK_LAST_CURSOR;
if (frame_cursor_)
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/gtk_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698