Re: Move decorationless window with mouse
- From: Gabriel Schulhof <nix go-nix ca>
- To: 3saul <saul_lethbridge hotmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Move decorationless window with mouse
- Date: Mon, 26 Mar 2007 03:58:12 +0300
Hey!
On Thu, 2007-03-22 at 18:14 -0700, 3saul wrote:
I had this in mind also. But how would I detect the movements of the mouse
and where to place the window?
You need to connect to the "button-press-event" signal and the
"motion-notify-event" signal. You also need to enable the reception of
these signals with gtk_widget_add_events:
gtk_widget_add_events (my_window, GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_HINT_MASK) ;
g_signal_connect (my_window, "button-press-event",
(GCallback)my_window_button_press, NULL) ;
g_signal_connect (my_window, "motion-notify-event",
(GCallback)my_window_motion_notify, NULL) ;
Check http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html to see
what the my_window_button_press and my_window_motion_notify functions
have to look like. Then, you can do something like this:
On button press:
- remember where in the window (x,y) the button was pressed
On mouse move (with button down):
- Check how much the mouse, which is now at (x1,y1) has moved
(x1-x,y1-y) and move the window by just as much
HTH
Gabriel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]