mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-02 15:46:18 +03:00
Make the window list more private
TODO: fix arexx.c to not need it
This commit is contained in:
parent
a5051c7128
commit
24b910f4ff
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
@ -177,6 +176,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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user