accessor for window from gui_window_2

This commit is contained in:
Chris Young 2019-05-07 23:43:15 +01:00
parent 83c3831853
commit b9dd0a60c3
7 changed files with 32 additions and 22 deletions

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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)

View File

@ -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
*/

View File

@ -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)

View File

@ -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)