Hello. I'm writing a function for the motion-notify-event event for my
window (the event is actually emited by the event box). But it simply
doesn't work. What's wrong?

----

gboolean window_move_event(GtkWidget *widget, GdkEventMotion *event,
gpointer data)
{
        gint cur_x, cur_y, mouse_x, mouse_y;
        gint tmpx, tmpy;
        gint x, y;

        GtkWidget *window = (GtkWidget *)data;
        gdk_window_get_position(window->window, &cur_x, &cur_y);
        tmpx = cur_x;
        tmpy = cur_y;

        if (gdk_window_get_pointer(window->window, &mouse_x, &mouse_y, NULL) !=
NULL) {
        
                if ((prev_x != 0) || (prev_y != 0)) {
                        x = mouse_x - prev_x;
                        y = mouse_y - prev_y;
                        g_print("mouse_x = %d, mouse_y = %d\nx = %d, y = %d\n", 
mouse_x,
mouse_y, x, y);
                        gdk_window_move(window->window, tmpx + x, tmpy + y);
                }
                prev_x = mouse_x;
                prev_y = mouse_y;
        }
        return TRUE;
}
----

Greets,
Luka
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to