static void gui_window_set_scroll(struct gui_window *w, int sx, int sy) { if ( (w == NULL) || (w->browser->bw == NULL) || (!browser_window_has_content(w->browser->bw))) return; LOG("scroll (gui_window: %p) %d, %d\n", w, sx, sy); window_scroll_by(w->root, sx, sy); return; }
HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *) { struct browser_window *bw; struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); bw = gwin->gw->bw; if (bw == NULL || browser_window_has_content(bw) == false) return; hotlist_add_url(browser_window_get_url(bw)); ami_gui_update_hotlist_button(gwin); }
/** * 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); } } }
static void gui_window_update_box(struct gui_window *g, const struct rect *rect) { int sx, sy; float scale; if (!browser_window_has_content(g->bw)) return; gui_window_get_scroll(g, &sx, &sy); scale = browser_window_get_scale(g->bw); gtk_widget_queue_draw_area(GTK_WIDGET(g->layout), rect->x0 * scale - sx, rect->y0 * scale - sy, (rect->x1 - rect->x0) * scale, (rect->y1 - rect->y0) * scale); }