summaryrefslogtreecommitdiff
path: root/atari/browser_win.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2011-11-28 23:23:28 +0000
committerOle Loots <ole@monochrom.net>2011-11-28 23:23:28 +0000
commit999410adc818e9bc9e566580b38954720d7dad55 (patch)
tree6abf17a5a94a9835673e2b5b5a6542087f010737 /atari/browser_win.c
parenta7ba1b7ccd1178717e8e4a0546282270ed2fb1d6 (diff)
downloadnetsurf-999410adc818e9bc9e566580b38954720d7dad55.tar.gz
netsurf-999410adc818e9bc9e566580b38954720d7dad55.tar.bz2
I'm actually trying to simplify the frontend code, changes:
- Optimized browser window caret, uses back-buffer now. ( So no content redraw is scheduled by the frontend just for a caret move ) - Fixed a double redraw issue when the browser reformat is pending and the AES also sends an redraw request because of the resize. - Started to use netsurfs textarea instead of a custom implementation ( to reduce code size ). svn path=/trunk/netsurf/; revision=13191
Diffstat (limited to 'atari/browser_win.c')
-rwxr-xr-xatari/browser_win.c99
1 files changed, 56 insertions, 43 deletions
diff --git a/atari/browser_win.c b/atari/browser_win.c
index 87f2dbcc7..4824a3808 100755
--- a/atari/browser_win.c
+++ b/atari/browser_win.c
@@ -67,7 +67,27 @@ extern short last_drag_x;
extern short last_drag_y;
void __CDECL std_szd( WINDOW * win, short buff[8], void * );
-void __CDECL std_mvd( WINDOW * win, short buff[8], void * );
+void __CDECL std_mvd( WINDOW * win, short buff[8], void * );
+
+
+/* -------------------------------------------------------------------------- */
+/* Static module methods follow here: */
+/* -------------------------------------------------------------------------- */
+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], 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], void * data);
+static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data);
+static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data );
/* -------------------------------------------------------------------------- */
/* Module public functions: */
@@ -259,7 +279,8 @@ int window_destroy( struct gui_window * gw)
/* needed? */ /*listRemove( (LINKABLE*)gw->root->cmproot ); */
if( gw->root ) {
- /* TODO: check if no other browser is bound to this root window! */
+ /* TODO: check if no other browser is bound to this root window! */
+ /* only needed for tabs */
if( gw->root->title )
free( gw->root->title );
if( gw->root->cmproot )
@@ -289,7 +310,7 @@ void window_open( struct gui_window * gw)
mt_CompEvntExec( gl_appvar, gw->browser->comp, lfbuff );
/* recompute the nested component sizes and positions: */
- browser_update_rects( gw );
+ browser_update_rects( gw );
mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);
browser_get_rect( gw, BR_CONTENT, &br );
plotter->move( plotter, br.g_x, br.g_y );
@@ -298,6 +319,7 @@ void window_open( struct gui_window * gw)
if( gw->root->statusbar != NULL ){
gw->root->statusbar->attached = true;
}
+ tb_adjust_size( gw );
/*TBD: get already present content and set size? */
}
@@ -358,6 +380,7 @@ bool window_widget_has_focus( struct gui_window * gw, enum focus_element_type t,
return( ( element == gw->root->focus.element && t == gw->root->focus.type) );
}
+
/* -------------------------------------------------------------------------- */
/* Event Handlers: */
/* -------------------------------------------------------------------------- */
@@ -390,7 +413,8 @@ static void __CDECL evnt_window_arrowed( WINDOW *win, short buff[8], void *data
break;
}
browser_scroll( input_window, buff[4], value, abs );
-}
+}
+
static void __CDECL evnt_window_dd( WINDOW *win, short wbuff[8], void * data )
{
@@ -516,7 +540,6 @@ static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data)
{
struct gui_window * gw = input_window;
static bool prev_url = false;
- static bool prev_sb = false;
short mx, my, mbut, mkstate;
bool a = false; //flags if mouse is within controls or browser
bool within = false;
@@ -555,21 +578,10 @@ static void __CDECL evnt_window_m1( WINDOW * win, short buff[8], void * data)
prev_url = a = true;
}
}
- if( gw->root->statusbar && within == false /* && a == false */ ) {
- if( mx >= sbbox.g_x + (sbbox.g_w-MOVER_WH) && mx <= sbbox.g_x + sbbox.g_w &&
- my >= sbbox.g_y + (sbbox.g_h-MOVER_WH) && my <= sbbox.g_y + sbbox.g_h ) {
- /* mouse within sizer box ( bottom right ) */
- prev_sb = a = true;
- gem_set_cursor( &gem_cursors.sizenwse );
- }
- }
if( !a ) {
- if( prev_sb )
- gw->root->statusbar->resize_init = true;
- if( prev_url || prev_sb ) {
+ if( prev_url ) {
gem_set_cursor( &gem_cursors.arrow );
prev_url = false;
- prev_sb = false;
}
/* report mouse move in the browser window */
if( within ){
@@ -632,14 +644,15 @@ static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data
int dy = buff[5];
GRECT work, screen;
struct gui_window * gw = data;
-
+
if (!dx && !dy) return;
if( input_window == NULL || input_window != gw ) {
return;
}
- /* update the sliders _before_ we call redraw (which might depend on the slider possitions) */
+ /* update the sliders _before_ we call redraw
+ (which might depend on the slider possitions) */
WindSlider( win, (dx?HSLIDER:0) | (dy?VSLIDER:0) );
if( dy > 0 )
@@ -650,6 +663,8 @@ static void __CDECL evnt_window_slider( WINDOW * win, short buff[8], void * data
browser_scroll( gw, WA_RTPAGE, abs(dx), false );
else if( dx < 0 )
browser_scroll( gw, WA_LFPAGE, abs(dx), false );
+
+
}
@@ -707,7 +722,7 @@ static void __CDECL evnt_window_move( WINDOW *win, short buff[8], void * data )
void __CDECL evnt_window_resize( WINDOW *win, short buff[8], void * data )
{
short wx, wy, wh, ww, nw, nh;
- short r;
+ short r;
wind_get( win->handle, WF_CURRXYWH, &wx, &wy, &ww, &wh );
r = graf_rubberbox(wx, wy, 20, 20, &nw, &nh);
@@ -726,8 +741,8 @@ static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * da
{
short x,y,w,h;
struct gui_window * gw;
- LGRECT rect;
-
+ LGRECT rect;
+
if(buff[0] == WM_FORCE_MOVE ) {
std_mvd(win, buff, &app);
std_szd(win, buff, &app);
@@ -736,30 +751,28 @@ static void __CDECL evnt_window_rt_resize( WINDOW *win, short buff[8], void * da
wind_get( win->handle, WF_CURRXYWH, &x, &y, &w, &h );
gw = (struct gui_window *)data;
- assert( gw != NULL );
+ assert( gw != NULL );
if(gw->root->loc.g_w != w || gw->root->loc.g_h != h ){
/* report resize to component interface: */
- browser_update_rects( gw );
- mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);
- browser_get_rect( gw, BR_CONTENT, &rect );
- if( gw->browser->bw->current_content != NULL )
- browser_window_reformat(gw->browser->bw, false, rect.g_w, rect.g_h );
- else
- WindClear( gw->root->handle );
- gw->root->toolbar->url.scrollx = 0;
-
- /* send complete redraw to toolbar & statusbar: */
- mt_CompGetLGrect(&app, gw->root->toolbar->comp, WF_WORKXYWH, &rect);
- ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
- rect.g_x, rect.g_y, rect.g_w, rect.g_h
- );
- mt_CompGetLGrect(&app, gw->root->statusbar->comp, WF_WORKXYWH, &rect);
- ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
- rect.g_x, rect.g_y, rect.g_w, rect.g_h
- );
-
- /* TODO: recalculate scroll position, instead of zeroing? */
+ browser_update_rects( gw );
+ tb_adjust_size( gw );
+ if( gw->browser->bw->current_content != NULL ){
+ /* Reformat will happen when next redraw message arrives: */
+ gw->browser->reformat_pending = true;
+ if( sys_XAAES() ){
+ if( gw->root->loc.g_w > w || gw->root->loc.g_h > h ){
+ ApplWrite( _AESapid, WM_REDRAW, gw->root->handle->handle,
+ gw->root->loc.g_x, gw->root->loc.g_y,
+ gw->root->loc.g_w, gw->root->loc.g_h );
+ }
+ }
+ mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH,
+ (GRECT*)&gw->root->loc);
+ }
+ else {
+ WindClear( gw->root->handle );
+ }
} else {
if(gw->root->loc.g_x != x || gw->root->loc.g_y != y ){
mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);