moving a window with an event
- From: Luka Napotnik <luka napotnik gmail com>
- To: gtk-app-devel-list gnome org
- Subject: moving a window with an event
- Date: Sat, 04 Nov 2006 17:18:29 +0100
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]