Mercurial > audlegacy
changeset 1044:d4ecce9b5190 trunk
[svn] - same for equalizerwin
author | nenolod |
---|---|
date | Sun, 14 May 2006 11:23:22 -0700 |
parents | d122e3abf61c |
children | 238cd31c1512 |
files | audacious/equalizer.c |
diffstat | 1 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/audacious/equalizer.c Sun May 14 11:10:01 2006 -0700 +++ b/audacious/equalizer.c Sun May 14 11:23:22 2006 -0700 @@ -373,7 +373,14 @@ grab = FALSE; } else { + gint mx, my; equalizerwin_raise(); + + gdk_window_get_pointer(GDK_WINDOW(equalizerwin->window), &mx, &my, NULL); + gtk_object_set_data(GTK_OBJECT(equalizerwin), "offset_x", GINT_TO_POINTER(mx)); + gtk_object_set_data(GTK_OBJECT(equalizerwin), "offset_y", GINT_TO_POINTER(my)); + + gtk_object_set_data(GTK_OBJECT(equalizerwin), "is_moving", GINT_TO_POINTER(1)); } } else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS @@ -416,8 +423,25 @@ { GdkEvent *gevent; - handle_motion_cb(equalizerwin_wlist, widget, event); - draw_main_window(FALSE); + if (gtk_object_get_data(GTK_OBJECT(equalizerwin), "is_moving")) + { + gint offset_x, offset_y, mx, my, x, y; + + offset_x = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(equalizerwin), "offset_x")); + offset_y = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(equalizerwin), "offset_y")); + + gdk_window_get_pointer(NULL, &mx, &my, NULL); + + x = mx - offset_x; + y = my - offset_y; + + gtk_window_move(GTK_WINDOW(equalizerwin), x, y); + } + else + { + handle_motion_cb(equalizerwin_wlist, widget, event); + draw_main_window(FALSE); /* XXX: shouldn't this be draw_equalizer_window()? */ + } gdk_flush(); @@ -433,6 +457,10 @@ gdk_pointer_ungrab(GDK_CURRENT_TIME); gdk_flush(); + gtk_object_remove_data(GTK_OBJECT(equalizerwin), "is_moving"); + gtk_object_remove_data(GTK_OBJECT(equalizerwin), "offset_x"); + gtk_object_remove_data(GTK_OBJECT(equalizerwin), "offset_y"); + handle_release_cb(equalizerwin_wlist, widget, event); draw_equalizer_window(FALSE);