mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Fix broken event handling.
Any structures attached to the window_list *must* have a struct nsObject * as their first entry, and handle events outside of gui.c. svn path=/trunk/netsurf/; revision=10332
This commit is contained in:
parent
4a4cc0d1bc
commit
b6937419e1
@ -214,7 +214,7 @@ void gui_download_window_done(struct gui_download_window *dw)
|
||||
TAG_DONE);
|
||||
}
|
||||
|
||||
if(bw) bw->download = false;
|
||||
download_context_destroy(dw->ctx);
|
||||
|
||||
if(dln = dw->dln)
|
||||
{
|
||||
@ -235,6 +235,30 @@ void gui_download_window_done(struct gui_download_window *dw)
|
||||
if(queuedl) browser_window_download(bw,dln2->node.ln_Name,NULL);
|
||||
}
|
||||
|
||||
BOOL ami_download_window_event(struct gui_download_window *dw)
|
||||
{
|
||||
/* return TRUE if window destroyed */
|
||||
ULONG class,result,relevent = 0;
|
||||
uint16 code;
|
||||
|
||||
while((result = RA_HandleInput(dw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_GADGETUP:
|
||||
switch(result & WMHI_GADGETMASK)
|
||||
{
|
||||
case GID_CANCEL:
|
||||
ami_download_window_abort(dw);
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ami_free_download_list(struct List *dllist)
|
||||
{
|
||||
struct dlnode *node;
|
||||
|
@ -29,10 +29,9 @@ struct dlnode
|
||||
};
|
||||
|
||||
struct gui_download_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
struct nsObject *node;
|
||||
ULONG pad[5];
|
||||
BPTR fh;
|
||||
uint32 size;
|
||||
uint32 downloaded;
|
||||
@ -48,6 +47,7 @@ void *drag_save_data;
|
||||
struct gui_window *drag_save_gui;
|
||||
|
||||
void ami_download_window_abort(struct gui_download_window *dw);
|
||||
BOOL ami_download_window_event(struct gui_download_window *dw);
|
||||
void ami_drag_save(struct Window *win);
|
||||
void ami_free_download_list(struct List *dllist);
|
||||
void ami_superimpose_favicon(STRPTR path, struct hlcache_handle *icon, STRPTR type);
|
||||
|
56
amiga/gui.c
56
amiga/gui.c
@ -939,6 +939,40 @@ void ami_handle_msg(void)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if(node->Type == AMINS_DLWINDOW)
|
||||
{
|
||||
if(ami_download_window_event((struct gui_download_window *)gwin))
|
||||
{
|
||||
if(IsMinListEmpty(window_list))
|
||||
{
|
||||
/* last window closed, so exit */
|
||||
ami_try_quit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
node = nnode;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if(node->Type == AMINS_LOGINWINDOW)
|
||||
{
|
||||
if(ami_401login_event((struct gui_login_window *)gwin))
|
||||
{
|
||||
if(IsMinListEmpty(window_list))
|
||||
{
|
||||
/* last window closed, so exit */
|
||||
ami_try_quit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
node = nnode;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
while((result = RA_HandleInput(gwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
|
||||
{
|
||||
@ -1173,24 +1207,6 @@ void ami_handle_msg(void)
|
||||
ami_update_buttons(gwin);
|
||||
break;
|
||||
|
||||
case GID_LOGIN:
|
||||
ami_401login_login((struct gui_login_window *)gwin);
|
||||
win_destroyed = true;
|
||||
break;
|
||||
|
||||
case GID_CANCEL:
|
||||
if(gwin->node->Type == AMINS_LOGINWINDOW)
|
||||
{
|
||||
ami_401login_close((struct gui_login_window *)gwin);
|
||||
win_destroyed = true;
|
||||
}
|
||||
else if(gwin->node->Type == AMINS_DLWINDOW)
|
||||
{
|
||||
ami_download_window_abort((struct gui_download_window *)gwin);
|
||||
win_destroyed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// printf("GADGET: %ld\n",(result & WMHI_GADGETMASK));
|
||||
break;
|
||||
@ -2975,7 +2991,7 @@ void ami_do_redraw_limits(struct gui_window *g, hlcache_handle *c,int x0, int y0
|
||||
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
|
||||
|
||||
if(!c) return;
|
||||
// if (c->locked) return;
|
||||
if(content_is_locked(c)) return;
|
||||
|
||||
current_redraw_browser = g->shared->bw;
|
||||
|
||||
@ -3091,7 +3107,7 @@ void ami_do_redraw(struct gui_window_2 *g)
|
||||
c = g->bw->current_content;
|
||||
|
||||
if(!c) return;
|
||||
// if (c->locked) return;
|
||||
if(content_is_locked(c)) return;
|
||||
|
||||
current_redraw_browser = g->bw;
|
||||
// currp = &browserglob.rp;
|
||||
|
@ -78,9 +78,9 @@ struct find_window;
|
||||
struct history_window;
|
||||
|
||||
struct gui_window_2 {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
struct nsObject *node;
|
||||
struct browser_window *bw;
|
||||
bool redraw_required;
|
||||
int throbber_frame;
|
||||
|
@ -181,10 +181,9 @@ enum
|
||||
#define OPTS_MAX_NATIVEBM 3
|
||||
|
||||
struct ami_gui_opts_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[GID_OPTS_LAST];
|
||||
struct nsObject *node;
|
||||
ULONG pad[6];
|
||||
};
|
||||
|
||||
static struct ami_gui_opts_window *gow = NULL;
|
||||
|
@ -112,8 +112,8 @@ void ami_history_open(struct browser_window *bw, struct history *history)
|
||||
WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
|
||||
// WA_ReportMouse,TRUE,
|
||||
WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
|
||||
WINDOW_ParentGroup, hwindow->gadgets[GID_MAIN] = VGroupObject,
|
||||
LAYOUT_AddChild, hwindow->gadgets[GID_BROWSER] = SpaceObject,
|
||||
WINDOW_ParentGroup, hwindow->objects[GID_MAIN] = VGroupObject,
|
||||
LAYOUT_AddChild, hwindow->objects[GID_BROWSER] = SpaceObject,
|
||||
GA_ID,GID_BROWSER,
|
||||
// SPACE_MinWidth,width,
|
||||
// SPACE_MinHeight,height,
|
||||
@ -157,7 +157,7 @@ void ami_history_redraw(struct history_window *hw)
|
||||
struct IBox *bbox;
|
||||
ULONG xs,ys;
|
||||
|
||||
GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
||||
GetAttr(SPACE_AreaBox,hw->objects[GID_BROWSER],(ULONG *)&bbox);
|
||||
GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
|
||||
GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
|
||||
|
||||
@ -188,7 +188,7 @@ bool ami_history_click(struct history_window *hw,uint16 code)
|
||||
struct IBox *bbox;
|
||||
ULONG width,height,xs,ys;
|
||||
|
||||
GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
||||
GetAttr(SPACE_AreaBox,hw->objects[GID_BROWSER],(ULONG *)&bbox);
|
||||
|
||||
GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
|
||||
x = hw->win->MouseX - bbox->Left +xs;
|
||||
@ -252,7 +252,7 @@ BOOL ami_history_event(struct history_window *hw)
|
||||
*/
|
||||
|
||||
case WMHI_MOUSEMOVE:
|
||||
GetAttr(SPACE_AreaBox, hw->gadgets[GID_BROWSER], (ULONG *)&bbox);
|
||||
GetAttr(SPACE_AreaBox, hw->objects[GID_BROWSER], (ULONG *)&bbox);
|
||||
GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs);
|
||||
GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys);
|
||||
|
||||
@ -260,7 +260,7 @@ BOOL ami_history_event(struct history_window *hw)
|
||||
hw->win->MouseX - bbox->Left + xs,
|
||||
hw->win->MouseY - bbox->Top + ys);
|
||||
|
||||
RefreshSetGadgetAttrs((APTR)hw->gadgets[GID_BROWSER],
|
||||
RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER],
|
||||
hw->win, NULL,
|
||||
GA_HintInfo, url,
|
||||
TAG_DONE);
|
||||
@ -289,7 +289,7 @@ void ami_history_update_extent(struct history_window *hw)
|
||||
int width, height;
|
||||
|
||||
history_size(hw->bw->history, &width, &height);
|
||||
GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox);
|
||||
GetAttr(SPACE_AreaBox,hw->objects[GID_BROWSER],(ULONG *)&bbox);
|
||||
|
||||
RefreshSetGadgetAttrs((APTR)hw->objects[OID_VSCROLL],hw->win,NULL,
|
||||
GA_ID,OID_VSCROLL,
|
||||
|
@ -24,12 +24,10 @@
|
||||
#include "amiga/gui.h"
|
||||
|
||||
struct history_window {
|
||||
struct Window *win;
|
||||
Object *objects[OID_LAST];
|
||||
struct Gadget *gadgets[GID_LAST]; // not used
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
struct browser_window *bw;
|
||||
ULONG pad[4];
|
||||
struct Hook scrollerhook;
|
||||
struct gui_globals gg;
|
||||
};
|
||||
|
@ -147,3 +147,32 @@ void ami_401login_login(struct gui_login_window *lw)
|
||||
|
||||
ami_401login_close(lw);
|
||||
}
|
||||
|
||||
BOOL ami_401login_event(struct gui_login_window *lw)
|
||||
{
|
||||
/* return TRUE if window destroyed */
|
||||
ULONG class,result,relevent = 0;
|
||||
uint16 code;
|
||||
|
||||
while((result = RA_HandleInput(lw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
|
||||
{
|
||||
switch(result & WMHI_CLASSMASK) // class
|
||||
{
|
||||
case WMHI_GADGETUP:
|
||||
switch(result & WMHI_GADGETMASK)
|
||||
{
|
||||
case GID_LOGIN:
|
||||
ami_401login_login(lw);
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case GID_CANCEL:
|
||||
ami_401login_close(lw);
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -19,11 +19,10 @@
|
||||
#ifndef AMIGA_LOGIN_H
|
||||
#define AMIGA_LOGIN_H
|
||||
struct gui_login_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[GID_LAST];
|
||||
struct nsObject *node;
|
||||
struct browser_window *bw;
|
||||
ULONG pad[3];
|
||||
char *url;
|
||||
char *realm;
|
||||
char *host;
|
||||
@ -31,4 +30,5 @@ struct gui_login_window {
|
||||
|
||||
void ami_401login_close(struct gui_login_window *lw);
|
||||
void ami_401login_login(struct gui_login_window *lw);
|
||||
BOOL ami_401login_event(struct gui_login_window *lw);
|
||||
#endif
|
||||
|
@ -23,10 +23,10 @@
|
||||
struct content;
|
||||
|
||||
struct ami_print_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[OID_LAST];
|
||||
struct Gadget *gadgets[GID_LAST];
|
||||
struct nsObject *node;
|
||||
struct hlcache_handle *c;
|
||||
};
|
||||
|
||||
|
@ -22,12 +22,11 @@
|
||||
#include "amiga/gui.h"
|
||||
|
||||
struct find_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[OID_LAST];
|
||||
struct Gadget *gadgets[GID_LAST];
|
||||
struct nsObject *node;
|
||||
struct gui_window *gwin;
|
||||
ULONG pad[3];
|
||||
};
|
||||
|
||||
void ami_search_open(struct gui_window *gwin);
|
||||
|
@ -24,11 +24,10 @@
|
||||
#include "amiga/gui.h"
|
||||
|
||||
struct treeview_window {
|
||||
struct nsObject *node;
|
||||
struct Window *win;
|
||||
Object *objects[OID_LAST];
|
||||
struct Gadget *gadgets[GID_LAST];
|
||||
struct nsObject *node;
|
||||
ULONG pad[5];
|
||||
struct tree *tree;
|
||||
struct List *listbrowser_list;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user