From 54f719aa960159c5b1978846223732c9669ca7fa Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Thu, 31 Jan 2013 19:22:35 +0100 Subject: Some more finetuning... --- atari/Makefile.defaults | 4 + atari/Makefile.target | 2 + atari/deskmenu.c | 9 +- atari/encoding.c | 2 + atari/gemtk/gemtk.h | 11 +- atari/gemtk/guiwin.c | 77 +++++++++---- atari/gui.c | 281 +++++++++++++++++++++------------------------ atari/history.c | 4 +- atari/hotlist.c | 7 +- atari/plot/font_freetype.c | 7 +- atari/plot/font_internal.c | 16 ++- atari/plot/font_vdi.c | 207 +++++++++++++++++++++++---------- atari/plot/plot.c | 72 ++++++------ atari/plot/plot.h | 4 +- atari/rootwin.c | 39 ++++--- atari/settings.c | 2 +- atari/toolbar.c | 8 +- atari/treeview.c | 9 +- 18 files changed, 448 insertions(+), 313 deletions(-) diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults index a8b1857df..83464d6fd 100644 --- a/atari/Makefile.defaults +++ b/atari/Makefile.defaults @@ -32,6 +32,10 @@ # Valid options: YES, NO NETSURF_USE_ATARI_NETSURF_FONT := YES + # Enable VDI Font rendering + # Valid options: YES, NO + NETSURF_USE_ATARI_VDI_FONT := NO + # Configure support for screen drivers with no true colour mode # Valid options: YES, NO NETSURF_USE_ATARI_8BPP_SUPPORT := NO diff --git a/atari/Makefile.target b/atari/Makefile.target index 169e3c742..d3392928d 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -40,6 +40,7 @@ $(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_VDI_FONT,-DWITH_VDI_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 @@ -104,6 +105,7 @@ S_ATARI := \ plot/eddi.s \ plot/font_freetype.c \ plot/font_internal.c \ + plot/font_vdi.c \ gemtk/aestabs.c \ gemtk/dragdrop.c \ gemtk/guiwin.c \ diff --git a/atari/deskmenu.c b/atari/deskmenu.c index 0811b1230..df31ba012 100644 --- a/atari/deskmenu.c +++ b/atari/deskmenu.c @@ -268,8 +268,13 @@ static void __CDECL menu_find(short item, short title, void *data) { static bool visible = false; LOG(("%s", __FUNCTION__)); - if( input_window != NULL ){ - window_open_search(input_window->root, true); + if (input_window != NULL) { + if (input_window->search) { + window_close_search(input_window->root); + } + else { + window_open_search(input_window->root, true); + } } } diff --git a/atari/encoding.c b/atari/encoding.c index 2cd26709a..75d0fec90 100644 --- a/atari/encoding.c +++ b/atari/encoding.c @@ -67,3 +67,5 @@ int atari_to_ucs4(unsigned char atari) ucs4 = (int)atari; return( ucs4 ); } + + diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h index e187aea6c..1853e75bc 100644 --- a/atari/gemtk/gemtk.h +++ b/atari/gemtk/gemtk.h @@ -112,7 +112,7 @@ short gemtk_msg_box_show(short type, const char * msg); #define GEMTK_WM_VSLIDER 0x01 #define GEMTK_WM_HSLIDER 0x02 -#define GEMTK_WM_VH_SLIDER 0x03 +#define GEMTK_WM_VH_SLIDER 0x03 /* Message sent to the client application when an AES object is @@ -123,7 +123,8 @@ short gemtk_msg_box_show(short type, const char * msg); msg[5] = Number of clicks. msg[6] = Modifier keys. */ -#define GEMTK_WM_WM_FORM 1001 +#define GEMTK_WM_WM_FORM_CLICK 1001 +#define GEMTK_WM_WM_FORM_KEY 1002 struct gemtk_window_s; @@ -182,6 +183,10 @@ short gemtk_wm_remove(GUIWIN *win); GUIWIN * gemtk_wm_validate_ptr(GUIWIN *win); +GUIWIN *gemtk_wm_link(GUIWIN *win); + +GUIWIN *gemtk_wm_unlink(GUIWIN *win); + short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8]); void gemtk_wm_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest); @@ -224,6 +229,8 @@ void gemtk_wm_send_redraw(GUIWIN *win, GRECT *area); VdiHdl gemtk_wm_get_vdi_handle(GUIWIN *win); +short getm_wm_get_toolbar_edit_obj(GUIWIN *win); + bool gemtk_wm_has_intersection(GUIWIN *win, GRECT *work); void gemtk_wm_toolbar_redraw(GUIWIN *win, uint16_t msg, GRECT *clip); diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c index 95e9b085c..0334e58df 100644 --- a/atari/gemtk/guiwin.c +++ b/atari/gemtk/guiwin.c @@ -434,7 +434,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) } short oldevents = ev_out->emo_events; - short msg_out[8] = { GEMTK_WM_WM_FORM, gl_apid, + short msg_out[8] = { GEMTK_WM_WM_FORM_CLICK, gl_apid, 0, gw->handle, gw->form_focus_obj, ev_out->emo_mclicks, ev_out->emo_kmeta, 0 @@ -484,7 +484,9 @@ static short preproc_mu_keybd(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8]) ev_out->emo_kreturn, &edit_idx, EDCHAR, gw->handle); } - retval = 1; + //retval = 1; + /*gemtk_wm_send_msg(gw, GEMTK_WM_WM_FORM_KEY, gw->toolbar_edit_obj, + ev_out->emo_kreturn, 0, 0);*/ } if((gw->form != NULL) && (gw->form_edit_obj > -1) ) { @@ -649,19 +651,7 @@ GUIWIN * gemtk_wm_add(short handle, uint32_t flags, gemtk_wm_event_handler_f cb) win->handle = handle; win->handler_func = cb; win->flags = flags; - if (winlist == NULL) { - winlist = win; - win->next = NULL; - win->prev = NULL; - } else { - GUIWIN *tmp = winlist; - while( tmp->next != NULL ) { - tmp = tmp->next; - } - tmp->next = win; - win->prev = tmp; - win->next = NULL; - } + gemtk_wm_link(win); DEBUG_PRINT(("Added guiwin: %p, tb: %p\n", win, win->toolbar)); return(win); @@ -700,15 +690,41 @@ GUIWIN *gemtk_wm_validate_ptr(GUIWIN *win) return(NULL); } -/** -* Remove an GUIWIN from the list of managed windows. -* Call this when the AES window is closed or deleted. -*/ -short gemtk_wm_remove(GUIWIN *win) +GUIWIN *gemtk_wm_link(GUIWIN *win) { - win = gemtk_wm_validate_ptr(win); - if (win == NULL) - return(-1); + /* Make sure the window is not linked: */ + GUIWIN *win_val = gemtk_wm_validate_ptr(win); + if(win_val){ + DEBUG_PRINT(("GUIWIN %p is already linked!\n", win)); + return(NULL); + } + + if (winlist == NULL) { + winlist = win; + win->next = NULL; + win->prev = NULL; + } else { + GUIWIN *tmp = winlist; + while( tmp->next != NULL ) { + tmp = tmp->next; + } + tmp->next = win; + win->prev = tmp; + win->next = NULL; + } +} + +GUIWIN *gemtk_wm_unlink(GUIWIN *win) +{ + GUIWIN * win_val; + + /* Make sure the window is linked: */ + win_val = gemtk_wm_validate_ptr(win); + if (win_val == NULL){ + DEBUG_PRINT(("GUIWIN %p is not linked!\n", win)); + return(NULL); + } + /* unlink the window: */ if(win->prev != NULL ) { @@ -719,6 +735,16 @@ short gemtk_wm_remove(GUIWIN *win) if (win->next != NULL) { win->next->prev = win->prev; } + return(win); +} + +/** +* Remove an GUIWIN from the list of managed windows and free the GUIWIN. +* Call this when the AES window is closed or deleted. +*/ +short gemtk_wm_remove(GUIWIN *win) +{ + gemtk_wm_unlink(win); DEBUG_PRINT(("guiwin free: %p\n", win)); free(win); return(0); @@ -990,6 +1016,11 @@ void gemtk_wm_set_toolbar_size(GUIWIN *win, uint16_t s) win->toolbar_size = s; } +short getm_wm_get_toolbar_edit_obj(GUIWIN *win) +{ + return(win->toolbar_edit_obj); +} + /** Set the current active edit object */ void gemtk_wm_set_toolbar_edit_obj(GUIWIN *win, uint16_t obj, short kreturn) { diff --git a/atari/gui.c b/atari/gui.c index c957bafe3..a59caa8e5 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -81,7 +81,6 @@ struct gui_window *window_list = NULL; void * h_gem_rsrc; long next_poll; bool rendering = false; -bool gui_poll_repeat = false; GRECT desk_area; @@ -117,81 +116,68 @@ short aes_msg_out[8]; void gui_poll(bool active) { + struct gui_window *tmp; short mx, my, dummy; - unsigned short nkc = 0; - - gui_poll_repeat = false; + unsigned short nkc = 0; aes_event_in.emi_tlow = schedule_run(); - if(active || rendering) - aes_event_in.emi_tlow = 0; + if(active || rendering) + aes_event_in.emi_tlow = 0; - if(aes_event_in.emi_tlow < 0){ - aes_event_in.emi_tlow = 10000; - printf("long poll!\n"); - } + if(aes_event_in.emi_tlow < 0) { + aes_event_in.emi_tlow = 10000; + printf("long poll!\n"); + } struct gui_window * g; if( !active ) { - if(input_window && input_window->root->redraw_slots.areas_used > 0){ - window_process_redraws(input_window->root); - } - /* this suits for stuff with lower priority */ - /* TBD: really be spare on redraws??? */ - hotlist_redraw(); - global_history_redraw(); + if(input_window && input_window->root->redraw_slots.areas_used > 0) { + window_process_redraws(input_window->root); + } } - // Handle events until there are no more messages pending or - // until the engine indicates activity: - 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; - - graf_mkstate(&mx, &my, &dummy, &dummy); - aes_event_in.emi_m1.g_x = mx; - aes_event_in.emi_m1.g_y = my; - evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out); - if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) { - if( (aes_event_out.emo_events & MU_MESAG) != 0 ) { - 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; - } - } - 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); - deskmenu_dispatch_keypress(aes_event_out.emo_kreturn, - aes_event_out.emo_kmeta, nkc); - } - } - } while ( gui_poll_repeat && !(active||rendering)); - if(input_window && input_window->root->redraw_slots.areas_used > 0){ - window_process_redraws(input_window->root); + graf_mkstate(&mx, &my, &dummy, &dummy); + aes_event_in.emi_m1.g_x = mx; + aes_event_in.emi_m1.g_y = my; + evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out); + if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) { + if( (aes_event_out.emo_events & MU_MESAG) != 0 ) { + 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; + } + } + 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); + deskmenu_dispatch_keypress(aes_event_out.emo_kreturn, + aes_event_out.emo_kmeta, nkc); + } + } + + tmp = window_list; + while(tmp){ + if(tmp->root->redraw_slots.areas_used > 0){ + window_process_redraws(tmp->root); } - //} else { - //printf("skip poll %d (%d)\n", next_poll, clock()); - //} + tmp = tmp->next; + } + if(hl.tv->redraw){ + atari_treeview_redraw(hl.tv); + } + + if(gl_history.tv->redraw){ + atari_treeview_redraw(gl_history.tv); + } } @@ -248,11 +234,11 @@ void gui_window_destroy(struct gui_window *w) LOG(("%s\n", __FUNCTION__ )); - if (input_window == w) { - gui_set_input_gui_window(NULL); + if (input_window == w) { + gui_set_input_gui_window(NULL); } - nsatari_search_session_destroy(w->search); + nsatari_search_session_destroy(w->search); free(w->browser); free(w->status); free(w->title); @@ -273,11 +259,11 @@ void gui_window_destroy(struct gui_window *w) free(w); w = NULL; - if(input_window == NULL){ + if(input_window == NULL) { w = window_list; while( w != NULL ) { if(w->root) { - gui_set_input_gui_window(w); + gui_set_input_gui_window(w); break; } w = w->next; @@ -307,7 +293,7 @@ void gui_window_set_title(struct gui_window *gw, const char *title) int l; char * conv; l = strlen(title)+1; - if (utf8_to_local_encoding(title, l, &conv) == UTF8_CONVERT_OK ) { + if (utf8_to_local_encoding(title, l-1, &conv) == UTF8_CONVERT_OK ) { l = MIN((uint32_t)atari_sysinfo.aes_max_win_title_len, strlen(conv)); if(gw->title == NULL) gw->title = malloc(l); @@ -367,8 +353,8 @@ void gui_window_redraw_window(struct gui_window *gw) void gui_window_update_box(struct gui_window *gw, const struct rect *rect) { - GRECT area; - struct gemtk_wm_scroll_info_s *slid; + GRECT area; + struct gemtk_wm_scroll_info_s *slid; if (gw == NULL) return; @@ -376,8 +362,8 @@ void gui_window_update_box(struct gui_window *gw, const struct rect *rect) slid = gemtk_wm_get_scroll_info(gw->root->win); window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); - 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_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); @@ -386,11 +372,11 @@ void gui_window_update_box(struct gui_window *gw, const struct rect *rect) bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) { - int x,y; + int x,y; if (w == NULL) return false; - window_get_scroll(w->root, sx, sy); + window_get_scroll(w->root, sx, sy); return( true ); } @@ -399,12 +385,12 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy) { int units = 0; if ((w == NULL) - || (w->browser->bw == NULL) - || (w->browser->bw->current_content == NULL)) - return; + || (w->browser->bw == NULL) + || (w->browser->bw->current_content == NULL)) + return; - //printf("scroll %d, %d\n", sx, sy); - window_scroll_by(w->root, sx, sy); + LOG(("scroll (gui_window: %p) %d, %d\n", w, sx, sy)); + window_scroll_by(w->root, sx, sy); return; } @@ -412,9 +398,7 @@ void gui_window_set_scroll(struct gui_window *w, int sx, int sy) void gui_window_scroll_visible(struct gui_window *w, int x0, int y0, int x1, int y1) { LOG(("%s:(%p, %d, %d, %d, %d)", __func__, w, x0, y0, x1, y1)); - printf("scroll visible\n"); gui_window_set_scroll(w,x0,y0); - //browser_schedule_redraw_rect( w, 0, 0, x1-x0,y1-y0); } @@ -427,11 +411,11 @@ void gui_window_update_extent(struct gui_window *gw) if( gw->browser->bw->current_content != NULL ) { // TODO: store content size! - if(window_get_active_gui_window(gw->root) == gw){ + if(window_get_active_gui_window(gw->root) == gw) { window_set_content_size( gw->root, - content_get_width(gw->browser->bw->current_content), - content_get_height(gw->browser->bw->current_content) - ); + content_get_width(gw->browser->bw->current_content), + content_get_height(gw->browser->bw->current_content) + ); window_update_back_forward(gw->root); GRECT area; window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area); @@ -549,7 +533,7 @@ void gui_window_set_url(struct gui_window *w, const char *url) } strncpy(w->url, url, l); w->url[l] = 0; - if(input_window == w->root->active_gui_window){ + if(input_window == w->root->active_gui_window) { toolbar_set_url(w->root->toolbar, url); } } @@ -599,8 +583,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) { - window_place_caret(w->root, 1, x, y, height, NULL); - w->root->caret.state |= CARET_STATE_ENABLED; + window_place_caret(w->root, 1, x, y, height, NULL); + w->root->caret.state |= CARET_STATE_ENABLED; return; } @@ -614,11 +598,11 @@ gui_window_remove_caret(struct gui_window *w) if (w == NULL) return; - 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->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; + } return; } @@ -629,7 +613,7 @@ gui_window_set_icon(struct gui_window *g, hlcache_handle *icon) bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL; g->icon = bmp_icon; - if(input_window == g){ + if(input_window == g) { window_set_icon(g->root, bmp_icon); } } @@ -642,10 +626,10 @@ gui_window_set_search_ico(hlcache_handle *ico) void gui_window_new_content(struct gui_window *w) { - struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win); - slid->x_pos = 0; - slid->y_pos = 0; - gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER); + struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(w->root->win); + slid->x_pos = 0; + slid->y_pos = 0; + gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER); gui_window_redraw_window(w); } @@ -696,37 +680,36 @@ void gui_start_selection(struct gui_window *w) */ void gui_get_clipboard(char **buffer, size_t *length) { - char *clip; - size_t clip_len; + char *clip; + size_t clip_len; - *length = 0; - *buffer = 0; + *length = 0; + *buffer = 0; - clip = scrap_txt_read(); + clip = scrap_txt_read(); - if(clip == NULL){ - return; - } else { + if(clip == NULL) { + return; + } else { - // clipboard is in atari encoding, convert it to utf8: + // clipboard is in atari encoding, convert it to utf8: - char *utf8 = NULL; - utf8_convert_ret ret; + char *utf8 = NULL; + utf8_convert_ret ret; - clip_len = strlen(clip); - if (clip_len > 0) { - ret = utf8_to_local_encoding(clip, clip_len, &utf8); - if (ret == UTF8_CONVERT_OK && utf8 != NULL) { - *buffer = utf8; - *length = strlen(utf8); - } - else { - assert(ret == UTF8_CONVERT_OK && utf8 != NULL); - } - } + clip_len = strlen(clip); + if (clip_len > 0) { + ret = utf8_to_local_encoding(clip, clip_len, &utf8); + if (ret == UTF8_CONVERT_OK && utf8 != NULL) { + *buffer = utf8; + *length = strlen(utf8); + } else { + assert(ret == UTF8_CONVERT_OK && utf8 != NULL); + } + } - free(clip); - } + free(clip); + } } /** @@ -738,23 +721,23 @@ void gui_get_clipboard(char **buffer, size_t *length) * \param n_styles Number of text run styles in array */ void gui_set_clipboard(const char *buffer, size_t length, - nsclipboard_styles styles[], int n_styles) + nsclipboard_styles styles[], int n_styles) { - if (length > 0 && buffer != NULL) { + if (length > 0 && buffer != NULL) { - // convert utf8 input to atari encoding: + // convert utf8 input to atari encoding: - utf8_convert_ret ret; - char *clip = NULL; + utf8_convert_ret ret; + char *clip = NULL; - ret = utf8_to_local_encoding(buffer,length, &clip); - if (ret == UTF8_CONVERT_OK) { - scrap_txt_write(clip); - } else { - assert(ret == UTF8_CONVERT_OK); - } - free(clip); - } + ret = utf8_to_local_encoding(buffer,length, &clip); + if (ret == UTF8_CONVERT_OK) { + scrap_txt_write(clip); + } else { + assert(ret == UTF8_CONVERT_OK); + } + free(clip); + } } @@ -787,7 +770,7 @@ void gui_401login_open(nsurl *url, const char *realm, free( out ); } if (cb != NULL) { - cb(bres, cbpw); + cb(bres, cbpw); } } @@ -810,8 +793,8 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, void gui_set_input_gui_window(struct gui_window *gw) { - LOG(("Setting input window from: %p to %p\n", input_window, gw)); - input_window = gw; + LOG(("Setting input window from: %p to %p\n", input_window, gw)); + input_window = gw; } void gui_quit(void) @@ -863,7 +846,7 @@ process_cmdline(int argc, char** argv) option_window_y = nsoption_int(window_y); if (option_window_width <= desk_area.g_w - && option_window_height < desk_area.g_h) { + && option_window_height < desk_area.g_h) { set_default_dimensions = false; } } @@ -962,7 +945,7 @@ static void gui_init(int argc, char** argv) die("Uable to open GEM Resource file!"); } - wind_get_grect(0, WF_WORKXYWH, &desk_area); + wind_get_grect(0, WF_WORKXYWH, &desk_area); create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand ); create_cursor(0, TEXT_CRSR, NULL, &gem_cursors.ibeam ); @@ -1005,19 +988,19 @@ static void gui_init(int argc, char** argv) if (process_cmdline(argc,argv) != true) die("unable to process command line.\n"); - LOG(("Initializing NKC...")); + LOG(("Initializing NKC...")); nkc_init(); - LOG(("Initializing plotters...")); + LOG(("Initializing plotters...")); plot_init(nsoption_charp(atari_font_driver)); tree_set_icon_dir(nsoption_charp(tree_icons_path)); - 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); + 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); } static char *theapp = (char*)"NetSurf"; @@ -1072,7 +1055,7 @@ int main(int argc, char** argv) graf_mouse( ARROW , NULL); - LOG(("Creating initial browser window...")); + LOG(("Creating initial browser window...")); browser_window_create(option_homepage_url, 0, 0, true, false); LOG(("Entering NetSurf mainloop...")); @@ -1084,7 +1067,7 @@ int main(int argc, char** argv) fclose(stdout); fclose(stderr); #endif - exit_gem(); + exit_gem(); return 0; } diff --git a/atari/history.c b/atari/history.c index 6d52c4e91..aa32cbf7e 100755 --- a/atari/history.c +++ b/atari/history.c @@ -83,7 +83,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { NSTREEVIEW tv=NULL; - printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open); + //printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open); if(ev_out->emo_events & MU_MESAG){ switch (msg[0]) { @@ -121,6 +121,8 @@ bool global_history_init( void ) gl_history.tv = atari_treeview_create(history_global_get_tree_flags(), gl_history.window, handle_event); + gemtk_wm_unlink(gl_history.window); + if (gl_history.tv == NULL) { /* TODO: handle it properly, clean up previous allocs */ LOG(("Failed to allocate history treeview")); diff --git a/atari/hotlist.c b/atari/hotlist.c index ede5814e7..3684a9a85 100755 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -89,7 +89,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) break; case WM_CLOSED: - hotlist_destroy(); + hotlist_close(); break; default: break; @@ -129,6 +129,7 @@ void hotlist_init(void) } wind_set_str(handle, WF_NAME, (char*)messages_get("Hotlist")); gemtk_wm_set_toolbar(hl.window, tree, 0, 0); + gemtk_wm_unlink(hl.window); hl.tv = atari_treeview_create( hotlist_get_tree_flags(), hl.window, @@ -181,7 +182,7 @@ void hotlist_close(void) { wind_close(gemtk_wm_get_handle(hl.window)); hl.open = false; - atari_treeview_close( hl.tv ); + atari_treeview_close(hl.tv); } void hotlist_destroy(void) @@ -197,7 +198,7 @@ void hotlist_destroy(void) wind_delete(gemtk_wm_get_handle(hl.window)); gemtk_wm_remove(hl.window); hl.window = NULL; - atari_treeview_destroy( hl.tv ); + atari_treeview_destroy(hl.tv); hl.init = false; } LOG(("done")); diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c index 2339cd659..8db7cc2c0 100755 --- a/atari/plot/font_freetype.c +++ b/atari/plot/font_freetype.c @@ -607,9 +607,10 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng #ifdef WITH_8BPP_SUPPORT if( app.nplanes > 8 ){ #endif - unsigned short out[4]; - rgb_to_vdi1000( (unsigned char*)&c, (unsigned short*)&out ); - vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0]); + RGB1000 out; + rgb_to_vdi1000( (unsigned char*)&c, &out); + vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, + (unsigned short*)&out); #ifdef WITH_8BPP_SUPPORT } else { c = RGB_TO_VDI(c); diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c index 6e6e330ef..3db29eba5 100644 --- a/atari/plot/font_internal.c +++ b/atari/plot/font_internal.c @@ -245,10 +245,18 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng #ifdef WITH_8BPP_SUPPORT if( app.nplanes > 8 ){ #endif - unsigned short out[4]; - rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out ); - vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] ); - plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS ); + //unsigned short out[4]; + RGB1000 out; + //rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out ); + out.blue = 0; + out.green = 1000; + out.red = 0; + vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (short *)&out); + vq_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, 1, (short *)&out); + //printf("r:%d,g:%d,b:%d", out.red, out.green, out.blue); + //vsl_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR); + //vsf_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR); + plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS); #ifdef WITH_8BPP_SUPPORT } else { unsigned char c = RGB_TO_VDI(fstyle->foreground); diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c index 89596b38a..4ebab24fb 100755 --- a/atari/plot/font_vdi.c +++ b/atari/plot/font_vdi.c @@ -16,15 +16,20 @@ * along with this program. If not, see . */ -#ifdef WITH_VDI_FONT_DRIVER +#ifdef WITH_VDI_FONT_DRIVER + +#include + #include "atari/plot/plot.h" #include "atari/plot/font_vdi.h" #include "utils/utf8.h" -#include "utils/log.h" +#include "utils/log.h" + -static char * lstr = NULL; + +//static char * lstr = NULL; static int dtor( FONT_PLOTTER self ); @@ -39,6 +44,25 @@ static bool init = false; static int vdih; extern struct s_vdi_sysinfo vdi_sysinfo; + +static inline void atari_to_vdi_str(char *lstr, int length) +{ + int i, z; + + for (i=z=0; iflags & FONTF_ITALIC ) fx |= 4; @@ -79,11 +107,19 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c fx |= 1; vst_effects( self->vdi_handle, fx ); /* TODO: replace 90 with global dpi setting */ - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); - vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 ); + vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); +/* + if(slen != utf8_bounded_length(str, length)){ + printf("sl: %d, utl: %d\n ", slen, utf8_bounded_length(str, length)); + printf("s: %s // %s\n", str, lstr ); + }*/ + + *width = slen * cellw; - free( (void*)lstr ); - lstr = NULL; + free((void*)lstr); return( 0 ); } @@ -94,15 +130,19 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const short pxsize; short fx=0; int i; - lstr = (char*)string; - int slen = 0; + char *lstr = NULL; + size_t slen = 0; int last_space_x = 0; - int last_space_idx = 0; + int last_space_idx = 0; + size_t nxtchr = 0; - utf8_to_enc(string, "ATARIST", length, &lstr ); + utf8_to_local_encoding(string, length, &lstr ); assert( lstr != NULL ); + slen = strlen(lstr); + + + atari_to_vdi_str(lstr, slen); - slen = strlen(lstr); if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) @@ -110,27 +150,50 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const if( fstyle->weight > 450 ) fx |= 1; vst_effects( self->vdi_handle, fx ); - pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); - vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); + //vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); + + pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 ); + vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); *actual_x = 0; - *char_offset = 0; - int cpos=0; - for( i=0; i x ) { - *actual_x = last_space_x; - *char_offset = last_space_idx; - return true; - } - *actual_x += cellw; - cpos++; - } - *char_offset = cpos; + last_space_idx = nxtchr; + } + *actual_x += cellw; + if (*actual_x > x) { + *actual_x = last_space_x; + *char_offset = last_space_idx; + //printf("at: %s\n", lstr); + return(0); + } + + nxtchr++; + } + if(nxtchr >= length){ + nxtchr = length-1; + } + + *char_offset = nxtchr; + +// for( i=0; i x ) { +// *actual_x = last_space_x; +// *char_offset = last_space_idx; +// return true; +// } +// *actual_x += cellw; +// cpos++; +// } +// *char_offset = cpos; free( (void*)lstr ); - lstr = NULL; return( 0 ); } @@ -141,19 +204,22 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const short pxsize=0; short fx=0; - lstr = (char*)string; + char *lstr = NULL; int i=0; int curpx=0; - utf8_to_enc(string, "ATRIST", length, &lstr ); + utf8_to_local_encoding(string, length, &lstr ); assert( lstr != NULL ); - int slen = strlen(lstr); + int slen = strlen(lstr); + + atari_to_vdi_str(lstr, slen); + if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) fx |= 16; if( fstyle->weight > 450 ) fx |= 1; - vst_effects( self->vdi_handle, fx ); + vst_effects(self->vdi_handle, fx); pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); *actual_x = 0; @@ -166,24 +232,30 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const break; } } - free( (void*)lstr ); + free((void*)lstr); lstr = NULL; return( 0 ); } static inline void vst_rgbcolor( short vdih, uint32_t cin ) { - if( vdi_sysinfo.scr_bpp > 8 ) { - unsigned short c[4]; - rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c ); - vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] ); +#ifdef WITH_8BPP_SUPPORT + if( vdi_sysinfo.scr_bpp > 8 ) { +#endif + //unsigned short c[4]; + RGB1000 c; + + rgb_to_vdi1000( (unsigned char*)&cin, &c ); + vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c); vst_color( vdih, OFFSET_CUSTOM_COLOR ); +#ifdef WITH_8BPP_SUPPORT } else { if( vdi_sysinfo.scr_bpp >= 4 ) vst_color( vdih, RGB_TO_VDI(cin) ); else vst_color( vdih, BLACK ); - } + } +#endif } static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, @@ -192,16 +264,20 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng /* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */ short cw, ch, cellw, cellh; short pxsize=8; - short fx=0; - lstr = (char*)text; - utf8_to_enc(text, "ATARIST", length, &lstr ); - assert( lstr != NULL ); - int slen = strlen(lstr); - size_t mylen = MIN(511, slen ); - char textcpy[mylen+1]; + short fx=0; + GRECT canvas; + char *lstr = NULL; + assert( utf8_to_local_encoding(text, length, &lstr) == UTF8_CONVERT_OK); + assert( lstr != NULL ); + + int slen = strlen(lstr); + if(slen > 800){ + lstr[800]=0; + } + + + atari_to_vdi_str(lstr, slen); - textcpy[mylen] = 0; - strncpy((char*)&textcpy, lstr, mylen+1 ); if( fstyle != NULL){ if( fstyle->flags & FONTF_ITALIC ) fx |= 4; @@ -212,20 +288,25 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng /* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss), use that value or pass it as arg, to reduce netsurf dependency */ + //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); - } - x += CURFB(self->plotter).x; - y += CURFB(self->plotter).y; + } + plot_get_dimensions(&canvas); + x += canvas.g_x; + y += canvas.g_y; vst_effects( self->vdi_handle, fx ); - vst_alignment(vdih, 0, 4, &cw, &ch ); - vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); + vst_alignment(vdih, 0, 0, &cw, &ch ); + vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); + //vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); vswr_mode( self->vdi_handle, MD_TRANS ); - vst_rgbcolor(self->vdi_handle, fstyle->foreground ); + vst_rgbcolor(self->vdi_handle, fstyle->foreground); - if( atari_sysinfo.gdos_FSMC ){ - v_ftext( self->vdi_handle, x, y, (char*)&textcpy ); - } else { - v_gtext( self->vdi_handle, x, y, (char*)&textcpy ); + if( atari_sysinfo.gdos_FSMC ){ + //printf("\nftext\n"); + v_ftext( self->vdi_handle, x, y, (char*)lstr ); + } else { + //printf("\ngtext\n"); + v_gtext( self->vdi_handle, x, y, (char*)lstr ); } free( lstr ); return( 0 ); diff --git a/atari/plot/plot.c b/atari/plot/plot.c index eb44e47b8..2a8fd6868 100755 --- a/atari/plot/plot.c +++ b/atari/plot/plot.c @@ -193,9 +193,10 @@ inline static void vsl_rgbcolor(short vdih, colour cin) #ifdef WITH_8BPP_SUPPORT if( vdi_sysinfo.scr_bpp > 8 ) { #endif - unsigned short c[4]; - rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c); - vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0]); + //unsigned short c[4]; + RGB1000 c; + rgb_to_vdi1000( (unsigned char*)&cin, &c); + vs_color(vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c); vsl_color(vdih, OFFSET_CUSTOM_COLOR); #ifdef WITH_8BPP_SUPPORT } else { @@ -219,9 +220,9 @@ inline static void vsf_rgbcolor(short vdih, colour cin) #ifdef WITH_8BPP_SUPPORT if( vdi_sysinfo.scr_bpp > 8 ) { #endif - unsigned short c[4]; - rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c ); - vs_color( vdih, OFFSET_CUSTOM_COLOR, &c[0] ); + RGB1000 c; + rgb_to_vdi1000( (unsigned char*)&cin, &c); + vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c); vsf_color( vdih, OFFSET_CUSTOM_COLOR ); #ifdef WITH_8BPP_SUPPORT } else { @@ -512,14 +513,14 @@ static struct s_vdi_sysinfo * read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo /* Convert an RGB color to an VDI Color */ -inline void rgb_to_vdi1000(unsigned char * in, unsigned short * out) +inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out) { double r = ((double)in[3]/255); /* prozentsatz red */ double g = ((double)in[2]/255); /* prozentsatz green */ double b = ((double)in[1]/255); /* prozentsatz blue */ - out[0] = 1000 * r + 0.5; - out[1] = 1000 * g + 0.5; - out[2] = 1000 * b + 0.5; + out->red = 1000 * r + 0.5; + out->green = 1000 * g + 0.5; + out->blue = 1000 * b + 0.5; return; } @@ -1441,14 +1442,14 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, return(true); } -bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, +bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags) { MFDB screen, tran; MFDB * src; short pxy[8]; - short c[2] = {fgcolor, G_WHITE}; + short c[2] = {fgcolor, 0}; GRECT off; plot_get_clip_grect(&off); @@ -1457,29 +1458,30 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, } init_mfdb( 0, loc->g_w, loc->g_h, 0, &screen ); - - if( insrc->fd_stand ){ - int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h, - MFDB_FLAG_NOALLOC, - &tran - ); - if( size_buf_scr == 0 ){ - buf_scr.fd_addr = malloc( size ); - size_buf_scr = size; - } else { - if( size > size_buf_scr ) { - buf_scr.fd_addr = realloc( - buf_scr.fd_addr, size - ); - size_buf_scr = size; - } - } - tran.fd_addr = buf_scr.fd_addr; - vr_trnfm(atari_plot_vdi_handle, insrc, &tran ); - src = &tran; - } else { +// +// if( insrc->fd_stand){ +// printf("st\n"); +// int size = init_mfdb( insrc->fd_nplanes, loc->g_w, loc->g_h, +// MFDB_FLAG_NOALLOC, +// &tran +// ); +// if( size_buf_scr == 0 ){ +// buf_scr.fd_addr = malloc( size ); +// size_buf_scr = size; +// } else { +// if( size > size_buf_scr ) { +// buf_scr.fd_addr = realloc( +// buf_scr.fd_addr, size +// ); +// size_buf_scr = size; +// } +// } +// tran.fd_addr = buf_scr.fd_addr; +// vr_trnfm(atari_plot_vdi_handle, insrc, &tran ); +// src = &tran; +// } else { src = insrc; - } +// } pxy[0] = off.g_x - loc->g_x; pxy[1] = off.g_y - loc->g_y; @@ -1492,7 +1494,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, if( flags & PLOT_FLAG_TRANS && src->fd_nplanes == 1){ - vrt_cpyfm(atari_plot_vdi_handle, MD_TRANS, (short*)pxy, src, &screen, (short*)&c ); + vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen, (short*)&c); } else { /* this method only plots transparent bitmaps, right now... */ } diff --git a/atari/plot/plot.h b/atari/plot/plot.h index df34be4d5..b0ec58b5a 100755 --- a/atari/plot/plot.h +++ b/atari/plot/plot.h @@ -115,7 +115,7 @@ bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t *style ); bool plot_line( int x0, int y0, int x1, int y1, const plot_style_t *style ); bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, unsigned long bg, unsigned long flags); -bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, +bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags); bool plot_copy_rect(GRECT src, GRECT dst); @@ -123,7 +123,7 @@ bool plot_copy_rect(GRECT src, GRECT dst); void vdi1000_to_rgb( unsigned short * in, unsigned char * out ); /* convert an bgra color to vdi1000 color */ -void rgb_to_vdi1000( unsigned char * in, unsigned short * out ); +void rgb_to_vdi1000( unsigned char * in, RGB1000 *out); /* convert an rgb color to an index into the web palette */ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b); diff --git a/atari/rootwin.c b/atari/rootwin.c index a0d773f90..45f55684f 100755 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -96,12 +96,13 @@ static const struct redraw_context rootwin_rdrw_ctx = { static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { short retval = 0; - GRECT content_area; + GRECT area; static bool prev_url = false; static short prev_x=0; static short prev_y=0; struct rootwin_data_s * data = gemtk_wm_get_user_data(win); struct gui_window *tmp; + OBJECT *obj; if ((ev_out->emo_events & MU_MESAG) != 0) { @@ -177,9 +178,9 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) } if ((ev_out->emo_events & MU_BUTTON) != 0) { window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, - &content_area); + &area); if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, - content_area)) { + area)) { on_content_mouse_click(data->rootwin); } } @@ -191,10 +192,10 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) // The window found at x,y is an gui_window // and it's the input window. window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, - &content_area); + &area); if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, - content_area)) { - on_content_mouse_move(data->rootwin, &content_area); + area)) { + on_content_mouse_move(data->rootwin, &area); } else { GRECT tb_area; window_get_grect(data->rootwin, BROWSER_AREA_URL_INPUT, &tb_area); @@ -1303,18 +1304,20 @@ static short on_window_key_input(ROOTWIN *rootwin, unsigned short nkc) /* make sure we report for the root window and report...: */ done = toolbar_key_input(gw->root->toolbar, nkc); } else { - gw_tmp = window_list; - /* search for active browser component: */ - while( gw_tmp != NULL && done == false ) { - /* todo: only handle when input_window == ontop */ - if( window_widget_has_focus(input_window->root, BROWSER, - (void*)gw_tmp->browser)) { - done = on_content_keypress(gw_tmp->browser->bw, nkc); - break; - } else { - gw_tmp = gw_tmp->next; - } - } + if( window_widget_has_focus(input_window->root, BROWSER, + (void*)input_window->browser)) { + done = on_content_keypress(input_window->browser->bw, nkc); + } + else if(window_widget_has_focus(input_window->root, SEARCH_INPUT, NULL)) { + OBJECT * obj; + obj = toolbar_get_form(input_window->root->toolbar); + obj[TOOLBAR_BT_SEARCH_FWD].ob_state &= ~OS_DISABLED; + obj[TOOLBAR_BT_SEARCH_BACK].ob_state &= ~OS_DISABLED; + window_schedule_redraw_grect(input_window->root, + gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_FWD)); + window_schedule_redraw_grect(input_window->root, + gemtk_obj_screen_rect(obj, TOOLBAR_BT_SEARCH_BACK)); + } } return((done==true) ? 1 : 0); } diff --git a/atari/settings.c b/atari/settings.c index d46de4713..4f73fc3db 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -691,7 +691,7 @@ static short on_aes_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) } break; - case GEMTK_WM_WM_FORM: + case GEMTK_WM_WM_FORM_CLICK: form_event(msg[4], 1); break; diff --git a/atari/toolbar.c b/atari/toolbar.c index c81c969ee..56d3b04b4 100644 --- a/atari/toolbar.c +++ b/atari/toolbar.c @@ -653,17 +653,17 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text) bool toolbar_key_input(struct s_toolbar *tb, short nkc) { - assert(tb!=NULL); - GRECT work; + assert(tb!=NULL); + + GRECT work; bool ret = false; - struct gui_window *gw = window_get_active_gui_window(tb->owner); assert( gw != NULL ); long ucs4; long ik = nkc_to_input_key(nkc, &ucs4); - + if (ik == 0) { if ((nkc&0xFF) >= 9) { ret = textarea_keypress(tb->url.textarea, ucs4); diff --git a/atari/treeview.c b/atari/treeview.c index 8d5520edb..0aedb4cfc 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -292,14 +292,17 @@ NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win, void atari_treeview_open( NSTREEVIEW tv ) { if( tv->window != NULL ) { + gemtk_wm_link(tv->window); tree_set_redraw(tv->tree, true); + } } -void atari_treeview_close( NSTREEVIEW tv ) +void atari_treeview_close(NSTREEVIEW tv) { - if( tv->window != NULL ) { + if(tv->window != NULL) { tree_set_redraw(tv->tree, false); + gemtk_wm_unlink(tv->window); } } @@ -340,7 +343,7 @@ bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y -void atari_treeview_redraw( NSTREEVIEW tv) +void atari_treeview_redraw(NSTREEVIEW tv) { if (tv != NULL) { if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) { -- cgit v1.2.3