From b9dd0a60c300b0de6b117500f67b6724b520652c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 7 May 2019 23:43:15 +0100 Subject: accessor for window from gui_window_2 --- frontends/amiga/clipboard.c | 12 ++++++------ frontends/amiga/drag.c | 2 +- frontends/amiga/file.c | 6 +++--- frontends/amiga/gui.c | 9 +++++++-- frontends/amiga/gui.h | 5 +++++ frontends/amiga/gui_menu.c | 16 ++++++++-------- frontends/amiga/theme.c | 4 ++-- 7 files changed, 32 insertions(+), 22 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c index d0372c267..ae3d22e3f 100644 --- a/frontends/amiga/clipboard.c +++ b/frontends/amiga/clipboard.c @@ -280,8 +280,8 @@ void ami_drag_selection(struct gui_window *g) return; } - x = gwin->win->MouseX; - y = gwin->win->MouseY; + x = ami_gui2_get_window(gwin)->MouseX; + y = ami_gui2_get_window(gwin)->MouseY; if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y)) { @@ -296,8 +296,8 @@ void ami_drag_selection(struct gui_window *g) } else { - x = gwin->win->MouseX; - y = gwin->win->MouseY; + x = ami_gui2_get_window(gwin)->MouseX; + y = ami_gui2_get_window(gwin)->MouseY; if(ami_gadget_hit(gwin->objects[GID_URL], x, y)) { @@ -305,7 +305,7 @@ void ami_drag_selection(struct gui_window *g) { utf8text = ami_utf8_easy(sel); RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL], - gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE); + ami_gui2_get_window(gwin), NULL, STRINGA_TextVal, utf8text, TAG_DONE); free(sel); ami_utf8_free(utf8text); } @@ -316,7 +316,7 @@ void ami_drag_selection(struct gui_window *g) { utf8text = ami_utf8_easy(sel); RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING], - gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE); + ami_gui2_get_window(gwin), NULL, STRINGA_TextVal, utf8text, TAG_DONE); free(sel); ami_utf8_free(utf8text); } diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c index c022a9c3a..049542770 100644 --- a/frontends/amiga/drag.c +++ b/frontends/amiga/drag.c @@ -304,7 +304,7 @@ static void *ami_find_gwin_by_id(struct Window *win, uint32 type) if(node->Type == type) { gwin = node->objstruct; - if(win == gwin->win) return gwin; + if(win == ami_gui2_get_window(gwin)) return gwin; } } while((node = nnode)); } diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c index 40d7288cc..4d02ddf49 100644 --- a/frontends/amiga/file.c +++ b/frontends/amiga/file.c @@ -84,7 +84,7 @@ void ami_file_open(struct gui_window_2 *gwin) if(AslRequestTags(filereq, ASLFR_TitleText, messages_get("NetSurf"), - ASLFR_Window, gwin->win, + ASLFR_Window, ami_gui2_get_window(gwin), ASLFR_SleepWindow, TRUE, ASLFR_Screen, scrn, ASLFR_DoSaveMode, FALSE, @@ -257,7 +257,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin, } if(AslRequestTags(savereq, - ASLFR_Window, gwin->win, + ASLFR_Window, ami_gui2_get_window(gwin), ASLFR_SleepWindow, TRUE, ASLFR_TitleText, messages_get("NetSurf"), ASLFR_Screen, scrn, @@ -267,7 +267,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin, strlcpy(fname, savereq->fr_Drawer, 1024); AddPart(fname, savereq->fr_File, 1024); - ami_file_save(type, fname, gwin->win, object, + ami_file_save(type, fname, ami_gui2_get_window(gwin), object, ami_gui_get_favicon(gwin->gw), ami_gui_get_browser_window(gwin->gw)); } diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index ca0fda167..6db8434fb 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -349,11 +349,16 @@ void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing) gw->throbbing = throbbing; } +struct Window *ami_gui2_get_window(struct gui_window_2 *gwin) +{ + assert(gwin != NULL); + return gwin->win; +} + struct Window *ami_gui_get_window(struct gui_window *gw) { assert(gw != NULL); - assert(gw->shared != NULL); - return gw->shared->win; + return ami_gui2_get_window(gw->shared); } struct Menu *ami_gui_get_menu(struct gui_window *gw) diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index 727b578f2..6b0818920 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -311,6 +311,11 @@ void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing); */ struct Window *ami_gui_get_window(struct gui_window *gw); +/** + * Get window from gui_window_2 + */ +struct Window *ami_gui2_get_window(struct gui_window_2 *gwin); + /** * Get imenu from gui_window */ diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c index b86abcb55..f82384b77 100644 --- a/frontends/amiga/gui_menu.c +++ b/frontends/amiga/gui_menu.c @@ -191,7 +191,7 @@ HOOKF(void, ami_menu_item_project_about, APTR, window, struct IntuiMessage *) #ifdef __amigaos4__ sel = TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_INFO, TDR_TitleString, messages_get("NetSurf"), - TDR_Window, gwin->win, + TDR_Window, ami_gui2_get_window(gwin), TDR_GadgetString, temp2, TDR_FormatString,"NetSurf %s\nBuild date %s\n\nhttp://www.netsurf-browser.org", TDR_Arg1,netsurf_version, @@ -206,7 +206,7 @@ HOOKF(void, ami_menu_item_project_about, APTR, window, struct IntuiMessage *) temp2, }; - sel = EasyRequest(gwin->win, &about_req, NULL, netsurf_version, verdate); + sel = EasyRequest(ami_gui2_get_window(gwin), &about_req, NULL, netsurf_version, verdate); #endif free(temp2); @@ -455,10 +455,10 @@ HOOKF(void, ami_menu_item_settings_snapshot, APTR, window, struct IntuiMessage * struct gui_window_2 *gwin; GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); - nsoption_set_int(window_x, gwin->win->LeftEdge); - nsoption_set_int(window_y, gwin->win->TopEdge); - nsoption_set_int(window_width, gwin->win->Width); - nsoption_set_int(window_height, gwin->win->Height); + nsoption_set_int(window_x, ami_gui2_get_window(gwin)->LeftEdge); + nsoption_set_int(window_y, ami_gui2_get_window(gwin)->TopEdge); + nsoption_set_int(window_width, ami_gui2_get_window(gwin)->Width); + nsoption_set_int(window_height, ami_gui2_get_window(gwin)->Height); } HOOKF(void, ami_menu_item_settings_save, APTR, window, struct IntuiMessage *) @@ -473,7 +473,7 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *) GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin); if(AslRequestTags(filereq, - ASLFR_Window, gwin->win, + ASLFR_Window, ami_gui2_get_window(gwin), ASLFR_SleepWindow, TRUE, ASLFR_TitleText, messages_get("NetSurf"), ASLFR_Screen, scrn, @@ -706,7 +706,7 @@ void ami_gui_menu_update_checked(struct gui_window_2 *gwin) ItemAddress(menustrip, ami_gui_menu_number(M_IMGBACK))->Flags ^= CHECKED; } - ResetMenuStrip(gwin->win, menustrip); + ResetMenuStrip(ami_gui2_get_window(gwin), menustrip); } void ami_gui_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c) diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c index 8e2f47059..f41d04b99 100644 --- a/frontends/amiga/theme.c +++ b/frontends/amiga/theme.c @@ -221,14 +221,14 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) 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); + ami_update_pointer(ami_gui2_get_window(gwin), 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 gui_window_2 *gwin) { - ami_update_pointer(gwin->win, gwin->mouse_pointer); + ami_update_pointer(ami_gui2_get_window(gwin), gwin->mouse_pointer); } void ami_update_pointer(struct Window *win, gui_pointer_shape shape) -- cgit v1.2.3