move more optional window operations into table including removing unused hide_pointer operation altogether

This commit is contained in:
Vincent Sanders 2014-01-12 22:55:26 +00:00
parent b7736bae2f
commit 4b49b4ac77
13 changed files with 87 additions and 179 deletions

View File

@ -4545,12 +4545,6 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
// g->shared->new_content = false;
}
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
gui_window_set_scroll(g, x0, y0);
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
@ -4825,7 +4819,7 @@ void gui_window_remove_caret(struct gui_window *g)
g->c_h = 0;
}
void gui_window_new_content(struct gui_window *g)
static void gui_window_new_content(struct gui_window *g)
{
hlcache_handle *c;
@ -4845,11 +4839,6 @@ void gui_window_new_content(struct gui_window *g)
ami_gui_update_hotlist_button(g->shared);
}
bool gui_window_scroll_start(struct gui_window *g)
{
return true;
}
static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
const struct rect *rect)
{
@ -5102,6 +5091,7 @@ static struct gui_window_table ami_window_table = {
.set_url = gui_window_set_url,
.drag_start = gui_window_drag_start,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,

View File

@ -275,11 +275,6 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
}
}
void gui_window_hide_pointer(struct gui_window *g)
{
ami_set_pointer(g->shared, AMI_GUI_POINTER_BLANK, true);
}
void ami_init_mouse_pointers(void)
{
if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) return;

View File

@ -418,13 +418,6 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1)
{
LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1));
gui_window_set_scroll(w,x0,y0);
}
/* 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.
@ -534,11 +527,6 @@ void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape)
}
}
void gui_window_hide_pointer(struct gui_window *w)
{
TODO();
}
static void gui_window_set_url(struct gui_window *w, const char *url)
{
@ -658,7 +646,7 @@ gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
}
}
void gui_window_new_content(struct gui_window *w)
static void gui_window_new_content(struct gui_window *w)
{
struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win);
slid->x_pos = 0;
@ -667,13 +655,6 @@ void gui_window_new_content(struct gui_window *w)
gui_window_redraw_window(w);
}
bool gui_window_scroll_start(struct gui_window *w)
{
TODO();
return true;
}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *w)
{
@ -1094,6 +1075,7 @@ static struct gui_window_table atari_window_table = {
.set_url = gui_window_set_url,
.set_icon = gui_window_set_icon,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
};

View File

@ -406,12 +406,6 @@ static struct gui_window *gui_window_create(struct browser_window *bw,
}
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
gui_window_set_scroll(g, x0, y0);
}
void nsbeos_dispatch_event(BMessage *message)
{
struct gui_window *gui = NULL;
@ -1215,11 +1209,6 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
delete cursor;
}
void gui_window_hide_pointer(struct gui_window *g)
{
//XXX no BView::HideCursor... use empty one
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip)
{
@ -1263,7 +1252,7 @@ void gui_window_remove_caret(struct gui_window *g)
g->view->UnlockLooper();
}
void gui_window_new_content(struct gui_window *g)
static void gui_window_new_content(struct gui_window *g)
{
if (!g->toplevel)
return;
@ -1279,12 +1268,6 @@ void gui_window_new_content(struct gui_window *g)
g->view->UnlockLooper();
}
bool gui_window_scroll_start(struct gui_window *g)
{
return true;
}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *g)
{
@ -1383,6 +1366,8 @@ static struct gui_window_table gui_window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
.new_content = gui_window_new_content,
/* from scaffold */
.set_icon = gui_window_set_icon,
.set_title = gui_window_set_title,

View File

@ -135,12 +135,6 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
[[(BrowserViewController *)g browserView] scrollPoint: cocoa_point( sx, sy )];
}
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
gui_window_set_scroll( g, x0, y0 );
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
@ -205,10 +199,6 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
}
}
void gui_window_hide_pointer(struct gui_window *g)
{
}
static void gui_window_set_url(struct gui_window *g, const char *url)
{
[(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: url]];
@ -255,16 +245,11 @@ void gui_window_remove_caret(struct gui_window *g)
[[(BrowserViewController *)g browserView] removeCaret];
}
void gui_window_new_content(struct gui_window *g)
static void gui_window_new_content(struct gui_window *g)
{
[(BrowserViewController *)g contentUpdated];
}
bool gui_window_scroll_start(struct gui_window *g)
{
return true;
}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *g)
{
@ -319,6 +304,7 @@ static struct gui_window_table cocoa_window_table = {
.set_url = gui_window_set_url,
.set_icon = gui_window_set_icon,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
};

View File

@ -484,7 +484,7 @@ void browser_window_scroll_visible(struct browser_window *bw,
if (bw->window != NULL) {
/* Front end window */
gui_window_scroll_visible(bw->window,
guit->window->scroll_visible(bw->window,
rect->x0, rect->y0, rect->x1, rect->y1);
} else {
/* Core managed browser window */
@ -1233,7 +1233,7 @@ static nserror browser_window_callback(hlcache_handle *c,
browser_window_remove_caret(bw, false);
if (bw->window != NULL) {
gui_window_new_content(bw->window);
guit->window->new_content(bw->window);
browser_window_refresh_url_bar(bw,
hlcache_handle_get_url(bw->current_content),
@ -2949,7 +2949,7 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
gui_window_get_scroll(bw->window, &bw->drag_start_scroll_x,
&bw->drag_start_scroll_y);
gui_window_scroll_start(bw->window);
guit->window->scroll_start(bw->window);
} else {
/* Core managed browser window */
bw->drag_start_scroll_x = scrollbar_get_offset(bw->scroll_x);

View File

@ -102,6 +102,32 @@ struct gui_window_table {
/** set favicon */
void (*set_icon)(struct gui_window *g, hlcache_handle *icon);
/**
* Scrolls the specified area of a browser window into view.
*
* \param g gui_window to scroll
* \param x0 left point to ensure visible
* \param y0 bottom point to ensure visible
* \param x1 right point to ensure visible
* \param y1 top point to ensure visible
*/
void (*scroll_visible)(struct gui_window *g, int x0, int y0, int x1, int y1);
/**
* Starts drag scrolling of a browser window
*
* \param g the window to scroll
*/
bool (*scroll_start)(struct gui_window *g);
/**
* Called when the gui_window has new content.
*
* \param g the gui_window that has new content
*/
void (*new_content)(struct gui_window *g);
};
/** Graphical user interface function table
@ -143,19 +169,14 @@ void gui_window_update_box(struct gui_window *g,
const struct rect *rect);
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy);
void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1);
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_hide_pointer(struct gui_window *g);
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip);
void gui_window_remove_caret(struct gui_window *g);
void gui_window_new_content(struct gui_window *g);
bool gui_window_scroll_start(struct gui_window *g);
struct gui_download_window *gui_download_window_create(download_context *ctx,

View File

@ -9,6 +9,11 @@ static void gui_default_quit(void)
{
}
static void gui_default_set_search_ico(hlcache_handle *ico)
{
}
static void gui_default_window_set_title(struct gui_window *g, const char *title)
{
}
@ -25,31 +30,41 @@ static void gui_default_window_stop_throbber(struct gui_window *g)
{
}
static bool
gui_default_window_drag_start(struct gui_window *g,
gui_drag_type type,
const struct rect *rect)
static bool gui_default_window_drag_start(struct gui_window *g,
gui_drag_type type,
const struct rect *rect)
{
return true;
}
static void
gui_default_window_save_link(struct gui_window *g,
const char *url,
const char *title)
static void gui_default_window_save_link(struct gui_window *g,
const char *url,
const char *title)
{
}
static void
gui_default_window_set_icon(struct gui_window *g, hlcache_handle *icon)
static void gui_default_window_set_icon(struct gui_window *g,
hlcache_handle *icon)
{
}
static void
gui_default_set_search_ico(hlcache_handle *ico)
static void gui_default_window_scroll_visible(struct gui_window *g,
int x0, int y0,
int x1, int y1)
{
gui_window_set_scroll(g, x0, y0);
}
static void gui_default_window_new_content(struct gui_window *g)
{
}
static bool gui_default_window_scroll_start(struct gui_window *g)
{
return true;
}
/** verify window table is valid */
static nserror verify_window_register(struct gui_window_table *gwt)
{
@ -88,6 +103,15 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->set_icon == NULL) {
gwt->set_icon = gui_default_window_set_icon;
}
if (gwt->scroll_visible == NULL) {
gwt->scroll_visible = gui_default_window_scroll_visible;
}
if (gwt->new_content == NULL) {
gwt->new_content = gui_default_window_new_content;
}
if (gwt->scroll_start == NULL) {
gwt->scroll_start = gui_default_window_scroll_start;
}
return NSERROR_OK;
}

View File

@ -1574,12 +1574,6 @@ gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
widget_scroll_y(gw, sy * gw->bw->scale, true);
}
void
gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
LOG(("%s:(%p, %d, %d, %d, %d)", __func__, g, x0, y0, x1, y1));
}
void
gui_window_get_dimensions(struct gui_window *g,
@ -1646,11 +1640,6 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
}
}
void
gui_window_hide_pointer(struct gui_window *g)
{
}
static void
gui_window_set_url(struct gui_window *g, const char *url)
{
@ -1777,18 +1766,6 @@ gui_window_remove_caret(struct gui_window *g)
}
}
void
gui_window_new_content(struct gui_window *g)
{
}
bool
gui_window_scroll_start(struct gui_window *g)
{
return true;
}
struct gui_download_window *
gui_download_window_create(download_context *ctx, struct gui_window *parent)
{

View File

@ -987,13 +987,6 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
gtk_adjustment_set_value(hadj, x);
}
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
gui_window_set_scroll(g,x0,y0);
}
void gui_window_update_extent(struct gui_window *g)
{
if (!g->bw->current_content)
@ -1099,10 +1092,6 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
nsgdk_cursor_unref(cursor);
}
void gui_window_hide_pointer(struct gui_window *g)
{
}
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip)
@ -1118,15 +1107,6 @@ void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
}
void gui_window_new_content(struct gui_window *g)
{
}
bool gui_window_scroll_start(struct gui_window *g)
{
return true;
}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,

View File

@ -142,7 +142,7 @@ gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
*height = g->height;
}
void
static void
gui_window_new_content(struct gui_window *g)
{
fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
@ -293,7 +293,7 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
bool
static bool
gui_window_scroll_start(struct gui_window *g)
{
fprintf(stdout, "WINDOW SCROLL_START WIN %u\n", g->win_num);
@ -301,7 +301,7 @@ gui_window_scroll_start(struct gui_window *g)
return true;
}
void
static void
gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
@ -573,6 +573,9 @@ static struct gui_window_table gui_window_table = {
.drag_start = gui_window_drag_start,
.save_link = gui_window_save_link,
.scroll_visible = gui_window_scroll_visible,
.scroll_start = gui_window_scroll_start,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
};

View File

@ -831,7 +831,7 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
* \param x1 right point to ensure visible
* \param y1 top point to ensure visible
*/
void gui_window_scroll_visible(struct gui_window *g, int x0, int y0, int x1, int y1)
static void gui_window_scroll_visible(struct gui_window *g, int x0, int y0, int x1, int y1)
{
wimp_window_state state;
os_error *error;
@ -1037,23 +1037,6 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
}
/**
* Remove the mouse pointer from the screen
*/
void gui_window_hide_pointer(struct gui_window *g)
{
os_error *error;
error = xwimpspriteop_set_pointer_shape(NULL, 0x30, 0, 0, 0, 0);
if (error) {
LOG(("xwimpspriteop_set_pointer_shape: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
}
/**
* Set the contents of a window's address bar.
*
@ -1172,7 +1155,7 @@ void gui_window_remove_caret(struct gui_window *g)
* \param g the gui_window that has new content
*/
void gui_window_new_content(struct gui_window *g)
static void gui_window_new_content(struct gui_window *g)
{
ro_gui_menu_refresh(ro_gui_browser_window_menu);
ro_gui_window_update_toolbar_buttons(g);
@ -1184,10 +1167,10 @@ void gui_window_new_content(struct gui_window *g)
/**
* Starts drag scrolling of a browser window
*
* \param gw gui window
* \param g the window to scroll
*/
bool gui_window_scroll_start(struct gui_window *g)
static bool gui_window_scroll_start(struct gui_window *g)
{
wimp_window_info_base info;
wimp_pointer pointer;
@ -5266,6 +5249,9 @@ static struct gui_window_table gui_window_table = {
.save_link = gui_window_save_link,
.drag_start = gui_window_drag_start,
.scroll_visible = gui_window_scroll_visible,
.scroll_start = gui_window_scroll_start,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
};

View File

@ -1543,12 +1543,6 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0,
int x1, int y1)
{
LOG(("scroll visible (%p, %d, %d, %d, %d)", w, x0, y0, x1, y1));
}
void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
bool scaled)
{
@ -1650,10 +1644,6 @@ struct nsws_pointers *nsws_get_pointers(void)
return &nsws_pointer;
}
void gui_window_hide_pointer(struct gui_window *w)
{
}
static void gui_window_set_url(struct gui_window *w, const char *url)
{
if (w == NULL)
@ -1737,17 +1727,6 @@ gui_window_remove_caret(struct gui_window *w)
HideCaret(w->drawingarea);
}
void gui_window_new_content(struct gui_window *w)
{
}
bool gui_window_scroll_start(struct gui_window *w)
{
return true;
}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *w)
{