[gtkmm] Widget::set_window(): Increase the ref count of the Gdk::Window.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Widget::set_window(): Increase the ref count of the Gdk::Window.
- Date: Thu, 13 Jan 2011 10:32:50 +0000 (UTC)
commit ca7941d984bd673eb89bc6e99e37a3887ae3e96b
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Jan 13 11:32:37 2011 +0100
Widget::set_window(): Increase the ref count of the Gdk::Window.
* gdk/src/widget.[hg|ccg]: set_window() increases the ref count of the
Gdk::Window, since gtk_widget_set_window() does not.
Bug #606903 (Hammered)
ChangeLog | 9 +++++++++
gtk/src/widget.ccg | 7 +++++++
gtk/src/widget.hg | 18 +++++++++++++++++-
3 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f770e36..3436e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-11 Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+ Widget::set_window(): Increase the ref count of the Gdk::Window.
+
+ * gdk/src/widget.[hg|ccg]: set_window() increases the ref count of the
+ Gdk::Window, since gtk_widget_set_window() does not.
+
+ Bug #606903 (Hammered)
+
2.99.1:
2011-01-12 Murray Cumming <murrayc murrayc com>
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index b9c438a..f297a69 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -198,6 +198,13 @@ Widget* Widget::get_current_modal_grab()
return Glib::wrap(gtk_grab_get_current());
}
+void Widget::set_window(const Glib::RefPtr<Gdk::Window>& window)
+{
+ gtk_widget_set_window(gobj(), Glib::unwrap(window));
+ if (window)
+ window->reference(); // gtk_widget_set_window does not add a ref.
+}
+
Allocation Widget::get_allocation() const
{
Allocation allocation;
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 5c3e57e..eb742df 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -240,7 +240,23 @@ public:
_WRAP_METHOD(void set_child_visible(bool is_visible = true), gtk_widget_set_child_visible)
_WRAP_METHOD(bool get_child_visible() const, gtk_widget_get_child_visible)
- _WRAP_METHOD(void set_window(const Glib::RefPtr<Gdk::Window>& window), gtk_widget_set_window)
+ /** Sets a widget's window. This function should only be used in a
+ * widget's Gtk::Widget::on_realize() implementation. The %window passed is
+ * usually either a new window created with Gdk::Window::create(), or the
+ * window of its parent widget as returned by get_parent_window().
+ *
+ * Widgets must indicate whether they will create their own Gdk::Window
+ * by calling set_has_window(). This is usually done in the
+ * widget's constructor.
+ *
+ * This function should only be called by custom widget implementations,
+ * and they should call it in their on_realize() function.
+ *
+ * @newin{2,18}
+ * @param window A Gdk::Window.
+ */
+ void set_window(const Glib::RefPtr<Gdk::Window>& window);
+ _IGNORE(gtk_widget_set_window)
_WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_window(), gtk_widget_get_window, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_window() const, gtk_widget_get_window, refreturn, constversion)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]