From 07024b05c4be91498245a3066fc3365259acf8bd Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 3 Jan 2013 19:53:20 +0000 Subject: Change the mouse pointer back to what it was (and what NetSurf thinks it is) instead of to the default pointer. Additionally don't use ami_update_pointer for treeview windows as AmigaOS has a pointer setting per window, but NetSurf is only storing the current one as a single global variable. --- amiga/arexx.c | 9 +++++++-- amiga/download.c | 9 +++++++-- amiga/drag.c | 10 +++++----- amiga/file.c | 4 ++-- amiga/gui.c | 8 +++++--- amiga/menu.c | 8 ++++---- amiga/theme.c | 12 +++++++++--- amiga/theme.h | 3 ++- amiga/tree.c | 16 +++++++++++----- 9 files changed, 52 insertions(+), 27 deletions(-) diff --git a/amiga/arexx.c b/amiga/arexx.c index c3279ad3d..154f69703 100755 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -275,7 +275,12 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu if(!bw) return; - ami_update_pointer(bw->window->shared->win,GUI_POINTER_WAIT); + /* 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); + if(fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)) { if(source_data = content_get_source_data(bw->current_content, &source_size)) @@ -285,7 +290,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_update_pointer(bw->window->shared->win,GUI_POINTER_DEFAULT); + ami_reset_pointer(bw->window->shared->win); } STATIC VOID rx_quit(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused))) diff --git a/amiga/download.c b/amiga/download.c index c0c88bb0b..37fc79e28 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -356,7 +356,12 @@ 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); - ami_update_pointer(g->shared->win,GUI_POINTER_WAIT); + + /* 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); if(ami_download_check_overwrite(fname, g->shared->win, 0)) { @@ -383,7 +388,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title) } FreeVec(linkname); } - ami_update_pointer(g->shared->win,GUI_POINTER_DEFAULT); + ami_reset_pointer(g->shared->win); } } diff --git a/amiga/drag.c b/amiga/drag.c index e19b27393..20dbc78e3 100644 --- a/amiga/drag.c +++ b/amiga/drag.c @@ -142,7 +142,7 @@ void ami_drag_save(struct Window *win) return; } - ami_update_pointer(win,GUI_POINTER_WAIT); + ami_update_pointer(win, GUI_POINTER_WAIT, false); switch(drag_save) { @@ -189,7 +189,7 @@ void ami_drag_save(struct Window *win) drag_save = 0; drag_save_data = NULL; - ami_update_pointer(win,GUI_POINTER_DEFAULT); + ami_update_pointer(win, GUI_POINTER_DEFAULT, false); } void ami_drag_icon_show(struct Window *win, const char *type) @@ -205,12 +205,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); + ami_update_pointer(win, AMI_GUI_POINTER_DRAG, false); return; } else { - ami_update_pointer(win, GUI_POINTER_DEFAULT); + ami_update_pointer(win, GUI_POINTER_DEFAULT, false); } if(!strcmp(type, "drawer")) deftype = WBDRAWER; @@ -266,7 +266,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); + if(win) ami_update_pointer(win, GUI_POINTER_DEFAULT, false); drag_icon = NULL; drag_in_progress = FALSE; } diff --git a/amiga/file.c b/amiga/file.c index 30a63b615..161aabdf3 100644 --- a/amiga/file.c +++ b/amiga/file.c @@ -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); + ami_update_pointer(win, GUI_POINTER_WAIT, false); 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); + ami_update_pointer(win, GUI_POINTER_DEFAULT, false); } void ami_file_save_req(int type, struct gui_window_2 *gwin, diff --git a/amiga/gui.c b/amiga/gui.c index 1221a2cc0..0c31c7f68 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -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); + if(!gwin->mouse_state) ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false); } break; @@ -3600,6 +3600,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, 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, @@ -3673,7 +3674,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin, } } - SetWindowPointer(gwin->win, TAG_DONE); + ami_reset_pointer(gwin->win); } @@ -3851,6 +3852,7 @@ 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, @@ -3862,7 +3864,7 @@ void ami_do_redraw(struct gui_window_2 *gwin) browserglob.rp = temprp; } - SetWindowPointer(gwin->win, TAG_DONE); + ami_reset_pointer(gwin->win); } } diff --git a/amiga/menu.c b/amiga/menu.c index 3ecfbb16a..c3b191e40 100755 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -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); + ami_update_pointer(gwin->win, GUI_POINTER_WAIT, false); ami_print_ui(gwin->bw->current_content); - ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT); + ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false); } 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); + ami_update_pointer(gwin->win, 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); + ami_update_pointer(gwin->win, GUI_POINTER_DEFAULT, false); } static void ami_menu_item_project_quit(struct Hook *hook, APTR window, struct IntuiMessage *msg) diff --git a/amiga/theme.c b/amiga/theme.c index fce69eda3..52462c03c 100644 --- a/amiga/theme.c +++ b/amiga/theme.c @@ -174,12 +174,18 @@ 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); + ami_update_pointer(g->shared->win, shape, false); } -void ami_update_pointer(struct Window *win, gui_pointer_shape shape) +/* reset the mouse pointer back to what NetSurf last set it as */ +void ami_reset_pointer(struct Window *win) { - if(mouseptrcurrent == shape) return; + ami_update_pointer(win, mouseptrcurrent, true); +} + +void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reapply) +{ + if((mouseptrcurrent == shape) && (reapply == false)) return; if(drag_save_data) return; if(nsoption_bool(use_os_pointers)) diff --git a/amiga/theme.h b/amiga/theme.h index ba1295d61..52a21bb1a 100644 --- a/amiga/theme.h +++ b/amiga/theme.h @@ -35,5 +35,6 @@ 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); +void ami_update_pointer(struct Window *win, gui_pointer_shape shape, bool reapply); +void ami_reset_pointer(struct Window *win); #endif diff --git a/amiga/tree.c b/amiga/tree.c index 95a68dc20..e3224ff53 100755 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -991,12 +991,15 @@ BOOL ami_tree_event(struct treeview_window *twin) { strlcpy(fname,savereq->fr_Drawer,1024); AddPart(fname,savereq->fr_File,1024); - ami_update_pointer(twin->win,GUI_POINTER_WAIT); + SetWindowPointer(twin->win, + WA_BusyPointer, TRUE, + WA_PointerDelay, TRUE, + TAG_DONE); if(twin->type == AMI_TREE_HISTORY) history_global_export(fname); else if(twin->type == AMI_TREE_HOTLIST) hotlist_export(fname); - ami_update_pointer(twin->win,GUI_POINTER_DEFAULT); + SetWindowPointer(twin->win, TAG_DONE); } break; @@ -1237,9 +1240,12 @@ void ami_tree_redraw_request(int x, int y, int width, int height, void *data) }; if(!twin->win) return; -// if(tree_get_redraw(twin->tree) == false) return; - ami_update_pointer(twin->win, GUI_POINTER_WAIT); + SetWindowPointer(twin->win, + WA_BusyPointer, TRUE, + WA_PointerDelay, TRUE, + TAG_DONE); + glob = &twin->globals; GetAttr(SPACE_AreaBox,twin->objects[GID_BROWSER],(ULONG *)&bbox); @@ -1286,6 +1292,6 @@ void ami_tree_redraw_request(int x, int y, int width, int height, void *data) } } - ami_update_pointer(twin->win, GUI_POINTER_DEFAULT); + SetWindowPointer(twin->win, TAG_DONE); glob = &browserglob; } -- cgit v1.2.3