[gtkmm] moving window
- From: SMS WebMaster <sms 4-sms com>
- To: gtkmm list <gtkmm-list gnome org>
- Subject: [gtkmm] moving window
- Date: Wed, 12 Nov 2003 20:10:28 +0300
Hi
can anyone tell me what is the wrong in this code (this code to allow me
to move the window when I press it and move the mouse, but the problem
is thta I have to move the mouse very slow to make this code work, if I
mouse the mouse fast the window will not move with the mouse ):
PicEvent.set_events(Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK
| Gdk::POINTER_MOTION_HINT_MASK);
PicEvent.signal_motion_notify_event().connect(
SigC::slot(*this, &MainWindow::window_motion) );
PicEvent.signal_button_press_event().connect(
SigC::slot(*this, &MainWindow::on_PICEvent_button_press) );
PicEvent.signal_button_release_event().connect(
SigC::slot(*this, &MainWindow::on_PICEvent_button_release) );
bool MainWindow::window_motion (GdkEventMotion* event)
{
gint x;
gint y;
gint mx, my;
double x_delta;
double y_delta;
this->get_pointer (mx, my);
if (!dragging) {
return TRUE;
}
x_delta = event->x_root - drag_x;
y_delta = event->y_root - drag_y;
get_window()->get_root_origin (x, y);
get_window()->move ((gint) floor (x + x_delta), (gint) floor (y +
y_delta));
drag_x = event->x_root;
drag_y = event->y_root;
return TRUE;
}
bool MainWindow::on_TimeEvent_button_press(GdkEventButton* event)
{
return true;
}
bool MainWindow::on_PICEvent_button_press(GdkEventButton* event)
{
dragging=TRUE;
drag_x = event->x_root;
drag_y = event->y_root;
return true;
}
bool MainWindow::on_PICEvent_button_release(GdkEventButton* event)
{
dragging=FALSE;
return true;
}
Any help please ?
--
http://www.4-SMS.Com
http://eShop.4-SMS.Com
http://Mozilla.4-SMS.Com
-*- If Linux doesn't have the solution, you have the wrong problem -*-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]