In article <[email protected]>,
   Pawe³ Blokus <[email protected]> wrote:
> >If this is always reached at the start of a drag, why not call the
> >gui_window_box_scroll_start() start function from here? It can't go in
> >scroll_drag_start_internal() because that's also used for content drags,
> >right?

> Right, but we would need to keep a pointer to the browser or gui
> window for that purpose only. If that is preferred I can change it any
> time :)

OK, just leave it.

Also, I'm still unsure what's happening here:

> +/**
> + * Callback for in-page scrolls.
> + */
> +void browser_scroll_callback(void *client_data,
> +             struct scroll_msg_data *scroll_data)
> +{
> +     struct browser_window *bw = client_data;
> +     struct box *box = bw->scrolling_box;
> +     int x = 0, y = 0, box_x, box_y, diff_x = 0, diff_y = 0;
> +
> +     if (box != NULL) {


What's going on if it is NULL?


> +             diff_x = box->padding[LEFT] + box->width + box->padding[RIGHT] -
> +                             SCROLLBAR_WIDTH;
> +             diff_y = box->padding[TOP] + box->height + box->padding[BOTTOM] 
> -
> +                             SCROLLBAR_WIDTH;
> +
> +             box_coords(box, &box_x, &box_y);
> +             if (scroll_is_horizontal(scroll_data->scroll)) {
> +                     x = box_x + scroll_get(box->scroll_x);
> +                     y = box_y + scroll_get(box->scroll_y) + diff_y;
> +             } else {
> +                     x = box_x + scroll_get(box->scroll_x) + diff_x;
> +                     y = box_y + scroll_get(box->scroll_y);
> +             }
> +     }
> +
> +     switch(scroll_data->msg) {
> +             case SCROLL_MSG_REDRAW:
> +                     browser_window_redraw_rect(bw,
> +                                     x + scroll_data->x0,
> +                                     y + scroll_data->y0,
> +                                             scroll_data->x1 - 
> scroll_data->x0,
> +                                     scroll_data->y1 - scroll_data->y0);
> +                     break;
> +             case SCROLL_MSG_MOVED:
> +                     browser_redraw_box(bw->current_content, box);
> +                     break;
> +             case SCROLL_MSG_SCROLL_START:
> +                             bw->scroll = scroll_data->scroll;
> +                     gui_window_box_scroll_start(bw->window,
> +                                     scroll_data->x0, scroll_data->y0,
> +                                             scroll_data->x1, 
> scroll_data->y1);
> +                     break;
> +             case SCROLL_MSG_SCROLL_FINISHED:
> +                     bw->scroll = NULL;
> +                     bw->scrolling_box = NULL;
> +
> +                     browser_window_set_pointer(bw->window,
> +                                     GUI_POINTER_DEFAULT);
> +                     break;
> +     }
> +}

-- 

Michael Drake (tlsa)                  http://www.netsurf-browser.org/


Reply via email to