summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2007-10-12 07:55:44 +0000
committerjoncruz <joncruz@users.sourceforge.net>2007-10-12 07:55:44 +0000
commitf4b829f2a349cd9c2fef32c7dfb6d6ff49db7c6b (patch)
tree0ea102a3011542aec35d640e6b42a3398a19dea8
parentshift+drag (diff)
downloadinkscape-f4b829f2a349cd9c2fef32c7dfb6d6ff49db7c6b.tar.gz
inkscape-f4b829f2a349cd9c2fef32c7dfb6d6ff49db7c6b.zip
fix drag-n-drop color problems
(bzr r3897)
-rw-r--r--src/dialogs/swatches.cpp45
1 files changed, 19 insertions, 26 deletions
diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp
index 8f2702b63..1196c8378 100644
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
@@ -218,31 +218,18 @@ static void dragBegin( GtkWidget *widget, GdkDragContext* dc, gpointer data )
// return TRUE;
// }
-static gboolean onButtonPressed (GtkWidget *widget, GdkEventButton *event, gpointer userdata)
-{
- (void)widget;
- /* single click with the right mouse button? */
- if(event->type == GDK_BUTTON_RELEASE)
- {
- ColorItem* item = reinterpret_cast<ColorItem*>(userdata);
- if(item)
- {
- if (event->button == 1)
- {
- if(event->state & GDK_SHIFT_MASK)
- item->buttonClicked(true); /* the button was pressed with shift held down. set the stroke */
- else item->buttonClicked(false);
- return TRUE; /* we handled this */
- }
- else if (event->button == 3)
- {
- item->buttonClicked(true);
- return TRUE; /* we handled this */
- }
- }
+static void handleClick( GtkWidget* widget, gpointer callback_data ) {
+ ColorItem* item = reinterpret_cast<ColorItem*>(callback_data);
+ if ( item ) {
+ item->buttonClicked(false);
}
+}
- return FALSE; /* we did not handle this */
+static void handleSecondaryClick( GtkWidget* widget, gint arg1, gpointer callback_data ) {
+ ColorItem* item = reinterpret_cast<ColorItem*>(callback_data);
+ if ( item ) {
+ item->buttonClicked(true);
+ }
}
static void dieDieDie( GtkObject *obj, gpointer user_data )
@@ -500,11 +487,17 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Inkscape::
sigc::signal<void> type_signal_something;
*/
+
g_signal_connect( G_OBJECT(newBlot->gobj()),
- "button-release-event",
- G_CALLBACK(onButtonPressed),
+ "clicked",
+ G_CALLBACK(handleClick),
this);
-
+
+ g_signal_connect( G_OBJECT(newBlot->gobj()),
+ "alt-clicked",
+ G_CALLBACK(handleSecondaryClick),
+ this);
+
gtk_drag_source_set( GTK_WIDGET(newBlot->gobj()),
GDK_BUTTON1_MASK,
sourceColorEntries,