From b20f47262ba01db6a5786314d3457c54bcf471a8 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Wed, 30 Nov 2011 23:08:21 +0000 Subject: [PATCH] Open window by configured width, removed unused variables svn path=/trunk/netsurf/; revision=13212 --- atari/browser.c | 9 --------- atari/browser_win.c | 23 +++++++---------------- atari/browser_win.h | 6 +++--- atari/global_evnt.c | 2 +- atari/gui.c | 8 ++++++-- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/atari/browser.c b/atari/browser.c index 7ab77cdd4..0c6d394a8 100755 --- a/atari/browser.c +++ b/atari/browser.c @@ -91,9 +91,6 @@ struct s_browser * browser_create int lt, int w, int flex ) { - LGRECT cwork; - COMPONENT * scrollv, * scrollh, * drawable; - CMP_BROWSER bnew = (CMP_BROWSER)malloc( sizeof(struct s_browser) ); if( bnew ) { @@ -177,7 +174,6 @@ void browser_get_rect( struct gui_window * gw, enum browser_rect type, LGRECT * void browser_update_rects(struct gui_window * gw ) { short buff[8]; - LGRECT cmprect; mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&buff[4]); buff[0] = CM_REFLOW; buff[1] = _AESapid; @@ -223,7 +219,6 @@ static void __CDECL browser_evnt_destroy( COMPONENT * c, long buff[8], void * da static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8], void * data) { - long lbuff[8]; short mx, my, dummy, mbut; uint32_t tnow = clock()*1000 / CLOCKS_PER_SEC; LGRECT cwork; @@ -597,8 +592,6 @@ void browser_schedule_redraw(struct gui_window * gw, short x0, short y0, short x { assert( gw != NULL ); CMP_BROWSER b = gw->browser; - int i; - struct rect area; LGRECT work; if( y1 < 0 || x1 < 0 ) @@ -618,7 +611,6 @@ void browser_schedule_redraw(struct gui_window * gw, short x0, short y0, short x static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff, struct rect * area ) { - LGRECT work; CMP_BROWSER b = gw->browser; struct redraw_context ctx = { @@ -839,7 +831,6 @@ void browser_redraw( struct gui_window * gw ) static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * data) { - short pxy[8]; struct gui_window * gw = (struct gui_window *) data; CMP_BROWSER b = gw->browser; LGRECT work, lclip; diff --git a/atari/browser_win.c b/atari/browser_win.c index cb409395f..92744bba4 100755 --- a/atari/browser_win.c +++ b/atari/browser_win.c @@ -163,14 +163,12 @@ static void window_track_mouse_state( LGRECT * bwrect, bool within, short mx, sh } } -int window_create( struct gui_window * gw, struct browser_window * bw, unsigned long inflags) +int window_create( struct gui_window * gw, + struct browser_window * bw, + unsigned long inflags ) { - short buff[8]; - OBJECT * tbtree; int err = 0; bool tb, sb; - short sc; - short w,h, wx, wy, wh, ww; int flags; tb = (inflags & WIDGET_TOOLBAR ); @@ -255,7 +253,6 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned int window_destroy( struct gui_window * gw) { - short buff[8]; int err = 0; search_destroy( gw ); @@ -294,12 +291,11 @@ int window_destroy( struct gui_window * gw) -void window_open( struct gui_window * gw) +void window_open( struct gui_window * gw, GRECT pos ) { - LGRECT br; - GRECT dim; + LGRECT br; - WindOpen(gw->root->handle, 20, 20, app.w/2, app.h/2 ); + WindOpen(gw->root->handle, pos.g_x, pos.g_y, pos.g_w, pos.g_h ); WindClear( gw->root->handle ); WindSetStr( gw->root->handle, WF_NAME, (char *)"" ); @@ -642,7 +638,6 @@ static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data { int dx = buff[4]; int dy = buff[5]; - GRECT work, screen; struct gui_window * gw = data; if (!dx && !dy) return; @@ -697,10 +692,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], void * data ) { - short mx,my, mb, ks; short wx, wy, wh, ww, nx, ny; - short r; - short xoff, yoff; if( option_atari_realtime_move ) { std_mvd( win, buff, &app ); evnt_window_rt_resize( win, buff, data ); @@ -738,8 +730,7 @@ void __CDECL evnt_window_resize( WINDOW *win, short buff[8], void * data ) 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; + struct gui_window * gw; if(buff[0] == WM_FORCE_MOVE ) { std_mvd(win, buff, &app); diff --git a/atari/browser_win.h b/atari/browser_win.h index 0826b8668..9d56226cf 100755 --- a/atari/browser_win.h +++ b/atari/browser_win.h @@ -34,12 +34,13 @@ /* -------------------------------------------------------------------------- */ /* Creates an normal Browser window with [toolbar], [statusbar] */ -int window_create( struct gui_window * gw, struct browser_window * bw, unsigned long flags ); +int window_create( struct gui_window * gw, + struct browser_window * bw, unsigned long flags ); /* Destroys WinDom part of gui_window */ int window_destroy( struct gui_window * gw ); /* show the window */ -void window_open( struct gui_window * gw); +void window_open( struct gui_window * gw, GRECT pos); void window_snd_redraw(struct gui_window * gw, short x, short y, short w, short h ); /* Update Shade / Unshade state of the fwd/back buttons*/ @@ -56,7 +57,6 @@ bool window_widget_has_focus( struct gui_window * gw, enum focus_element_type t, bool window_url_widget_has_focus( struct gui_window * gw ); void window_set_url( struct gui_window * gw, const char * text); void window_set_stauts( struct gui_window * gw , char * text ); -void window_center(struct gui_window * gw); void window_set_icon(struct gui_window * gw, struct bitmap * bmp ); diff --git a/atari/global_evnt.c b/atari/global_evnt.c index 5c6da5448..12fff075b 100755 --- a/atari/global_evnt.c +++ b/atari/global_evnt.c @@ -476,7 +476,7 @@ static int parse_accel( char * message, struct s_accelerator * accel) accel->mod |= K_CTRL; s++; } -parsekey: + /* expect F1/F10 or something like A, B, C ... : */ if(strlen(s) >= 2 && s[0] == 'F' ) { if(s[1] >= 49 && s[1] <= 57) { diff --git a/atari/gui.c b/atari/gui.c index c6dfb4f87..b887a7413 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -204,8 +204,12 @@ gui_create_browser_window(struct browser_window *bw, LOG(("new window: %p, bw: %p\n", gw, bw)); window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE|WIDGET_SCROLL ); - if( gw->root->handle ) { - window_open( gw ); + if( gw->root->handle ) { + GRECT pos = { + app.w/2-(cfg_width/2), app.h/2-(cfg_height/2), + cfg_width, cfg_height + }; + window_open( gw , pos ); /* Recalculate windows browser area now */ browser_update_rects( gw ); tb_update_buttons( gw );