diff options
author | Ole Loots <ole@monochrom.net> | 2012-12-18 01:10:20 +0100 |
---|---|---|
committer | Ole Loots <ole@monochrom.net> | 2012-12-18 01:10:20 +0100 |
commit | c6a5109a95c1206ccf63d99316fa12b8c43bb7cf (patch) | |
tree | b967622841c027122d9a3970705c0cce675e5249 | |
parent | 59a44380a6951b220c91d109532c24ecc7148361 (diff) | |
download | netsurf-c6a5109a95c1206ccf63d99316fa12b8c43bb7cf.tar.gz netsurf-c6a5109a95c1206ccf63d99316fa12b8c43bb7cf.tar.bz2 |
Preparing for merge...
-rw-r--r-- | atari/Makefile.target | 6 | ||||
-rw-r--r-- | atari/Makefile.target.orig | 120 | ||||
-rwxr-xr-x | atari/browser.c | 573 | ||||
-rwxr-xr-x | atari/browser.h | 6 | ||||
-rw-r--r-- | atari/caret.c | 129 | ||||
-rw-r--r-- | atari/caret.h | 17 | ||||
-rwxr-xr-x | atari/download.c | 4 | ||||
-rwxr-xr-x | atari/extract.php | 10 | ||||
-rw-r--r-- | atari/gemtk/gemtk.h | 3 | ||||
-rw-r--r-- | atari/gemtk/guiwin.c | 45 | ||||
-rw-r--r-- | atari/gemtk/redrawslots.c | 123 | ||||
-rw-r--r-- | atari/gemtk/redrawslots.h | 28 | ||||
-rwxr-xr-x | atari/gui.c | 94 | ||||
-rwxr-xr-x | atari/gui.h | 2 | ||||
-rwxr-xr-x | atari/history.c | 5 | ||||
-rwxr-xr-x | atari/history.h | 7 | ||||
-rwxr-xr-x | atari/hotlist.c | 6 | ||||
-rwxr-xr-x | atari/hotlist.h | 7 | ||||
-rwxr-xr-x | atari/res/netsurf.rsc | bin | 35788 -> 35786 bytes | |||
-rwxr-xr-x | atari/res/netsurf.rsh | 2 | ||||
-rwxr-xr-x | atari/res/netsurf.rsm | 6 |
21 files changed, 832 insertions, 361 deletions
diff --git a/atari/Makefile.target b/atari/Makefile.target index 616fa5ab8..849451873 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -73,12 +73,14 @@ LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib # S_ATARI are sources purely for the Atari FreeMiNT build -S_ATARI := gui.c \ +S_ATARI := \ + bitmap.c \ + caret.c \ findfile.c \ filetype.c \ font.c \ + gui.c \ misc.c \ - bitmap.c \ schedule.c \ download.c \ thumbnail.c \ diff --git a/atari/Makefile.target.orig b/atari/Makefile.target.orig new file mode 100644 index 000000000..25951b961 --- /dev/null +++ b/atari/Makefile.target.orig @@ -0,0 +1,120 @@ +# ---------------------------------------------------------------------------- +# Atari target setup +# ---------------------------------------------------------------------------- + +ifeq ($(ATARI_ARCH),68000) +PRGSUFFIX := 000.app +PKGNAME := ns000.zip +endif + +ifeq ($(ATARI_ARCH),68020-60) +CFLAGS += -m68020-60 +LDFLAGS += -m68020-60 +PRGSUFFIX := 020.app +PKGNAME := ns020.zip +endif + +ifeq ($(ATARI_ARCH),5475) +CFLAGS += -mcpu=5475 +LDFLAGS += -mcpu=5475 +PRGSUFFIX := v4e.app +PKGNAME := nsv4e.zip +endif + +# non-pkgconfig components + +FREETYPE_FONT_CFLAGS := $(shell freetype-config --cflags) -DWITH_FREETYPE_FONT_DRIVER +SPIDERMONKEY_CFLAGS := -DWITH_MOZJS -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE + +$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng))) +$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng))) +$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey))) +$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype))) +$(eval $(call feature_enabled,ATARI_NETSURF_FONT,-DWITH_INTERNAL_FONT_DRIVER,,(Internal Font))) +$(eval $(call feature_enabled,ATARI_8BPP_SUPPORT,-DWITH_8BPP_SUPPORT,,(Indexed screen format support))) + +# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here +NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG +NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB +NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP +NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF +NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0 +NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0 + +ifeq ($(NETSURF_USE_MOZJS),YES) +NETSURF_USE_JS:=YES +NETSURF_USE_MOZJS:=YES +endif + +$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP)) +$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF)) + +CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \ + -D_BSD_SOURCE \ + -D_XOPEN_SOURCE=600 \ + -D_POSIX_C_SOURCE=200112L \ + $(shell $(PKG_CONFIG) --cflags libhubbub libcss openssl ) \ + $(shell $(PKG_CONFIG) --cflags libxml-2.0 ) \ + $(shell $(PKG_CONFIG) --cflags libcurl ) + +LDFLAGS += -lcflib -lcurl +LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub +LDFLAGS += -lssl -lcrypto +LDFLAGS += -lxml2 -lz -liconv -lcares -lHermes -lwindom -lgem -lm +LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib + + +# S_ATARI are sources purely for the Atari FreeMiNT build +S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \ + download.c thumbnail.c login.c verify_ssl.c treeview.c hotlist.c history.c\ + search.c font.c \ + plot/plot.c plot/fontplot.c plot/eddi.s \ + plot/font_freetype.c plot/font_internal.c \ + redrawslots.c encoding.c \ + browser_win.c toolbar.c statusbar.c browser.c \ + global_evnt.c osspec.c dragdrop.c system_colour.c \ + ctxmenu.c save.c settings.c +S_ATARI := $(addprefix atari/,$(S_ATARI)) + +# This is the final source build list +# Note this is deliberately *not* expanded here as common and image +# are not yet available +SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI) +EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX) + +# ---------------------------------------------------------------------------- +# Install target +# ---------------------------------------------------------------------------- + +<<<<<<< Updated upstream +install-atari: + +# ---------------------------------------------------------------------------- +# Package target +# ---------------------------------------------------------------------------- + +package-atari: +======= +ATARI_INSTALL_TARGET_DIR := nsatari.package +ATARI_RES_DIR := atari/res + +install-atari: $(PKGNAME) + $(VQ)echo Creating $(PKGNAME) + +$(PKGNAME): $(EXETARGET) + $(Q)rm -rf $(ATARI_INSTALL_TARGET_DIR) + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/ + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/doc + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/download + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res + $(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/fonts + #$(Q)mkdir $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons + $(Q)touch $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/cookies + $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/netsurf.rsc + $(Q)cp $(ATARI_RES_DIR)/icons/ $(ATARI_INSTALL_TARGET_DIR)/netsurf/res/icons/ -R + + + $(Q)cp $(EXETARGET) $(ATARI_INSTALL_TARGET_DIR)/netsurf + +>>>>>>> Stashed changes diff --git a/atari/browser.c b/atari/browser.c index 83fcb43c3..ec2a64df5 100755 --- a/atari/browser.c +++ b/atari/browser.c @@ -43,7 +43,6 @@ #include "css/css.h"
#include "utils/log.h"
#include "utils/messages.h"
-
#include "atari/gui.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
@@ -273,9 +272,9 @@ static void __CDECL browser_evnt_mbutton( COMPONENT * c, short buff[8], void * d rel_cur_x, rel_cur_y);
}
}
- if( browser_redraw_required( gw ) ){
- browser_redraw( gw );
- }
+ //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;
@@ -478,9 +477,9 @@ static void browser_process_scroll( struct gui_window * gw, GRECT bwrect ) }
b->scroll.requested.y = 0;
b->scroll.requested.x = 0;
- if( b->caret.requested.g_w > 0 ){
- b->caret.redraw = true;
- }
+// if( b->caret.requested.g_w > 0 ){
+// b->caret.redraw = true;
+// }
// TODO: implement new sliding
//gw->root->handle->xpos = b->scroll.current.x;
@@ -557,23 +556,23 @@ bool browser_input( struct gui_window * gw, unsigned short nkc ) }
/* 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 );
-}
+//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 */
@@ -640,273 +639,273 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff, /*
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 = ▭
- }
- /* 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;
-}
+//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 = ▭
+// }
+// /* 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: */
- //assert( b->caret.background.fd_addr == NULL );
- 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;
- /* hide the mouse */
- v_hide_c (app.graf.handle);
- /* copy screen image */
- 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 */
- v_show_c ( app.graf.handle, 1);
- 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 */
-}
+//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)
{
diff --git a/atari/browser.h b/atari/browser.h index e855e591c..a442380ef 100755 --- a/atari/browser.h +++ b/atari/browser.h @@ -57,7 +57,7 @@ struct s_scroll_info This struct holds information of the cursor within the browser
viewport.
*/
-struct s_caret
+struct s_caret_old
{
GRECT requested;
GRECT current;
@@ -101,8 +101,8 @@ 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);
+//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 ); /*
diff --git a/atari/caret.c b/atari/caret.c new file mode 100644 index 000000000..42a35a452 --- /dev/null +++ b/atari/caret.c @@ -0,0 +1,129 @@ +#include <stdbool.h> + +#include "desktop/plot_style.h" +#include "atari/plot/plot.h" +#include "atari/caret.h" + +extern struct s_vdi_sysinfo vdi_sysinfo; + +static void caret_restore_background(struct s_caret *c, VdiHdl vh, GRECT *clip); + +void caret_show(struct s_caret *caret, VdiHdl vh, GRECT *dimensions, GRECT *clip) +{ + GRECT visible, old_dim; + MFDB screen; + short pxy[8]; + + struct rect old_clip; + + return; + + + + plot_get_clip(&old_clip); + plot_get_dimensions(&old_dim); + + + // store background: + visible = *dimensions; + visible.g_x += clip->g_x; + visible.g_y += clip->g_y; + + if(!rc_intersect(clip, &visible)){ + printf("no isect...\n"); + return; + } + + + // TODO: do not alloc / free on each move... + if (caret->background.fd_addr != NULL) { + //caret_restore_background(caret, vh, clip); + } + + plot_lock(); + plot_set_dimensions(clip->g_x, clip->g_y, clip->g_w, clip->g_h); + + caret->dimensions.g_x = dimensions->g_x; + caret->dimensions.g_y = dimensions->g_y; + caret->dimensions.g_w = visible.g_w; + caret->dimensions.g_h = visible.g_h; + + dbg_grect("clip", clip); + dbg_grect("visible", &visible); + // TODO: do not alloc / free on every redraw... + init_mfdb(vdi_sysinfo.scr_bpp, visible.g_w, visible.g_h, 0, + &caret->background); + init_mfdb(0, visible.g_w, visible.g_h, 0, &screen); + pxy[0] = visible.g_x;
+ pxy[1] = visible.g_y;
+ pxy[2] = visible.g_x + visible.g_w;
+ pxy[3] = visible.g_y + visible.g_h;
+ pxy[4] = 0;
+ pxy[5] = 0;
+ pxy[6] = visible.g_w;
+ pxy[7] = visible.g_h; + vro_cpyfm (vh, S_ONLY, pxy, &screen, &caret->background); + + plot_line(dimensions->g_x, dimensions->g_y, dimensions->g_x, + dimensions->g_y + dimensions->g_h, plot_style_caret); + + plot_set_dimensions(old_clip.x0, old_clip.y0, old_clip.x1, old_clip.y1); + plot_clip(&old_clip); + + plot_unlock(); + caret->visible = true; +} + +void caret_hide(struct s_caret *caret, VdiHdl vh, GRECT *clip) +{ + struct rect old_clip; + GRECT old_dim; + + plot_lock(); + plot_get_clip(&old_clip); + plot_get_dimensions(&old_dim); + plot_set_dimensions(clip->g_x, clip->g_y, clip->g_w, clip->g_h); + caret_restore_background(caret, vh, clip); + plot_set_dimensions(old_clip.x0, old_clip.y0, old_clip.x1, old_clip.y1); + plot_clip(&old_clip); + plot_unlock(); + caret->visible = false; +} + +static void caret_restore_background(struct s_caret *caret, VdiHdl vh, GRECT *clip) +{ + MFDB screen; + GRECT visible; + short pxy[8]; + + visible = caret->dimensions; + visible.g_x += clip->g_x; + visible.g_y += clip->g_y; + + dbg_grect("restore ", &visible); + + if(!rc_intersect(clip, &visible)){ + goto exit; + } + + // TODO: check isect + + // restore mfdb + + init_mfdb(0, caret->dimensions.g_w, caret->dimensions.g_h, 0, &screen); + pxy[0] = 0; + pxy[1] = 0;
+ pxy[2] = caret->dimensions.g_w; + pxy[3] = caret->dimensions.g_h;
+ pxy[4] = clip->g_x + caret->dimensions.g_x;
+ pxy[5] = clip->g_y + caret->dimensions.g_y;
+ pxy[6] = pxy[2];
+ pxy[7] = pxy[3]; + vro_cpyfm(vh, S_ONLY, pxy, &caret->background, &screen); + // exit: + // TODO: do not alloc / free on every redraw... + +exit: + free(caret->background.fd_addr); + caret->background.fd_addr = NULL; +} diff --git a/atari/caret.h b/atari/caret.h new file mode 100644 index 000000000..c9352dc8b --- /dev/null +++ b/atari/caret.h @@ -0,0 +1,17 @@ +#ifndef NS_ATARI_CARET_H +#define NS_ATARI_CARET_H + +#include <mt_gem.h> +#include <stdbool.h> + +struct s_caret { + GRECT dimensions; + MFDB background; + bool visible; +}; + +void caret_show(struct s_caret *c, VdiHdl vh, GRECT * dimensions, GRECT *clip); +void caret_hide(struct s_caret *c, VdiHdl vh, GRECT *clip); + +#endif // NS_ATARI_CARET_H + diff --git a/atari/download.c b/atari/download.c index 566f44a86..e35f31d9e 100755 --- a/atari/download.c +++ b/atari/download.c @@ -81,12 +81,10 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_CLOSED: // TODO: this needs to iterate through all gui windows and // check if the rootwin is this window... - printf("destroy...\n"); - on_close(data); + on_close(data); break; case WM_TOOLBAR: - printf("tb idx: %d\n", msg[4]); switch(msg[4]){ case DOWNLOAD_BT_ABORT: diff --git a/atari/extract.php b/atari/extract.php new file mode 100755 index 000000000..865b70ed7 --- /dev/null +++ b/atari/extract.php @@ -0,0 +1,10 @@ +#!/usr/bin/php +<? +$lines = file("deskmenu.c"); + +foreach($lines as $line){ + if(stripos($line, "static void __CDECL menu_") === 0){ + echo $line; + } +} +?> diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h index ad9253c63..1225a0ccd 100644 --- a/atari/gemtk/gemtk.h +++ b/atari/gemtk/gemtk.h @@ -112,13 +112,14 @@ void *guiwin_get_user_data(GUIWIN *win); struct guiwin_scroll_info_s * guiwin_get_scroll_info(GUIWIN *win); bool guiwin_update_slider(GUIWIN *win, short mode); void guiwin_scroll(GUIWIN *gw, short orientation, int units, bool refresh); +void guiwin_send_msg(GUIWIN *win, short msgtype, short a, short b, short c, + short d); void guiwin_send_redraw(GUIWIN *win, GRECT *area); VdiHdl guiwin_get_vdi_handle(GUIWIN *win); bool guiwin_has_intersection(GUIWIN *win, GRECT *work); void guiwin_toolbar_redraw(GUIWIN *win, GRECT *clip); void guiwin_clear(GUIWIN *win); - /* * AES Scroller Object */ diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c index c3042bcff..e587b97d1 100644 --- a/atari/gemtk/guiwin.c +++ b/atari/gemtk/guiwin.c @@ -282,12 +282,11 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]) } } else { - short info[4]; - wind_get( 0, WF_TOP, &info[0], &info[1], &info[2], &info[3]); + short h_aes; + h_aes = wind_find(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + if(h_aes > 0 && (ev_out->emo_events != MU_TIMER)) { - if(info[0] != 0 && info[1] == gl_apid) { - - dest = guiwin_find(info[0]); + dest = guiwin_find(h_aes); if(dest == NULL || dest->handler_func == NULL) return(0); @@ -309,16 +308,20 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]) dest->toolbar_idx, 8, ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + DEBUG_PRINT(("Toolbar index: %d\n", obj_idx)); short msg_out[8] = {WM_TOOLBAR, gl_apid, 0, dest->handle, obj_idx, ev_out->emo_mclicks, ev_out->emo_kmeta, 0 }; - if (((dest->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) - && (obj_idx > 0) - && (dest->toolbar[obj_idx].ob_flags & OF_SELECTABLE) != 0) { - dest->toolbar[obj_idx].ob_state |= OS_SELECTED; - // TODO: optimize redraw by setting the object clip: - guiwin_toolbar_redraw(dest, NULL); - } + if (obj_idx > 0) { + if ((dest->toolbar[obj_idx].ob_flags & OF_SELECTABLE)!=0 + && ((dest->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) + && ((dest->flags & GW_FLAG_TOOLBAR_REDRAW) == 0)) { + dest->toolbar[obj_idx].ob_state |= OS_SELECTED; + // TODO: optimize redraw by setting the object clip: + guiwin_toolbar_redraw(dest, NULL); + } + } + short oldevents = ev_out->emo_events; ev_out->emo_events = MU_MESAG; // notify the window about toolbar click: @@ -378,6 +381,8 @@ GUIWIN * guiwin_add(short handle, uint32_t flags, guiwin_event_handler_f cb) win->prev = tmp; win->next = NULL; } + + DEBUG_PRINT(("Added guiwin: %p, tb: %p\n", win, win->toolbar)); return(win); } @@ -429,6 +434,9 @@ short guiwin_remove(GUIWIN *win) void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest) { + + assert(win != NULL); + wind_get_grect(win->handle, WF_WORKXYWH, dest); if (mode == GUIWIN_AREA_CONTENT) { GRECT tb_area; @@ -680,8 +688,16 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area) }; EVMULT_OUT event_out; - if(area == NULL) { + if (area == NULL) { guiwin_get_grect(win, GUIWIN_AREA_WORK, &work); + if (work.g_w < 1 || work.g_h < 1) { + if (win->toolbar != NULL) { + guiwin_get_grect(win, GUIWIN_AREA_TOOLBAR, &work); + if (work.g_w < 1 || work.g_h < 1) { + return; + } + } + } area = &work; } @@ -786,6 +802,3 @@ void guiwin_clear(GUIWIN *win) wind_get_grect(win->handle, WF_NEXTXYWH, &g); } } - - - diff --git a/atari/gemtk/redrawslots.c b/atari/gemtk/redrawslots.c new file mode 100644 index 000000000..ee5627daf --- /dev/null +++ b/atari/gemtk/redrawslots.c @@ -0,0 +1,123 @@ +/*
+ * Copyright 2011 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/>.
+ */ + +#include <stdbool.h> +#define WITH_RECT +#include "gemtk.h" +#undef WITH_RECT + +void redraw_slots_init(struct s_redrw_slots * slots, short size) +{ + // TODO: allocate slots dynamically! + slots->size = MIN( MAX_REDRW_SLOTS , size); + slots->areas_used = 0; +} + +void redraw_slots_free(struct s_redrw_slots * slots) +{ + // TOOD: free areas... +} + + +static inline bool rect_intersect( struct rect * box1, struct rect * box2 )
+{
+ if (box2->x1 < box1->x0)
+ return false;
+
+ if (box2->y1 < box1->y0)
+ return false;
+
+ if (box2->x0 > box1->x1)
+ return false;
+
+ if (box2->y0 > box1->y1)
+ return false;
+
+ return true;
+} + + +void redraw_slot_schedule_grect(struct s_redrw_slots * slots, GRECT *area, + bool force) +{ + redraw_slot_schedule(slots, area->g_x, area->g_y, + area->g_x + area->g_w, area->g_y + area->g_h, force); +} + +/*
+ schedule redraw coords.
+*/
+void redraw_slot_schedule(struct s_redrw_slots * slots, short x0, short y0, + short x1, short y1, bool force)
+{
+ int i = 0;
+ struct rect area;
+
+ area.x0 = x0;
+ area.y0 = y0;
+ area.x1 = x1;
+ area.y1 = y1;
+ + if (force == false) {
+ for (i=0; i<slots->areas_used; i++) {
+ if (slots->areas[i].x0 <= x0
+ && slots->areas[i].x1 >= x1
+ && slots->areas[i].y0 <= y0
+ && slots->areas[i].y1 >= y1) {
+ /* the area is already queued for redraw */
+ return;
+ } else {
+ if (rect_intersect(&slots->areas[i], &area )) {
+ slots->areas[i].x0 = MIN(slots->areas[i].x0, x0);
+ slots->areas[i].y0 = MIN(slots->areas[i].y0, y0);
+ slots->areas[i].x1 = MAX(slots->areas[i].x1, x1);
+ slots->areas[i].y1 = MAX(slots->areas[i].y1, y1);
+ return;
+ }
+ }
+ } + }
+
+ if (slots->areas_used < slots->size) {
+ slots->areas[slots->areas_used].x0 = x0;
+ slots->areas[slots->areas_used].x1 = x1;
+ slots->areas[slots->areas_used].y0 = y0;
+ slots->areas[slots->areas_used].y1 = y1;
+ slots->areas_used++;
+ } else {
+ /*
+ we are out of available slots, merge box with last slot
+ this is dumb... but also a very rare case.
+ */
+ slots->areas[slots->size-1].x0 = MIN(slots->areas[i].x0, x0);
+ slots->areas[slots->size-1].y0 = MIN(slots->areas[i].y0, y0);
+ slots->areas[slots->size-1].x1 = MAX(slots->areas[i].x1, x1);
+ slots->areas[slots->size-1].y1 = MAX(slots->areas[i].y1, y1);
+ }
+done: + return;
+} + +void redraw_slots_remove_area(struct s_redrw_slots * slots, int i) +{ + int x; + for(x = i+1; i<slots->areas_used; x++){ + slots->areas[x-1] = slots->areas[x]; + } + slots->areas_used--; +} diff --git a/atari/gemtk/redrawslots.h b/atari/gemtk/redrawslots.h new file mode 100644 index 000000000..d045b3965 --- /dev/null +++ b/atari/gemtk/redrawslots.h @@ -0,0 +1,28 @@ +/*
+ * Copyright 2012 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 ATARI_REDRAW_SLOTS_H +#define ATARI_REDRAW_SLOTS_H + +#include <mt_gem.h> +#include "utils/types.h" + + + +#endif diff --git a/atari/gui.c b/atari/gui.c index 165fff65a..51865b987 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -144,13 +144,23 @@ void gui_poll(bool active) } /* this suits for stuff with lower priority */ /* TBD: really be spare on redraws??? */ - hotlist_redraw(); - global_history_redraw(); + //hotlist_redraw(); + //global_history_redraw(); } // Handle events until there are no more messages pending or // until the engine indicates activity: - if(!(active || rendering) || (clock() >= next_poll)){ + bool skip = false; +/* + if (active || rendering){ + if ((clock() < next_poll)){ + skip = true; + } else { + next_poll = clock() + (CLOCKS_PER_SEC>>5); + } + } +*/ + //if (skip == false) { do { short mx, my, dummy; @@ -163,15 +173,14 @@ void gui_poll(bool active) LOG(("WM: %d\n", aes_msg_out[0])); switch(aes_msg_out[0]) { - case MN_SELECTED: - LOG(("Menu Item: %d\n",aes_msg_out[4])); - deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]); - break; - default: - break; - } + case MN_SELECTED: + LOG(("Menu Item: %d\n",aes_msg_out[4])); + deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]); + break; + default: + break; + } } - if((aes_event_out.emo_events & MU_KEYBD) != 0) { uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta, (short)aes_event_out.emo_kreturn); @@ -180,12 +189,12 @@ void gui_poll(bool active) } } } while ( gui_poll_repeat && !(active||rendering)); - if(input_window && input_window->root->redraw_slots.areas_used > 0 && !active){ + if(input_window && input_window->root->redraw_slots.areas_used > 0){ window_process_redraws(input_window->root); } - if(active || rendering) - next_poll = clock() + (CLOCKS_PER_SEC>>3); - } + //} else { + //printf("skip poll %d (%d)\n", next_poll, clock()); + //} } @@ -374,10 +383,11 @@ void gui_window_update_box(struct gui_window *gw, const struct rect *rect) slid = guiwin_get_scroll_info(gw->root->win); guiwin_get_grect(gw->root->win, GUIWIN_AREA_CONTENT, &area); - area.g_x += rect->x0; - area.g_y += rect->y0; + area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px); + area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px); area.g_w = rect->x1 - rect->x0; area.g_h = rect->y1 - rect->y0; + //dbg_grect("update box", &area); window_schedule_redraw_grect(gw->root, &area); } @@ -597,15 +607,26 @@ 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) { + + GRECT clip, dim; + struct guiwin_scroll_info_s * slid; if (w == NULL) return; - 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; + + 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; } @@ -619,11 +640,11 @@ gui_window_remove_caret(struct gui_window *w) if (w == NULL) return; - 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; - } +// 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; } @@ -829,16 +850,18 @@ void gui_401login_open(nsurl *url, const char *realm, { bool bres; char * out = NULL; - bres = login_form_do( url, (char*)realm, &out ); - if( bres ) { + bres = login_form_do( url, (char*)realm, &out); + if (bres) { LOG(("url: %s, realm: %s, auth: %s\n", url, realm, out )); - urldb_set_auth_details(url, realm, out ); + urldb_set_auth_details(url, realm, out); } - if( out != NULL ) { + if (out != NULL) { free( out ); } - if( cb != NULL ) - cb(bres, cbpw); + if (cb != NULL) { + cb(bres, cbpw); + } + } void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, @@ -1065,6 +1088,7 @@ static void gui_init(int argc, char** argv) aes_event_in.emi_m1leave = MO_LEAVE; aes_event_in.emi_m1.g_w = 1; aes_event_in.emi_m1.g_h = 1; + next_poll = clock() + (CLOCKS_PER_SEC>>3); } diff --git a/atari/gui.h b/atari/gui.h index 7bedd2b39..0fc1a2c3c 100755 --- a/atari/gui.h +++ b/atari/gui.h @@ -20,6 +20,7 @@ #define NS_ATARI_GUI_H_ #include "atari/redrawslots.h" +#include "atari/caret.h" #include "atari/gemtk/gemtk.h" struct point_s { @@ -126,6 +127,7 @@ struct gui_window { char * title; char * url; struct bitmap * icon; + struct s_caret caret; struct gui_window *next, *prev; }; diff --git a/atari/history.c b/atari/history.c index e7db74bae..f9faef555 100755 --- a/atari/history.c +++ b/atari/history.c @@ -131,6 +131,11 @@ bool global_history_init( void ) void global_history_destroy( void ) { + +void global_history_redraw( void )
+{
+ atari_treeview_redraw( gl_history.tv );
+} if( gl_history.init == false ) { return; } diff --git a/atari/history.h b/atari/history.h index 2935793ac..3ea2621bf 100755 --- a/atari/history.h +++ b/atari/history.h @@ -39,11 +39,8 @@ void global_history_destroy( void ); void global_history_open( void ); void global_history_close( void ); -inline void global_history_redraw( void ); -inline void global_history_redraw( void )
-{
- atari_treeview_redraw( gl_history.tv );
-} +void global_history_redraw( void ); + #endif diff --git a/atari/hotlist.c b/atari/hotlist.c index f79a16187..66e7560ea 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -180,6 +180,12 @@ void hotlist_close(void) void hotlist_destroy(void) { + +void hotlist_redraw(void)
+{ + int i = 01;
+ atari_treeview_redraw(hl.tv);
+} if( hl.init == false ) { return; } diff --git a/atari/hotlist.h b/atari/hotlist.h index 858d1a1bf..ed965a5a7 100755 --- a/atari/hotlist.h +++ b/atari/hotlist.h @@ -41,10 +41,7 @@ void hotlist_close( void ); void hotlist_destroy( void );
void atari_hotlist_add_page( const char * url, const char * title );
-inline void hotlist_redraw( void );
-inline void hotlist_redraw( void )
-{
- atari_treeview_redraw( hl.tv );
-}
+void hotlist_redraw( void );
+
#endif diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc Binary files differindex 6addf8260..cb8a3a046 100755 --- a/atari/res/netsurf.rsc +++ b/atari/res/netsurf.rsc diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh index 824552688..0b3961cd3 100755 --- a/atari/res/netsurf.rsh +++ b/atari/res/netsurf.rsh @@ -113,7 +113,7 @@ #define DOWNLOAD_LBL_BYTES 6 /* TEXT in tree DOWNLOAD */
#define DOWNLOAD_LBL_PERCENT 7 /* TEXT in tree DOWNLOAD */
#define DOWNLOAD_LBL_SPEED 8 /* TEXT in tree DOWNLOAD */
-#define DOWNLOAD_CB_CLOSE_RDY 9 /* BUTTON in tree DOWNLOAD */
+#define DOWNLOAD_CB_CLOSE_RDY 9 /* BOXCHAR in tree DOWNLOAD */
#define ABOUT 11 /* form/dial */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm index 6c8e2e1c1..3e12e13f8 100755 --- a/atari/res/netsurf.rsm +++ b/atari/res/netsurf.rsm @@ -3,7 +3,7 @@ ResourceMaster v3.65 #N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@1@1@
-#M 20010100@0@7728@623@
+#M 20010100@0@7728@624@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -107,7 +107,7 @@ ResourceMaster v3.65 #O 6@21@LBL_BYTES@@
#O 7@21@LBL_PERCENT@@
#O 8@21@LBL_SPEED@@
-#O 9@26@CB_CLOSE_RDY@@
+#O 9@27@CB_CLOSE_RDY@@
#T 11@2@ABOUT@@2@@
#T 12@2@POP_CTX@@12@@
#O 1@21@CUT_SEL@@
@@ -198,4 +198,4 @@ ResourceMaster v3.65 #O 5@33@BT_DOWN_PIC@@
#O 6@25@BT_UP@@
#O 4@33@BT_UP_PIC@@
-#c 32640@
+#c 205@
|