Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/97010ecef521de524846734e093db89a18f81f62
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/97010ecef521de524846734e093db89a18f81f62
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/97010ecef521de524846734e093db89a18f81f62

The branch, master has been updated
       via  97010ecef521de524846734e093db89a18f81f62 (commit)
       via  c5a07fac76313c2d2d6348dee20d881a639c40c8 (commit)
      from  8f9d434b1295215c377eab2ba7186ad8b2d92aa9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=97010ecef521de524846734e093db89a18f81f62
commit 97010ecef521de524846734e093db89a18f81f62
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Make screen pointer accesible through an accessor function only

diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 6798902..7497ff9 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -383,7 +383,7 @@ RXHOOKF(rx_quit)
 RXHOOKF(rx_tofront)
 {
        cmd->ac_RC = 0;
-       ScreenToFront(scrn);
+       ScreenToFront(ami_gui_get_screen());
 }
 
 RXHOOKF(rx_geturl)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 8341d41..6ad1610 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -490,6 +490,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct 
bitmap *bitmap,
                        int width, int height, struct BitMap *restrict 
friendbm, int type)
 {
        struct BitMap *restrict tbm = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        if(bitmap->nativebm)
        {
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 731492b..00dba2d 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -276,7 +276,7 @@ void ami_drag_selection(struct gui_window *g)
        
        if(!gwin)
        {
-               DisplayBeep(scrn);
+               ami_gui_beep();
                return;
        }
 
@@ -323,7 +323,7 @@ void ami_drag_selection(struct gui_window *g)
                }
                else
                {
-                       DisplayBeep(scrn);
+                       ami_gui_beep();
                }
        }
 }
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 45e883f..a0761e4 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -310,7 +310,7 @@ ami_cookies_create_window(struct ami_cookie_window 
*cookie_win)
                WA_Left, nsoption_int(cookies_window_xpos),
                WA_Width, nsoption_int(cookies_window_xsize),
                WA_Height, nsoption_int(cookies_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 627d328..7ab6e8e 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -587,6 +587,7 @@ static void
 ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
 {
        if(ami_cw->dragging == false) return;
+       struct Screen *scrn = ami_gui_get_screen();
 
        switch(ami_cw->drag_status) {
                case CORE_WINDOW_DRAG_SELECTION:
diff --git a/frontends/amiga/ctxmenu.c b/frontends/amiga/ctxmenu.c
index 92f399f..42826a3 100644
--- a/frontends/amiga/ctxmenu.c
+++ b/frontends/amiga/ctxmenu.c
@@ -402,7 +402,7 @@ static void ami_ctxmenu_alloc_item(int id, const char 
*label, const char *key, c
 
        if(image != NULL) {
                ctxmenu_item_image[id] = BitMapObj,
-                                                                       
BITMAP_Screen, scrn,
+                                                                       
BITMAP_Screen, ami_gui_get_screen(),
                                                                        
BITMAP_SourceFile, image,
                                                                        
BITMAP_Masking, TRUE,
                                                                        
BitMapEnd;
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index ed7a166..c5365db 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -144,7 +144,7 @@ static struct gui_download_window 
*gui_download_window_create(download_context *
                        ASLFR_Window, ami_gui_get_window(gui),
                        ASLFR_SleepWindow, TRUE,
                        ASLFR_TitleText, messages_get("NetSurf"),
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_InitialFile, dl_filename,
                        TAG_DONE))
                {
@@ -199,7 +199,7 @@ static struct gui_download_window 
*gui_download_window_create(download_context *
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,dw,
                        WINDOW_IconifyGadget, FALSE,
@@ -437,8 +437,8 @@ gui_window_save_link(struct gui_window *g, nsurl *url, 
const char *title)
                ASLFR_Window, ami_gui_get_window(g),
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText,messages_get("NetSurf"),
-               ASLFR_Screen,scrn,
-               ASLFR_InitialFile,linkname,
+               ASLFR_Screen, ami_gui_get_screen(),
+               ASLFR_InitialFile, linkname,
                TAG_DONE))
        {
                strlcpy(fname, savereq->fr_Drawer, 1024);
diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c
index 0495427..ee831f4 100644
--- a/frontends/amiga/drag.c
+++ b/frontends/amiga/drag.c
@@ -109,6 +109,7 @@ void ami_drag_save(struct Window *win)
 {
        ULONG which = WBO_NONE, type;
        char path[1025], dpath[1025];
+       struct Screen *scrn = ami_gui_get_screen();
 
        path[0] = 0; /* ensure path is terminated */
 
@@ -204,7 +205,7 @@ void ami_drag_icon_show(struct Window *win, const char 
*type)
        struct DiskObject *dobj = NULL;
        ULONG width, height;
        int deftype = WBPROJECT;
-
+       struct Screen *scrn = ami_gui_get_screen();
        drag_in_progress = TRUE;
 
        if(nsoption_bool(drag_save_icons) == false)
@@ -255,6 +256,7 @@ void ami_drag_icon_show(struct Window *win, const char 
*type)
 bool ami_drag_icon_move(void)
 {
        if(drag_icon == NULL) return FALSE;
+       struct Screen *scrn = ami_gui_get_screen();
 
        ChangeWindowBox(drag_icon, scrn->MouseX - (drag_icon_width / 2),
                scrn->MouseY - (drag_icon_height / 2),
@@ -314,6 +316,7 @@ static void *ami_find_gwin_by_id(struct Window *win, uint32 
type)
 void *ami_window_at_pointer(int type)
 {
        struct Layer *layer;
+       struct Screen *scrn = ami_gui_get_screen();
 
        LockLayerInfo(&scrn->LayerInfo);
 
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 1d74d6f..67866aa 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -86,7 +86,7 @@ void ami_file_open(struct gui_window_2 *gwin)
                        ASLFR_TitleText, messages_get("NetSurf"),
                        ASLFR_Window, ami_gui2_get_window(gwin),
                        ASLFR_SleepWindow, TRUE,
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_DoSaveMode, FALSE,
                        ASLFR_RejectIcons, TRUE,
                        ASLFR_FilterFunc, &aslhookfunc,
@@ -260,7 +260,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
                        ASLFR_Window, ami_gui2_get_window(gwin),
                        ASLFR_SleepWindow, TRUE,
                        ASLFR_TitleText, messages_get("NetSurf"),
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_InitialFile, fname_with_ext ? fname_with_ext : "",
                        TAG_DONE))
        {
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index cb37f97..3fa71f7 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -114,7 +114,7 @@ static struct ami_font_scan_window 
*ami_font_scan_gui_open(int32 fonts)
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen, scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WA_BusyPointer, TRUE,
                        WA_Width, 400,
                        WINDOW_UserData, fsw,
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 4374521..6e60e6d 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -311,7 +311,7 @@ struct ami_gui_tb_userdata {
 };
 
 struct MinList *window_list = NULL;
-struct Screen *scrn = NULL;
+static struct Screen *scrn = NULL;
 struct MsgPort *sport = NULL;
 static struct gui_window *cur_gw = NULL;
 
@@ -382,6 +382,16 @@ struct gui_window *ami_gui_get_active_gw(void)
        return cur_gw;
 }
 
+struct Screen *ami_gui_get_screen(void)
+{
+       return scrn;
+}
+
+void ami_gui_beep(void)
+{
+       DisplayBeep(scrn);
+}
+
 struct browser_window *ami_gui_get_browser_window(struct gui_window *gw)
 {
        assert(gw != NULL);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index caa21c3..c4af98f 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -77,7 +77,6 @@ struct ami_generic_window {
 
 
 extern struct MinList *window_list; /**\todo stop arexx.c poking about in here 
*/
-extern struct Screen *scrn;
 extern struct MsgPort *sport;
 
 #define IS_CURRENT_GW(GWIN,GW) (ami_gui2_get_gui_window(GWIN) == GW)
@@ -108,6 +107,11 @@ void ami_set_pointer(struct gui_window_2 *gwin, 
gui_pointer_shape shape, bool up
 void ami_reset_pointer(struct gui_window_2 *gwin);
 
 /**
+ * Beep
+ */
+void ami_gui_beep(void);
+
+/**
  * Close a window and all tabs attached to it.
  *
  * @param w gui_window_2 to act upon.
@@ -145,6 +149,13 @@ void ami_gui_free_space_box(struct IBox *bbox);
 uint32 ami_gui_get_app_id(void);
 
 /**
+ * Get a pointer to the screen NetSurf is running on.
+ *
+ * @return Pointer to struct Screen.
+ */
+struct Screen *ami_gui_get_screen(void);
+
+/**
  * Get the string for NetSurf's screen titlebar.
  *
  * @return String to use as the screen's titlebar text.
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 7eda6bc..64dd7fb 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -476,7 +476,7 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, 
struct IntuiMessage *)
                                                ASLFR_Window, 
ami_gui2_get_window(gwin),
                                                ASLFR_SleepWindow, TRUE,
                                                ASLFR_TitleText, 
messages_get("NetSurf"),
-                                               ASLFR_Screen, scrn,
+                                               ASLFR_Screen, 
ami_gui_get_screen(),
                                                ASLFR_DoSaveMode, FALSE,
                                                ASLFR_InitialDrawer, 
nsoption_charp(arexx_dir),
                                                ASLFR_InitialPattern, "#?.nsrx",
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index d35c42b..c731598 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -657,7 +657,7 @@ void ami_gui_opts_open(void)
                        WA_DragBar, TRUE,
                        WA_CloseGadget, TRUE,
                        WA_SizeGadget, FALSE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,gow,
                        WINDOW_IconifyGadget, FALSE,
@@ -2109,10 +2109,10 @@ static BOOL ami_gui_opts_event(void *w)
                        case WMHI_GADGETHELP:
                                if((result & WMHI_GADGETMASK) == 0) {
                                        /* Pointer not over our window */
-                                       ami_help_open(AMI_HELP_MAIN, scrn);
+                                       ami_help_open(AMI_HELP_MAIN, 
ami_gui_get_screen());
                                } else {
                                        /* TODO: Make this sensitive to the tab 
the user is currently on */
-                                       ami_help_open(AMI_HELP_PREFS, scrn);
+                                       ami_help_open(AMI_HELP_PREFS, 
ami_gui_get_screen());
                                }
                        break;
                        
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 2cd2f84..a505101 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -200,7 +200,7 @@ ami_history_global_drag_end(struct ami_corewindow *ami_cw, 
int x, int y)
        }
        
        if((ok == false) || (url == NULL)) {
-               DisplayBeep(scrn);
+               DisplayBeep(ami_gui_get_screen());
        } else if(url) {
                if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
                        
browser_window_navigate(ami_gui2_get_browser_window(gwin),
@@ -233,7 +233,7 @@ HOOKF(void, ami_history_global_menu_item_project_export, 
APTR, window, struct In
                ASLFR_Window, ami_cw->win,
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText, messages_get("NetSurf"),
-               ASLFR_Screen, scrn,
+               ASLFR_Screen, ami_gui_get_screen(),
                ASLFR_InitialFile, "history.html",
                TAG_DONE)) {
                        strlcpy(fname, savereq->fr_Drawer, 1024);
@@ -384,7 +384,7 @@ ami_history_global_create_window(struct 
ami_history_global_window *history_win)
                WA_Left, nsoption_int(history_window_xpos),
                WA_Width, nsoption_int(history_window_xsize),
                WA_Height, nsoption_int(history_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 95f422d..f8a8816 100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -209,7 +209,7 @@ ami_history_local_create_window(struct 
ami_history_local_window *history_local_w
                WA_SizeBRight, TRUE,
                WA_Width, 100,
                WA_Height, 100,
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index e8cf3a1..f8df8c8 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -251,7 +251,7 @@ ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, 
int y)
        }
        
        if((ok == false) || (url == NULL)) {
-               DisplayBeep(scrn);
+               ami_gui_beep();
        } else if(url) {
                if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
                        
browser_window_navigate(ami_gui2_get_browser_window(gwin),
@@ -313,7 +313,7 @@ HOOKF(void, ami_hotlist_menu_item_project_export, APTR, 
window, struct IntuiMess
                ASLFR_Window, ami_cw->win,
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText, messages_get("NetSurf"),
-               ASLFR_Screen, scrn,
+               ASLFR_Screen, ami_gui_get_screen(),
                ASLFR_InitialFile, "hotlist.html",
                TAG_DONE)) {
                        strlcpy(fname, savereq->fr_Drawer, 1024);
@@ -487,7 +487,7 @@ ami_hotlist_create_window(struct ami_hotlist_window 
*hotlist_win)
                WA_Left, nsoption_int(hotlist_window_xpos),
                WA_Width, nsoption_int(hotlist_window_xsize),
                WA_Height, nsoption_int(hotlist_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 0948caa..6c0c1cd 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -146,7 +146,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,lw,
                        WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 1f3f981..85b2ec4 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -251,7 +251,7 @@ static int ami_menu_layout_mc_recursive(Object 
*menu_parent, struct ami_menu_dat
                                        MA_Image,
                                                BitMapObj,
                                                        IA_Scalable, TRUE,
-                                                       BITMAP_Screen, scrn,
+                                                       BITMAP_Screen, 
ami_gui_get_screen(),
                                                        BITMAP_SourceFile, 
md[j]->menuicon,
                                                        BITMAP_Masking, TRUE,
                                                BitMapEnd,
@@ -298,6 +298,7 @@ static struct Menu *ami_menu_layout_gt(struct ami_menu_data 
**md, int max)
        struct NewMenu *nm;
        struct Menu *imenu = NULL;
        struct VisualInfo *vi;
+       struct Screen *scrn = ami_gui_get_screen();
        struct RastPort *rp = &scrn->RastPort;
        struct DrawInfo *dri = GetScreenDrawInfo(scrn);
        int space_width = TextLength(rp, " ", 1);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 2e9f5cb..b6add47 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -115,6 +115,7 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG 
height, bool force32bit
        /* init shared bitmaps */
        int depth = 32;
        struct BitMap *friend = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        struct gui_globals *gg = malloc(sizeof(struct gui_globals));
 
@@ -295,6 +296,7 @@ void ami_plot_ra_set_pen_list(struct gui_globals *gg, 
struct MinList *pen_list)
 void ami_clearclipreg(struct gui_globals *gg)
 {
        struct Region *reg = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        reg = InstallClipRegion(gg->rp->Layer,NULL);
        if(reg) DisposeRegion(reg);
@@ -313,6 +315,8 @@ void ami_clearclipreg(struct gui_globals *gg)
 static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
 {
        struct ami_plot_pen *node;
+       struct Screen *scrn = ami_gui_get_screen();
+
        LONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
                        (colr & 0x000000ff) << 24,
                        (colr & 0x0000ff00) << 16,
@@ -336,6 +340,7 @@ static ULONG ami_plot_obtain_pen(struct MinList 
*shared_pens, ULONG colr)
 
 void ami_plot_release_pens(struct MinList *shared_pens)
 {
+       struct Screen *scrn = ami_gui_get_screen();
        struct ami_plot_pen *node;
        struct ami_plot_pen *nnode;
 
@@ -429,7 +434,7 @@ static nserror
 ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, 
struct bitmap *bitmap)
 {
        NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()");
-
+       struct Screen *scrn = ami_gui_get_screen();
        struct BitMap *tbm;
 
        if (!width || !height) {
@@ -519,6 +524,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, 
struct BackFillMessage
 {
        int xf,yf;
        struct bfbitmap *bfbm = (struct bfbitmap *)hook->h_Data;
+       struct Screen *scrn = ami_gui_get_screen();
 
        /* tile down and across to extents  (msg->Bounds.MinX)*/
        for (xf = -bfbm->offsetx; xf < msg->Bounds.MaxX; xf += bfbm->width) {
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 05f068b..e0b5254 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -276,7 +276,7 @@ void ami_print_ui(struct hlcache_handle *c)
                WA_DragBar, TRUE,
                WA_CloseGadget, TRUE,
                WA_SizeGadget, FALSE,
-                       WA_PubScreen, scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort, sport,
                        WINDOW_UserData, pw,
                        WINDOW_IconifyGadget, FALSE,
@@ -565,7 +565,7 @@ void ami_print_progress(void)
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        //WINDOW_SharedPort,sport,
                        WINDOW_UserData, &ami_print_info,
                        WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index aad8e4c..e46c9df 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -169,7 +169,7 @@ void ami_search_open(struct gui_window *gwin)
                WA_DragBar, TRUE,
                WA_CloseGadget, TRUE,
                WA_SizeGadget, TRUE,
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WINDOW_SharedPort, sport,
                WINDOW_UserData, fwin,
                WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 136b918..92b06a1 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -218,6 +218,7 @@ ami_crtvrfy_create_window(struct ami_crtvrfy_window 
*crtvrfy_win)
 {
        struct ami_corewindow *ami_cw = (struct ami_corewindow 
*)&crtvrfy_win->core;
        ULONG refresh_mode = WA_SmartRefresh;
+       struct Screen *scrn = ami_gui_get_screen();
 
        if(nsoption_bool(window_simple_refresh) == true) {
                refresh_mode = WA_SimpleRefresh;


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=c5a07fac76313c2d2d6348dee20d881a639c40c8
commit c5a07fac76313c2d2d6348dee20d881a639c40c8
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Replace global current gui_window with an accessor function

diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 24da3e7..6798902 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -260,7 +260,7 @@ static struct gui_window *ami_find_tab(int window, int tab)
 RXHOOKF(rx_open)
 {
        struct dlnode *dln;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        nsurl *url;
 
        cmd->ac_RC = 0;
@@ -346,7 +346,7 @@ RXHOOKF(rx_open)
 RXHOOKF(rx_save)
 {
        BPTR fh = 0;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -388,7 +388,7 @@ RXHOOKF(rx_tofront)
 
 RXHOOKF(rx_geturl)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -409,7 +409,7 @@ RXHOOKF(rx_geturl)
 
 RXHOOKF(rx_gettitle)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -515,7 +515,7 @@ RXHOOKF(rx_pubscreen)
 
 RXHOOKF(rx_back)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -527,7 +527,7 @@ RXHOOKF(rx_back)
 
 RXHOOKF(rx_forward)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -540,7 +540,7 @@ RXHOOKF(rx_forward)
 
 RXHOOKF(rx_home)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        nsurl *url;
 
        cmd->ac_RC = 0;
@@ -566,7 +566,7 @@ RXHOOKF(rx_home)
 
 RXHOOKF(rx_reload)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -604,7 +604,7 @@ RXHOOKF(rx_windows)
 RXHOOKF(rx_active)
 {
        int window = 0, tab = 0;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        struct nsObject *node, *nnode;
        struct gui_window_2 *gwin = NULL;
 
@@ -646,7 +646,7 @@ RXHOOKF(rx_active)
 
 RXHOOKF(rx_close)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index fec9ed3..4374521 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -313,7 +313,7 @@ struct ami_gui_tb_userdata {
 struct MinList *window_list = NULL;
 struct Screen *scrn = NULL;
 struct MsgPort *sport = NULL;
-struct gui_window *cur_gw = NULL;
+static struct gui_window *cur_gw = NULL;
 
 static bool ami_quit = false;
 
@@ -377,6 +377,11 @@ static void gui_window_place_caret(struct gui_window *g, 
int x, int y, int heigh
        nsoptions_default[NSOPTION_##OPTION].value.i = VALUE
 
 /* Functions documented in gui.h */
+struct gui_window *ami_gui_get_active_gw(void)
+{
+       return cur_gw;
+}
+
 struct browser_window *ami_gui_get_browser_window(struct gui_window *gw)
 {
        assert(gw != NULL);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 0ce5011..caa21c3 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2017 Chris Young <[email protected]>
+ * Copyright 2008-2019 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -79,7 +79,6 @@ struct ami_generic_window {
 extern struct MinList *window_list; /**\todo stop arexx.c poking about in here 
*/
 extern struct Screen *scrn;
 extern struct MsgPort *sport;
-extern struct gui_window *cur_gw;
 
 #define IS_CURRENT_GW(GWIN,GW) (ami_gui2_get_gui_window(GWIN) == GW)
 
@@ -184,6 +183,12 @@ bool ami_gui_window_update_box_deferred_check(struct 
MinList *deferred_rects,
 void ami_gui_adjust_scale(struct gui_window *gw, float adjustment);
 
 /**
+ * Get a pointer to the gui_window which NetSurf considers
+ * to be the current/active one
+ */
+struct gui_window *ami_gui_get_active_gw(void);
+
+/**
  * Get browser window from gui_window
  */
 struct browser_window *ami_gui_get_browser_window(struct gui_window *gw);
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 9b6cc8d..d35c42b 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -2141,9 +2141,9 @@ static BOOL ami_gui_opts_event(void *w)
                                        break;
 
                                        case GID_OPTS_HOMEPAGE_CURRENT:
-                                               if(cur_gw) 
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
+                                               if(ami_gui_get_active_gw()) 
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
                                                        gow->win, NULL, 
STRINGA_TextVal,
-                                                       
nsurl_access(browser_window_access_url(ami_gui_get_browser_window(cur_gw))), 
TAG_DONE);
+                                                       
nsurl_access(browser_window_access_url(ami_gui_get_browser_window(ami_gui_get_active_gw()))),
 TAG_DONE);
                                        break;
 
                                        case GID_OPTS_HOMEPAGE_BLANK:
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 9bd8bfe..63add64 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -45,6 +45,7 @@
 static LONG ami_misc_req(const char *message, uint32 type)
 {
        LONG ret = 0;
+       struct gui_window *cur_gw = ami_gui_get_active_gw();
 
        NSLOG(netsurf, INFO, "%s", message);
 #ifdef __amigaos4__


-----------------------------------------------------------------------

Summary of changes:
 frontends/amiga/arexx.c         |   22 +++++++++++-----------
 frontends/amiga/bitmap.c        |    1 +
 frontends/amiga/clipboard.c     |    4 ++--
 frontends/amiga/cookies.c       |    2 +-
 frontends/amiga/corewindow.c    |    1 +
 frontends/amiga/ctxmenu.c       |    2 +-
 frontends/amiga/download.c      |    8 ++++----
 frontends/amiga/drag.c          |    5 ++++-
 frontends/amiga/file.c          |    4 ++--
 frontends/amiga/font_scan.c     |    2 +-
 frontends/amiga/gui.c           |   19 +++++++++++++++++--
 frontends/amiga/gui.h           |   22 +++++++++++++++++++---
 frontends/amiga/gui_menu.c      |    2 +-
 frontends/amiga/gui_options.c   |   10 +++++-----
 frontends/amiga/history.c       |    6 +++---
 frontends/amiga/history_local.c |    2 +-
 frontends/amiga/hotlist.c       |    6 +++---
 frontends/amiga/login.c         |    2 +-
 frontends/amiga/menu.c          |    3 ++-
 frontends/amiga/misc.c          |    1 +
 frontends/amiga/plotters.c      |    8 +++++++-
 frontends/amiga/print.c         |    4 ++--
 frontends/amiga/search.c        |    2 +-
 frontends/amiga/sslcert.c       |    1 +
 24 files changed, 92 insertions(+), 47 deletions(-)

diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 24da3e7..7497ff9 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -260,7 +260,7 @@ static struct gui_window *ami_find_tab(int window, int tab)
 RXHOOKF(rx_open)
 {
        struct dlnode *dln;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        nsurl *url;
 
        cmd->ac_RC = 0;
@@ -346,7 +346,7 @@ RXHOOKF(rx_open)
 RXHOOKF(rx_save)
 {
        BPTR fh = 0;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -383,12 +383,12 @@ RXHOOKF(rx_quit)
 RXHOOKF(rx_tofront)
 {
        cmd->ac_RC = 0;
-       ScreenToFront(scrn);
+       ScreenToFront(ami_gui_get_screen());
 }
 
 RXHOOKF(rx_geturl)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -409,7 +409,7 @@ RXHOOKF(rx_geturl)
 
 RXHOOKF(rx_gettitle)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -515,7 +515,7 @@ RXHOOKF(rx_pubscreen)
 
 RXHOOKF(rx_back)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -527,7 +527,7 @@ RXHOOKF(rx_back)
 
 RXHOOKF(rx_forward)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -540,7 +540,7 @@ RXHOOKF(rx_forward)
 
 RXHOOKF(rx_home)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        nsurl *url;
 
        cmd->ac_RC = 0;
@@ -566,7 +566,7 @@ RXHOOKF(rx_home)
 
 RXHOOKF(rx_reload)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
@@ -604,7 +604,7 @@ RXHOOKF(rx_windows)
 RXHOOKF(rx_active)
 {
        int window = 0, tab = 0;
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
        struct nsObject *node, *nnode;
        struct gui_window_2 *gwin = NULL;
 
@@ -646,7 +646,7 @@ RXHOOKF(rx_active)
 
 RXHOOKF(rx_close)
 {
-       struct gui_window *gw = cur_gw;
+       struct gui_window *gw = ami_gui_get_active_gw();
 
        cmd->ac_RC = 0;
 
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 8341d41..6ad1610 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -490,6 +490,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct 
bitmap *bitmap,
                        int width, int height, struct BitMap *restrict 
friendbm, int type)
 {
        struct BitMap *restrict tbm = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        if(bitmap->nativebm)
        {
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 731492b..00dba2d 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -276,7 +276,7 @@ void ami_drag_selection(struct gui_window *g)
        
        if(!gwin)
        {
-               DisplayBeep(scrn);
+               ami_gui_beep();
                return;
        }
 
@@ -323,7 +323,7 @@ void ami_drag_selection(struct gui_window *g)
                }
                else
                {
-                       DisplayBeep(scrn);
+                       ami_gui_beep();
                }
        }
 }
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 45e883f..a0761e4 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -310,7 +310,7 @@ ami_cookies_create_window(struct ami_cookie_window 
*cookie_win)
                WA_Left, nsoption_int(cookies_window_xpos),
                WA_Width, nsoption_int(cookies_window_xsize),
                WA_Height, nsoption_int(cookies_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 627d328..7ab6e8e 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -587,6 +587,7 @@ static void
 ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y)
 {
        if(ami_cw->dragging == false) return;
+       struct Screen *scrn = ami_gui_get_screen();
 
        switch(ami_cw->drag_status) {
                case CORE_WINDOW_DRAG_SELECTION:
diff --git a/frontends/amiga/ctxmenu.c b/frontends/amiga/ctxmenu.c
index 92f399f..42826a3 100644
--- a/frontends/amiga/ctxmenu.c
+++ b/frontends/amiga/ctxmenu.c
@@ -402,7 +402,7 @@ static void ami_ctxmenu_alloc_item(int id, const char 
*label, const char *key, c
 
        if(image != NULL) {
                ctxmenu_item_image[id] = BitMapObj,
-                                                                       
BITMAP_Screen, scrn,
+                                                                       
BITMAP_Screen, ami_gui_get_screen(),
                                                                        
BITMAP_SourceFile, image,
                                                                        
BITMAP_Masking, TRUE,
                                                                        
BitMapEnd;
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index ed7a166..c5365db 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -144,7 +144,7 @@ static struct gui_download_window 
*gui_download_window_create(download_context *
                        ASLFR_Window, ami_gui_get_window(gui),
                        ASLFR_SleepWindow, TRUE,
                        ASLFR_TitleText, messages_get("NetSurf"),
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_InitialFile, dl_filename,
                        TAG_DONE))
                {
@@ -199,7 +199,7 @@ static struct gui_download_window 
*gui_download_window_create(download_context *
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,dw,
                        WINDOW_IconifyGadget, FALSE,
@@ -437,8 +437,8 @@ gui_window_save_link(struct gui_window *g, nsurl *url, 
const char *title)
                ASLFR_Window, ami_gui_get_window(g),
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText,messages_get("NetSurf"),
-               ASLFR_Screen,scrn,
-               ASLFR_InitialFile,linkname,
+               ASLFR_Screen, ami_gui_get_screen(),
+               ASLFR_InitialFile, linkname,
                TAG_DONE))
        {
                strlcpy(fname, savereq->fr_Drawer, 1024);
diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c
index 0495427..ee831f4 100644
--- a/frontends/amiga/drag.c
+++ b/frontends/amiga/drag.c
@@ -109,6 +109,7 @@ void ami_drag_save(struct Window *win)
 {
        ULONG which = WBO_NONE, type;
        char path[1025], dpath[1025];
+       struct Screen *scrn = ami_gui_get_screen();
 
        path[0] = 0; /* ensure path is terminated */
 
@@ -204,7 +205,7 @@ void ami_drag_icon_show(struct Window *win, const char 
*type)
        struct DiskObject *dobj = NULL;
        ULONG width, height;
        int deftype = WBPROJECT;
-
+       struct Screen *scrn = ami_gui_get_screen();
        drag_in_progress = TRUE;
 
        if(nsoption_bool(drag_save_icons) == false)
@@ -255,6 +256,7 @@ void ami_drag_icon_show(struct Window *win, const char 
*type)
 bool ami_drag_icon_move(void)
 {
        if(drag_icon == NULL) return FALSE;
+       struct Screen *scrn = ami_gui_get_screen();
 
        ChangeWindowBox(drag_icon, scrn->MouseX - (drag_icon_width / 2),
                scrn->MouseY - (drag_icon_height / 2),
@@ -314,6 +316,7 @@ static void *ami_find_gwin_by_id(struct Window *win, uint32 
type)
 void *ami_window_at_pointer(int type)
 {
        struct Layer *layer;
+       struct Screen *scrn = ami_gui_get_screen();
 
        LockLayerInfo(&scrn->LayerInfo);
 
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 1d74d6f..67866aa 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -86,7 +86,7 @@ void ami_file_open(struct gui_window_2 *gwin)
                        ASLFR_TitleText, messages_get("NetSurf"),
                        ASLFR_Window, ami_gui2_get_window(gwin),
                        ASLFR_SleepWindow, TRUE,
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_DoSaveMode, FALSE,
                        ASLFR_RejectIcons, TRUE,
                        ASLFR_FilterFunc, &aslhookfunc,
@@ -260,7 +260,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
                        ASLFR_Window, ami_gui2_get_window(gwin),
                        ASLFR_SleepWindow, TRUE,
                        ASLFR_TitleText, messages_get("NetSurf"),
-                       ASLFR_Screen, scrn,
+                       ASLFR_Screen, ami_gui_get_screen(),
                        ASLFR_InitialFile, fname_with_ext ? fname_with_ext : "",
                        TAG_DONE))
        {
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index cb37f97..3fa71f7 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -114,7 +114,7 @@ static struct ami_font_scan_window 
*ami_font_scan_gui_open(int32 fonts)
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen, scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WA_BusyPointer, TRUE,
                        WA_Width, 400,
                        WINDOW_UserData, fsw,
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index fec9ed3..6e60e6d 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -311,9 +311,9 @@ struct ami_gui_tb_userdata {
 };
 
 struct MinList *window_list = NULL;
-struct Screen *scrn = NULL;
+static struct Screen *scrn = NULL;
 struct MsgPort *sport = NULL;
-struct gui_window *cur_gw = NULL;
+static struct gui_window *cur_gw = NULL;
 
 static bool ami_quit = false;
 
@@ -377,6 +377,21 @@ static void gui_window_place_caret(struct gui_window *g, 
int x, int y, int heigh
        nsoptions_default[NSOPTION_##OPTION].value.i = VALUE
 
 /* Functions documented in gui.h */
+struct gui_window *ami_gui_get_active_gw(void)
+{
+       return cur_gw;
+}
+
+struct Screen *ami_gui_get_screen(void)
+{
+       return scrn;
+}
+
+void ami_gui_beep(void)
+{
+       DisplayBeep(scrn);
+}
+
 struct browser_window *ami_gui_get_browser_window(struct gui_window *gw)
 {
        assert(gw != NULL);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 0ce5011..c4af98f 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2017 Chris Young <[email protected]>
+ * Copyright 2008-2019 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -77,9 +77,7 @@ struct ami_generic_window {
 
 
 extern struct MinList *window_list; /**\todo stop arexx.c poking about in here 
*/
-extern struct Screen *scrn;
 extern struct MsgPort *sport;
-extern struct gui_window *cur_gw;
 
 #define IS_CURRENT_GW(GWIN,GW) (ami_gui2_get_gui_window(GWIN) == GW)
 
@@ -109,6 +107,11 @@ void ami_set_pointer(struct gui_window_2 *gwin, 
gui_pointer_shape shape, bool up
 void ami_reset_pointer(struct gui_window_2 *gwin);
 
 /**
+ * Beep
+ */
+void ami_gui_beep(void);
+
+/**
  * Close a window and all tabs attached to it.
  *
  * @param w gui_window_2 to act upon.
@@ -146,6 +149,13 @@ void ami_gui_free_space_box(struct IBox *bbox);
 uint32 ami_gui_get_app_id(void);
 
 /**
+ * Get a pointer to the screen NetSurf is running on.
+ *
+ * @return Pointer to struct Screen.
+ */
+struct Screen *ami_gui_get_screen(void);
+
+/**
  * Get the string for NetSurf's screen titlebar.
  *
  * @return String to use as the screen's titlebar text.
@@ -184,6 +194,12 @@ bool ami_gui_window_update_box_deferred_check(struct 
MinList *deferred_rects,
 void ami_gui_adjust_scale(struct gui_window *gw, float adjustment);
 
 /**
+ * Get a pointer to the gui_window which NetSurf considers
+ * to be the current/active one
+ */
+struct gui_window *ami_gui_get_active_gw(void);
+
+/**
  * Get browser window from gui_window
  */
 struct browser_window *ami_gui_get_browser_window(struct gui_window *gw);
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 7eda6bc..64dd7fb 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -476,7 +476,7 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, 
struct IntuiMessage *)
                                                ASLFR_Window, 
ami_gui2_get_window(gwin),
                                                ASLFR_SleepWindow, TRUE,
                                                ASLFR_TitleText, 
messages_get("NetSurf"),
-                                               ASLFR_Screen, scrn,
+                                               ASLFR_Screen, 
ami_gui_get_screen(),
                                                ASLFR_DoSaveMode, FALSE,
                                                ASLFR_InitialDrawer, 
nsoption_charp(arexx_dir),
                                                ASLFR_InitialPattern, "#?.nsrx",
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 9b6cc8d..c731598 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -657,7 +657,7 @@ void ami_gui_opts_open(void)
                        WA_DragBar, TRUE,
                        WA_CloseGadget, TRUE,
                        WA_SizeGadget, FALSE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,gow,
                        WINDOW_IconifyGadget, FALSE,
@@ -2109,10 +2109,10 @@ static BOOL ami_gui_opts_event(void *w)
                        case WMHI_GADGETHELP:
                                if((result & WMHI_GADGETMASK) == 0) {
                                        /* Pointer not over our window */
-                                       ami_help_open(AMI_HELP_MAIN, scrn);
+                                       ami_help_open(AMI_HELP_MAIN, 
ami_gui_get_screen());
                                } else {
                                        /* TODO: Make this sensitive to the tab 
the user is currently on */
-                                       ami_help_open(AMI_HELP_PREFS, scrn);
+                                       ami_help_open(AMI_HELP_PREFS, 
ami_gui_get_screen());
                                }
                        break;
                        
@@ -2141,9 +2141,9 @@ static BOOL ami_gui_opts_event(void *w)
                                        break;
 
                                        case GID_OPTS_HOMEPAGE_CURRENT:
-                                               if(cur_gw) 
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
+                                               if(ami_gui_get_active_gw()) 
RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
                                                        gow->win, NULL, 
STRINGA_TextVal,
-                                                       
nsurl_access(browser_window_access_url(ami_gui_get_browser_window(cur_gw))), 
TAG_DONE);
+                                                       
nsurl_access(browser_window_access_url(ami_gui_get_browser_window(ami_gui_get_active_gw()))),
 TAG_DONE);
                                        break;
 
                                        case GID_OPTS_HOMEPAGE_BLANK:
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 2cd2f84..a505101 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -200,7 +200,7 @@ ami_history_global_drag_end(struct ami_corewindow *ami_cw, 
int x, int y)
        }
        
        if((ok == false) || (url == NULL)) {
-               DisplayBeep(scrn);
+               DisplayBeep(ami_gui_get_screen());
        } else if(url) {
                if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
                        
browser_window_navigate(ami_gui2_get_browser_window(gwin),
@@ -233,7 +233,7 @@ HOOKF(void, ami_history_global_menu_item_project_export, 
APTR, window, struct In
                ASLFR_Window, ami_cw->win,
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText, messages_get("NetSurf"),
-               ASLFR_Screen, scrn,
+               ASLFR_Screen, ami_gui_get_screen(),
                ASLFR_InitialFile, "history.html",
                TAG_DONE)) {
                        strlcpy(fname, savereq->fr_Drawer, 1024);
@@ -384,7 +384,7 @@ ami_history_global_create_window(struct 
ami_history_global_window *history_win)
                WA_Left, nsoption_int(history_window_xpos),
                WA_Width, nsoption_int(history_window_xsize),
                WA_Height, nsoption_int(history_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 95f422d..f8a8816 100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -209,7 +209,7 @@ ami_history_local_create_window(struct 
ami_history_local_window *history_local_w
                WA_SizeBRight, TRUE,
                WA_Width, 100,
                WA_Height, 100,
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index e8cf3a1..f8df8c8 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -251,7 +251,7 @@ ami_hotlist_drag_end(struct ami_corewindow *ami_cw, int x, 
int y)
        }
        
        if((ok == false) || (url == NULL)) {
-               DisplayBeep(scrn);
+               ami_gui_beep();
        } else if(url) {
                if((gwin = ami_window_at_pointer(AMINS_WINDOW))) {
                        
browser_window_navigate(ami_gui2_get_browser_window(gwin),
@@ -313,7 +313,7 @@ HOOKF(void, ami_hotlist_menu_item_project_export, APTR, 
window, struct IntuiMess
                ASLFR_Window, ami_cw->win,
                ASLFR_SleepWindow, TRUE,
                ASLFR_TitleText, messages_get("NetSurf"),
-               ASLFR_Screen, scrn,
+               ASLFR_Screen, ami_gui_get_screen(),
                ASLFR_InitialFile, "hotlist.html",
                TAG_DONE)) {
                        strlcpy(fname, savereq->fr_Drawer, 1024);
@@ -487,7 +487,7 @@ ami_hotlist_create_window(struct ami_hotlist_window 
*hotlist_win)
                WA_Left, nsoption_int(hotlist_window_xpos),
                WA_Width, nsoption_int(hotlist_window_xsize),
                WA_Height, nsoption_int(hotlist_window_ysize),
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WA_ReportMouse, TRUE,
                refresh_mode, TRUE,
                WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 0948caa..6c0c1cd 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -146,7 +146,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort,sport,
                        WINDOW_UserData,lw,
                        WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 1f3f981..85b2ec4 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -251,7 +251,7 @@ static int ami_menu_layout_mc_recursive(Object 
*menu_parent, struct ami_menu_dat
                                        MA_Image,
                                                BitMapObj,
                                                        IA_Scalable, TRUE,
-                                                       BITMAP_Screen, scrn,
+                                                       BITMAP_Screen, 
ami_gui_get_screen(),
                                                        BITMAP_SourceFile, 
md[j]->menuicon,
                                                        BITMAP_Masking, TRUE,
                                                BitMapEnd,
@@ -298,6 +298,7 @@ static struct Menu *ami_menu_layout_gt(struct ami_menu_data 
**md, int max)
        struct NewMenu *nm;
        struct Menu *imenu = NULL;
        struct VisualInfo *vi;
+       struct Screen *scrn = ami_gui_get_screen();
        struct RastPort *rp = &scrn->RastPort;
        struct DrawInfo *dri = GetScreenDrawInfo(scrn);
        int space_width = TextLength(rp, " ", 1);
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 9bd8bfe..63add64 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -45,6 +45,7 @@
 static LONG ami_misc_req(const char *message, uint32 type)
 {
        LONG ret = 0;
+       struct gui_window *cur_gw = ami_gui_get_active_gw();
 
        NSLOG(netsurf, INFO, "%s", message);
 #ifdef __amigaos4__
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 2e9f5cb..b6add47 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -115,6 +115,7 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG 
height, bool force32bit
        /* init shared bitmaps */
        int depth = 32;
        struct BitMap *friend = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        struct gui_globals *gg = malloc(sizeof(struct gui_globals));
 
@@ -295,6 +296,7 @@ void ami_plot_ra_set_pen_list(struct gui_globals *gg, 
struct MinList *pen_list)
 void ami_clearclipreg(struct gui_globals *gg)
 {
        struct Region *reg = NULL;
+       struct Screen *scrn = ami_gui_get_screen();
 
        reg = InstallClipRegion(gg->rp->Layer,NULL);
        if(reg) DisposeRegion(reg);
@@ -313,6 +315,8 @@ void ami_clearclipreg(struct gui_globals *gg)
 static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
 {
        struct ami_plot_pen *node;
+       struct Screen *scrn = ami_gui_get_screen();
+
        LONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
                        (colr & 0x000000ff) << 24,
                        (colr & 0x0000ff00) << 16,
@@ -336,6 +340,7 @@ static ULONG ami_plot_obtain_pen(struct MinList 
*shared_pens, ULONG colr)
 
 void ami_plot_release_pens(struct MinList *shared_pens)
 {
+       struct Screen *scrn = ami_gui_get_screen();
        struct ami_plot_pen *node;
        struct ami_plot_pen *nnode;
 
@@ -429,7 +434,7 @@ static nserror
 ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, 
struct bitmap *bitmap)
 {
        NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()");
-
+       struct Screen *scrn = ami_gui_get_screen();
        struct BitMap *tbm;
 
        if (!width || !height) {
@@ -519,6 +524,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, 
struct BackFillMessage
 {
        int xf,yf;
        struct bfbitmap *bfbm = (struct bfbitmap *)hook->h_Data;
+       struct Screen *scrn = ami_gui_get_screen();
 
        /* tile down and across to extents  (msg->Bounds.MinX)*/
        for (xf = -bfbm->offsetx; xf < msg->Bounds.MaxX; xf += bfbm->width) {
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 05f068b..e0b5254 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -276,7 +276,7 @@ void ami_print_ui(struct hlcache_handle *c)
                WA_DragBar, TRUE,
                WA_CloseGadget, TRUE,
                WA_SizeGadget, FALSE,
-                       WA_PubScreen, scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        WINDOW_SharedPort, sport,
                        WINDOW_UserData, pw,
                        WINDOW_IconifyGadget, FALSE,
@@ -565,7 +565,7 @@ void ami_print_progress(void)
                WA_DragBar, TRUE,
                WA_CloseGadget, FALSE,
                WA_SizeGadget, TRUE,
-                       WA_PubScreen,scrn,
+                       WA_PubScreen, ami_gui_get_screen(),
                        //WINDOW_SharedPort,sport,
                        WINDOW_UserData, &ami_print_info,
                        WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index aad8e4c..e46c9df 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -169,7 +169,7 @@ void ami_search_open(struct gui_window *gwin)
                WA_DragBar, TRUE,
                WA_CloseGadget, TRUE,
                WA_SizeGadget, TRUE,
-               WA_PubScreen, scrn,
+               WA_PubScreen, ami_gui_get_screen(),
                WINDOW_SharedPort, sport,
                WINDOW_UserData, fwin,
                WINDOW_IconifyGadget, FALSE,
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 136b918..92b06a1 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -218,6 +218,7 @@ ami_crtvrfy_create_window(struct ami_crtvrfy_window 
*crtvrfy_win)
 {
        struct ami_corewindow *ami_cw = (struct ami_corewindow 
*)&crtvrfy_win->core;
        ULONG refresh_mode = WA_SmartRefresh;
+       struct Screen *scrn = ami_gui_get_screen();
 
        if(nsoption_bool(window_simple_refresh) == true) {
                refresh_mode = WA_SimpleRefresh;


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to