port-to-gtk3: Use Gdk::Cursor via Glib::RefPtr<> (#7)
Starting from Gtkmm3 Gdk::Cursor objects cannot be constructed directly, but instead you have to get a smart pointer to an instance by calling the static member function Gdk::Cursor::create(). Gdk::Cursor::create() returns a Glib::RefPtr<Gdk::Cursor> object. Gtkmm3 always uses Glib::RefPtr<Gdk::Cursor> in its interface and never plain Gdk::Cursor. Reference: [1] Programming with gtkmm3, Changes in gtkmm3: https://developer.gnome.org/gtkmm-tutorial/3.24/changes-gtkmm3.html.en "... Gdk::Cursor are now used via Glib::RefPtr." Closes #7 - Port to Gtk3
This commit is contained in:
parent
29a21a5a4c
commit
5fb58f8877
|
@ -82,7 +82,8 @@ protected:
|
||||||
|
|
||||||
std::vector<Gdk::Point> arrow_points;
|
std::vector<Gdk::Point> arrow_points;
|
||||||
|
|
||||||
Gdk::Cursor *cursor_resize, *cursor_move;
|
Glib::RefPtr<Gdk::Cursor> cursor_resize;
|
||||||
|
Glib::RefPtr<Gdk::Cursor> cursor_move;
|
||||||
|
|
||||||
int temp_x, temp_y ;
|
int temp_x, temp_y ;
|
||||||
bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality..
|
bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality..
|
||||||
|
|
|
@ -74,7 +74,7 @@ void DialogManageFlags::load_treeview()
|
||||||
|
|
||||||
void DialogManageFlags::on_flag_toggled( const Glib::ustring & path )
|
void DialogManageFlags::on_flag_toggled( const Glib::ustring & path )
|
||||||
{
|
{
|
||||||
get_window() ->set_cursor( Gdk::Cursor( Gdk::WATCH ) ) ;
|
get_window()->set_cursor(Gdk::Cursor::create(Gdk::WATCH));
|
||||||
set_sensitive( false ) ;
|
set_sensitive( false ) ;
|
||||||
while ( Gtk::Main::events_pending() )
|
while ( Gtk::Main::events_pending() )
|
||||||
Gtk::Main::iteration() ;
|
Gtk::Main::iteration() ;
|
||||||
|
|
|
@ -59,8 +59,8 @@ void Frame_Resizer_Base::init()
|
||||||
color_background.set("darkgrey");
|
color_background.set("darkgrey");
|
||||||
color_arrow_rectangle.set("lightgrey");
|
color_arrow_rectangle.set("lightgrey");
|
||||||
|
|
||||||
cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ;
|
cursor_resize = Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW);
|
||||||
cursor_move = new Gdk::Cursor( Gdk::FLEUR ) ;
|
cursor_move = Gdk::Cursor::create(Gdk::FLEUR);
|
||||||
|
|
||||||
GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false;
|
GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false;
|
||||||
X_END = 0;
|
X_END = 0;
|
||||||
|
@ -306,18 +306,18 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion * ev )
|
||||||
ev ->x <= X_START &&
|
ev ->x <= X_START &&
|
||||||
ev ->y >= 5 &&
|
ev ->y >= 5 &&
|
||||||
ev ->y <= 45 )
|
ev ->y <= 45 )
|
||||||
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
|
drawingarea.get_parent_window()->set_cursor(cursor_resize);
|
||||||
//right grip
|
//right grip
|
||||||
else if ( ev ->x >= X_END &&
|
else if ( ev ->x >= X_END &&
|
||||||
ev ->x <= X_END + GRIPPER &&
|
ev ->x <= X_END + GRIPPER &&
|
||||||
ev ->y >= 5 &&
|
ev ->y >= 5 &&
|
||||||
ev ->y <= 45 )
|
ev ->y <= 45 )
|
||||||
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
|
drawingarea.get_parent_window()->set_cursor(cursor_resize);
|
||||||
//move grip
|
//move grip
|
||||||
else if ( ! fixed_start &&
|
else if ( ! fixed_start &&
|
||||||
ev ->x >= X_START &&
|
ev ->x >= X_START &&
|
||||||
ev ->x <= X_END )
|
ev ->x <= X_END )
|
||||||
drawingarea .get_parent_window() ->set_cursor( *cursor_move ) ;
|
drawingarea.get_parent_window()->set_cursor(cursor_move);
|
||||||
//normal pointer
|
//normal pointer
|
||||||
else
|
else
|
||||||
drawingarea .get_parent_window() ->set_cursor() ;
|
drawingarea .get_parent_window() ->set_cursor() ;
|
||||||
|
@ -451,8 +451,6 @@ void Frame_Resizer_Base::redraw()
|
||||||
|
|
||||||
Frame_Resizer_Base::~Frame_Resizer_Base()
|
Frame_Resizer_Base::~Frame_Resizer_Base()
|
||||||
{
|
{
|
||||||
delete cursor_resize;
|
|
||||||
delete cursor_move;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -143,13 +143,13 @@ bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion * ev )
|
||||||
ev ->x <= X_START &&
|
ev ->x <= X_START &&
|
||||||
ev ->y >= 5 &&
|
ev ->y >= 5 &&
|
||||||
ev ->y <= 45 )
|
ev ->y <= 45 )
|
||||||
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
|
drawingarea.get_parent_window()->set_cursor(cursor_resize);
|
||||||
//right grip
|
//right grip
|
||||||
else if ( ev ->x >= X_END &&
|
else if ( ev ->x >= X_END &&
|
||||||
ev ->x <= X_END + GRIPPER &&
|
ev ->x <= X_END + GRIPPER &&
|
||||||
ev ->y >= 5 &&
|
ev ->y >= 5 &&
|
||||||
ev ->y <= 45 )
|
ev ->y <= 45 )
|
||||||
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
|
drawingarea.get_parent_window()->set_cursor(cursor_resize);
|
||||||
//normal pointer
|
//normal pointer
|
||||||
else
|
else
|
||||||
drawingarea .get_parent_window() ->set_cursor() ;
|
drawingarea .get_parent_window() ->set_cursor() ;
|
||||||
|
|
|
@ -3095,7 +3095,7 @@ void Win_GParted::activate_manage_flags()
|
||||||
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
||||||
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
||||||
|
|
||||||
get_window() ->set_cursor( Gdk::Cursor( Gdk::WATCH ) ) ;
|
get_window()->set_cursor(Gdk::Cursor::create(Gdk::WATCH));
|
||||||
while ( Gtk::Main::events_pending() )
|
while ( Gtk::Main::events_pending() )
|
||||||
Gtk::Main::iteration() ;
|
Gtk::Main::iteration() ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue