diff options
-rw-r--r-- | libmdock/matcher.c | 2 | ||||
-rw-r--r-- | libmdock/mdock-item-window-selector.c | 4 | ||||
-rw-r--r-- | libmdock/mdock-widget.c | 56 |
3 files changed, 26 insertions, 36 deletions
diff --git a/libmdock/matcher.c b/libmdock/matcher.c index 129514e..979dd41 100644 --- a/libmdock/matcher.c +++ b/libmdock/matcher.c @@ -261,7 +261,7 @@ const gchar * match_appid_to_desktopid(AppId *appid) if (list) { list = g_slist_sort(list, desktop_item_compare); -#if 1 +#if 0 g_debug("for appid with wmclass %s", appid->wm_class_class); for (GSList *l = list; l; l = l->next) { DesktopItem *item = l->data; diff --git a/libmdock/mdock-item-window-selector.c b/libmdock/mdock-item-window-selector.c index 2fbf3e7..7e5b1ca 100644 --- a/libmdock/mdock-item-window-selector.c +++ b/libmdock/mdock-item-window-selector.c @@ -66,8 +66,6 @@ static GSequenceIter * find_window(MDockItemWindowSelector *self, WnckWindow *wi static gboolean handle_window_button_press(MDockItemWindowSelector *self, GdkEventButton *event, MDockWindow *window) { - g_debug("window item button press"); - switch (event->button) { case 3: gtk_menu_popup(GTK_MENU(g_object_get_qdata(G_OBJECT(window), mdock_item_window_selector_menu_quark())), @@ -81,8 +79,6 @@ static gboolean handle_window_button_press(MDockItemWindowSelector *self, GdkEve static gboolean handle_window_button_release(MDockItemWindowSelector *self, GdkEventButton *event, MDockWindow *window) { - g_debug("window item button release"); - switch (event->button) { case 1: if (!wnck_window_is_minimized(window->window) && diff --git a/libmdock/mdock-widget.c b/libmdock/mdock-widget.c index 8efaf19..561a5b4 100644 --- a/libmdock/mdock-widget.c +++ b/libmdock/mdock-widget.c @@ -49,7 +49,7 @@ struct _MDockWidgetPrivate MDockItem *current_popup_item; guint popup_timer; gboolean loading_settings : 1; - gboolean just_dropped : 1; + gboolean primary_button_down : 1; }; G_DEFINE_TYPE(MDockWidget, mdock_widget, GTK_TYPE_BOX) @@ -112,7 +112,6 @@ static void save_items_to_settings(MDockWidget *self) static void move_item_to_position(MDockWidget *self, GSequenceIter *iter, GSequenceIter *position) { - g_debug("moving item to position %d", g_sequence_iter_get_position(position)); gtk_box_reorder_child(GTK_BOX(self), GTK_WIDGET(g_sequence_get(iter)), g_sequence_iter_get_position(position)); g_sequence_move(iter, position); @@ -121,7 +120,6 @@ static void move_item_to_position(MDockWidget *self, GSequenceIter *iter, GSeque static void hide_item_popup(MDockWidget *self) { g_return_if_fail(self->priv->current_popup_item); - g_debug("hiding popup %p", self->priv->current_popup_item); MDockItemWindowSelector *selector = MDOCK_ITEM_WINDOW_SELECTOR(g_object_get_qdata(G_OBJECT(self->priv->current_popup_item), @@ -134,7 +132,6 @@ static void hide_item_popup(MDockWidget *self) static void show_item_popup(MDockWidget *self, MDockItem *item) { g_warn_if_fail(!self->priv->current_popup_item); - g_debug("showing popup %p", item); MDockItemWindowSelector *selector = MDOCK_ITEM_WINDOW_SELECTOR(g_object_get_qdata(G_OBJECT(item), @@ -230,6 +227,9 @@ static gboolean handle_item_button_press(MDockWidget *self, GdkEventButton *even } switch (event->button) { + case 1: + self->priv->primary_button_down = TRUE; + break; case 3: gtk_menu_popup(GTK_MENU(g_object_get_qdata(G_OBJECT(item), mdock_widget_item_menu_quark())), NULL, NULL, NULL, NULL, event->button, event->time); @@ -244,13 +244,11 @@ static gboolean handle_item_button_release(MDockWidget *self, GdkEventButton *ev { switch (event->button) { case 1: - if (self->priv->just_dropped) { - self->priv->just_dropped = FALSE; + if (self->priv->primary_button_down) { + mdock_item_activate(item); + self->priv->primary_button_down = FALSE; break; } - - mdock_item_activate(item); - break; } @@ -259,33 +257,29 @@ static gboolean handle_item_button_release(MDockWidget *self, GdkEventButton *ev static void handle_item_drag_begin(MDockWidget *self, GdkDragContext *dc, MDockItem *item) { - g_debug("drag begin"); gtk_drag_set_icon_pixbuf(dc, mdock_item_get_icon_pixbuf(item), 0, 0); - gtk_widget_hide(GTK_WIDGET(item)); + self->priv->primary_button_down = FALSE; + self->priv->current_pointed_item = NULL; } static void handle_item_drag_end(MDockWidget *self, GdkDragContext *dc, MDockItem *item) { - g_debug("drag end"); - gtk_widget_show(GTK_WIDGET(item)); + // Nothing to do. } static void handle_item_drag_data_get(MDockWidget *self, GdkDragContext *dc, GtkSelectionData *selection_data, guint target_type, guint timestamp, MDockItem *item) { - g_debug("data get"); GSequenceIter *iter = g_object_get_qdata(G_OBJECT(item), mdock_widget_item_iter_quark()); GDesktopAppInfo *appinfo = mdock_item_get_desktop_app_info(item); gint32 position = g_sequence_iter_get_position(iter); switch (target_type) { case DRAG_TYPE_ITEM: - g_debug("data get item"); gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data), sizeof(gint32)*8, (guchar*)&position, sizeof(gint32)); break; case DRAG_TYPE_URILIST: - g_debug("data get urilist"); if (appinfo) { const gchar *strv[2] = { g_desktop_app_info_get_filename(appinfo), NULL }; gtk_selection_data_set_uris(selection_data, (gchar**) strv); @@ -296,7 +290,7 @@ static void handle_item_drag_data_get(MDockWidget *self, GdkDragContext *dc, static void handle_item_drag_data_delete(MDockWidget *self, GdkDragContext *dc, MDockItem *item) { - g_debug("data delete"); + // Ignored, as this only happens when moving an applet item. } static GSequenceIter * find_drop_position_at_coordinates(MDockWidget *self, gint x, gint y, gboolean moving) @@ -325,17 +319,14 @@ static void mdock_widget_drag_data_received(GtkWidget *widget, GdkDragContext *c gint x, gint y, GtkSelectionData *selection_data, guint info, guint timestamp) { - g_debug("data received"); MDockWidget *self = MDOCK_WIDGET(widget); const guchar *data = gtk_selection_data_get_data(selection_data); gchar **uris; switch (info) { case DRAG_TYPE_ITEM: - g_debug("Got item"); if (data) { gint32 position = *(gint32*)data; - g_debug("Got position %u", position); GSequenceIter *iter = g_sequence_get_iter_at_pos(self->priv->items, position); g_warn_if_fail(iter); GSequenceIter *pos_iter = find_drop_position_at_coordinates(self, x, y, TRUE); @@ -351,7 +342,7 @@ static void mdock_widget_drag_data_received(GtkWidget *widget, GdkDragContext *c if (uris) { for (int i = 0; uris[i]; i++) { gchar *uri = uris[i]; - g_debug("Got uri %s", uri); + g_message("TODO: handle uri %s", uri); } g_strfreev(uris); } @@ -359,7 +350,7 @@ static void mdock_widget_drag_data_received(GtkWidget *widget, GdkDragContext *c gtk_drag_finish(context, TRUE, FALSE, timestamp); break; default: - g_message("Drag target type not found"); + g_warning("drag target type not found"); gtk_drag_finish(context, FALSE, FALSE, timestamp); break; } @@ -383,12 +374,9 @@ static gboolean mdock_widget_drag_drop(GtkWidget *widget, GdkDragContext *contex break; } } else { - g_message("Drag target type not found"); + g_warning("drag target type not found"); } - g_debug("drag drop"); - self->priv->just_dropped = TRUE; - if (drag_ok) { gtk_drag_get_data(widget, context, target, timestamp); } else { @@ -419,7 +407,7 @@ static gboolean mdock_widget_drag_motion(GtkWidget *widget, GdkDragContext *cont break; } } else { - g_message("Drag target type not found"); + g_warning("drag target type not found"); } if (drag_ok) { @@ -447,7 +435,11 @@ static gboolean handle_popup_timer(gpointer user_data) static gboolean handle_item_enter(MDockWidget *self, GdkEventCrossing *event, MDockItem *item) { - g_warn_if_fail(!self->priv->current_pointed_item); + if (self->priv->primary_button_down) { + // Do nothing if dragging + return FALSE; + } + g_warn_if_fail(!self->priv->current_pointed_item || self->priv->current_pointed_item == item); self->priv->current_pointed_item = item; if (self->priv->current_popup_item) { if (self->priv->popup_timer) { @@ -463,7 +455,11 @@ static gboolean handle_item_enter(MDockWidget *self, GdkEventCrossing *event, MD static gboolean handle_item_leave(MDockWidget *self, GdkEventCrossing *event, MDockItem *item) { - g_warn_if_fail(self->priv->current_pointed_item == item); + if (self->priv->primary_button_down) { + // Do nothing if dragging + return FALSE; + } + g_warn_if_fail(!self->priv->current_pointed_item || self->priv->current_pointed_item == item); g_warn_if_fail(!self->priv->current_popup_item || self->priv->current_pointed_item == item); self->priv->current_pointed_item = NULL; if (self->priv->current_popup_item && !self->priv->popup_timer) { @@ -474,7 +470,6 @@ static gboolean handle_item_leave(MDockWidget *self, GdkEventCrossing *event, MD static gboolean handle_item_selector_enter(MDockWidget *self, GdkEventCrossing *event, MDockItemWindowSelector *selector) { - g_debug("Item selector enter %d", event->detail); if (event->detail == GDK_NOTIFY_INFERIOR) return FALSE; g_warn_if_fail(self->priv->current_popup_item); if (self->priv->popup_timer) { @@ -486,7 +481,6 @@ static gboolean handle_item_selector_enter(MDockWidget *self, GdkEventCrossing * static gboolean handle_item_selector_leave(MDockWidget *self, GdkEventCrossing *event, MDockItemWindowSelector *selector) { - g_debug("Item selector leave %d", event->detail); if (event->detail == GDK_NOTIFY_INFERIOR) return FALSE; g_warn_if_fail(self->priv->current_popup_item); if (!self->priv->popup_timer) { |