summaryrefslogtreecommitdiff
path: root/atari
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-01-03 01:22:38 +0100
committerOle Loots <ole@monochrom.net>2013-01-03 01:22:38 +0100
commit9fdd190e008b86cc92abb41bb659d74161062369 (patch)
tree7b685177c2659374f54b535a09eaacefa986fb61 /atari
parentc0e6cf65902f93bc2286c72e28d916341ec641a6 (diff)
downloadnetsurf-9fdd190e008b86cc92abb41bb659d74161062369.tar.gz
netsurf-9fdd190e008b86cc92abb41bb659d74161062369.tar.bz2
Removed browser.h/.c
Diffstat (limited to 'atari')
-rw-r--r--atari/Makefile.target1
-rwxr-xr-xatari/browser.c960
-rwxr-xr-xatari/browser.h122
-rw-r--r--atari/ctxmenu.c19
-rw-r--r--atari/deskmenu.c5
-rwxr-xr-xatari/gui.c43
-rwxr-xr-xatari/gui.h7
-rwxr-xr-xatari/rootwin.c47
-rwxr-xr-xatari/rootwin.h4
-rw-r--r--atari/search.c1
-rw-r--r--atari/toolbar.c1
11 files changed, 55 insertions, 1155 deletions
diff --git a/atari/Makefile.target b/atari/Makefile.target
index eab2ef8a4..fdd4ee48f 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -95,7 +95,6 @@ S_ATARI := \
rootwin.c \
toolbar.c \
statusbar.c \
- browser.c \
osspec.c \
system_colour.c \
ctxmenu.c \
diff --git a/atari/browser.c b/atari/browser.c
deleted file mode 100755
index ec2a64df5..000000000
--- a/atari/browser.c
+++ /dev/null
@@ -1,960 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole@monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Module Description:
- *
- * This WinDom compo
- *
- *
- */
-
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdbool.h>
-#include <assert.h>
-#include <windom.h>
-
-#include "desktop/gui.h"
-#include "desktop/netsurf.h"
-#include "desktop/browser.h"
-#include "desktop/browser_private.h"
-#include "desktop/mouse.h"
-#include "desktop/textinput.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "css/css.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "atari/gui.h"
-#include "atari/rootwin.h"
-#include "atari/misc.h"
-#include "atari/res/netsurf.rsh"
-#include "atari/redrawslots.h"
-#include "atari/browser.h"
-#include "atari/plot/plot.h"
-#include "atari/plot/plot.h"
-#include "atari/encoding.h"
-#include "atari/ctxmenu.h"
-#include "cflib.h"
-
-extern struct gui_window *input_window;
-
-extern long atari_plot_flags;
-extern int atari_plot_vdi_handle;
-
-static void browser_process_scroll( struct gui_window * gw, GRECT bwrect );
-static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
- struct rect * area );
-static void __CDECL browser_evnt_destroy( COMPONENT * c, short buff[8],
- void * data);
-static void __CDECL browser_evnt_redraw( COMPONENT * c, short buff[8],
- void * data);
-static void __CDECL browser_evnt_mbutton( COMPONENT * c, short buff[8],
- void * data);
-
-
-/*
- Create an browser component.
- Currently, this area is the area which is used to display HTML content.
- However, it could also contains other areas, these need to be handled within
- "browser_get_rect" function.
-*/
-struct s_browser * browser_create
-(
- struct gui_window * gw,
- struct browser_window *bw,
- struct browser_window * clone,
- int lt, int w, int flex
-)
-{
- CMP_BROWSER bnew = (CMP_BROWSER)malloc( sizeof(struct s_browser) );
- if( bnew )
- {
- memset(bnew, 0, sizeof(struct s_browser) );
- bnew->bw = bw;
- bnew->attached = false;
- if(clone)
- bw->scale = clone->scale;
- else
- bw->scale = 1;
- redraw_slots_init( &bnew->redraw, MAX_REDRW_SLOTS );
- bnew->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, 100, 1);
- if( bnew->comp == NULL ) {
- free(bnew);
- return(NULL);
- }
-
- /* Attach events to the component: */
- // TODO: implement event chaining in rootwin
- /*
- mt_CompEvntDataAdd( &app, bnew->comp, WM_XBUTTON,
- browser_evnt_mbutton, (void*)gw, EV_BOT
- );
- mt_CompEvntDataAttach( &app, bnew->comp, WM_REDRAW,
- browser_evnt_redraw, (void*)gw
- );
- mt_CompEvntDataAttach( &app, bnew->comp, WM_DESTROY,
- browser_evnt_destroy, (void*)bnew
- );
- */
-
- /* Set the gui_window owner. */
- /* it is an link to the netsurf window system */
- mt_CompDataAttach( &app, bnew->comp, CDT_OWNER, gw );
-
- bnew->scroll.requested.y = 0;
- bnew->scroll.requested.x = 0;
- bnew->scroll.current.x = 0;
- bnew->scroll.current.y = 0;
- bnew->reformat_pending = false;
-
- }
- return( bnew );
-}
-
-bool browser_destroy( struct s_browser * b )
-{
-
- LOG(("%s\n", b->bw->name ));
-
- assert( b != NULL );
- assert( b->bw != NULL );
-
- struct gui_window * gw = b->bw->window;
- LOG(("%s\n",gw->browser->bw->name));
-
- assert( b != NULL );
- assert( gw != NULL );
- free( b );
- gw->browser = NULL;
-
- return( true );
-}
-
-/*
- Query the browser component for widget rectangles.
-*/
-void browser_get_rect( struct gui_window * gw, enum browser_rect type, GRECT * out)
-{
- GRECT cur;
-
- // TODO: update browser get grect
- /* Query component for it's current size: */
- /* And extract the different widget dimensions: */
- if (type == BR_CONTENT ) {
- guiwin_get_grect(gw->root->win, GUIWIN_AREA_CONTENT, out);
- }
- else if (type==BR_URL_INPUT) {
- // TODO: calculate url input area somehow
- guiwin_get_grect(gw->root->win, GUIWIN_AREA_TOOLBAR, out);
- }
- else if (type==BR_THROBBER) {
- // TODO: calculate throbber area somehow
- guiwin_get_grect(gw->root->win, GUIWIN_AREA_TOOLBAR, out);
- }
-
-
- return;
-}
-
-void browser_set_content_size(struct gui_window * gw, int w, int h)
-{
- CMP_BROWSER b = gw->browser;
- GRECT work;
- browser_get_rect( gw, BR_CONTENT, &work );
-
- // TODO: implement new content size setter
- //gw->root->handle->xpos_max = w;
- //gw->root->handle->ypos_max = h;
-
-// if( w < work.g_w + b->scroll.current.x || w < work.g_h + b->scroll.current.y ) {
-// /* let the scroll routine detect invalid scroll values... */
-// browser_scroll(gw, WA_LFLINE, b->scroll.current.x, true );
-// browser_scroll(gw, WA_UPLINE, b->scroll.current.y, true );
-// /* force update of scrollbars: */
-// b->scroll.required = true;
-// }
-}
-
-
-static void __CDECL browser_evnt_destroy( COMPONENT * c, short buff[8], void * data)
-{
- struct s_browser * b = (struct s_browser*)data;
-
- LOG(("evnt_destroy done!"));
-}
-
-/*
- Mouse Button handler for browser component.
-*/
-
-static void __CDECL browser_evnt_mbutton( COMPONENT * c, short buff[8], void * data)
-{
- short mx, my, dummy, mbut;
- GRECT cwork;
- browser_mouse_state bmstate = 0;
- struct gui_window * gw = data;
-
- if( input_window != gw ){
- input_window = gw;
- }
-
- window_set_focus(gw->root, BROWSER, (void*)gw->browser );
- browser_get_rect(gw, BR_CONTENT, &cwork );
-
- /* convert screen coords to component coords: */
- mx = evnt.mx - cwork.g_x;
- my = evnt.my - cwork.g_y;
-
- /* Translate GEM key state to netsurf mouse modifier */
- if( evnt.mkstate & (K_RSHIFT | K_LSHIFT) ){
- bmstate |= BROWSER_MOUSE_MOD_1;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_1);
- }
- if( (evnt.mkstate & K_CTRL) ){
- bmstate |= BROWSER_MOUSE_MOD_2;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_2);
- }
- if( (evnt.mkstate & K_ALT) ){
- bmstate |= BROWSER_MOUSE_MOD_3;
- } else {
- bmstate &= ~(BROWSER_MOUSE_MOD_3);
- }
-
- /* convert component coords to scrolled content coords: */
- int sx_origin = (mx + gw->browser->scroll.current.x);
- int sy_origin = (my + gw->browser->scroll.current.y);
-
- short rel_cur_x, rel_cur_y;
- short prev_x=sx_origin, prev_y=sy_origin;
- bool dragmode = 0;
-
- /* Detect left mouse button state and compare with event state: */
- graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
- if( (mbut & 1) && (evnt.mbut & 1) ){
- /* Mouse still pressed, report drag */
- rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
- rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
- browser_window_mouse_click( gw->browser->bw,
- BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
- sx_origin, sy_origin);
- do{
- if( abs(prev_x-rel_cur_x) > 5 || abs(prev_y-rel_cur_y) > 5 ){
- browser_window_mouse_track( gw->browser->bw,
- BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
- rel_cur_x, rel_cur_y);
- prev_x = rel_cur_x;
- prev_y = rel_cur_y;
- dragmode = true;
- } else {
- if( dragmode == false ){
- browser_window_mouse_track( gw->browser->bw,BROWSER_MOUSE_PRESS_1,
- rel_cur_x, rel_cur_y);
- }
- }
- //if( browser_redraw_required( gw ) ){
- //browser_redraw( gw );
- //}
- graf_mkstate(&rel_cur_x, &rel_cur_y, &mbut, &dummy);
- rel_cur_x = (rel_cur_x - cwork.g_x) + gw->browser->scroll.current.x;
- rel_cur_y = (rel_cur_y - cwork.g_y) + gw->browser->scroll.current.y;
- } while( mbut & 1 );
- browser_window_mouse_track(gw->browser->bw, 0, rel_cur_x,rel_cur_y);
- } else {
- /* Right button pressed? */
- if( (evnt.mbut & 2 ) ) {
- context_popup( gw, evnt.mx, evnt.my );
- } else {
- browser_window_mouse_click(gw->browser->bw,
- bmstate|BROWSER_MOUSE_PRESS_1,
- sx_origin,sy_origin);
- browser_window_mouse_click(gw->browser->bw,
- bmstate|BROWSER_MOUSE_CLICK_1,
- sx_origin,sy_origin);
- }
- }
-
-
-}
-
-
-/*
- Report scroll event to the browser component.
-*/
-void browser_scroll( struct gui_window * gw, short mode, int value, bool abs )
-{
- GRECT work;
- int max_y_scroll;
- int max_x_scroll;
- int oldx = gw->browser->scroll.current.x;
- int oldy = gw->browser->scroll.current.y;
- struct s_browser * b = gw->browser;
- LOG((""));
-
- if( b->bw->current_content != NULL ) {
- browser_get_rect( gw, BR_CONTENT, &work);
- max_y_scroll = (content_get_height( b->bw->current_content ) - work.g_h );
- max_x_scroll = (content_get_width( b->bw->current_content ) - work.g_w);
- } else {
- return;
- }
-
-
- switch( mode ) {
-
- case WA_UPPAGE:
- case WA_UPLINE:
- if( max_y_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.y -= value;
- else
- b->scroll.requested.y = value - b->scroll.current.y;
- break;
-
- case WA_DNPAGE:
- case WA_DNLINE:
- if( max_y_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.y += value;
- else
- b->scroll.requested.y = value - b->scroll.current.y;
- break;
-
- case WA_LFPAGE:
- case WA_LFLINE:
- if( max_x_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.x -= value;
- else
- b->scroll.requested.x = value - b->scroll.current.x;
- break;
-
- case WA_RTPAGE:
- case WA_RTLINE:
- if( max_x_scroll < 1 )
- return;
- if( abs == false )
- b->scroll.requested.x += value;
- else
- b->scroll.requested.x = value - b->scroll.current.x;
- break;
-
- default: break;
- }
-
- if( b->scroll.current.y + b->scroll.requested.y < 0 ) {
- b->scroll.requested.y = -b->scroll.current.y;
- }
-
- if( b->scroll.current.y + b->scroll.requested.y > max_y_scroll ) {
- b->scroll.requested.y = max_y_scroll - b->scroll.current.y;
- }
-
- if( b->scroll.current.x + b->scroll.requested.x < 0 ) {
- b->scroll.requested.x = -b->scroll.current.x;
- }
-
- if( b->scroll.current.x + b->scroll.requested.x > max_x_scroll ) {
- b->scroll.requested.x = max_x_scroll - b->scroll.current.x;
- }
-
- if( oldy != b->scroll.current.y + b->scroll.requested.y ||
- oldx != b->scroll.current.x + b->scroll.requested.x ) {
- b->scroll.required = true;
- }
-}
-
-/*
- perform the requested scrolling.
- gw -> the browser window to act upon.
- bwrect -> the dimensions of the browser, so that this function
- doesn't need to get it.
-*/
-static void browser_process_scroll( struct gui_window * gw, GRECT bwrect )
-{
- struct s_browser * b = gw->browser;
- GRECT src;
- GRECT dst;
- short h,w;
-
- if( gw->browser->bw->current_content == NULL )
- return;
-
- h = (short) abs( b->scroll.requested.y );
- w = (short) abs( b->scroll.requested.x );
-
- /* if the request exceeds the browser size, redraw the whole area */
- if ( b->scroll.requested.y > bwrect.g_h || b->scroll.requested.y < -bwrect.g_h ||
- b->scroll.requested.x > bwrect.g_w || b->scroll.requested.x < -bwrect.g_w ) {
- b->scroll.current.y += b->scroll.requested.y;
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, 0, 0, bwrect.g_w, bwrect.g_h);
- /* don't scroll again: */
- b->scroll.requested.y = 0;
- b->scroll.requested.x = 0;
- }
- if( b->scroll.requested.y < 0 ) {
- /* scroll up */
- src.g_x = 0;
- src.g_y = 0;
- src.g_w = bwrect.g_w;
- src.g_h = bwrect.g_h - h;
- dst.g_x = 0;
- dst.g_y = h;
- dst.g_w = src.g_w;
- dst.g_h = src.g_h;
- plot_copy_rect(src, dst);
- b->scroll.current.y += b->scroll.requested.y;
- browser_schedule_redraw( gw, 0, 0, bwrect.g_w, h );
- }
-
- if( b->scroll.requested.y > 0 ) {
- /* scroll down */
- src.g_x = 0;
- src.g_y = h;
- src.g_w = bwrect.g_w;
- src.g_h = bwrect.g_h - h;
- dst.g_x = 0;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w;
- dst.g_h = bwrect.g_h - h;
- plot_copy_rect(src, dst );
- b->scroll.current.y += b->scroll.requested.y;
- browser_schedule_redraw( gw, 0, bwrect.g_h - h, bwrect.g_w, bwrect.g_h );
- }
-
- if( b->scroll.requested.x < 0 ) {
- /* scroll to the left */
- src.g_x = 0;
- src.g_y = 0;
- src.g_w = bwrect.g_w - w;
- src.g_h = bwrect.g_h;
- dst.g_x = w;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w - w;
- dst.g_h = bwrect.g_h;
- plot_copy_rect(src, dst );
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, 0, 0, w, bwrect.g_h );
- }
-
- if( b->scroll.requested.x > 0 ) {
- /* scroll to the right */
- src.g_x = w;
- src.g_y = 0;
- src.g_w = bwrect.g_w - w;
- src.g_h = bwrect.g_h;
- dst.g_x = 0;
- dst.g_y = 0;
- dst.g_w = bwrect.g_w - w;
- dst.g_h = bwrect.g_h;
- plot_copy_rect(src, dst );
- b->scroll.current.x += b->scroll.requested.x;
- browser_schedule_redraw( gw, bwrect.g_w - w, 0, bwrect.g_w, bwrect.g_h );
- }
- b->scroll.requested.y = 0;
- b->scroll.requested.x = 0;
-// if( b->caret.requested.g_w > 0 ){
-// b->caret.redraw = true;
-// }
-
- // TODO: implement new sliding
- //gw->root->handle->xpos = b->scroll.current.x;
- //gw->root->handle->ypos = b->scroll.current.y;
-
- //mt_WindSlider( &app, gw->root->handle, HSLIDER|VSLIDER );
-}
-
-/*
- Report keypress to browser component.
- The browser component doesn't listen for keyinput by itself.
- parameter:
- - gui_window ( compocnent owner ).
- - unsigned short nkc ( CFLIB normalised key code )
-*/
-bool browser_input( struct gui_window * gw, unsigned short nkc )
-{
- GRECT work;
- bool r = false;
- unsigned char ascii = (nkc & 0xFF);
- long ucs4;
- long ik = nkc_to_input_key( nkc, &ucs4 );
-
- // pass event to specific control?
-
- if( ik == 0 ){
- if (ascii >= 9 ) {
- r = browser_window_key_press(gw->browser->bw, ucs4 );
- }
- } else {
- r = browser_window_key_press(gw->browser->bw, ik );
- if( r == false ){
- browser_get_rect(gw, BR_CONTENT, &work);
- switch( ik ){
- case KEY_LINE_START:
- browser_scroll( gw, WA_LFPAGE, work.g_w, false );
- break;
-
- case KEY_LINE_END:
- browser_scroll( gw, WA_RTPAGE, work.g_w, false );
- break;
-
- case KEY_PAGE_UP:
- browser_scroll( gw, WA_UPPAGE, work.g_h, false );
- break;
-
- case KEY_PAGE_DOWN:
- browser_scroll( gw, WA_DNPAGE, work.g_h, false );
- break;
-
- case KEY_RIGHT:
- browser_scroll( gw, WA_RTLINE, 16, false );
- break;
-
- case KEY_LEFT:
- browser_scroll( gw, WA_LFLINE, 16, false );
- break;
-
- case KEY_UP:
- browser_scroll( gw, WA_UPLINE, 16, false);
- break;
-
- case KEY_DOWN:
- browser_scroll( gw, WA_DNLINE, 16, false);
- break;
-
- default:
- break;
- }
- }
- }
-
- return( r );
-}
-
-/* determines if a browser window needs redraw */
-//bool browser_redraw_required( struct gui_window * gw)
-//{
-// bool ret = true;
-// CMP_BROWSER b = gw->browser;
-//
-// if( b->bw->current_content == NULL )
-// return ( false );
-//
-// /* disable redraws when the browser awaits WM_REDRAW caused by resize */
-// if( b->reformat_pending )
-// return( false );
-//
-// ret = ( ((b->redraw.areas_used > 0) )
-// || b->scroll.required
-// || b->caret.redraw);
-// return( ret );
-//}
-
-
-/* schedule a redraw of content */
-/* coords are relative to the framebuffer */
-void browser_schedule_redraw_rect(struct gui_window * gw, short x, short y, short w, short h)
-{
- if(x < 0){
- w += x;
- x = 0;
- }
-
- if(y < 0) {
- h += y;
- y = 0;
- }
- browser_schedule_redraw( gw, x, y, x+w, y+h );
-}
-
-
-/*
- schedule a redraw of content, coords are relative to the framebuffer
-*/
-void browser_schedule_redraw(struct gui_window * gw, short x0, short y0, short x1, short y1)
-{
- assert( gw != NULL );
- CMP_BROWSER b = gw->browser;
- GRECT work;
-
- if( y1 < 0 || x1 < 0 )
- return;
-
- browser_get_rect( gw, BR_CONTENT, &work);
- if( x0 > work.g_w )
- return;
- if( y0 > work.g_h )
- return;
-
- redraw_slot_schedule(&b->redraw, x0, y0, x1, y1, false);
-
- return;
-}
-
-static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
- struct rect * area )
-{
- CMP_BROWSER b = gw->browser;
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
-
- LOG(("%s : %d,%d - %d,%d\n", b->bw->name, area->x0,
- area->y0, area->x1, area->y1
- ));
-
-
- browser_window_redraw( b->bw, -b->scroll.current.x,
- -b->scroll.current.y, area, &ctx );
-
-}
-
-/*
- area: the browser canvas
-*/
-//void browser_restore_caret_background( struct gui_window * gw, GRECT * area)
-//{
-// CMP_BROWSER b = gw->browser;
-// GRECT rect;
-// if( area == NULL ){
-// browser_get_rect( gw, BR_CONTENT, &rect );
-// area = &rect;
-// }
-// /* This call restores the background and releases the memory: */
-// // TODO: only release memory/clear flag when the caret is not clipped.
-// // TODO: apply clipping.
-// w_put_bkgr( &app,
-// area->g_x-b->scroll.current.x+b->caret.current.g_x,
-// area->g_y-b->scroll.current.y+b->caret.current.g_y,
-// gw->browser->caret.current.g_w,
-// gw->browser->caret.current.g_h+1,
-// &gw->browser->caret.background
-// );
-// gw->browser->caret.background.fd_addr = NULL;
-//}
-
-/*
- area: the browser canvas
-*/
-//void browser_redraw_caret( struct gui_window * gw, GRECT * area )
-//{
-//
-// if( gw->browser->caret.redraw && gw->browser->caret.requested.g_w > 0 ){
-//
-// short wind_info[4];
-//
-// /* Only redraw caret when window is topped. */
-// wind_get( 0, WF_TOP, &wind_info[0], &wind_info[1], &wind_info[2], &wind_info[3]);
-// if (guiwin_get_handle(gw->root->win) != wind_info[0]) {
-// return;
-// }
-//
-//
-// GRECT caret;
-// struct s_browser * b = gw->browser;
-// struct rect old_clip;
-// struct rect clip;
-//
-// if( b->caret.current.g_w > 0 && b->caret.background.fd_addr != NULL ){
-// browser_restore_caret_background( gw, area );
-// }
-//
-// caret = b->caret.requested;
-// caret.g_x -= b->scroll.current.x - area->g_x;
-// caret.g_y -= b->scroll.current.y - area->g_y;
-//
-// if( !rc_intersect( area, &caret ) ) {
-// return;
-// }
-//
-// MFDB screen;
-// short pxy[8];
-//
-// /* save background: */
-// init_mfdb(app.nplanes, caret.g_w, caret.g_h, 0,
-// &b->caret.background);
-// init_mfdb(0, caret.g_w, caret.g_h, 0, &screen);
-// pxy[0] = caret.g_x;
-// pxy[1] = caret.g_y;
-// pxy[2] = caret.g_x + caret.g_w;
-// pxy[3] = caret.g_y + caret.g_h;
-// pxy[4] = 0;
-// pxy[5] = 0;
-// pxy[6] = caret.g_w;
-// pxy[7] = caret.g_h;
-//
-// plot_lock();
-//
-// /* copy screen image behin the caret for later restore: */
-// vro_cpyfm (app.graf.handle, S_ONLY, pxy, &screen, &b->caret.background);
-// /* draw caret: */
-// caret.g_x -= area->g_x;
-// caret.g_y -= area->g_y;
-// clip.x0 = caret.g_x;
-// clip.y0 = caret.g_y;
-// clip.x1 = caret.g_x + caret.g_w;
-// clip.y1 = caret.g_y + caret.g_h;
-// /* store old clip before adjusting it: */
-// plot_get_clip( &old_clip );
-// /* clip to cursor: */
-// plot_clip( &clip );
-// plot_line( caret.g_x, caret.g_y, caret.g_x, caret.g_y + caret.g_h,
-// plot_style_caret );
-// /* restore old clip area: */
-// plot_clip( &old_clip );
-// /* restore the mouse */
-// plot_unlock();
-// b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x;
-// b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y;
-// b->caret.current.g_w = caret.g_w;
-// b->caret.current.g_h = caret.g_h;
-// }
-//}
-//
-//void browser_redraw( struct gui_window * gw )
-//{
-// GRECT bwrect;
-// struct s_browser * b = gw->browser;
-// short todo[4];
-// struct rect clip;
-// /* used for clipping of content redraw: */
-// struct rect redraw_area;
-//
-// if( b->attached == false || b->bw->current_content == NULL ) {
-// return;
-// }
-//
-// browser_get_rect(gw, BR_CONTENT, &bwrect);
-//
-// plot_set_dimensions(bwrect.g_x, bwrect.g_y, bwrect.g_w, bwrect.g_h);
-// clip.x0 = 0;
-// clip.y0 = 0;
-// clip.x1 = bwrect.g_w;
-// clip.y1 = bwrect.g_h;
-// plot_clip(&clip);
-// if (plot_lock() == false)
-// return;
-//
-// if( b->scroll.required == true && b->bw->current_content != NULL) {
-// browser_process_scroll( gw, bwrect );
-// b->scroll.required = false;
-// }
-//
-// if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) {
-// if( (atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
-//
-// int i;
-// GRECT area;
-// GRECT fbwork;
-// short wf_top[4];
-// todo[0] = bwrect.g_x;
-// todo[1] = bwrect.g_y;
-// todo[2] = todo[0] + bwrect.g_w-1;
-// todo[3] = todo[1] + bwrect.g_h-1;
-// vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
-//
-// wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
-// &wf_top[2], &wf_top[3] );
-//
-// if( wf_top[0] == guiwin_get_handle(gw->root->win)
-// && wf_top[1] == _AESapid ){
-// /* The window is on top, so there is no need to walk the */
-// /* AES rectangle list. */
-// for( i=0; i<b->redraw.areas_used; i++ ){
-// fbwork.g_x = todo[0] - bwrect.g_x;
-// fbwork.g_y = todo[1] - bwrect.g_y;
-// if( fbwork.g_x < 0 ){
-// fbwork.g_w = todo[2] + todo[0];
-// fbwork.g_x = 0;
-// } else {
-// fbwork.g_w = todo[2];
-// }
-// if( fbwork.g_y < 0 ){
-// fbwork.g_h = todo[3] + todo[1];
-// fbwork.g_y = 0;
-// } else {
-// fbwork.g_h = todo[3];
-// }
-// area.g_x = b->redraw.areas[i].x0;
-// area.g_y = b->redraw.areas[i].y0;
-// area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
-// area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
-// if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
-// redraw_area.x0 = area.g_x;
-// redraw_area.y0 = area.g_y;
-// redraw_area.x1 = area.g_x + area.g_w;
-// redraw_area.y1 = area.g_y + area.g_h;
-// browser_redraw_content( gw, 0, 0, &redraw_area );
-// } else {
-// /* the area should be kept scheduled for later redraw,*/
-// /* but because this is onscreen plotter, it doesn't */
-// /* make much sense anyway... */
-// }
-// }
-// } else {
-// /* walk the AES rectangle list: */
-// short aes_handle = guiwin_get_handle(gw->root->win);
-// if( wind_get(aes_handle, WF_FIRSTXYWH,
-// &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
-// while (todo[2] && todo[3]) {
-// /* convert screen to framebuffer coords: */
-// fbwork.g_x = todo[0] - bwrect.g_x;
-// fbwork.g_y = todo[1] - bwrect.g_y;
-// if( fbwork.g_x < 0 ){
-// fbwork.g_w = todo[2] + todo[0];
-// fbwork.g_x = 0;
-// } else {
-// fbwork.g_w = todo[2];
-// }
-// if( fbwork.g_y < 0 ){
-// fbwork.g_h = todo[3] + todo[1];
-// fbwork.g_y = 0;
-// } else {
-// fbwork.g_h = todo[3];
-// }
-// /* walk the redraw requests: */
-// for( i=0; i<b->redraw.areas_used; i++ ){
-// area.g_x = b->redraw.areas[i].x0;
-// area.g_y = b->redraw.areas[i].y0;
-// area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0;
-// area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0;
-// if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) {
-// redraw_area.x0 = area.g_x;
-// redraw_area.y0 = area.g_y;
-// redraw_area.x1 = area.g_x + area.g_w;
-// redraw_area.y1 = area.g_y + area.g_h;
-// browser_redraw_content( gw, 0, 0, &redraw_area );
-// } else {
-// /* the area should be kept scheduled for later redraw,*/
-// /* but because this is onscreen plotter, it doesn't */
-// /* make much sense anyway... */
-// }
-// }
-// if (wind_get(aes_handle, WF_NEXTXYWH,
-// &todo[0], &todo[1], &todo[2], &todo[3])==0) {
-// break;
-// }
-// }
-// }
-// }
-// vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
-// } else {
-//
-// /* its save to do a complete redraw without knowledge about GEM windows :) */
-// /* walk the redraw requests: */
-// int i;
-// for( i=0; i<b->redraw.areas_used; i++ ){
-// struct redraw_context ctx = {
-// .interactive = true,
-// .background_images = true,
-// .plot = &atari_plotters
-// };
-// browser_window_redraw( b->bw, -b->scroll.current.x,
-// -b->scroll.current.y, &b->redraw.areas[i], &ctx );
-// }
-// GRECT area;
-// area.g_x = bwrect.g_x;
-// area.g_y = bwrect.g_y;
-// area.g_w = bwrect.g_w;
-// area.g_h = bwrect.g_h;
-// //plot_blit( plotter, &area );
-// }
-// b->redraw.areas_used = 0;
-// }
-// if( b->caret.redraw == true && b->bw->current_content != NULL ) {
-// GRECT area;
-// todo[0] = bwrect.g_x;
-// todo[1] = bwrect.g_y;
-// todo[2] = todo[0] + bwrect.g_w;
-// todo[3] = todo[1] + bwrect.g_h;
-// area.g_x = bwrect.g_x;
-// area.g_y = bwrect.g_y;
-// area.g_w = bwrect.g_w;
-// area.g_h = bwrect.g_h;
-// vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
-// browser_redraw_caret( gw, &area );
-// vs_clip(atari_plot_vdi_handle, 0, (short*)&todo[0]);
-// b->caret.redraw = false;
-// }
-// plot_unlock();
-// /* TODO: if we use offscreen bitmap, trigger content redraw here */
-//}
-
-static void __CDECL browser_evnt_redraw( COMPONENT * c, short buff[8], void * data)
-{
- struct gui_window * gw = (struct gui_window *) data;
- CMP_BROWSER b = gw->browser;
- GRECT work, lclip;
-
- browser_get_rect( gw, BR_CONTENT, &work );
- lclip = work;
- if ( !rc_intersect( (GRECT*)&buff[4], &lclip ) ) return;
-
- if( b->bw->current_content == NULL ){
- guiwin_clear(gw->root->win);
- 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 ) {
-
- if( gw->browser->reformat_pending == true ){
- GRECT newsize;
- gw->browser->reformat_pending = false;
- browser_get_rect(gw, BR_CONTENT, &newsize);
- /* this call will also schedule an redraw for the complete */
- /* area. */
- /* Resize must be handled here, because otherwise */
- /* a redraw is scheduled twice (1. by the frontend, 2. by AES) */
- // TODO: this was introduced because
- // of bad knowledge about the AES system...
- browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h );
- } else {
- browser_schedule_redraw( gw, lclip.g_x, lclip.g_y,
- lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h
- );
- }
- }
-
- return;
-}
diff --git a/atari/browser.h b/atari/browser.h
deleted file mode 100755
index a442380ef..000000000
--- a/atari/browser.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2010 Ole Loots <ole@monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_BROWSER_H
-#define NS_ATARI_BROWSER_H
-
-#include "atari/redrawslots.h"
-
-/*
- Each browser_window in the Atari Port is represented by an struct s_browser,
- which consist mainly of an WinDom COMPONENT.
-*/
-
-/*
- BROWSER_SCROLL_SVAL
- The small scroll inc. value (used by scroll-wheel, arrow click):
-*/
-#define BROWSER_SCROLL_SVAL 64
-
-
-enum browser_rect
-{
- BR_CONTENT = 1,
- BR_URL_INPUT,
- BR_THROBBER
-};
-
-
-/*
- 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
-{
- POINT requested;
- POINT current;
- bool required;
-};
-
-/*
- This struct holds information of the cursor within the browser
- viewport.
-*/
-struct s_caret_old
-{
- GRECT requested;
- GRECT current;
- bool redraw;
- MFDB background;
-};
-
-/*
- This is the browser content area (viewport).
- It is redrawable and scrollable. It is based on the WinDOM
- Component window (undocumented feature).
-
- It's an windom component containing it's own Window controls,
- like scrollbars, resizer, etc.
-
- Now that the NetSurf core handles frames, the advantages of this
- choice have probably vanished.
-*/
-struct s_browser
-{
- int type;
- COMPONENT * comp;
- struct browser_window * bw;
- struct s_scroll_info scroll;
- struct s_redrw_slots redraw;
- struct s_caret caret;
- bool attached;
- bool reformat_pending;
-};
-
-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,
- GRECT * out);
-bool browser_input( struct gui_window * gw, unsigned short nkc ) ;
-void browser_redraw( struct gui_window * gw );
-void browser_set_content_size(struct gui_window * gw, int w, int h);
-void browser_scroll( struct gui_window * gw, short MODE, int value, bool abs );
-struct gui_window * browser_find_root( struct gui_window * gw );
-bool browser_redraw_required( struct gui_window * gw);
-//void browser_redraw_caret( struct gui_window * gw, GRECT * area);
-//void browser_restore_caret_background(struct gui_window * gw, GRECT * area);
-/* update loc / size of the browser widgets: */
-void browser_update_rects(struct gui_window * gw );
-/*
- This queues an redraw to one of the slots.
- 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 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.
-*/
-void browser_schedule_redraw_rect(struct gui_window * gw, short x, short y, short w, short h);
-void browser_schedule_redraw(struct gui_window * gw, short x, short y, short w, short h );
-
-#endif
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 035fbcc9f..664556463 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -40,7 +40,6 @@
#include "utils/messages.h"
#include "atari/gui.h"
-#include "atari/browser.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/clipboard.h"
@@ -70,7 +69,8 @@ static struct s_context_info * get_context_info( struct gui_window * gw, short m
hlcache_handle *h;
GRECT bwrect;
struct contextual_content ccdata;
- struct browser_window * bw = gw->browser->bw;
+ struct browser_window * bw = gw->browser->bw;
+ int sx, sy;
h = bw->current_content;
ctxinfo.flags = 0;
@@ -89,13 +89,14 @@ static struct s_context_info * get_context_info( struct gui_window * gw, short m
}
ctxinfo.flags |= CNT_BROWSER;
- memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 );
- browser_window_get_contextual_content(
- gw->browser->bw,
- mx+gw->browser->scroll.current.x,
- my+gw->browser->scroll.current.y,
- (struct contextual_content*)&ctxinfo.ccdata
- );
+
+ memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 );
+
+ gui_window_get_scroll(gw, &sx, &sy);
+
+ browser_window_get_contextual_content( gw->browser->bw, mx+sx, my+sy,
+ (struct contextual_content*)&ctxinfo.ccdata);
+
if( ctxinfo.ccdata.link_url ){
ctxinfo.flags |= CNT_HREF;
}
diff --git a/atari/deskmenu.c b/atari/deskmenu.c
index 4a6b08318..c6e7f27a9 100644
--- a/atari/deskmenu.c
+++ b/atari/deskmenu.c
@@ -17,7 +17,6 @@
#include "atari/search.h"
#include "atari/misc.h"
#include "atari/gui.h"
-#include "atari/browser.h"
#include "atari/findfile.h"
#include "atari/rootwin.h"
@@ -413,8 +412,8 @@ static void __CDECL menu_debug_render(short item, short title, void *data)
if( input_window != NULL ) {
if ( input_window->browser != NULL
&& input_window->browser->bw != NULL) {
- GRECT rect;
- browser_get_rect( input_window, BR_CONTENT, &rect );
+ GRECT rect;
+ window_get_grect(input_window->root, BROWSER_AREA_CONTENT, &rect);
browser_window_reformat(input_window->browser->bw, false,
rect.g_w, rect.g_h );
menu_icheck(h_gem_menu, MAINMENU_M_DEBUG_RENDER,
diff --git a/atari/gui.c b/atari/gui.c
index dac842c30..e5038dcf1 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -61,7 +61,6 @@
#include "atari/findfile.h"
#include "atari/schedule.h"
#include "atari/rootwin.h"
-#include "atari/browser.h"
#include "atari/statusbar.h"
#include "atari/toolbar.h"
#include "atari/verify_ssl.h"
@@ -213,7 +212,7 @@ gui_create_browser_window(struct browser_window *bw,
return NULL;
LOG(("new window: %p, bw: %p\n", gw, bw));
- window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\
+ window_create(gw, bw, clone, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\
|WIDGET_SCROLL);
if (gw->root->win) {
GRECT pos = {
@@ -260,7 +259,7 @@ void gui_window_destroy(struct gui_window *w)
}
search_destroy(w);
- browser_destroy(w->browser);
+ free(w->browser);
free(w->status);
free(w->title);
free(w->url);
@@ -298,7 +297,7 @@ void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
if (w == NULL)
return;
GRECT rect;
- browser_get_rect( w, BR_CONTENT, &rect );
+ window_get_grect(w->root, BROWSER_AREA_CONTENT, &rect);
*width = rect.g_w;
*height = rect.g_h;
}
@@ -431,9 +430,7 @@ void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int
*/
void gui_window_update_extent(struct gui_window *gw)
{
- int oldx, oldy;
- oldx = gw->browser->scroll.current.x;
- oldy = gw->browser->scroll.current.y;
+
if( gw->browser->bw->current_content != NULL ) {
// TODO: store content size!
if(window_get_active_gui_window(gw->root) == gw){
@@ -607,30 +604,8 @@ void gui_window_stop_throbber(struct gui_window *w)
/* Place caret in window */
void gui_window_place_caret(struct gui_window *w, int x, int y, int height)
{
- //printf("gw place caret\n");
-
window_place_caret(w->root, 1, x, y, height, NULL);
w->root->caret.state |= CARET_STATE_ENABLED;
-//
-// GRECT clip, dim;
-// struct guiwin_scroll_info_s * slid;
-// if (w == NULL)
-// return;
-//
-// slid = guiwin_get_scroll_info(w->root->win);
-// window_get_grect(w->root, BROWSER_AREA_CONTENT, &clip);
-// dim.g_x = x - (slid->x_pos * slid->x_unit_px);
-// dim.g_y = y - (slid->y_pos * slid->y_unit_px);
-// dim.g_h = height;
-// dim.g_w = 2;
-// caret_show(&w->caret, guiwin_get_vdi_handle(w->root->win), &dim, &clip);
-//// if( w->browser->caret.current.g_w > 0 )
-//// gui_window_remove_caret( w );
-//// w->browser->caret.requested.g_x = x;
-//// w->browser->caret.requested.g_y = y;
-//// w->browser->caret.requested.g_w = 1;
-//// w->browser->caret.requested.g_h = height;
-//// w->browser->caret.redraw = true;
return;
}
@@ -644,19 +619,11 @@ gui_window_remove_caret(struct gui_window *w)
if (w == NULL)
return;
-
-
- if(w->root->caret.dimensions.g_h > 0 ){
+ if ((w->root->caret.state & CARET_STATE_ENABLED) != 0) {
//printf("gw hide caret\n");
window_place_caret(w->root, 0, -1, -1, -1, NULL);
w->root->caret.state &= ~CARET_STATE_ENABLED;
}
-
-// if( w->browser->caret.background.fd_addr != NULL ) {
-// browser_restore_caret_background( w, NULL );
-// w->browser->caret.requested.g_w = 0;
-// w->browser->caret.current.g_w = 0;
-// }
return;
}
diff --git a/atari/gui.h b/atari/gui.h
index fafafbd30..209dc5d85 100755
--- a/atari/gui.h
+++ b/atari/gui.h
@@ -126,6 +126,13 @@ struct s_gui_win_root
};
typedef struct s_gui_win_root ROOTWIN;
+struct s_browser
+{
+ struct browser_window * bw;
+ bool attached;
+ bool reformat_pending;
+};
+
/*
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.
diff --git a/atari/rootwin.c b/atari/rootwin.c
index b4d566fbe..f902286bc 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -48,15 +48,14 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "css/css.h"
+
+#include "atari/res/netsurf.rsh"
#include "atari/gemtk/gemtk.h"
+#include "atari/ctxmenu.h"
#include "atari/gui.h"
#include "atari/rootwin.h"
-
#include "atari/misc.h"
#include "atari/plot/plot.h"
-
-#include "atari/res/netsurf.rsh"
-
#include "atari/toolbar.h"
#include "atari/statusbar.h"
#include "atari/search.h"
@@ -64,7 +63,6 @@
#include "atari/encoding.h"
#include "atari/redrawslots.h"
#include "atari/toolbar.h"
-#include "atari/browser.h"
#include "atari/gemtk/gemtk.h"
extern struct gui_window *input_window;
@@ -204,6 +202,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
int window_create(struct gui_window * gw,
struct browser_window * bw,
+ struct browser_window * clone,
unsigned long inflags)
{
int err = 0;
@@ -259,7 +258,16 @@ int window_create(struct gui_window * gw,
}
/* create browser component: */
- gw->browser = browser_create( gw, bw, NULL, CLT_HORIZONTAL, 1, 1 );
+ gw->browser = (CMP_BROWSER)malloc( sizeof(struct s_browser) );
+
+ assert(gw->browser);
+
+ gw->browser->bw = bw;
+ if(clone)
+ gw->browser->bw->scale = clone->scale;
+ else
+ gw->browser->bw->scale = 1;
+
/* create statusbar component: */
if(sb) {
@@ -777,7 +785,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
caret_pos.g_w = caret->dimensions.g_w;
caret_pos.g_h = caret->dimensions.g_h;
- if (rc_intersect(work, &caret_pos) /*&& redraw_active == false*/) {
+ if (rc_intersect(work, &caret_pos) && redraw_active == false) {
pxy[0] = 0;
pxy[1] = 0;
@@ -794,11 +802,10 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
// draw caret to screen coords:
vrt_cpyfm(vh, /*MD_REPLACE*/ MD_XOR, pxy, &caret->symbol, &screen, colors);
+ // update state:
+ caret->state |= CARET_STATE_VISIBLE;
}
- // update state:
- caret->state |= CARET_STATE_VISIBLE;
-
exit:
// disable clipping:
vs_clip(guiwin_get_vdi_handle(rootwin->win), 0, pxy);
@@ -903,6 +910,7 @@ void window_process_redraws(ROOTWIN * rootwin)
// force redraw of caret:
caret_h = rootwin->caret.dimensions.g_h;
rootwin->caret.dimensions.g_h = 0;
+ redraw_active = false;
window_place_caret(rootwin, 1, rootwin->caret.dimensions.g_x,
rootwin->caret.dimensions.g_y,
caret_h, &content_area);
@@ -1248,16 +1256,18 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
size, mx, my
));
{
- GRECT bwrect;
+ GRECT content_area;
struct browser_window * bw = gw->browser->bw;
- browser_get_rect(gw, BR_CONTENT, &bwrect);
- mx = mx - bwrect.g_x;
- my = my - bwrect.g_y;
- if( (mx < 0 || mx > bwrect.g_w) || (my < 0 || my > bwrect.g_h) )
+ window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area);
+ mx = mx - content_area.g_x;
+ my = my - content_area.g_y;
+ if( (mx < 0 || mx > content_area.g_w)
+ || (my < 0 || my > content_area.g_h) )
return;
utf8_convert_ret ret;
char *utf8_fn;
+ int sx, sy;
ret = utf8_from_local_encoding(buff, 0, &utf8_fn);
if (ret != UTF8_CONVERT_OK) {
@@ -1268,10 +1278,9 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
/* no memory */
return;
}
- browser_window_drop_file_at_point( gw->browser->bw,
- mx+gw->browser->scroll.current.x,
- my+gw->browser->scroll.current.y,
- utf8_fn );
+ gui_window_get_scroll(gw, &sx, &sy);
+ browser_window_drop_file_at_point( gw->browser->bw, mx+sx,
+ my+sy, utf8_fn );
free(utf8_fn);
free(buff);
}
diff --git a/atari/rootwin.h b/atari/rootwin.h
index 626858606..2efbe0b06 100755
--- a/atari/rootwin.h
+++ b/atari/rootwin.h
@@ -44,7 +44,9 @@ enum browser_area_e {
/* Creates an normal Browser window with [toolbar], [statusbar] */
int window_create(struct gui_window * gw,
- struct browser_window * bw, unsigned long flags );
+ struct browser_window * bw,
+ struct browser_window * clone,
+ unsigned long flags );
/* Destroys WinDom part of gui_window */
int window_destroy(ROOTWIN *rootwin);
diff --git a/atari/search.c b/atari/search.c
index cc58caa7b..a8bde07ce 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -39,7 +39,6 @@
#include "utils/messages.h"
#include "atari/gui.h"
#include "atari/misc.h"
-#include "atari/browser.h"
#include "atari/search.h"
#include "atari/gemtk/gemtk.h"
#include "atari/res/netsurf.rsh"
diff --git a/atari/toolbar.c b/atari/toolbar.c
index 9920b920f..d8c131f20 100644
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -46,7 +46,6 @@
#include "atari/clipboard.h"
#include "atari/misc.h"
-#include "atari/browser.h"
#include "atari/plot/plot.h"
#include "cflib.h"
#include "atari/res/netsurf.rsh"