[glom] Use Gdk::Cursor via RefPtr.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Use Gdk::Cursor via RefPtr.
- Date: Wed, 5 Jan 2011 13:29:34 +0000 (UTC)
commit fb433502a3ede871279935bbee028aa442d1e972
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Jan 5 14:29:26 2011 +0100
Use Gdk::Cursor via RefPtr.
* glom/bakery/busy_cursor.[h|cc]:
* glom/utility_widgets/canvas/canvas_item_movable.[h|cc]:
gtkmm 3 now requires Gdk::Cursor to be used via RefPtr.
ChangeLog | 8 ++++++++
glom/bakery/busy_cursor.cc | 14 +++++---------
glom/bakery/busy_cursor.h | 9 ++++-----
glom/utility_widgets/canvas/canvas_item_movable.cc | 18 +++++++++---------
glom/utility_widgets/canvas/canvas_item_movable.h | 6 +++---
5 files changed, 29 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 81997d9..c8c6338 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-01-05 Murray Cumming <murrayc murrayc com>
+ Use Gdk::Cursor via RefPtr.
+
+ * glom/bakery/busy_cursor.[h|cc]:
+ * glom/utility_widgets/canvas/canvas_item_movable.[h|cc]:
+ gtkmm 3 now requires Gdk::Cursor to be used via RefPtr.
+
+2011-01-05 Murray Cumming <murrayc murrayc com>
+
Replace a used of (removed from GTK+) gdk_spawn_*() API.
* glom/application.cc: This partially fixes the build.
diff --git a/glom/bakery/busy_cursor.cc b/glom/bakery/busy_cursor.cc
index c982ca4..04426fc 100644
--- a/glom/bakery/busy_cursor.cc
+++ b/glom/bakery/busy_cursor.cc
@@ -9,19 +9,16 @@ namespace Glom
BusyCursor::type_map_cursors BusyCursor::m_map_cursors;
BusyCursor::BusyCursor(Gtk::Window& window, Gdk::CursorType cursor_type)
-: m_Cursor(cursor_type),
- m_old_cursor_valid(false)
+: m_Cursor( Gdk::Cursor::create(cursor_type) ),
+ m_pWindow(&window) //If this is a nested cursor then remember the previously-set cursor, so we can restore it.
{
- //If this is a nested cursor then remember the previously-set cursor, so we can restore it:
- m_pWindow = &window;
init();
}
BusyCursor::BusyCursor(Gtk::Window* window, Gdk::CursorType cursor_type)
-: m_Cursor(cursor_type),
- m_old_cursor_valid(false)
+: m_Cursor( Gdk::Cursor::create(cursor_type) ),
+ m_pWindow(window) //If this is a nested cursor then remember the previously-set cursor, so we can restore it.
{
- m_pWindow = window;
if(m_pWindow)
init();
}
@@ -39,7 +36,6 @@ void BusyCursor::init()
if(iter != m_map_cursors.end())
{
m_old_cursor = iter->second; //Remember the existing cursor.
- m_old_cursor_valid = true;
}
m_map_cursors[m_pWindow] = m_Cursor; //Let a further nested cursor know about the new cursor in use.
@@ -55,7 +51,7 @@ void BusyCursor::init()
BusyCursor::~BusyCursor()
{
//Restore the old cursor:
- if(m_old_cursor_valid)
+ if(m_old_cursor)
{
if(m_refWindow)
m_refWindow->set_cursor(m_old_cursor);
diff --git a/glom/bakery/busy_cursor.h b/glom/bakery/busy_cursor.h
index 98c9387..b21e4c4 100644
--- a/glom/bakery/busy_cursor.h
+++ b/glom/bakery/busy_cursor.h
@@ -42,19 +42,18 @@ public:
virtual ~BusyCursor();
-protected:
+private:
void init();
void force_gui_update();
- Gdk::Cursor m_Cursor;
+ Glib::RefPtr<Gdk::Cursor> m_Cursor;
Gtk::Window* m_pWindow;
Glib::RefPtr<Gdk::Window> m_refWindow;
- typedef std::map<Gtk::Window*, Gdk::Cursor> type_map_cursors;
+ typedef std::map<Gtk::Window*, Glib::RefPtr<Gdk::Cursor> > type_map_cursors;
static type_map_cursors m_map_cursors;
- Gdk::Cursor m_old_cursor;
- bool m_old_cursor_valid;
+ Glib::RefPtr<Gdk::Cursor> m_old_cursor;
};
} //namespace Glom
diff --git a/glom/utility_widgets/canvas/canvas_item_movable.cc b/glom/utility_widgets/canvas/canvas_item_movable.cc
index fd3008a..263f20e 100644
--- a/glom/utility_widgets/canvas/canvas_item_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_item_movable.cc
@@ -196,25 +196,25 @@ CanvasItemMovable::type_signal_show_context CanvasItemMovable::signal_show_conte
return m_signal_show_context;
}
-void CanvasItemMovable::set_drag_cursor(const Gdk::Cursor& cursor)
+void CanvasItemMovable::set_drag_cursor(const Glib::RefPtr<Gdk::Cursor>& cursor)
{
m_drag_cursor = cursor;
}
void CanvasItemMovable::set_drag_cursor(Gdk::CursorType cursor)
{
- m_drag_cursor = Gdk::Cursor(cursor);
+ m_drag_cursor = Gdk::Cursor::create(cursor);
}
-void CanvasItemMovable::set_cursor(const Gdk::Cursor& cursor)
+void CanvasItemMovable::set_cursor(const Glib::RefPtr<Gdk::Cursor>& cursor)
{
Goocanvas::Canvas* canvas = get_parent_canvas_widget();
- if(canvas)
- {
- Glib::RefPtr<Gdk::Window> window = canvas->get_window();
- if(window)
- window->set_cursor(cursor);
- }
+ if(!canvas)
+ return;
+
+ Glib::RefPtr<Gdk::Window> window = canvas->get_window();
+ if(window)
+ window->set_cursor(cursor);
}
void CanvasItemMovable::unset_cursor()
diff --git a/glom/utility_widgets/canvas/canvas_item_movable.h b/glom/utility_widgets/canvas/canvas_item_movable.h
index 5d197f6..bd1f8f4 100644
--- a/glom/utility_widgets/canvas/canvas_item_movable.h
+++ b/glom/utility_widgets/canvas/canvas_item_movable.h
@@ -58,7 +58,7 @@ public:
virtual void set_width_height(double width, double height) = 0;
void set_drag_cursor(Gdk::CursorType cursor);
- void set_drag_cursor(const Gdk::Cursor& cursor);
+ void set_drag_cursor(const Glib::RefPtr<Gdk::Cursor>& cursor);
typedef sigc::signal<void> type_signal_moved;
@@ -95,7 +95,7 @@ private:
virtual Goocanvas::Canvas* get_parent_canvas_widget() = 0;
- void set_cursor(const Gdk::Cursor& cursor);
+ void set_cursor(const Glib::RefPtr<Gdk::Cursor>& cursor);
void unset_cursor();
public:
@@ -111,7 +111,7 @@ private:
bool m_dragging_vertical_only, m_dragging_horizontal_only; //Set by using Ctrl while dragging.
double m_drag_start_cursor_x, m_drag_start_cursor_y;
double m_drag_start_position_x, m_drag_start_position_y;
- Gdk::Cursor m_drag_cursor;
+ Glib::RefPtr<Gdk::Cursor> m_drag_cursor;
protected:
Glib::RefPtr<const CanvasGroupGrid> m_grid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]