removed preparations for frames. (will be handled within the core)

svn path=/trunk/netsurf/; revision=12550
This commit is contained in:
Ole Loots 2011-06-30 20:20:27 +00:00
parent e9d4b68e28
commit 5639e1e047
12 changed files with 125 additions and 262 deletions

View File

@ -62,11 +62,13 @@ static bool frameinit = true;
/* create an browser component */
struct s_browser * browser_create( struct gui_window * gw,
struct browser_window *bw,
struct browser_window * clone,
enum browser_type type,
int lt, int w, int flex )
struct s_browser * browser_create
(
struct gui_window * gw,
struct browser_window *bw,
struct browser_window * clone,
int lt, int w, int flex
)
{
LGRECT cwork;
COMPONENT * scrollv, * scrollh, * drawable;
@ -80,7 +82,6 @@ struct s_browser * browser_create( struct gui_window * gw,
if( bnew )
{
memset(bnew, 0, sizeof(struct s_browser) );
bnew->type = type;
bnew->bw = bw;
bnew->attached = false;
if(clone)
@ -126,27 +127,13 @@ struct s_browser * browser_create( struct gui_window * gw,
bool browser_destroy( struct s_browser * b )
{
short type = BT_ROOT;
LGRECT restore;
/* only free the components if it is an root browser,
this should delete all attached COMPONENTS...
*/
LOG(("%s (%s)\n", b->bw->name, (b->type == BT_ROOT) ? "ROOT" : "FRAME"));
LOG(("%s\n", b->bw->name ));
assert( b != NULL );
assert( b->comp != NULL );
assert( b->bw != NULL );
struct gui_window * rootgw = browser_find_root( b->bw->window );
if( b->type == BT_ROOT ) {
} else if( BT_FRAME ){
type = BT_FRAME;
} else {
assert( 1 == 0 );
}
if( b->compwin != NULL ){
if( b->compwin != NULL ) {
COMPONENT * old = b->comp;
WINDOW * oldwin = b->compwin;
b->comp = NULL;
@ -159,10 +146,6 @@ bool browser_destroy( struct s_browser * b )
WindDelete( oldwin );
mt_CompDelete(&app, old );
}
if( type == BT_FRAME ) {
/* TODO: restore the remaining frameset (rebuild???) */
}
return( true );
}
@ -187,19 +170,6 @@ bool browser_attach_frame( struct gui_window * container, struct gui_window * fr
frame->browser->attached = true;
}
/* find the root of an frame ( or just return gw if is already the root) */
struct gui_window * browser_find_root( struct gui_window * gw )
{
if( gw->parent == NULL )
return( gw );
struct gui_window * g;
for( g=window_list; g; g=g->next){
if( g->root == gw->root && g->parent == NULL )
return( g );
}
return( NULL );
}
void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * out)
{
GRECT work;
@ -274,13 +244,12 @@ static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8], void * da
{
struct s_browser * b = (struct s_browser*)data;
struct gui_window * gw = b->bw->window;
LOG(("%s: %s (%s)\n", __FUNCTION__ ,gw->browser->bw->name, ( gw->browser->type ==BT_FRAME) ? "FRAME" : "NOFRAME"));
LOG(("%s\n",gw->browser->bw->name));
assert( b != NULL );
assert( gw != NULL );
/* TODO: inspect why this assert fails with frames / iframes
/* this should have been happened alrdy */
/* assert( b->comp == NULL ); */
assert( b->comp == NULL );
free( b );
gw->browser = NULL;
@ -306,7 +275,7 @@ static void __CDECL browser_evnt_arrowed( WINDOW *win, short buff[8], void * dat
case WA_RTPAGE:
value = cwork.g_w;
break;
default:
break;
}
@ -623,7 +592,7 @@ bool browser_input( struct gui_window * gw, unsigned short nkc )
case 'A':
r = browser_window_key_press(gw->browser->bw, KEY_SELECT_ALL);
break;
case 'C':
r = browser_window_key_press(gw->browser->bw, KEY_COPY_SELECTION);
break;
@ -631,14 +600,14 @@ bool browser_input( struct gui_window * gw, unsigned short nkc )
case 'X':
r = browser_window_key_press(gw->browser->bw, KEY_CUT_SELECTION);
break;
case 'V':
r = browser_window_key_press(gw->browser->bw, KEY_PASTE);
break;
default:
break;
}
break;
}
}
if( (nkc & NKF_SHIFT) != 0 ) {
switch( ascii ) {
@ -777,26 +746,13 @@ static void __CDECL browser_evnt_redraw_x( WINDOW * c, short buf[8], void * data
bool browser_redraw_required( struct gui_window * gw)
{
bool ret = true;
int frames = 0;
CMP_BROWSER b = gw->browser;
if( b->bw->current_content == NULL )
return ( false );
{
/* don't do redraws if we have subframes */
/* iframes will be an special case and must be handled special... */
struct gui_window * g;
for( g=window_list; g; g=g->next ) {
if ( g != gw && g->parent == gw ) {
if( g->browser->type == BT_FRAME ) {
frames++;
}
}
}
}
ret = ( ((b->redraw.areas_used > 0) && frames == 0)
|| b->scroll.required
ret = ( ((b->redraw.areas_used > 0) )
|| b->scroll.required
|| b->caret.redraw );
return( ret );
}
@ -1071,34 +1027,41 @@ static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * dat
WINDOW * w;
struct gui_window * gw = (struct gui_window *) data;
CMP_BROWSER b = gw->browser;
struct gui_window * rgw = browser_find_root( gw );
LGRECT work, lclip, rwork;
// TODO: maybe implement something like validate_gw()
// to fetch spurious redraw events? the function should
// traverse all gui_windows and see if gw exists in the list
int xoff,yoff,width,heigth;
short cw, ch, cellw, cellh;
/* use that instead of browser_find_root() ? */
w = (WINDOW*)mt_CompGetPtr( &app, c, CF_WINDOW );
browser_get_rect( gw, BR_CONTENT, &work );
browser_get_rect( rgw, BR_CONTENT, &rwork );
lclip = work;
if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return;
if( b->bw->current_content == NULL )
return;
/* convert redraw coords to framebuffer coords: */
lclip.g_x -= work.g_x;
lclip.g_y -= work.g_y;
if( lclip.g_x < 0 ) {
lclip.g_w = work.g_w + lclip.g_x;
lclip.g_x = 0;
}
if( lclip.g_y < 0 ) {
lclip.g_h = work.g_h + lclip.g_y;
lclip.g_y = 0;
}
if( lclip.g_h > 0 && lclip.g_w > 0 ) {
browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
);
if( lclip.g_h > 0 && lclip.g_w > 0 ) {
browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
);
}
return;

View File

@ -19,32 +19,24 @@
#ifndef NS_ATARI_BROWSER_H
#define NS_ATARI_BROWSER_H
/*
/*
Each browser_window in the Atari Port is represented by an struct s_browser,
which cosnist mainly of an WinDom COMPONENT.
*/
/*
BROWSER_SCROLL_SVAL
The small scroll inc. value (used by scroll-wheel, arrow click):
*/
#define BROWSER_SCROLL_SVAL 64
/*
/*
BROWSER_SCROLL_SVAL
The small scroll inc. value (used by scroll-wheel, arrow click):
*/
#define BROWSER_SCROLL_SVAL 64
/*
MAX_REDRW_SLOTS
This is the number of redraw requests that an browser window can queue.
This is the number of redraw requests that an browser window can queue.
If a redraw is scheduled and all slots are used, the rectangle will
be merged to one of the existing slots.
*/
#define MAX_REDRW_SLOTS 32
enum browser_type
{
BT_ROOT=1,
BT_FRAME=2,
BT_FRAMESET=3,
BT_IFRAME=4
};
#define MAX_REDRW_SLOTS 32
enum browser_rect
{
@ -55,10 +47,10 @@ enum browser_rect
};
/*
This struct contains info of current browser viewport scroll
and the scroll which is requested. If a scroll is requested,
the field required is set to true.
/*
This struct contains info of current browser viewport scroll
and the scroll which is requested. If a scroll is requested,
the field required is set to true.
*/
struct s_scroll_info
{
@ -88,9 +80,9 @@ struct s_browser_redrw_info
BBOX area; /* used for clipping of content redraw */
};
/*
This is the actual browser widget, containings GUI elements and
the current state of the browser widget.
/*
This is the actual browser widget, containings GUI elements and
the current state of the browser widget.
*/
struct s_browser
{
@ -104,7 +96,7 @@ struct s_browser
bool attached;
};
struct s_browser * browser_create( struct gui_window * gw, struct browser_window * clone, struct browser_window *bw, enum browser_type, int lt, int w, int flex );
struct s_browser * browser_create( struct gui_window * gw, struct browser_window * clone, struct browser_window *bw, int lt, int w, int flex );
bool browser_destroy( struct s_browser * b );
void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * out);
bool browser_input( struct gui_window * gw, unsigned short nkc ) ;
@ -118,14 +110,14 @@ bool browser_redraw_required( struct gui_window * gw);
/*
This queues an redraw to one of the slots.
The following strategy is used:
The following strategy is used:
1. It checks if the rectangle to be scheduled is within one of the
already queued bboxes. If yes, it will return.
2. It checks for an intersection, and it will merge the rectangle to
already queued bboxes. If yes, it will return.
2. It checks for an intersection, and it will merge the rectangle to
already queued rectangle where it fits best.
3. it tries to put the rectangle into one available slot.
4. if no slot is available, it will simply merge the new rectangle with
the last available slot.
3. it tries to put the rectangle into one available slot.
4. if no slot is available, it will simply merge the new rectangle with
the last available slot.
*/
void browser_redraw_caret( struct gui_window * gw, GRECT * area );
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff );

View File

@ -174,13 +174,13 @@ static void window_track_mouse_state( LGRECT * bwrect, bool within, short mx, sh
);
}
}
}
}
}
}
}
}
static void __CDECL evnt_window_m1( WINDOW * win, short buff[8])
static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data)
{
struct gui_window * gw = input_window;
static bool prev_url = false;
@ -253,7 +253,7 @@ static void __CDECL evnt_window_m1( WINDOW * win, short buff[8])
}
}
} else {
/* set input window? */
/* set input window? */
}
}
@ -267,7 +267,7 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned
sb = (inflags & WIDGET_STATUSBAR);
short w,h, wx, wy, wh, ww;
int flags = CLOSER | MOVER | NAME | FULLER | SMALLER ;
gw->parent = NULL;
gw->root = malloc( sizeof(struct s_gui_win_root) );
if( gw->root == NULL )
return( -1 );
@ -286,12 +286,12 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned
gw->root->toolbar = tb_create( gw );
assert( gw->root->toolbar );
mt_CompAttach( &app, gw->root->cmproot, gw->root->toolbar->comp );
} else {
gw->root->toolbar = NULL;
}
gw->browser = browser_create( gw, bw, NULL, BT_ROOT, CLT_HORIZONTAL, 1, 1 );
gw->browser = browser_create( gw, bw, NULL, CLT_HORIZONTAL, 1, 1 );
mt_CompAttach( &app, gw->root->cmproot, gw->browser->comp );
if( sb ) {
@ -302,28 +302,28 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned
}
WindSetStr(gw->root->handle, WF_ICONTITLE, (char*)"NetSurf");
/* Event Handlers: */
EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, NULL );
EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, gw );
/* capture resize/move events so we can handle that manually */
if( !cfg_rt_resize ) {
EvntAttach( gw->root->handle, WM_SIZED, evnt_window_resize);
EvntDataAttach( gw->root->handle, WM_SIZED, evnt_window_resize, gw );
} else {
EvntAdd( gw->root->handle, WM_SIZED, evnt_window_rt_resize, EV_BOT );
EvntDataAdd( gw->root->handle, WM_SIZED, evnt_window_rt_resize, gw, EV_BOT );
}
if( !cfg_rt_move ) {
EvntAttach( gw->root->handle, WM_MOVED, evnt_window_move );
EvntDataAttach( gw->root->handle, WM_MOVED, evnt_window_move, gw );
} else {
EvntAdd( gw->root->handle, WM_MOVED, evnt_window_rt_resize, EV_BOT );
EvntDataAdd( gw->root->handle, WM_MOVED, evnt_window_rt_resize, gw, EV_BOT );
}
EvntAttach( gw->root->handle, WM_FORCE_MOVE, evnt_window_rt_resize );
EvntDataAttach( gw->root->handle, WM_FORCE_MOVE, evnt_window_rt_resize, gw );
EvntDataAttach( gw->root->handle, AP_DRAGDROP, evnt_window_dd, gw );
EvntDataAdd( gw->root->handle, WM_DESTROY,evnt_window_destroy, NULL, EV_TOP );
EvntDataAdd( gw->root->handle, WM_ARROWED,evnt_window_arrowed, NULL, EV_TOP );
EvntDataAdd( gw->root->handle, WM_NEWTOP, evnt_window_newtop, &evnt_data, EV_BOT);
EvntDataAdd( gw->root->handle, WM_TOPPED, evnt_window_newtop, &evnt_data, EV_BOT);
EvntDataAdd( gw->root->handle, WM_DESTROY,evnt_window_destroy, gw, EV_TOP );
EvntDataAdd( gw->root->handle, WM_ARROWED,evnt_window_arrowed, gw, EV_TOP );
EvntDataAdd( gw->root->handle, WM_NEWTOP, evnt_window_newtop, gw, EV_BOT);
EvntDataAdd( gw->root->handle, WM_TOPPED, evnt_window_newtop, gw, EV_BOT);
EvntDataAttach( gw->root->handle, WM_ICONDRAW, evnt_window_icondraw, gw);
EvntAttach( gw->root->handle, WM_XM1, evnt_window_m1 );
EvntDataAttach( gw->root->handle, WM_XM1, evnt_window_m1, gw );
/*
OBJECT * tbut;
@ -340,13 +340,6 @@ int window_destroy( struct gui_window * gw)
short buff[8];
int err = 0;
if( gw->browser->type != BT_ROOT ) {
return(0);
}
/* test this with frames: */
/* assert( gw->parent == NULL); */
search_destroy( gw );
if( input_window == gw )
@ -366,7 +359,6 @@ int window_destroy( struct gui_window * gw)
if( gw->browser )
browser_destroy( gw->browser );
/* destroy the icon: */
/*window_set_icon(gw, NULL, false );*/
@ -455,7 +447,7 @@ static void window_redraw_controls(struct gui_window *gw, uint32_t flags)
browser_get_rect( gw, BR_VSLIDER, &rect);
ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
rect.g_x, rect.g_y, rect.g_w, rect.g_h );
browser_get_rect( gw, BR_HSLIDER, &rect);
ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
rect.g_x, rect.g_y, rect.g_w, rect.g_h );
@ -633,8 +625,8 @@ static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
}
}
}
error:
ddclose( dd_hdl);
error:
ddclose( dd_hdl);
}
/* -------------------------------------------------------------------------- */
@ -650,7 +642,7 @@ static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data
static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data )
{
struct gui_window * gw = find_root_gui_window( win );
struct gui_window * gw = (struct gui_window *) data ;
if( gw != NULL ) {
browser_window_destroy( gw->browser->bw );
}
@ -659,7 +651,7 @@ static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data )
static void __CDECL evnt_window_newtop( WINDOW *win, short buff[8], void *data )
{
input_window = find_root_gui_window( win );
input_window = (struct gui_window *) data;
LOG(("newtop: iw: %p, win: %p", input_window, win ));
assert( input_window != NULL );
@ -684,7 +676,7 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void * dat
WindClear( win);
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
if( has_favicon == false ) {
OBJECT * tree;
RsrcGaddr( h_gem_rsrc, R_TREE, ICONIFY , &tree );
@ -696,7 +688,7 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void * dat
}
}
static void __CDECL evnt_window_move( WINDOW *win, short buff[8] )
static void __CDECL evnt_window_move( WINDOW *win, short buff[8], void * data )
{
short mx,my, mb, ks;
short wx, wy, wh, ww, nx, ny;
@ -704,7 +696,7 @@ static void __CDECL evnt_window_move( WINDOW *win, short buff[8] )
short xoff, yoff;
if( cfg_rt_move ) {
std_mvd( win, buff, &app );
evnt_window_rt_resize( win, buff );
evnt_window_rt_resize( win, buff, data );
} else {
wind_get( win->handle, WF_CURRXYWH, &wx, &wy, &ww, &wh );
if( graf_dragbox( ww, wh, wx, wy, app.x-ww, app.y, app.w+ww, app.h+wh, &nx, &ny )){
@ -713,12 +705,12 @@ static void __CDECL evnt_window_move( WINDOW *win, short buff[8] )
buff[6] = ww;
buff[7] = wh;
std_mvd( win, buff, &app );
evnt_window_rt_resize( win, buff );
evnt_window_rt_resize( win, buff, data );
}
}
}
void __CDECL evnt_window_resize( WINDOW *win, short buff[8] )
void __CDECL evnt_window_resize( WINDOW *win, short buff[8], void * data )
{
short mx,my, mb, ks;
short wx, wy, wh, ww, nw, nh;
@ -726,7 +718,7 @@ void __CDECL evnt_window_resize( WINDOW *win, short buff[8] )
graf_mkstate( &mx, &my, &mb, &ks );
if( cfg_rt_resize ) {
std_szd( win, buff, &app );
evnt_window_rt_resize( win, buff );
evnt_window_rt_resize( win, buff, data );
} else {
wind_get( win->handle, WF_CURRXYWH, &wx, &wy, &ww, &wh );
r = graf_rubberbox(wx, wy, 20, 20, &nw, &nh);
@ -737,26 +729,26 @@ void __CDECL evnt_window_resize( WINDOW *win, short buff[8] )
buff[6] = nw;
buff[7] = nh;
std_szd( win, buff, &app );
evnt_window_rt_resize( win, buff );
evnt_window_rt_resize( win, buff, data );
}
}
/* perform the actual resize */
static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8] )
static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * data )
{
short x,y,w,h;
struct gui_window * gw;
LGRECT rect;
bool resized;
bool moved;
if(buff[0] == WM_FORCE_MOVE ) {
std_mvd(win, buff, &app);
std_szd(win, buff, &app);
}
wind_get( win->handle, WF_WORKXYWH, &x, &y, &w, &h );
gw = find_root_gui_window( win );
gw = (struct gui_window *)data;
assert( gw != NULL );

View File

@ -66,18 +66,18 @@ void window_center(struct gui_window * gw);
/* -------------------------------------------------------------------------- */
/* Static module methods follow here: */
/* -------------------------------------------------------------------------- */
static void evnt_toolbar_click(WINDOW * win, short buf[8]);
static void evnt_toolbar_click(WINDOW * win, short buf[8], void * data);
static void __CDECL evnt_window_redraw( WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_newtop( WINDOW *win, short buff[8], void *data );
void __CDECL evnt_window_resize( WINDOW *win, short buff[8] );
static void __CDECL evnt_window_move( WINDOW *win, short buff[8] );
static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8] );
void __CDECL evnt_window_resize( WINDOW *win, short buff[8], void * data );
static void __CDECL evnt_window_move( WINDOW *win, short buff[8], void * data );
static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * date );
static void __CDECL evnt_window_close( WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data ) ;
static void __CDECL evnt_window_destroy( WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_keybd(WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_mbutton(WINDOW *win, short buff[8], void *data );
static void __CDECL evnt_window_m1( WINDOW * win, short buff[8]);
static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data);
#endif

View File

@ -326,7 +326,7 @@ void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data)
kstate |= K_LSHIFT|K_RSHIFT;
if( window_url_widget_has_focus( gw ) ) {
/* make sure we report for the root window and report...: */
done = tb_url_input( browser_find_root(gw), nkc );
done = tb_url_input( gw, nkc );
if( done ) return;
} else {
gw_tmp = window_list;

View File

@ -207,34 +207,28 @@ gui_create_browser_window(struct browser_window *bw,
}
break;
/*
case BROWSER_WINDOW_FRAME:
gwroot = bw->parent->window;
LOG(("create frame: %p, clone: %p\n", bw, clone));
gw->parent = gwroot;
gw->root = gwroot->root;
gw->browser = browser_create( gw, bw, clone, BT_FRAME, CLT_VERTICAL, 1, 1);
/*browser_attach_frame( gwroot, gw );*/
gw->browser = browser_create( gw, bw, clone, CLT_VERTICAL, 1, 1);
break;
case BROWSER_WINDOW_FRAMESET:
LOG(("frameset: %p, clone: %p\n", bw, clone));
gwroot = bw->parent->window;
gw->parent = gwroot;
gw->root = gwroot->root;
gw->browser = browser_create( gw, bw, clone, BT_FRAME, CLT_VERTICAL, 1, 1);
/*browser_attach_frame( gwroot, gw );*/
gw->browser = browser_create( gw, bw, clone, CLT_VERTICAL, 1, 1);
break;
case BROWSER_WINDOW_IFRAME:
LOG(("iframe: %p, clone: %p\n", bw, clone));
/* just dummy code here! */
gwroot = bw->parent->window;
gw->parent = gwroot;
gw->root = bw->parent->window->root;
gw->browser = browser_create( gw, bw, NULL, BT_FRAME, CLT_VERTICAL, 1, 1);
/*browser_attach_frame( gwroot, gw );*/
gw->browser = browser_create( gw, bw, NULL, CLT_VERTICAL, 1, 1);
break;
*/
default:
LOG(("unhandled type!"));
}
@ -267,13 +261,13 @@ void gui_window_destroy(struct gui_window *w)
input_window = NULL;
LGRECT dbg;
struct gui_window * root = browser_find_root( w );
browser_get_rect( root, BR_CONTENT, &dbg );
switch(w->browser->bw->browser_window_type) {
case BROWSER_WINDOW_NORMAL:
window_destroy( w );
break;
/*
case BROWSER_WINDOW_FRAME:
browser_destroy( w->browser );
break;
@ -283,10 +277,9 @@ void gui_window_destroy(struct gui_window *w)
break;
case BROWSER_WINDOW_IFRAME:
/* just dummy code here: */
window_destroy( w );
break;
*/
default:
LOG(("Unhandled type!"));
assert( 1 == 0 );
@ -323,8 +316,7 @@ void gui_window_set_title(struct gui_window *gw, const char *title)
{
if (gw == NULL)
return;
/* TODO: query AES for max. title length */
if( gw->root && gw->parent == NULL ){
if( gw->root ){
strncpy(gw->root->title, title, atari_sysinfo.aes_max_win_title_len);
gw->root->title[atari_sysinfo.aes_max_win_title_len] = 0;
WindSetStr( gw->root->handle, WF_NAME, gw->root->title );
@ -417,8 +409,8 @@ void gui_window_position_frame(struct gui_window *gw, int x0, int y0, int x1, in
LGRECT pardim;
int width = x1 - x0 + 2, height = y1 - y0 + 2;
/* get available width/height: */
if( gw->parent ) {
browser_get_rect( gw->parent, BR_CONTENT, &pardim );
if( gw ) {
browser_get_rect( gw, BR_CONTENT, &pardim );
LOG(("posframe %s: x0,y0: %d/%d, x1,y1: %d/%d, w: %d, h: %d \n",gw->browser->bw->name, x0,y0, x1,y1, width, height));
}
}
@ -923,9 +915,7 @@ void gui_quit(void)
while( gw ) {
tmp = gw->next;
if( gw->parent == NULL ) {
browser_window_destroy(gw->browser->bw);
}
browser_window_destroy(gw->browser->bw);
gw = tmp;
}

View File

@ -81,20 +81,10 @@ struct s_focus_info
void * element;
};
/*
struct s_gui_input_state {
short mbut;
short mkstat;
short mx;
short my;
browser_mouse_state bms;
} prev_inp_state;
*/
/* defines for data attached to components: */
#define CDT_OBJECT 0x004f424aUL
#define CDT_OWNER 0x03UL
#define CDT_ICON 0x04UL
#define CDT_OBJECT 0x004f424aUL
#define CDT_OWNER 0x03UL
#define CDT_ICON 0x04UL
#define CDT_ICON_TYPE 0x05UL
@ -107,10 +97,10 @@ typedef struct s_toolbar * CMP_TOOLBAR;
typedef struct s_statusbar * CMP_STATUSBAR;
typedef struct s_browser * CMP_BROWSER;
/*
This is the "main" window. It can consist of several components
/*
This is the "main" window. It can consist of several components
and also holds information shared by several frames within
the window. Each frame, no matter how deep nested,
the window. Each frame, no matter how deep nested,
knows about it's root (GEM window).
*/
struct s_gui_win_root
@ -127,17 +117,16 @@ struct s_gui_win_root
GRECT loc; /* current size of window on screen */
};
/*
This is the part of the gui which is known by netsurf core.
You must implement it. Altough, you are free how to do it.
Each of the browser "viewports" managed by netsurf are bound
to this structure. gui_window does not mean that it is an
comple window - also frames own an gui_window.
/*
This is the part of the gui which is known by netsurf core.
You must implement it. Altough, you are free how to do it.
Each of the browser "viewports" managed by netsurf are bound
to this structure. gui_window does not mean that it is an
comple window - also frames own an gui_window.
*/
struct gui_window {
struct s_gui_win_root * root;
CMP_BROWSER browser;
struct gui_window * parent;
struct gui_window *next, *prev;
};

View File

@ -100,22 +100,6 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
#define IS_TOPLEVEL_BROWSER_WIN( gw ) (gw->root->handle == win && gw->parent == NULL )
struct gui_window * find_root_gui_window( WINDOW * win )
{
struct gui_window * gw;
gw = window_list;
while( gw != NULL ) {
if( IS_TOPLEVEL_BROWSER_WIN( gw ) ) {
return( gw );
}
else
gw = gw->next;
}
return( NULL );
}
struct gui_window * find_cmp_window( COMPONENT * c )
{

View File

@ -30,7 +30,6 @@
lbuf[7] = (long)sbuf[7];
struct gui_window * find_root_gui_window( WINDOW * win );
struct gui_window * find_cmp_window( COMPONENT * c );
OBJECT *get_tree( int idx );
char *get_rsc_string( int idx );
@ -39,4 +38,4 @@ void dbg_grect( char * str, GRECT * r );
void * ldg_open( char * name, short * global );
void * ldg_find( char * name, short * ldg );
int ldg_close( void * ldg, short * global );
#endif
#endif

View File

@ -189,47 +189,3 @@ char * gemdos_realpath(const char * path, char * rpath)
return( rpath );
}
char * gemdos_realpathX(const char * path, char * rpath)
{
size_t l;
size_t i;
char old = '/';
char fsep = 0x5C;
if( rpath == NULL ){
return( NULL );
}
if( sys_type() & SYS_MINT ){
return( realpath(path, rpath) );
}
if( path[0] != '/' && path[0] != 0x5c && path[1] != ':') {
/* it is not an absolute path */
char cwd[PATH_MAX];
getcwd((char*)&cwd, PATH_MAX);
//fix_path((char*)&cwd);
strcpy(rpath, (char*)&cwd);
l = strlen(rpath);
/* append path seperator if needed: */
if(rpath[l-1] != 0x5C && rpath[l-1] != '/') {
rpath[l] = fsep;
rpath[l+1] = 0;
}
/* check if path is starting with: ./ */
if( (path[1] == '/' || path[1] == 0x5C ) ) {
strcat(rpath, &path[2]);
} else {
/* otherwise just append it */
strcat(rpath, path);
}
} else {
strcpy(rpath, path);
}
/* convert path seperator to configured value: */
l = strlen(rpath);
for( i = 0; i<l-1; i++){
if( rpath[i] == old ){
rpath[i] = fsep;
}
}
return( rpath );
}

View File

@ -169,7 +169,7 @@ static void __CDECL evnt_sb_click( COMPONENT *c, long buff[8] )
sbuff[5] = g->root->loc.g_y;
sbuff[6] = g->root->loc.g_w;
sbuff[7] = g->root->loc.g_h;
evnt_window_resize( g->root->handle, sbuff );
evnt_window_resize( g->root->handle, sbuff, g );
}
}
}

View File

@ -624,8 +624,6 @@ bool tb_url_input( struct gui_window * gw, short nkc )
char code = (nkc & 0xFF);
assert( gw != NULL );
/* make sure we navigate within the root window on enter: */
assert( gw->parent == NULL );
if( (code == NK_LEFT) && !shift ){
/* TODO: recognize shift + click */