allow use of null pointer as a valid cursor (implies using cursor of parent window)
This commit is contained in:
parent
fe08965d91
commit
90c1e0ffd2
|
@ -1012,7 +1012,7 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor)
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
|
Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
|
||||||
|
|
||||||
if (win && cursor) {
|
if (win && !_cursors->is_invalid (cursor)) {
|
||||||
win->set_cursor (*cursor);
|
win->set_cursor (*cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1020,7 +1020,7 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor)
|
||||||
size_t
|
size_t
|
||||||
Editor::push_canvas_cursor (Gdk::Cursor* cursor)
|
Editor::push_canvas_cursor (Gdk::Cursor* cursor)
|
||||||
{
|
{
|
||||||
if (cursor) {
|
if (!_cursors->is_invalid (cursor)) {
|
||||||
_cursor_stack.push_back (cursor);
|
_cursor_stack.push_back (cursor);
|
||||||
set_canvas_cursor (cursor);
|
set_canvas_cursor (cursor);
|
||||||
}
|
}
|
||||||
|
@ -1095,7 +1095,7 @@ Editor::which_trim_cursor (bool left) const
|
||||||
Gdk::Cursor*
|
Gdk::Cursor*
|
||||||
Editor::which_mode_cursor () const
|
Editor::which_mode_cursor () const
|
||||||
{
|
{
|
||||||
Gdk::Cursor* mode_cursor = 0;
|
Gdk::Cursor* mode_cursor = _cursors->invalid_cursor ();
|
||||||
|
|
||||||
switch (mouse_mode) {
|
switch (mouse_mode) {
|
||||||
case MouseRange:
|
case MouseRange:
|
||||||
|
@ -1161,7 +1161,7 @@ Editor::which_mode_cursor () const
|
||||||
Gdk::Cursor*
|
Gdk::Cursor*
|
||||||
Editor::which_track_cursor () const
|
Editor::which_track_cursor () const
|
||||||
{
|
{
|
||||||
Gdk::Cursor* cursor = 0;
|
Gdk::Cursor* cursor = _cursors->invalid_cursor();
|
||||||
|
|
||||||
switch (_join_object_range_state) {
|
switch (_join_object_range_state) {
|
||||||
case JOIN_OBJECT_RANGE_NONE:
|
case JOIN_OBJECT_RANGE_NONE:
|
||||||
|
@ -1332,7 +1332,7 @@ Editor::choose_canvas_cursor_on_entry (ItemType type)
|
||||||
|
|
||||||
Gdk::Cursor* cursor = which_canvas_cursor(type);
|
Gdk::Cursor* cursor = which_canvas_cursor(type);
|
||||||
|
|
||||||
if (cursor) {
|
if (!_cursors->is_invalid (cursor)) {
|
||||||
// Push a new enter context
|
// Push a new enter context
|
||||||
const EnterContext ctx = { type, CursorContext::create(*this, cursor) };
|
const EnterContext ctx = { type, CursorContext::create(*this, cursor) };
|
||||||
_enter_stack.push_back(ctx);
|
_enter_stack.push_back(ctx);
|
||||||
|
|
|
@ -234,11 +234,13 @@ Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t /*t
|
||||||
_item->ungrab ();
|
_item->ungrab ();
|
||||||
_item = new_item;
|
_item = new_item;
|
||||||
|
|
||||||
if (cursor == 0) {
|
if (!_cursor_ctx) {
|
||||||
_item->grab ();
|
_cursor_ctx = CursorContext::create (*_editor, cursor);
|
||||||
} else {
|
} else {
|
||||||
_item->grab ();
|
_cursor_ctx->change (cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_item->grab ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -271,12 +273,11 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
|
||||||
|
|
||||||
_last_pointer_y = _grab_y;
|
_last_pointer_y = _grab_y;
|
||||||
|
|
||||||
if (cursor == 0) {
|
_item->grab ();
|
||||||
_item->grab ();
|
|
||||||
} else {
|
if (!_editor->cursors()->is_invalid (cursor)) {
|
||||||
/* CAIROCANVAS need a variant here that passes *cursor */
|
/* CAIROCANVAS need a variant here that passes *cursor */
|
||||||
_item->grab ();
|
_cursor_ctx = CursorContext::create (*_editor, cursor);
|
||||||
_cursor_ctx = CursorContext::create(*_editor, cursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_editor->session() && _editor->session()->transport_rolling()) {
|
if (_editor->session() && _editor->session()->transport_rolling()) {
|
||||||
|
@ -4151,7 +4152,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Cursor* cursor = 0;
|
Gdk::Cursor* cursor = _editor->cursors()->invalid_cursor();
|
||||||
|
|
||||||
switch (_operation) {
|
switch (_operation) {
|
||||||
case CreateSelection:
|
case CreateSelection:
|
||||||
|
@ -4489,7 +4490,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Cursor* cursor = 0;
|
Gdk::Cursor* cursor = _editor->cursors()->invalid_cursor();
|
||||||
|
|
||||||
if (!_editor->temp_location) {
|
if (!_editor->temp_location) {
|
||||||
_editor->temp_location = new Location (*_editor->session());
|
_editor->temp_location = new Location (*_editor->session());
|
||||||
|
|
|
@ -211,4 +211,11 @@ MouseCursors::set_cursor_set (const std::string& name)
|
||||||
midi_resize = new Cursor (SIZING);
|
midi_resize = new Cursor (SIZING);
|
||||||
midi_erase = new Cursor (DRAPED_BOX);
|
midi_erase = new Cursor (DRAPED_BOX);
|
||||||
up_down = new Cursor (SB_V_DOUBLE_ARROW);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,11 +73,22 @@ public:
|
||||||
Gdk::Cursor* expand_left_right;
|
Gdk::Cursor* expand_left_right;
|
||||||
Gdk::Cursor* expand_up_down;
|
Gdk::Cursor* expand_up_down;
|
||||||
|
|
||||||
|
/* This cursor is not intended to be used directly, it just
|
||||||
|
serves as an out-of-bounds value when we need to indicate
|
||||||
|
"no cursor". NULL/0 doesn't work for this, because it
|
||||||
|
is actually a valid value for a Gdk::Cursor - it indicates
|
||||||
|
"use the parent window's cursor"
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool is_invalid (Gdk::Cursor* c) const { return c == _invalid; }
|
||||||
|
Gdk::Cursor* invalid_cursor() const { return _invalid; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _cursor_set;
|
std::string _cursor_set;
|
||||||
void drop_all ();
|
void drop_all ();
|
||||||
|
|
||||||
Gdk::Cursor* make_cursor (const char* name, int hotspot_x = 0, int hotspot_y = 0);
|
Gdk::Cursor* make_cursor (const char* name, int hotspot_x = 0, int hotspot_y = 0);
|
||||||
|
Gdk::Cursor* _invalid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtk2_ardour_mouse_cursors__ */
|
#endif /* __gtk2_ardour_mouse_cursors__ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user