diff options
Diffstat (limited to 'src/ui/tools/tool-base.cpp')
| -rw-r--r-- | src/ui/tools/tool-base.cpp | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 72ba499de..8a35882b9 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include <config.h> #endif #include "widgets/desktop-widget.h" @@ -24,12 +24,8 @@ #include "file.h" #include "ui/tools/tool-base.h" -#include <string.h> #include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> #include <glibmm/i18n.h> -#include <cstring> -#include <string> #include "display/sp-canvas.h" #include "xml/node-event-vector.h" @@ -43,18 +39,14 @@ #include "ui/interface.h" #include "macros.h" #include "ui/tools-switch.h" -#include "preferences.h" #include "message-context.h" #include "gradient-drag.h" -#include "attributes.h" #include "rubberband.h" #include "selcue.h" #include "ui/tools/lpe-tool.h" #include "ui/tool/control-point.h" #include "ui/shape-editor.h" #include "sp-guide.h" -#include "color.h" -#include "knot.h" #include "knot-ptr.h" // globals for temporary switching to selector by space @@ -118,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; } @@ -149,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 - } /** @@ -188,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); @@ -202,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); @@ -777,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) { @@ -842,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; @@ -1081,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); @@ -1157,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); |
