Better behaviour of the resize cursor.
This commit is contained in:
@@ -48,6 +48,14 @@ public:
|
||||
std::string os_host;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
NONE,
|
||||
BOTTOM_RIGHT,
|
||||
BOTTOM,
|
||||
RIGHT
|
||||
} YellowNoteResize_t;
|
||||
|
||||
|
||||
|
||||
class YellowNote
|
||||
{
|
||||
@@ -110,6 +118,8 @@ private:
|
||||
bool _resize_right;
|
||||
bool _resize_bottom;
|
||||
bool _resize_edge;
|
||||
YellowNoteResize_t _resize_type;
|
||||
|
||||
int _x_orig;
|
||||
int _y_orig;
|
||||
|
||||
@@ -1142,6 +1152,7 @@ YellowNote::YellowNote(YellowNotes *notes, const std::string &filename)
|
||||
_resize_bottom = false;
|
||||
_resize_edge = false;
|
||||
_resize_right = false;
|
||||
_resize_type = NONE;
|
||||
|
||||
_color = ColorType_t::YELLOW;
|
||||
_color_changed = false;
|
||||
@@ -1251,6 +1262,8 @@ YellowNote::YellowNote(YellowNotes *notes, const std::string &filename)
|
||||
gtk_container_add(_evt_box, _frame);
|
||||
gtk_container_add(_note_widget, _evt_box);
|
||||
|
||||
gtk_container_set_border_width(_evt_box, 0);
|
||||
|
||||
gtk_widget_show_all(_note_widget);
|
||||
|
||||
/*while (!gtk_widget_is_visible(_note_widget)) {
|
||||
@@ -1745,6 +1758,7 @@ bool YellowNote::move_begin(GtkWidget *sender, GdkEventButton *evt)
|
||||
|
||||
int threshold = 8;
|
||||
|
||||
/*
|
||||
if (AROUND(y, frame_bottom) && AROUND(x, frame_right)) {
|
||||
_resize_edge = true;
|
||||
} else if (AROUND(y, frame_bottom)) {
|
||||
@@ -1752,6 +1766,14 @@ bool YellowNote::move_begin(GtkWidget *sender, GdkEventButton *evt)
|
||||
} else if (AROUND(x, frame_right)) {
|
||||
_resize_right = true;
|
||||
}
|
||||
*/
|
||||
if (_resize_type == BOTTOM_RIGHT) {
|
||||
_resize_edge = true;
|
||||
} else if (_resize_type == BOTTOM) {
|
||||
_resize_bottom = true;
|
||||
} else if (_resize_type == RIGHT) {
|
||||
_resize_right = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1832,18 +1854,23 @@ bool YellowNote::moving(GtkWidget *sender, GdkEventMotion *evt)
|
||||
GdkWindow *window = gtk_widget_get_window(_frame);
|
||||
GdkCursor *c;
|
||||
|
||||
int threshold = 8;
|
||||
int threshold = 16;
|
||||
|
||||
if (y >= header_top && y <= header_bottom) {
|
||||
c = gdk_cursor_new(GDK_LEFT_PTR);
|
||||
_resize_type = NONE;
|
||||
} else if (AROUND(x, frame_right) && AROUND(y, frame_bottom)) {
|
||||
c = gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER);
|
||||
_resize_type = BOTTOM_RIGHT;
|
||||
} else if (AROUND(x, frame_right)) {
|
||||
c = gdk_cursor_new(GDK_RIGHT_SIDE);
|
||||
_resize_type = RIGHT;
|
||||
} else if (AROUND(y, frame_bottom)) {
|
||||
c = gdk_cursor_new(GDK_BOTTOM_SIDE);
|
||||
_resize_type = BOTTOM;
|
||||
} else {
|
||||
c = nullptr;
|
||||
_resize_type = NONE;
|
||||
}
|
||||
|
||||
gdk_window_set_cursor(window, c);
|
||||
|
||||
Reference in New Issue
Block a user