Merge branch 'master' of git://git.netsurf-browser.org/netsurf

This commit is contained in:
Michael Drake 2013-01-07 12:05:25 +00:00
commit c22c04710e
12 changed files with 63 additions and 84 deletions

View File

@ -275,11 +275,7 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
if(!bw) return;
/* Set the busy pointer. We intentionally don't use ami_update_pointer here. */
SetWindowPointer(bw->window->shared->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_set_pointer(bw->window->shared, GUI_POINTER_WAIT, false);
if(fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0))
{
@ -290,7 +286,7 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
SetComment((char *)cmd->ac_ArgList[0], nsurl_access(hlcache_handle_get_url(bw->current_content)));
}
ami_reset_pointer(bw->window->shared->win);
ami_reset_pointer(bw->window->shared);
}
STATIC VOID rx_quit(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))

View File

@ -357,11 +357,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
strlcpy(fname, savereq->fr_Drawer, 1024);
AddPart(fname,savereq->fr_File,1024);
/* Set the busy pointer. We intentionally don't use ami_update_pointer here. */
SetWindowPointer(g->shared->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);
if(ami_download_check_overwrite(fname, g->shared->win, 0))
{
@ -388,7 +384,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
}
FreeVec(linkname);
}
ami_reset_pointer(g->shared->win);
ami_reset_pointer(g->shared);
}
}

View File

@ -142,7 +142,7 @@ void ami_drag_save(struct Window *win)
return;
}
ami_update_pointer(win, GUI_POINTER_WAIT, false);
ami_update_pointer(win, GUI_POINTER_WAIT);
switch(drag_save)
{
@ -189,7 +189,8 @@ void ami_drag_save(struct Window *win)
drag_save = 0;
drag_save_data = NULL;
ami_update_pointer(win, GUI_POINTER_DEFAULT, false);
ami_update_pointer(win, GUI_POINTER_DEFAULT);
}
void ami_drag_icon_show(struct Window *win, const char *type)
@ -205,12 +206,12 @@ void ami_drag_icon_show(struct Window *win, const char *type)
if(nsoption_bool(drag_save_icons) == false)
{
ami_update_pointer(win, AMI_GUI_POINTER_DRAG, false);
ami_update_pointer(win, AMI_GUI_POINTER_DRAG);
return;
}
else
{
ami_update_pointer(win, GUI_POINTER_DEFAULT, false);
ami_update_pointer(win, GUI_POINTER_DEFAULT);
}
if(!strcmp(type, "drawer")) deftype = WBDRAWER;
@ -266,7 +267,7 @@ void ami_drag_icon_move(void)
void ami_drag_icon_close(struct Window *win)
{
if(drag_icon) CloseWindow(drag_icon);
if(win) ami_update_pointer(win, GUI_POINTER_DEFAULT, false);
if(win) ami_update_pointer(win, GUI_POINTER_DEFAULT);
drag_icon = NULL;
drag_in_progress = FALSE;
}

View File

@ -141,7 +141,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
struct bitmap *bm;
BPTR fh=0;
ami_update_pointer(win, GUI_POINTER_WAIT, false);
ami_update_pointer(win, GUI_POINTER_WAIT);
if(ami_download_check_overwrite(fname, win, 0))
{
@ -200,7 +200,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
if(object) SetComment(fname, nsurl_access(hlcache_handle_get_url(object)));
}
ami_update_pointer(win, GUI_POINTER_DEFAULT, false);
ami_update_pointer(win, GUI_POINTER_DEFAULT);
}
void ami_file_save_req(int type, struct gui_window_2 *gwin,

View File

@ -1435,7 +1435,7 @@ void ami_handle_msg(void)
{
ami_context_menu_mouse_trap(gwin, FALSE);
if(!gwin->mouse_state) ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false);
if(!gwin->mouse_state) ami_set_pointer(gwin, GUI_POINTER_DEFAULT, true);
}
break;
@ -3599,12 +3599,6 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
struct rect clip;
int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->bw->scale);
int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->bw->scale);
/* Set the busy pointer. We intentionally don't use ami_update_pointer here. */
SetWindowPointer(gwin->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
browserglob.shared_pens = &gwin->shared_pens;
@ -3638,6 +3632,8 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
// printf("%ld %ld %ld %ld\n",left, top, width, height);
ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
for(y = top; y < (top + height); y += tile_y_scale) {
clip.y0 = 0;
clip.y1 = nsoption_int(redraw_tile_size_y);
@ -3674,7 +3670,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
}
}
ami_reset_pointer(gwin->win);
ami_reset_pointer(gwin);
}
@ -3852,19 +3848,15 @@ void ami_do_redraw(struct gui_window_2 *gwin)
clip.x1 = bbox->Left + bbox->Width;
clip.y1 = bbox->Top + bbox->Height;
/* Set the busy pointer. We intentionally don't use ami_update_pointer here. */
SetWindowPointer(gwin->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
if(browser_window_redraw(gwin->bw, clip.x0 - hcurrent, clip.y0 - vcurrent, &clip, &ctx))
{
ami_clearclipreg(&browserglob);
browserglob.rp = temprp;
}
ami_reset_pointer(gwin->win);
ami_reset_pointer(gwin);
}
}

View File

@ -120,6 +120,7 @@ struct gui_window_2 {
struct IBox *ptr_lock;
struct AppWindow *appwin;
struct MinList shared_pens;
gui_pointer_shape mouse_pointer;
};
struct gui_window

View File

@ -1502,10 +1502,7 @@ void ami_gui_opts_use(bool save)
bool rescan_fonts = false;
bool old_tab_always_show;
SetWindowPointer(gow->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_update_pointer(gow->win, GUI_POINTER_WAIT);
GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_HOMEPAGE],(ULONG *)&data);
nsoption_set_charp(homepage_url, (char *)strdup((char *)data));
@ -1863,9 +1860,7 @@ void ami_gui_opts_use(bool save)
ami_menu_check_toggled = true;
SetWindowPointer(gow->win,
WA_Pointer, NULL,
TAG_DONE);
ami_update_pointer(gow->win, GUI_POINTER_DEFAULT);
}
void ami_gui_opts_close(void)

View File

@ -753,9 +753,9 @@ static void ami_menu_item_project_print(struct Hook *hook, APTR window, struct I
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_update_pointer(gwin->win, GUI_POINTER_WAIT, false);
ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
ami_print_ui(gwin->bw->current_content);
ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false);
ami_reset_pointer(gwin);
}
static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct IntuiMessage *msg)
@ -766,7 +766,7 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
ami_update_pointer(gwin->win, GUI_POINTER_WAIT, false);
ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
temp = ASPrintf("%s|%s|%s", messages_get("OK"),
messages_get("HelpCredits"),
@ -800,7 +800,7 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I
else if(sel == 0)
browser_window_create("about:licence", NULL, 0, true, false);
ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false);
ami_reset_pointer(gwin);
}
static void ami_menu_item_project_quit(struct Hook *hook, APTR window, struct IntuiMessage *msg)

View File

@ -36,9 +36,10 @@
#include "amiga/os3support.h"
#include "amiga/search.h"
#include "amiga/object.h"
#include "amiga/theme.h"
#include <proto/intuition.h>
#include <proto/exec.h>
#include <proto/window.h>
#include <proto/layout.h>
#include <proto/string.h>
@ -277,10 +278,10 @@ void ami_search_set_status(bool found, void *p)
void ami_search_set_hourglass(bool active, void *p)
{
SetWindowPointer(fwin->win,
WA_BusyPointer,active,
WA_PointerDelay,active,
TAG_DONE);
if(active)
ami_update_pointer(fwin->win, GUI_POINTER_WAIT);
else
ami_update_pointer(fwin->win, GUI_POINTER_DEFAULT);
}
/**

View File

@ -48,7 +48,6 @@ struct bitmap *throbber_nsbm = NULL;
ULONG throbber_frames,throbber_update_interval;
static Object *mouseptrobj[AMI_LASTPOINTER+1];
static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1];
static int mouseptrcurrent=0;
char *ptrs[AMI_LASTPOINTER+1] = {
"ptr_default",
@ -174,18 +173,24 @@ void ami_get_theme_filename(char *filename, char *themestring, bool protocol)
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
ami_update_pointer(g->shared->win, shape, false);
ami_set_pointer(g->shared, shape, true);
}
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
{
if(gwin->mouse_pointer == shape) return;
ami_update_pointer(gwin->win, shape);
if(update == true) gwin->mouse_pointer = shape;
}
/* reset the mouse pointer back to what NetSurf last set it as */
void ami_reset_pointer(struct Window *win)
void ami_reset_pointer(struct gui_window_2 *gwin)
{
ami_update_pointer(win, mouseptrcurrent, true);
ami_update_pointer(gwin->win, gwin->mouse_pointer);
}
void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reapply)
void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
{
if((mouseptrcurrent == shape) && (reapply == false)) return;
if(drag_save_data) return;
if(nsoption_bool(use_os_pointers))
@ -193,24 +198,24 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reappl
switch(shape)
{
case GUI_POINTER_DEFAULT:
SetWindowPointer(win,TAG_DONE);
SetWindowPointer(win, TAG_DONE);
break;
case GUI_POINTER_WAIT:
SetWindowPointer(win,
WA_BusyPointer,TRUE,
WA_PointerDelay,TRUE,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
break;
default:
if(mouseptrobj[shape])
{
SetWindowPointer(win,WA_Pointer,mouseptrobj[shape],TAG_DONE);
SetWindowPointer(win, WA_Pointer, mouseptrobj[shape], TAG_DONE);
}
else
{
SetWindowPointer(win,TAG_DONE);
SetWindowPointer(win, TAG_DONE);
}
break;
}
@ -219,34 +224,28 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reappl
{
if(mouseptrobj[shape])
{
SetWindowPointer(win,WA_Pointer,mouseptrobj[shape],TAG_DONE);
SetWindowPointer(win, WA_Pointer, mouseptrobj[shape], TAG_DONE);
}
else
{
if(shape == GUI_POINTER_WAIT)
{
SetWindowPointer(win,
WA_BusyPointer,TRUE,
WA_PointerDelay,TRUE,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
}
else
{
SetWindowPointer(win,TAG_DONE);
SetWindowPointer(win, TAG_DONE);
}
}
}
mouseptrcurrent = shape;
}
void gui_window_hide_pointer(struct gui_window *g)
{
if(mouseptrcurrent != AMI_GUI_POINTER_BLANK)
{
SetWindowPointer(g->shared->win,WA_Pointer,mouseptrobj[AMI_GUI_POINTER_BLANK],TAG_DONE);
mouseptrcurrent = AMI_GUI_POINTER_BLANK;
}
ami_set_pointer(g->shared, AMI_GUI_POINTER_BLANK, true);
}
void ami_init_mouse_pointers(void)

View File

@ -35,6 +35,10 @@ void ami_update_throbber(struct gui_window_2 *g,bool redraw);
void ami_init_mouse_pointers(void);
void ami_mouse_pointers_free(void);
void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reapply);
void ami_reset_pointer(struct Window *win);
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update);
void ami_reset_pointer(struct gui_window_2 *gwin);
/* Use the following ONLY if nothing other than the Intuition window pointer is available,
* and ALWAYS in preference to SetWindowPointer(), as it features more pointers and uses
* the correct ones specified in user preferences. */
void ami_update_pointer(struct Window *win, gui_pointer_shape shape);
#endif

View File

@ -991,15 +991,12 @@ BOOL ami_tree_event(struct treeview_window *twin)
{
strlcpy(fname,savereq->fr_Drawer,1024);
AddPart(fname,savereq->fr_File,1024);
SetWindowPointer(twin->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_update_pointer(twin->win, GUI_POINTER_WAIT);
if(twin->type == AMI_TREE_HISTORY)
history_global_export(fname);
else if(twin->type == AMI_TREE_HOTLIST)
hotlist_export(fname);
SetWindowPointer(twin->win, TAG_DONE);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
}
break;
@ -1241,10 +1238,7 @@ void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
if(!twin->win) return;
SetWindowPointer(twin->win,
WA_BusyPointer, TRUE,
WA_PointerDelay, TRUE,
TAG_DONE);
ami_update_pointer(twin->win, GUI_POINTER_WAIT);
glob = &twin->globals;
@ -1292,6 +1286,6 @@ void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
}
}
SetWindowPointer(twin->win, TAG_DONE);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
glob = &browserglob;
}