summaryrefslogtreecommitdiffstats
path: root/views/window/window_gtk.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 03:49:49 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 03:49:49 +0000
commit1cd6d7ffcfb20215c225e613a67b39dc5f51c4cf (patch)
treee5675385887bb9b244f10e8f4e5bf2090ef3e135 /views/window/window_gtk.cc
parent3c615f736d826d651890df71b0775873771aa7c0 (diff)
downloadchromium_src-1cd6d7ffcfb20215c225e613a67b39dc5f51c4cf.zip
chromium_src-1cd6d7ffcfb20215c225e613a67b39dc5f51c4cf.tar.gz
chromium_src-1cd6d7ffcfb20215c225e613a67b39dc5f51c4cf.tar.bz2
Implement custom window shapes as provided by the NonClientView in WindowGtk.
BUG=none TEST=none Review URL: http://codereview.chromium.org/119145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/window_gtk.cc')
-rw-r--r--views/window/window_gtk.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index c5b2208..51c726c 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -4,6 +4,7 @@
#include "views/window/window_gtk.h"
+#include "app/gfx/path.h"
#include "app/l10n_util.h"
#include "base/gfx/rect.h"
#include "views/window/custom_frame_view.h"
@@ -184,6 +185,25 @@ void WindowGtk::FrameTypeChanged() {
NOTIMPLEMENTED();
}
+////////////////////////////////////////////////////////////////////////////////
+// WindowGtk, WidgetGtk overrides:
+
+void WindowGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) {
+ WidgetGtk::OnSizeAllocate(widget, allocation);
+
+ // The Window's NonClientView may provide a custom shape for the Window.
+ gfx::Path window_mask;
+ non_client_view_->GetWindowMask(gfx::Size(allocation->width,
+ allocation->height),
+ &window_mask);
+ GdkRegion* mask_region = window_mask.CreateGdkRegion();
+ gdk_window_shape_combine_region(GetNativeView()->window, mask_region, 0, 0);
+ gdk_region_destroy(mask_region);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WindowGtk, protected:
+
WindowGtk::WindowGtk(WindowDelegate* window_delegate)
: WidgetGtk(TYPE_WINDOW),
is_modal_(false),
@@ -214,6 +234,7 @@ void WindowGtk::Init(const gfx::Rect& bounds) {
UpdateWindowTitle();
GtkWindow* gtk_window = GetNativeWindow();
+
g_signal_connect(G_OBJECT(gtk_window),
"window-state-event",
G_CALLBACK(CallWindowStateEvent),