static void gui_window_update_extent(struct gui_window *g) { int w, h; if (browser_window_get_extents(g->bw, true, &w, &h) == NSERROR_OK) { gtk_layout_set_size(g->layout, w, h); } }
static void gui_window_update_extent(struct gui_window *gw) { int w, h; browser_window_get_extents(gw->bw, true, &w, &h); fbtk_set_scroll_parameters(gw->hscroll, 0, w, fbtk_get_width(gw->browser), 100); fbtk_set_scroll_parameters(gw->vscroll, 0, h, fbtk_get_height(gw->browser), 100); }
/** * Update the extent of the inside of a browser window to that of the * current content. * * It seems this method is called when content size got adjusted, so * that we can adjust scroll info. We also have to call it when tab * change occurs. * * \param gw gui_window to update the extent of */ static void gui_window_update_extent(struct gui_window *gw) { if(browser_window_has_content(gw->browser->bw)) { /** @todo store content size. */ if(window_get_active_gui_window(gw->root) == gw) { int width, height; GRECT area; browser_window_get_extents(gw->browser->bw, false, &width, &height); window_set_content_size(gw->root, width, height); window_update_back_forward(gw->root); window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); window_schedule_redraw_grect(gw->root, &area); } } }
/* queue a window scroll */ static void widget_scroll_y(struct gui_window *gw, int y, bool abs) { struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser); int content_width, content_height; int height; LOG(("window scroll")); if (abs) { bwidget->pany = y - bwidget->scrolly; } else { bwidget->pany += y; } browser_window_get_extents(gw->bw, true, &content_width, &content_height); height = fbtk_get_height(gw->browser); /* dont pan off the top */ if ((bwidget->scrolly + bwidget->pany) < 0) bwidget->pany = -bwidget->scrolly; /* do not pan off the bottom of the content */ if ((bwidget->scrolly + bwidget->pany) > (content_height - height)) bwidget->pany = (content_height - height) - bwidget->scrolly; if (bwidget->pany == 0) { return; } bwidget->pan_required = true; fbtk_request_redraw(gw->browser); fbtk_set_scroll_position(gw->vscroll, bwidget->scrolly + bwidget->pany); }
/* queue a window scroll */ static void widget_scroll_x(struct gui_window *gw, int x, bool abs) { struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser); int content_width, content_height; int width; if (abs) { bwidget->panx = x - bwidget->scrollx; } else { bwidget->panx += x; } browser_window_get_extents(gw->bw, true, &content_width, &content_height); width = fbtk_get_width(gw->browser); /* dont pan off the left */ if ((bwidget->scrollx + bwidget->panx) < 0) bwidget->panx = - bwidget->scrollx; /* do not pan off the right of the content */ if ((bwidget->scrollx + bwidget->panx) > (content_width - width)) bwidget->panx = (content_width - width) - bwidget->scrollx; if (bwidget->panx == 0) { return; } bwidget->pan_required = true; fbtk_request_redraw(gw->browser); fbtk_set_scroll_position(gw->hscroll, bwidget->scrollx + bwidget->panx); }