summaryrefslogtreecommitdiff
path: root/frontends/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/amiga')
-rw-r--r--frontends/amiga/arexx.c2
-rw-r--r--frontends/amiga/drag.c45
-rw-r--r--frontends/amiga/drag.h3
-rw-r--r--frontends/amiga/gui.c57
-rw-r--r--frontends/amiga/gui.h12
5 files changed, 68 insertions, 51 deletions
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 7497ff9ba..05e780243 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -235,6 +235,7 @@ static int ami_find_tab_bw(struct gui_window_2 *gwin, struct browser_window *bw)
static struct gui_window *ami_find_tab(int window, int tab)
{
struct nsObject *node, *nnode;
+ struct MinList *window_list = ami_gui_get_window_list();
if(!IsMinListEmpty(window_list))
{
@@ -607,6 +608,7 @@ RXHOOKF(rx_active)
struct gui_window *gw = ami_gui_get_active_gw();
struct nsObject *node, *nnode;
struct gui_window_2 *gwin = NULL;
+ struct MinList *window_list = ami_gui_get_window_list();
cmd->ac_RC = 0;
diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c
index 5ae3f25c6..907d8f865 100644
--- a/frontends/amiga/drag.c
+++ b/frontends/amiga/drag.c
@@ -24,7 +24,6 @@
#include <proto/intuition.h>
#include <proto/utility.h>
#include <proto/icon.h>
-#include <proto/layers.h>
#include <graphics/blitattr.h>
#include <workbench/icon.h>
@@ -109,6 +108,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 */
@@ -289,44 +289,6 @@ bool ami_drag_has_data(void)
else return false;
}
-static void *ami_find_gwin_by_id(struct Window *win, uint32 type)
-{
- struct nsObject *node, *nnode;
- struct gui_window_2 *gwin;
-
- if(!IsMinListEmpty(window_list))
- {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- if(node->Type == type)
- {
- gwin = node->objstruct;
- if(win == ami_gui2_get_window(gwin)) return gwin;
- }
- } while((node = nnode));
- }
- return NULL;
-}
-
-void *ami_window_at_pointer(int type)
-{
- struct Layer *layer;
- struct Screen *scrn = ami_gui_get_screen();
-
- LockLayerInfo(&scrn->LayerInfo);
-
- layer = WhichLayer(&scrn->LayerInfo, scrn->MouseX, scrn->MouseY);
-
- UnlockLayerInfo(&scrn->LayerInfo);
-
- if(layer) return ami_find_gwin_by_id(layer->Window, type);
- else return NULL;
-}
-
#else
#include <stddef.h>
@@ -368,10 +330,5 @@ bool ami_drag_has_data(void)
{
return false;
}
-
-void *ami_window_at_pointer(int type)
-{
- return NULL;
-}
#endif
diff --git a/frontends/amiga/drag.h b/frontends/amiga/drag.h
index c0b040f72..1a546682c 100644
--- a/frontends/amiga/drag.h
+++ b/frontends/amiga/drag.h
@@ -35,8 +35,5 @@ void ami_drag_icon_close(struct Window *win);
bool ami_drag_icon_move(void);
BOOL ami_drag_in_progress(void);
bool ami_drag_has_data(void);
-
-void *ami_window_at_pointer(int type);
-
#endif
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 6e60e6d9b..ba6244f66 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2016 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-2019 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -36,6 +36,7 @@
#include <proto/icon.h>
#include <proto/intuition.h>
#include <proto/keymap.h>
+#include <proto/layers.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <proto/wb.h>
@@ -310,7 +311,7 @@ struct ami_gui_tb_userdata {
int items;
};
-struct MinList *window_list = NULL;
+static struct MinList *window_list = NULL;
static struct Screen *scrn = NULL;
struct MsgPort *sport = NULL;
static struct gui_window *cur_gw = NULL;
@@ -387,6 +388,12 @@ struct Screen *ami_gui_get_screen(void)
return scrn;
}
+struct MinList *ami_gui_get_window_list(void)
+{
+ assert(window_list != NULL);
+ return window_list;
+}
+
void ami_gui_beep(void)
{
DisplayBeep(scrn);
@@ -615,6 +622,52 @@ void ami_gui2_set_new_content(struct gui_window_2 *gwin, bool new_content)
/** undocumented, or internal, or documented elsewhere **/
+#ifdef __amigaos4__
+static void *ami_find_gwin_by_id(struct Window *win, uint32 type)
+{
+ struct nsObject *node, *nnode;
+ struct gui_window_2 *gwin;
+
+ if(!IsMinListEmpty(window_list))
+ {
+ node = (struct nsObject *)GetHead((struct List *)window_list);
+
+ do
+ {
+ nnode=(struct nsObject *)GetSucc((struct Node *)node);
+
+ if(node->Type == type)
+ {
+ gwin = node->objstruct;
+ if(win == ami_gui2_get_window(gwin)) return gwin;
+ }
+ } while((node = nnode));
+ }
+ return NULL;
+}
+
+void *ami_window_at_pointer(int type)
+{
+ struct Layer *layer;
+ struct Screen *scrn = ami_gui_get_screen();
+
+ LockLayerInfo(&scrn->LayerInfo);
+
+ layer = WhichLayer(&scrn->LayerInfo, scrn->MouseX, scrn->MouseY);
+
+ UnlockLayerInfo(&scrn->LayerInfo);
+
+ if(layer) return ami_find_gwin_by_id(layer->Window, type);
+ else return NULL;
+}
+#else
+/**\todo check if OS4 version of this function will build on OS3, even if it isn't called */
+void *ami_window_at_pointer(int type)
+{
+ return NULL;
+}
+#endif
+
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
{
if(gwin->mouse_pointer == shape) return;
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index c4af98f93..1376495c7 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -75,8 +75,6 @@ struct ami_generic_window {
const struct ami_win_event_table *tbl;
};
-
-extern struct MinList *window_list; /**\todo stop arexx.c poking about in here */
extern struct MsgPort *sport;
#define IS_CURRENT_GW(GWIN,GW) (ami_gui2_get_gui_window(GWIN) == GW)
@@ -105,6 +103,7 @@ int ami_gui_count_windows(int window, int *tabs);
void ami_gui_set_scale(struct gui_window *gw, float scale);
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update);
void ami_reset_pointer(struct gui_window_2 *gwin);
+void *ami_window_at_pointer(int type);
/**
* Beep
@@ -178,6 +177,15 @@ nserror ami_gui_win_list_add(void *win, int type, const struct ami_win_event_tab
void ami_gui_win_list_remove(void *win);
/**
+ * Get the window list.
+ *
+ *\TODO: Nothing should be poking around in this list, but we aren't
+ * assigning unique IDs to windows (ARexx interface needs this)
+ * ami_find_gwin_by_id() is close but not ARexx-friendly
+ */
+struct MinList *ami_gui_get_window_list(void);
+
+/**
* Get which qualifier keys are being pressed
*/
int ami_gui_get_quals(Object *win_obj);