RE: Moving non decorated window using code.
- From: Chandra Shekar Sengupta <sengupta tataelxsi co in>
- To: <gtk-app-devel-list gnome org>
- Subject: RE: Moving non decorated window using code.
- Date: Mon, 2 Jul 2007 11:46:44 +0530
-----Original Message-----
I have a GTKWindow that I have created and then afterwards attempted
to move using gtk_window_move(), I have the window set so that if I
click on it it toggles the window's decorations, the default being
none. For production I wish to have the window have no decorations,
but If I configure the window in that manner I it won't move. It is an
odd occurance considering alt-dragging still functions.
Does anyone have any suggestions on how to move the window? Should I
attempt with libwnck (unstable I read)?
Thanks for any advice.
-- Dan
------------------------------
hi Dan,
For moving a window without decoration,you can use a eventbox to catch the
event for dragging.Add a callback fn(Suppose on_drag) to that event box for
button_press_event,button_release_event,motion_notify_event.In the callback
u can use following code.
gint start_x,start_y;(global)
GtkWidget* window;
gboolean on_drag(GtkWidget *widget,
GdkEventButton *event)
{
static GdkEventType previous_type = GDK_NOTHING;
gint now_x,now_y;
if(event->type == GDK_BUTTON_PRESS)//for getting the start point
{
start_x = (gint)event->x;
start_y = (gint)event->y;
previous_type = event->type;
}
//move TopLevelWindow to new position
if((event->type == GDK_MOTION_NOTIFY) &&(previous_type ==
GDK_BUTTON_PRESS))
{
//getting the current window position
gtk_window_get_position(
GTK_WINDOW(window),&now_x,&now_y);
//moving the window
gtk_window_move(GTK_WINDOW(window),
(now_x+(gint)event->x - start_x),(now_y +(gint)event->y - start_y));
}
return TRUE;
}
i hope it will work.
regards,
chandra shekhar sengupta
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]