summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/gfx/native_widget_types.h2
-rw-r--r--app/scoped_handle_gtk.h50
-rw-r--r--app/theme_provider.h3
3 files changed, 53 insertions, 2 deletions
diff --git a/app/gfx/native_widget_types.h b/app/gfx/native_widget_types.h
index eda722d..ba845a0 100644
--- a/app/gfx/native_widget_types.h
+++ b/app/gfx/native_widget_types.h
@@ -48,10 +48,10 @@ class NSTextField;
#endif // __OBJC__
#elif defined(USE_X11)
typedef struct _GdkCursor GdkCursor;
+typedef struct _GdkRegion GdkRegion;
typedef struct _GtkWidget GtkWidget;
typedef struct _GtkWindow GtkWindow;
typedef struct _cairo cairo_t;
-typedef struct _GdkRegion GdkRegion;
#endif
namespace gfx {
diff --git a/app/scoped_handle_gtk.h b/app/scoped_handle_gtk.h
new file mode 100644
index 0000000..d501f91
--- /dev/null
+++ b/app/scoped_handle_gtk.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef APP_SCOPED_HANDLE_GTK_H_
+#define APP_SCOPED_HANDLE_GTK_H_
+
+#include <gdk/gdk.h>
+
+// Wraps a GdkRegion. This class provides the same methods as ScopedGDIObject in
+// scoped_handle_win.
+class ScopedRegion {
+ public:
+ ScopedRegion() : region_(NULL) {}
+ explicit ScopedRegion(GdkRegion* region) : region_(region) {}
+
+ ~ScopedRegion() {
+ Close();
+ }
+
+ void Set(GdkRegion* region) {
+ Close();
+
+ region_ = region;
+ }
+
+ GdkRegion* Get() {
+ return region_;
+ }
+
+ GdkRegion* release() {
+ GdkRegion* region = region_;
+ region_ = NULL;
+ return region;
+ }
+
+ private:
+ void Close() {
+ if (region_) {
+ gdk_region_destroy(region_);
+ region_ = NULL;
+ }
+ }
+
+ GdkRegion* region_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedRegion);
+};
+
+#endif // APP_SCOPED_HANDLE_GTK_H_
diff --git a/app/theme_provider.h b/app/theme_provider.h
index 0bd7ae1..13b421e 100644
--- a/app/theme_provider.h
+++ b/app/theme_provider.h
@@ -11,7 +11,8 @@
#include "third_party/skia/include/core/SkColor.h"
#if defined(OS_LINUX)
-#include <gdk/gdk.h>
+typedef struct _GdkColor GdkColor;
+typedef struct _GdkPixbuf GdkPixbuf;
#elif defined(OS_MACOSX)
#ifdef __OBJC__
@class NSColor;