summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/tool-base.cpp
diff options
context:
space:
mode:
authorkamalpreetgrewal <grewalkamal005@gmail.com>2016-08-15 03:59:18 +0000
committerkamalpreetgrewal <grewalkamal005@gmail.com>2016-08-15 03:59:18 +0000
commit25a9ed4f38121eeb59cf15dbf19391aaef45bba3 (patch)
treee123aeae50d98a52e1ad4575b29bf3c199619e33 /src/ui/tools/tool-base.cpp
parentSolve crash when deleting CSS property (diff)
parentinkview: Convert to ApplicationWindow (diff)
downloadinkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.tar.gz
inkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.zip
Merge changes from trunk
(bzr r14949.1.64)
Diffstat (limited to 'src/ui/tools/tool-base.cpp')
-rw-r--r--src/ui/tools/tool-base.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 735f5bd42..8a35882b9 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -110,11 +110,7 @@ ToolBase::~ToolBase() {
}
if (this->cursor != NULL) {
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref(this->cursor);
-#else
- gdk_cursor_unref(this->cursor);
-#endif
this->cursor = NULL;
}
@@ -141,16 +137,10 @@ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) {
GdkDisplay *display = gdk_display_get_default();
GdkCursor *cursor = gdk_cursor_new_for_display(display, cursor_type);
-#if WITH_GTKMM_3_0
if (cursor) {
gdk_window_set_cursor (gtk_widget_get_window (w), cursor);
g_object_unref (cursor);
}
-#else
- gdk_window_set_cursor (gtk_widget_get_window (w), cursor);
- gdk_cursor_unref (cursor);
-#endif
-
}
/**
@@ -180,11 +170,7 @@ void ToolBase::sp_event_context_update_cursor() {
);
if (pixbuf != NULL) {
if (this->cursor) {
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref(this->cursor);
-#else
- gdk_cursor_unref(this->cursor);
-#endif
}
this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y);
g_object_unref(pixbuf);
@@ -194,11 +180,7 @@ void ToolBase::sp_event_context_update_cursor() {
if (pixbuf) {
if (this->cursor) {
-#if GTK_CHECK_VERSION(3,0,0)
g_object_unref(this->cursor);
-#else
- gdk_cursor_unref(this->cursor);
-#endif
}
this->cursor = gdk_cursor_new_from_pixbuf(display,
pixbuf, this->hot_x, this->hot_y);
@@ -769,11 +751,9 @@ bool ToolBase::root_handler(GdkEvent* event) {
int const wheel_scroll = prefs->getIntLimited(
"/options/wheelscroll/value", 40, 0, 1000);
-#if GTK_CHECK_VERSION(3,0,0)
// Size of smooth-scrolls (only used in GTK+ 3)
gdouble delta_x = 0;
gdouble delta_y = 0;
-#endif
/* shift + wheel, pan left--right */
if (event->scroll.state & GDK_SHIFT_MASK) {
@@ -834,12 +814,10 @@ bool ToolBase::root_handler(GdkEvent* event) {
desktop->scroll_world(-wheel_scroll, 0);
break;
-#if GTK_CHECK_VERSION(3,0,0)
case GDK_SCROLL_SMOOTH:
gdk_event_get_scroll_deltas(event, &delta_x, &delta_y);
desktop->scroll_world(delta_x, delta_y);
break;
-#endif
}
}
break;
@@ -1073,9 +1051,8 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event)
item = sp_event_context_find_item (desktop,
Geom::Point(event->button.x, event->button.y), FALSE, FALSE);
- /* fixme: This is not what I want but works for now (Lauris) */
- if (event->type == GDK_KEY_PRESS) {
- item = desktop->getSelection()->itemList().front();
+ if (event->type == GDK_KEY_PRESS && !desktop->getSelection()->isEmpty()) {
+ item = desktop->getSelection()->items().front();
}
ContextMenu* CM = new ContextMenu(desktop, item);
@@ -1149,8 +1126,9 @@ SPItem *sp_event_context_find_item(SPDesktop *desktop, Geom::Point const &p,
SPItem *item = 0;
if (select_under) {
- SPItem *selected_at_point = desktop->getItemFromListAtPointBottom(
- desktop->selection->itemList(), p);
+ auto tmp = desktop->selection->items();
+ std::vector<SPItem *> vec(tmp.begin(), tmp.end());
+ SPItem *selected_at_point = desktop->getItemFromListAtPointBottom(vec, p);
item = desktop->getItemAtPoint(p, into_groups, selected_at_point);
if (item == NULL) { // we may have reached bottom, flip over to the top
item = desktop->getItemAtPoint(p, into_groups, NULL);