summaryrefslogtreecommitdiff
path: root/atari/rootwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'atari/rootwin.c')
-rwxr-xr-xatari/rootwin.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/atari/rootwin.c b/atari/rootwin.c
index 3c89e6d55..a9c958e04 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -38,7 +38,6 @@
#include "utils/log.h"
#include "desktop/gui.h"
-#include "desktop/local_history.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
#include "desktop/browser_private.h"
@@ -85,6 +84,8 @@ static bool on_content_mouse_click(ROOTWIN *rootwin);
static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area);
static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip);
+bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
+
static bool redraw_active = false;
static const struct redraw_context rootwin_rdrw_ctx = {
@@ -98,11 +99,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
short retval = 0;
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) {
@@ -228,7 +226,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,
+ struct gui_window * existing,
unsigned long inflags)
{
int err = 0;
@@ -292,8 +290,8 @@ int window_create(struct gui_window * gw,
assert(gw->browser);
gw->browser->bw = bw;
- if(clone)
- gw->browser->bw->scale = clone->scale;
+ if(existing)
+ gw->browser->bw->scale = existing->browser->bw->scale;
else
gw->browser->bw->scale = 1;
@@ -467,7 +465,6 @@ void window_set_title(struct s_gui_win_root * rootwin, char *title)
void window_scroll_by(ROOTWIN *root, int sx, int sy)
{
- int units;
GRECT content_area;
struct gemtk_wm_scroll_info_s *slid = gemtk_wm_get_scroll_info(root->win);
@@ -509,8 +506,6 @@ void window_set_content_size(ROOTWIN *rootwin, int width, int height)
void window_set_focus(struct s_gui_win_root *rootwin,
enum focus_element_type type, void * element)
{
- struct textarea * ta;
-
assert(rootwin != NULL);
if (rootwin->focus.type != type || rootwin->focus.element != element) {
@@ -568,7 +563,6 @@ void window_set_icon(ROOTWIN *rootwin, struct bitmap * bmp )
rootwin->icon = bmp;
/* redraw window when it is iconyfied: */
if (rootwin->icon != NULL) {
- short info, dummy;
if (gemtk_wm_get_state(rootwin->win) & GEMTK_WM_STATUS_ICONIFIED) {
window_redraw_favicon(rootwin, NULL);
}
@@ -767,7 +761,6 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
} else {
//printf("window_redraw_favicon image %p\n", rootwin->icon);
VdiHdl plot_vdi_handle = plot_get_vdi_handle();
- struct rect work_clip = { 0,0,work.g_w,work.g_h };
short pxy[4];
int xoff=0;
@@ -777,7 +770,6 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
}
plot_set_dimensions( work.g_x+xoff, work.g_y, work.g_w,
work.g_h);
- //plot_clip(&work_clip);
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible);
while (visible.g_h > 0 && visible.g_w > 0) {
@@ -842,7 +834,7 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
plot_set_dimensions(content_area->g_x, content_area->g_y,
content_area->g_w, content_area->g_h);
- oldscale = plot_set_scale(gui_window_get_scale(rootwin->active_gui_window));
+ oldscale = plot_set_scale(browser_window_get_scale(rootwin->active_gui_window->browser->bw));
/* first, we make the coords relative to the content area: */
content_area_rel.g_x = clip->g_x - content_area->g_x;
@@ -886,7 +878,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
short pxy[8];
GRECT mywork, caret_pos;
MFDB screen;
- int i, scroll_x, scroll_y;
+ int scroll_x, scroll_y;
uint16_t *fd_addr;
struct gemtk_wm_scroll_info_s *slid;
short colors[2] = {G_BLACK, G_WHITE};
@@ -972,6 +964,7 @@ void window_place_caret(ROOTWIN *rootwin, short mode, int content_x,
// draw the caret into the mfdb buffer:
if (render_required) {
+ int i;
assert(caret->symbol.fd_nplanes == 1);
assert(caret->symbol.fd_w == 16);
@@ -1022,7 +1015,6 @@ void window_process_redraws(ROOTWIN * rootwin)
GRECT work, visible_ro, tb_area, content_area;
short i;
short scroll_x=0, scroll_y=0;
- bool toolbar_rdrw_required;
bool caret_rdrw_required = false;
struct gemtk_wm_scroll_info_s *slid =NULL;
int caret_h = 0;
@@ -1366,7 +1358,6 @@ static short on_window_key_input(ROOTWIN *rootwin, unsigned short nkc)
{
bool done = false;
struct gui_window * gw = window_get_active_gui_window(rootwin);
- struct gui_window * gw_tmp;
if( gw == NULL )
return(false);
@@ -1396,8 +1387,6 @@ static short on_window_key_input(ROOTWIN *rootwin, unsigned short nkc)
static void on_redraw(ROOTWIN *rootwin, short msg[8])
{
- short handle;
-
GRECT clip = {msg[4], msg[5], msg[6], msg[7]};
//dbg_grect("on_redraw", &clip);
@@ -1414,7 +1403,6 @@ static void on_redraw(ROOTWIN *rootwin, short msg[8])
static void on_resized(ROOTWIN *rootwin)
{
GRECT g, work;
- OBJECT *toolbar;
struct gui_window *gw;
gw = window_get_active_gui_window(rootwin);
@@ -1497,6 +1485,8 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
size, mx, my
));
+ gui_window_get_scroll(gw, &sx, &sy);
+
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area);
mx = mx - content_area.g_x;
my = my - content_area.g_y;
@@ -1508,19 +1498,18 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
mx+sx, my+sy,
NULL);
if(processed == true) {
- utf8_convert_ret ret;
+ nserror ret;
char *utf8_fn;
ret = utf8_from_local_encoding(buff, 0, &utf8_fn);
- if (ret != UTF8_CONVERT_OK) {
+ if (ret != NSERROR_OK) {
free(buff);
/* A bad encoding should never happen */
LOG(("utf8_from_local_encoding failed"));
- assert(ret != UTF8_CONVERT_BADENC);
+ assert(ret != NSERROR_BAD_ENCODING);
/* no memory */
goto error;
}
- gui_window_get_scroll(gw, &sx, &sy);
processed = browser_window_drop_file_at_point(gw->browser->bw,
mx+sx, my+sy,
utf8_fn);
@@ -1534,8 +1523,8 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
char * tmp_url = local_file_to_url(buff);
if ((tmp_url != NULL)
&& nsurl_create(tmp_url, &ns_url) == NSERROR_OK) {
- browser_window_navigate(gw->browser->bw, ns_url, NULL,
- BROWSER_WINDOW_HISTORY | BROWSER_WINDOW_VERIFIABLE,
+ browser_window_navigate(gw->browser->bw, ns_url, NULL,
+ BW_NAVIGATE_HISTORY,
NULL, NULL, NULL);
nsurl_unref(ns_url);
}