move two more mandantory window operations to table

This commit is contained in:
Vincent Sanders 2014-01-13 11:38:35 +00:00
parent 7227c29bba
commit d70e371cd9
12 changed files with 77 additions and 27 deletions

View File

@ -4548,7 +4548,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
// g->shared->new_content = false;
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
struct IBox *bbox;
@ -4566,7 +4566,7 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
}
}
void gui_window_update_extent(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
{
struct IBox *bbox, zbox;
ULONG cur_tab = 0;
@ -5092,11 +5092,12 @@ static struct gui_window_table ami_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_icon = gui_window_set_icon,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,
.drag_start = gui_window_drag_start,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,

View File

@ -278,8 +278,11 @@ static void gui_window_destroy(struct gui_window *w)
}
}
void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
bool scaled)
static void
gui_window_get_dimensions(struct gui_window *w,
int *width,
int *height,
bool scaled)
{
if (w == NULL)
return;
@ -423,7 +426,7 @@ static void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
so that we can adjust scroll info. We also have to call it when tab
change occurs.
*/
void gui_window_update_extent(struct gui_window *gw)
static void gui_window_update_extent(struct gui_window *gw)
{
if( gw->browser->bw->current_content != NULL ) {
@ -1075,6 +1078,8 @@ static struct gui_window_table atari_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,

View File

@ -1087,7 +1087,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
}
void gui_window_update_extent(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
{
//CALLED();
if (!g->bw->current_content)
@ -1347,7 +1347,7 @@ void gui_set_clipboard(const char *buffer, size_t length,
}
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
if (g->view && g->view->LockLooper()) {
@ -1369,6 +1369,8 @@ static struct gui_window_table gui_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.new_content = gui_window_new_content,

View File

@ -135,7 +135,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
[[(BrowserViewController *)g browserView] scrollPoint: cocoa_point( sx, sy )];
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
NSCParameterAssert( width != NULL && height != NULL );
@ -150,7 +150,7 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
*height = cocoa_pt_to_px( NSHeight( frame ) );
}
void gui_window_update_extent(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
{
BrowserViewController * const window = (BrowserViewController *)g;
@ -303,6 +303,8 @@ static struct gui_window_table cocoa_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,

View File

@ -300,7 +300,7 @@ void browser_window_update_extent(struct browser_window *bw)
{
if (bw->window != NULL)
/* Front end window */
gui_window_update_extent(bw->window);
guit->window->update_extent(bw->window);
else
/* Core-managed browser window */
browser_window_handle_scrollbars(bw);
@ -1912,7 +1912,7 @@ void browser_window_get_dimensions(struct browser_window *bw,
*height = bw->height;
} else {
/* Front end window */
gui_window_get_dimensions(bw->window, width, height, scaled);
guit->window->get_dimensions(bw->window, width, height, scaled);
}
}

View File

@ -82,6 +82,8 @@ struct gui_window_table {
/**
* Force a redraw of the entire contents of a window.
*
* @todo this API should be merged with update.
*
* \param g gui_window to redraw
*/
void (*redraw)(struct gui_window *g);
@ -113,6 +115,31 @@ struct gui_window_table {
*/
void (*set_scroll)(struct gui_window *g, int sx, int sy);
/**
* Find the current dimensions of a browser window's content area.
*
* @todo The implementations of this are buggy and its only
* used from frames code.
*
* \param g gui_window to measure
* \param width receives width of window
* \param height receives height of window
* \param scaled whether to return scaled values
*/
void (*get_dimensions)(struct gui_window *g, int *width, int *height, bool scaled);
/**
* Update the extent of the inside of a browser window to that of the
* current content.
*
* @todo this is used to update scroll bars does it need
* renaming? some frontends (windows) do not even implement it.
*
* \param g gui_window to update the extent of
*/
void (*update_extent)(struct gui_window *g);
/* Optional entries */
@ -198,9 +225,7 @@ struct gui_table {
extern struct gui_table *guit; /* the gui vtable */
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled);
void gui_window_update_extent(struct gui_window *g);
void gui_window_set_status(struct gui_window *g, const char *text);
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,

View File

@ -92,6 +92,13 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->set_scroll == NULL) {
return NSERROR_BAD_PARAMETER;
}
if (gwt->get_dimensions == NULL) {
return NSERROR_BAD_PARAMETER;
}
if (gwt->update_extent == NULL) {
return NSERROR_BAD_PARAMETER;
}
/* fill in the optional entries with defaults */
if (gwt->set_title == NULL) {

View File

@ -1575,7 +1575,7 @@ gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
}
void
static void
gui_window_get_dimensions(struct gui_window *g,
int *width,
int *height,
@ -1590,7 +1590,7 @@ gui_window_get_dimensions(struct gui_window *g,
}
}
void
static void
gui_window_update_extent(struct gui_window *gw)
{
float scale = gw->bw->scale;
@ -1848,6 +1848,8 @@ static struct gui_window_table framebuffer_gui_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_url = gui_window_set_url,
.start_throbber = gui_window_start_throbber,

View File

@ -988,7 +988,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
gtk_adjustment_set_value(hadj, x);
}
void gui_window_update_extent(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
{
if (!g->bw->current_content)
return;
@ -1121,7 +1121,7 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection)
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
GtkAllocation alloc;
@ -1179,6 +1179,8 @@ static struct gui_window_table gui_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_icon = gui_window_set_icon,

View File

@ -132,7 +132,7 @@ gui_window_redraw_window(struct gui_window *g)
fprintf(stdout, "WINDOW REDRAW WIN %u\n", g->win_num);
}
void
static void
gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
@ -183,7 +183,7 @@ gui_window_update_box(struct gui_window *g, const struct rect *rect)
}
void
static void
gui_window_update_extent(struct gui_window *g)
{
if (!g->bw->current_content)
@ -570,11 +570,12 @@ static struct gui_window_table gui_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,
.set_icon = gui_window_set_icon,
.drag_start = gui_window_drag_start,
.save_link = gui_window_save_link,
.scroll_visible = gui_window_scroll_visible,

View File

@ -916,7 +916,7 @@ static void gui_window_scroll_visible(struct gui_window *g, int x0, int y0, int
* \param scaled whether to return scaled values
*/
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled)
static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled)
{
/* use the cached window sizes */
*width = g->old_width / 2;
@ -935,7 +935,7 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bo
* \param g gui_window to update the extent of
*/
void gui_window_update_extent(struct gui_window *g)
static void gui_window_update_extent(struct gui_window *g)
{
os_error *error;
wimp_window_info info;
@ -5247,11 +5247,12 @@ static struct gui_window_table gui_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_icon = gui_window_set_icon,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,
.save_link = gui_window_save_link,
.drag_start = gui_window_drag_start,
.scroll_visible = gui_window_scroll_visible,

View File

@ -1546,7 +1546,7 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
}
void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
static void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
bool scaled)
{
if (w == NULL)
@ -1558,7 +1558,7 @@ void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
*height = w->height;
}
void gui_window_update_extent(struct gui_window *w)
static void gui_window_update_extent(struct gui_window *w)
{
}
@ -1854,6 +1854,8 @@ static struct gui_window_table win32_window_table = {
.update = gui_window_update_box,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,