summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor_canvas.cc13
-rw-r--r--gtk2_ardour/editor_drag.cc4
-rw-r--r--gtk2_ardour/editor_drag.h5
-rw-r--r--gtk2_ardour/mouse_cursors.cc18
-rw-r--r--gtk2_ardour/mouse_cursors.h7
5 files changed, 30 insertions, 17 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 4a5378f145..c1929bd38b 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -1013,7 +1013,14 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor)
Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
if (win && !_cursors->is_invalid (cursor)) {
- win->set_cursor (*cursor);
+ /* glibmm 2.4 doesn't allow null cursor pointer because it uses
+ a Gdk::Cursor& as the argument to Gdk::Window::set_cursor().
+ But a null pointer just means "use parent window cursor",
+ and so should be allowed. Gtkmm 3.x has fixed this API.
+
+ For now, drop down and use C API
+ */
+ gdk_window_set_cursor (win->gobj(), cursor ? cursor->gobj() : 0);
}
}
@@ -1095,7 +1102,7 @@ Editor::which_trim_cursor (bool left) const
Gdk::Cursor*
Editor::which_mode_cursor () const
{
- Gdk::Cursor* mode_cursor = _cursors->invalid_cursor ();
+ Gdk::Cursor* mode_cursor = MouseCursors::invalid_cursor ();
switch (mouse_mode) {
case MouseRange:
@@ -1161,7 +1168,7 @@ Editor::which_mode_cursor () const
Gdk::Cursor*
Editor::which_track_cursor () const
{
- Gdk::Cursor* cursor = _cursors->invalid_cursor();
+ Gdk::Cursor* cursor = MouseCursors::invalid_cursor();
switch (_join_object_range_state) {
case JOIN_OBJECT_RANGE_NONE:
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 9d97f132fc..e9c315cf96 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -4152,7 +4152,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
return;
}
- Gdk::Cursor* cursor = _editor->cursors()->invalid_cursor();
+ Gdk::Cursor* cursor = MouseCursors::invalid_cursor();
switch (_operation) {
case CreateSelection:
@@ -4490,7 +4490,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
return;
}
- Gdk::Cursor* cursor = _editor->cursors()->invalid_cursor();
+ Gdk::Cursor* cursor = MouseCursors::invalid_cursor();
if (!_editor->temp_location) {
_editor->temp_location = new Location (*_editor->session());
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index aec672d92f..66ea64eb54 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -29,6 +29,7 @@
#include "cursor_context.h"
#include "editor_items.h"
+#include "mouse_cursors.h"
namespace ARDOUR {
class Location;
@@ -58,8 +59,8 @@ public:
void abort ();
void add (Drag *);
- void set (Drag *, GdkEvent *, Gdk::Cursor* c = 0);
- void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
+ void set (Drag *, GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
+ void start_grab (GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
bool end_grab (GdkEvent *);
bool have_item (ArdourCanvas::Item *) const;
diff --git a/gtk2_ardour/mouse_cursors.cc b/gtk2_ardour/mouse_cursors.cc
index 93bba191f8..b50bfa11c6 100644
--- a/gtk2_ardour/mouse_cursors.cc
+++ b/gtk2_ardour/mouse_cursors.cc
@@ -27,6 +27,8 @@
using namespace ARDOUR_UI_UTILS;
+Gdk::Cursor* MouseCursors::_invalid = 0;
+
MouseCursors::MouseCursors ()
: cross_hair (0)
, scissors (0)
@@ -211,11 +213,13 @@ MouseCursors::set_cursor_set (const std::string& name)
midi_resize = new Cursor (SIZING);
midi_erase = new Cursor (DRAPED_BOX);
up_down = new Cursor (SB_V_DOUBLE_ARROW);
-
- {
- char pix[4] = { 0, 0, 0, 0 };
- RefPtr<Bitmap> bits = Bitmap::create (pix, 2, 2);
- Color c;
- _invalid = new Cursor (bits, bits, c, c, 0, 0);
- }
+}
+
+void
+MouseCursors::create_invalid()
+{
+ char pix[4] = { 0, 0, 0, 0 };
+ Glib::RefPtr<Gdk::Bitmap> bits = Gdk::Bitmap::create (pix, 2, 2);
+ Gdk::Color c;
+ _invalid = new Gdk::Cursor (bits, bits, c, c, 0, 0);
}
diff --git a/gtk2_ardour/mouse_cursors.h b/gtk2_ardour/mouse_cursors.h
index 756b2657d9..7f43e19eec 100644
--- a/gtk2_ardour/mouse_cursors.h
+++ b/gtk2_ardour/mouse_cursors.h
@@ -80,15 +80,16 @@ public:
"use the parent window's cursor"
*/
- bool is_invalid (Gdk::Cursor* c) const { return c == _invalid; }
- Gdk::Cursor* invalid_cursor() const { return _invalid; }
+ static bool is_invalid (Gdk::Cursor* c) { if (!_invalid) { create_invalid(); } return c == _invalid; }
+ static Gdk::Cursor* invalid_cursor() { if (!_invalid) { create_invalid(); } return _invalid; }
private:
std::string _cursor_set;
void drop_all ();
Gdk::Cursor* make_cursor (const char* name, int hotspot_x = 0, int hotspot_y = 0);
- Gdk::Cursor* _invalid;
+ static Gdk::Cursor* _invalid;
+ static void create_invalid ();
};
#endif /* __gtk2_ardour_mouse_cursors__ */