-GrabshotPopup::GrabshotPopup(GrabshotThread *grab_thread, int mode)
- : BC_Popup(grab_thread->mwindow->gui, 0,0, 16,16, -1,1)
-{
- this->grab_thread = grab_thread;
- this->mode = mode;
- dragging = -1;
- grab_color = ORANGE;
- x0 = y0 = x1 = y1 = -1;
- lx0 = ly0 = lx1 = ly1 = -1;
-}
-GrabshotPopup::~GrabshotPopup()
-{
-}
-
-int GrabshotPopup::grab_event(XEvent *event)
-{
- int cur_drag = dragging;
- switch( event->type ) {
- case ButtonPress:
- if( cur_drag > 0 ) return 1;
- x0 = event->xbutton.x_root;
- y0 = event->xbutton.y_root;
- if( !cur_drag ) {
- draw_selection(-1);
- if( event->xbutton.button == RIGHT_BUTTON ) break;
- if( x0>=get_x() && x0<get_x()+get_w() &&
- y0>=get_y() && y0<get_y()+get_h() ) break;
- }
- x1 = x0; y1 = y0;
- draw_selection(1);
- dragging = 1;
- return 1;
- case ButtonRelease:
- dragging = 0;
- case MotionNotify:
- if( cur_drag > 0 ) {
- x1 = event->xbutton.x_root;
- y1 = event->xbutton.y_root;
- draw_selection(0);
- }
- return 1;
- default:
- return 0;
- }
-
- int cx = lx0, cy = ly0;
- int cw = lx1-lx0, ch = ly1-ly0;
- hide_window();
- sync_display();
- grab_thread->done = 1;
-
- MWindow *mwindow = grab_thread->mwindow;