r9530 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Aug 31 17:10:05 2009
New Revision: 9530
URL: http://source.netsurf-browser.org?rev=9530&view=rev
Log:
Remove unnecessary RethinkLayout() for tabs under OS4.1 (removes flicker when
compositing off)
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9530&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Aug 31 17:10:05 2009
@@ -1776,7 +1776,8 @@
TAG_DONE);
}
- RethinkLayout(gwin->shared->gadgets[GID_TABLAYOUT],gwin->shared->win,NULL,TRUE);
+ if(ClickTabBase->lib_Version < 53)
+ RethinkLayout(gwin->shared->gadgets[GID_TABLAYOUT],gwin->shared->win,NULL,TRUE);
gwin->shared->tabs++;
gwin->shared->next_tab++;
@@ -2301,7 +2302,9 @@
CLICKTAB_Labels,&g->shared->tab_list,
CLICKTAB_Current,ptabnum,
TAG_DONE);
- RethinkLayout(g->shared->gadgets[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
+
+ if(ClickTabBase->lib_Version < 53)
+ RethinkLayout(g->shared->gadgets[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
g->shared->tabs--;
ami_switch_tab(g->shared,true);
@@ -2354,7 +2357,9 @@
RefreshSetGadgetAttrs(g->shared->gadgets[GID_TABS],g->shared->win,NULL,
CLICKTAB_Labels,&g->shared->tab_list,
TAG_DONE);
- RethinkLayout(g->shared->gadgets[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
+
+ if(ClickTabBase->lib_Version < 53)
+ RethinkLayout(g->shared->gadgets[GID_TABLAYOUT],g->shared->win,NULL,TRUE);
GetAttr(CLICKTAB_Current,g->shared->gadgets[GID_TABS],(ULONG *)&cur_tab);
}
14 years, 3 months
r9529 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Aug 31 16:48:57 2009
New Revision: 9529
URL: http://source.netsurf-browser.org?rev=9529&view=rev
Log:
Support Alt
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9529&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Aug 31 16:48:57 2009
@@ -703,6 +703,11 @@
if(quals & IEQUALIFIER_CONTROL)
{
gwin->key_state |= BROWSER_MOUSE_MOD_2;
+ }
+
+ if((quals & IEQUALIFIER_LALT) || (quals & IEQUALIFIER_RALT))
+ {
+ gwin->key_state |= BROWSER_MOUSE_MOD_3;
}
}
@@ -2547,7 +2552,7 @@
ami_do_redraw_limits(g->bw->window, c,
hcurrent, (height / g->bw->scale) + oldv,
hcurrent + (width / g->bw->scale),
- vcurrent+(height / g->bw->scale),
+ vcurrent + (height / g->bw->scale),
hcurrent, vcurrent);
}
else if(vcurrent<oldv)
14 years, 3 months
r9528 MarkieB - /branches/MarkieB/windows/windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 12:54:20 2009
New Revision: 9528
URL: http://source.netsurf-browser.org?rev=9528&view=rev
Log:
add alt-modifier handling
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Mon Aug 31 12:54:20 2009
@@ -620,6 +620,7 @@
int x,y;
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
+ bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL)
@@ -646,7 +647,9 @@
w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
-
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_3;
+
browser_window_mouse_track(w->bw, w->mouse->state,
(x + w->scrollx) / w->bw->scale,
(y - w->voffset + w->scrolly) / w->bw->scale);
@@ -667,6 +670,8 @@
w->mouse->state |= BROWSER_MOUSE_MOD_1;
if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
w->mouse->state |= BROWSER_MOUSE_MOD_2;
+ if ((GetKeyState(VK_MENU) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_3;
w->mouse->pressed_x = (x + w->scrollx) / w->bw->scale;
w->mouse->pressed_y = (y - w->voffset + w->scrolly)
/ w->bw->scale;
@@ -693,6 +698,8 @@
w->mouse->state |= BROWSER_MOUSE_MOD_1;
if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
w->mouse->state |= BROWSER_MOUSE_MOD_2;
+ if ((GetKeyState(VK_MENU) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_3;
w->mouse->pressed_x = (x + w->scrollx) / w->bw->scale;
w->mouse->pressed_y = (y - w->voffset + w->scrolly)
/ w->bw->scale;
@@ -714,7 +721,8 @@
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
-
+ bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
+
if ((w->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
w->mouse->state &= ~BROWSER_MOUSE_PRESS_1;
w->mouse->state |= BROWSER_MOUSE_CLICK_1;
@@ -724,7 +732,9 @@
w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
-
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_3;
+
if ((w->mouse->state & BROWSER_MOUSE_CLICK_1) != 0)
browser_window_mouse_click(w->bw, w->mouse->state,
(x + w->scrollx) / w->bw->scale,
@@ -749,7 +759,8 @@
return DefWindowProc(hwnd, msg, wparam, lparam);
bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
-
+ bool alt = ((GetKeyState(VK_MENU) & 0x8000) == 0x8000);
+
if ((w->mouse->state & BROWSER_MOUSE_PRESS_2) != 0) {
w->mouse->state &= ~BROWSER_MOUSE_PRESS_2;
w->mouse->state |= BROWSER_MOUSE_CLICK_2;
@@ -759,7 +770,9 @@
w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
-
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_3) != 0) && !alt)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_3;
+
if ((w->mouse->state & BROWSER_MOUSE_CLICK_2) != 0)
browser_window_mouse_click(w->bw, w->mouse->state,
(x + w->scrollx) / w->bw->scale,
@@ -1884,9 +1897,6 @@
void gui_window_update_box(struct gui_window *w,
const union content_msg_data *data)
{
- LOG(("redraw %p from %.1f,%.1f w=%.1f,h=%.1f", w, data->redraw.x,
- data->redraw.y, data->redraw.width,
- data->redraw.height));
if (w == NULL)
return;
w->redraw.left = (long)data->redraw.x;
14 years, 3 months
r9527 MarkieB - in /branches/MarkieB/windows: desktop/browser.h gtk/gtk_window.h windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 12:42:01 2009
New Revision: 9527
URL: http://source.netsurf-browser.org?rev=9527&view=rev
Log:
add full handling of mouse events; migrate mouse state struct to core
Modified:
branches/MarkieB/windows/desktop/browser.h
branches/MarkieB/windows/gtk/gtk_window.h
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/desktop/browser.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/desktop/browse...
==============================================================================
--- branches/MarkieB/windows/desktop/browser.h (original)
+++ branches/MarkieB/windows/desktop/browser.h Mon Aug 31 12:42:01 2009
@@ -211,6 +211,16 @@
BROWSER_MOUSE_MOD_3 = 4096 /* secondary modifier key pressed
* (eg. Alt) */
} browser_mouse_state;
+
+struct browser_mouse {
+ struct gui_window *gui;
+ struct box *box;
+
+ double pressed_x;
+ double pressed_y;
+ bool waiting;
+ browser_mouse_state state;
+};
struct browser_scroll_data {
struct browser_window *bw;
Modified: branches/MarkieB/windows/gtk/gtk_window.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/gtk/gtk_window...
==============================================================================
--- branches/MarkieB/windows/gtk/gtk_window.h (original)
+++ branches/MarkieB/windows/gtk/gtk_window.h Mon Aug 31 12:42:01 2009
@@ -53,16 +53,6 @@
struct gui_window *next, *prev;
};
-struct browser_mouse {
- struct gui_window *gui;
- struct box *box;
-
- gdouble pressed_x;
- gdouble pressed_y;
- gboolean waiting;
- browser_mouse_state state;
-};
-
extern struct gui_window * window_list;
extern int temp_open_background;
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Mon Aug 31 12:42:01 2009
@@ -78,7 +78,7 @@
struct gui_window {
/* The front's private data connected to a browser window */
/* currently 1<->1 gui_window<->windows window [non-tabbed] */
- struct browser_window *bw;
+ struct browser_window *bw; /** the browser_window */
HWND main; /**< handle to the actual window */
HWND toolbar; /**< toolbar handle */
HWND urlbar; /**< url bar handle */
@@ -101,6 +101,8 @@
bool throbbing; /**< whether currently throbbing */
TBBUTTON buttons[NTOOLBUTTONS + 1]; /* 1 = url bar */
HBITMAP hbmp[NTOOLBUTTONS]; /**< tool button images */
+
+ struct browser_mouse *mouse; /**< mouse state */
HACCEL acceltable; /**< accelerators */
@@ -410,6 +412,16 @@
w->requestscrolly = 0;
w->localhistory = NULL;
+ w->mouse = malloc(sizeof(struct browser_mouse));
+ if (w->mouse == NULL) {
+ free(w);
+ return NULL;
+ }
+ w->mouse->gui = w;
+ w->mouse->state = 0;
+ w->mouse->pressed_x = 0;
+ w->mouse->pressed_y = 0;
+
if (bw != NULL)
switch(bw->browser_window_type) {
case BROWSER_WINDOW_NORMAL:
@@ -540,40 +552,42 @@
if (GetFocus() != hwnd)
break;
uint32_t i;
+ bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
+ bool capslock = ((GetKeyState(VK_CAPITAL) & 1) == 1);
switch(wparam) {
case VK_LEFT:
i = KEY_LEFT;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_HSCROLL,
MAKELONG(SB_LINELEFT, 0), 0);
break;
case VK_RIGHT:
i = KEY_RIGHT;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_HSCROLL,
MAKELONG(SB_LINERIGHT, 0), 0);
break;
case VK_UP:
i = KEY_UP;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_VSCROLL,
MAKELONG(SB_LINEUP, 0), 0);
break;
case VK_DOWN:
i = KEY_DOWN;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_VSCROLL,
MAKELONG(SB_LINEDOWN, 0), 0);
break;
case VK_HOME:
i = KEY_LINE_START;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_HSCROLL,
MAKELONG(SB_PAGELEFT, 0), 0);
break;
case VK_END:
i = KEY_LINE_END;
- if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ if (shift)
SendMessage(hwnd, WM_HSCROLL,
MAKELONG(SB_PAGERIGHT, 0), 0);
break;
@@ -595,11 +609,8 @@
break;
}
if ((i >= 'A') && (i <= 'Z') &&
-/* capslock off */ ((((GetKeyState(VK_CAPITAL) & 1) == 0) &&
-/* shift up */ ((GetKeyState(VK_SHIFT) & 0x8000) == 0)) ||
-/* capslock on */ (((GetKeyState(VK_CAPITAL) & 1) == 1)
-/* shift down */ && ((GetKeyState(VK_SHIFT) & 0x8000)
- == 0x8000))))
+ (((!capslock) && (!shift)) ||
+ ((capslock) && (shift))))
i += 'a' - 'A';
if (w != NULL)
browser_window_key_press(w->bw, i);
@@ -607,13 +618,38 @@
}
case WM_MOUSEMOVE: {
int x,y;
+ bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
+ bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((w != NULL) && (w->bw != NULL) && (y > w->voffset))
- browser_window_mouse_track(w->bw, 0,
- (x + w->scrollx) / w->bw->scale ,
- (y - w->voffset + w->scrolly) /
- w->bw->scale);
+ if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL)
+ || (y < w->voffset))
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+
+ if ((w->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
+ browser_window_mouse_click(w->bw, BROWSER_MOUSE_DRAG_1,
+ w->mouse->pressed_x,
+ w->mouse->pressed_y);
+ w->mouse->state &= ~BROWSER_MOUSE_PRESS_1;
+ w->mouse->state |= BROWSER_MOUSE_HOLDING_1 |
+ BROWSER_MOUSE_DRAG_ON;
+ }
+ else if ((w->mouse->state & BROWSER_MOUSE_PRESS_2) != 0) {
+ browser_window_mouse_click(w->bw, BROWSER_MOUSE_DRAG_2,
+ w->mouse->pressed_x,
+ w->mouse->pressed_y);
+ w->mouse->state &= ~BROWSER_MOUSE_PRESS_2;
+ w->mouse->state |= BROWSER_MOUSE_HOLDING_2 |
+ BROWSER_MOUSE_DRAG_ON;
+ }
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
+
+ browser_window_mouse_track(w->bw, w->mouse->state,
+ (x + w->scrollx) / w->bw->scale,
+ (y - w->voffset + w->scrolly) / w->bw->scale);
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
}
@@ -621,14 +657,25 @@
int x,y;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((w != NULL) && (w->bw != NULL) && (y > w->voffset)) {
- SetFocus(hwnd);
- browser_window_mouse_click(w->bw,
- BROWSER_MOUSE_PRESS_1,
- (x + w->scrollx) / w->bw->scale ,
- (y - w->voffset + w->scrolly) /
- w->bw->scale);
- }
+ if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL)
+ || (y < w->voffset)) {
+ nsws_localhistory_close(w);
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+ }
+ w->mouse->state = BROWSER_MOUSE_PRESS_1;
+ if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_1;
+ if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_2;
+ w->mouse->pressed_x = (x + w->scrollx) / w->bw->scale;
+ w->mouse->pressed_y = (y - w->voffset + w->scrolly)
+ / w->bw->scale;
+
+ SetFocus(hwnd);
+ browser_window_mouse_click(w->bw, w->mouse->state,
+ (x + w->scrollx) / w->bw->scale ,
+ (y - w->voffset + w->scrolly) /
+ w->bw->scale);
nsws_localhistory_close(w);
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
@@ -637,14 +684,23 @@
int x,y;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((w != NULL) && (w->bw != NULL) && (y > w->voffset)) {
- SetFocus(hwnd);
- browser_window_mouse_click(w->bw,
- BROWSER_MOUSE_PRESS_2,
- (x + w->scrollx) / w->bw->scale ,
- (y - w->voffset + w->scrolly) /
- w->bw->scale);
- }
+ if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL) ||
+ (y < w->voffset))
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+
+ w->mouse->state = BROWSER_MOUSE_PRESS_2;
+ if ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_1;
+ if ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000)
+ w->mouse->state |= BROWSER_MOUSE_MOD_2;
+ w->mouse->pressed_x = (x + w->scrollx) / w->bw->scale;
+ w->mouse->pressed_y = (y - w->voffset + w->scrolly)
+ / w->bw->scale;
+ SetFocus(hwnd);
+ browser_window_mouse_click(w->bw, w->mouse->state,
+ (x + w->scrollx) / w->bw->scale ,
+ (y - w->voffset + w->scrolly) /
+ w->bw->scale);
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
}
@@ -652,12 +708,35 @@
int x,y;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((w != NULL) && (w->bw != NULL) && (y > w->voffset))
- browser_window_mouse_click(w->bw,
- BROWSER_MOUSE_CLICK_1,
+ if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL)
+ || (y < w->voffset))
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+
+ bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
+ bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
+
+ if ((w->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
+ w->mouse->state &= ~BROWSER_MOUSE_PRESS_1;
+ w->mouse->state |= BROWSER_MOUSE_CLICK_1;
+ }
+
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
+
+ if ((w->mouse->state & BROWSER_MOUSE_CLICK_1) != 0)
+ browser_window_mouse_click(w->bw, w->mouse->state,
(x + w->scrollx) / w->bw->scale,
(y - w->voffset + w->scrolly) /
w->bw->scale);
+ else
+ browser_window_mouse_drag_end(w->bw, 0,
+ (x + w->scrollx) / w->bw->scale,
+ (y - w->voffset + w->scrolly) /
+ w->bw->scale);
+
+ w->mouse->state = 0;
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
}
@@ -665,12 +744,34 @@
int x,y;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((w != NULL) && (w->bw != NULL) && (y > w->voffset))
- browser_window_mouse_click(w->bw,
- BROWSER_MOUSE_CLICK_2,
- (x + w->scrollx)/ w->bw->scale ,
- (y - w->voffset + w->scrolly) /
+ if ((w == NULL) || (w->mouse == NULL) || (w->bw == NULL) ||
+ (y < w->voffset))
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+ bool shift = ((GetKeyState(VK_SHIFT) & 0x8000) == 0x8000);
+ bool ctrl = ((GetKeyState(VK_CONTROL) & 0x8000) == 0x8000);
+
+ if ((w->mouse->state & BROWSER_MOUSE_PRESS_2) != 0) {
+ w->mouse->state &= ~BROWSER_MOUSE_PRESS_2;
+ w->mouse->state |= BROWSER_MOUSE_CLICK_2;
+ }
+
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_1) != 0) && !shift)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_1;
+ if (((w->mouse->state & BROWSER_MOUSE_MOD_2) != 0) && !ctrl)
+ w->mouse->state &= ~BROWSER_MOUSE_MOD_2;
+
+ if ((w->mouse->state & BROWSER_MOUSE_CLICK_2) != 0)
+ browser_window_mouse_click(w->bw, w->mouse->state,
+ (x + w->scrollx) / w->bw->scale,
+ (y - w->voffset + w->scrolly) /
w->bw->scale);
+ else
+ browser_window_mouse_drag_end(w->bw, 0,
+ (x + w->scrollx) / w->bw->scale,
+ (y - w->voffset + w->scrolly) /
+ w->bw->scale);
+
+ w->mouse->state = 0;
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
}
14 years, 3 months
r9526 MarkieB - /branches/MarkieB/windows/windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 09:34:43 2009
New Revision: 9526
URL: http://source.netsurf-browser.org?rev=9526&view=rev
Log:
improve scrolling at large scale
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Mon Aug 31 09:34:43 2009
@@ -1815,6 +1815,8 @@
{
if ((w == NULL) || (w->bw == NULL) || (w->bw->current_content == NULL))
return;
+ if (abs(w->bw->scale - 0.0) < 0.00001)
+ w->bw->scale = 1.0;
w->requestscrollx = sx - w->scrollx;
w->requestscrolly = sy - w->scrolly;
@@ -1851,12 +1853,14 @@
r.right = w->width + 1;
ScrollWindowEx(w->main, - w->requestscrollx, - w->requestscrolly, &r,
NULL, NULL, &redraw, SW_INVALIDATE);
- gui_window_redraw(w, redraw.left + w->requestscrollx + w->scrollx,
- redraw.top + w->requestscrolly + w->scrolly
- - w->voffset,
- redraw.right + w->requestscrollx + w->scrollx,
- redraw.bottom + w->requestscrolly + w->scrolly
- - w->voffset);
+ gui_window_redraw(w, redraw.left + (w->requestscrollx + w->scrollx)
+ / w->bw->scale - 1,
+ redraw.top + (w->requestscrolly + w->scrolly)
+ / w->bw->scale - w->voffset - 1,
+ redraw.right + (w->requestscrollx + w->scrollx)
+ / w->bw->scale + 1,
+ redraw.bottom + (w->requestscrolly + w->scrolly)
+ / w->bw->scale - w->voffset + 1);
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0,
14 years, 3 months
r9525 MarkieB - in /branches/MarkieB/windows/windows: gui.c plot.c
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 09:17:22 2009
New Revision: 9525
URL: http://source.netsurf-browser.org?rev=9525&view=rev
Log:
improve interactivity
Modified:
branches/MarkieB/windows/windows/gui.c
branches/MarkieB/windows/windows/plot.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Mon Aug 31 09:17:22 2009
@@ -322,8 +322,14 @@
current_redraw_browser = bw;
nsws_plot_set_scale(bw->scale);
- doublebuffering = true;
- hdc = GetDC(w->main);
+/* doublebuffering = true;
+*/ hdc = GetDC(w->main);
+ if (w->bufferbm == NULL) {
+ w->bufferbm = CreateCompatibleBitmap(hdc, w->width,
+ w->height + w->voffset);
+ SelectObject(w->bufferdc, w->bufferbm);
+ }
+
if ((w->bufferbm == NULL) || (w->bufferdc == NULL) ||
(hdc == NULL))
@@ -333,10 +339,10 @@
content_redraw(c, -w->scrollx / w->bw->scale,
-w->scrolly / w->bw->scale,
w->width, w->height,
- w->redraw.left,
- w->redraw.top,
- w->redraw.right,
- w->redraw.bottom,
+ w->redraw.left - w->scrollx / w->bw->scale,
+ w->redraw.top - w->scrolly / w->bw->scale,
+ w->redraw.right - w->scrollx / w->bw->scale,
+ w->redraw.bottom - w->scrolly / w->bw->scale,
bw->scale, 0xFFFFFF);
if (doublebuffering)
/* blit buffer to screen */
@@ -1069,6 +1075,7 @@
w->redraw.bottom = MIN(ps.rcPaint.bottom, w->height);
redraw();
EndPaint(hwnd, &ps);
+ plot.clip(0, 0, w->width, w->height);
DWORD ret = DefWindowProc(hwnd, msg, wparam, lparam);
if (historyactive)
current_gui = NULL;
@@ -1781,10 +1788,10 @@
data->redraw.height));
if (w == NULL)
return;
- w->redraw.left = data->redraw.x;
- w->redraw.top = data->redraw.y;
- w->redraw.right = data->redraw.x + data->redraw.width;
- w->redraw.bottom = data->redraw.y + data->redraw.height;
+ w->redraw.left = (long)data->redraw.x;
+ w->redraw.top = (long)data->redraw.y;
+ w->redraw.right =(long)(data->redraw.x + data->redraw.width);
+ w->redraw.bottom = (long)(data->redraw.y + data->redraw.height);
redraw();
}
@@ -1837,13 +1844,19 @@
HideCaret(w->main);
SetCaretPos(p.x - w->requestscrollx, p.y - w->requestscrolly);
ShowCaret(w->main);
- RECT r;
+ RECT r, redraw;
r.top = w->voffset - 1;
r.bottom = w->voffset + w->height + 1;
r.left = 0;
r.right = w->width + 1;
ScrollWindowEx(w->main, - w->requestscrollx, - w->requestscrolly, &r,
- NULL, NULL, NULL, SW_INVALIDATE);
+ NULL, NULL, &redraw, SW_INVALIDATE);
+ gui_window_redraw(w, redraw.left + w->requestscrollx + w->scrollx,
+ redraw.top + w->requestscrolly + w->scrolly
+ - w->voffset,
+ redraw.right + w->requestscrollx + w->scrollx,
+ redraw.bottom + w->requestscrolly + w->scrolly
+ - w->voffset);
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0,
Modified: branches/MarkieB/windows/windows/plot.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/plot.c...
==============================================================================
--- branches/MarkieB/windows/windows/plot.c (original)
+++ branches/MarkieB/windows/windows/plot.c Mon Aug 31 09:17:22 2009
@@ -113,14 +113,16 @@
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ bak = SelectObject(hdc, (HGDIOBJ) pen);
if (bak == NULL) {
DeleteObject(pen);
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -173,7 +175,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF pencol = (DWORD)(style->stroke_colour & 0x00FFFFFF);
@@ -190,14 +193,16 @@
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateBrushIndirect(&lb1);
@@ -205,7 +210,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
@@ -214,7 +220,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -257,7 +264,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF pencol = (DWORD)(style->fill_colour & 0x00FFFFFF);
@@ -265,14 +273,16 @@
HPEN pen = CreatePen(PS_GEOMETRIC | PS_NULL, 1, pencol);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HPEN penbak = SelectObject(hdc, pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(brushcol);
@@ -280,7 +290,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brushbak = SelectObject(hdc, brush);
@@ -289,7 +300,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
SetPolyFillMode(hdc, WINDING);
@@ -340,14 +352,16 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HFONT fontbak, font = get_font(style);
if (font == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
int wlen;
@@ -407,7 +421,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
@@ -416,14 +431,16 @@
HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(col);
@@ -431,7 +448,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
@@ -440,7 +458,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -488,21 +507,24 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -603,13 +625,15 @@
cliprect = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(cliprect);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HDC Memhdc = CreateCompatibleDC(hdc);
if (Memhdc == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
BITMAPINFOHEADER bmih;
@@ -645,7 +669,8 @@
if (bmi == NULL) {
DeleteObject(clipregion);
DeleteDC(Memhdc);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBITMAP MemBMh = CreateCompatibleBitmap(
@@ -654,7 +679,8 @@
DeleteObject(clipregion);
free(bmi);
DeleteDC(Memhdc);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
14 years, 3 months
r9524 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Aug 31 07:12:00 2009
New Revision: 9524
URL: http://source.netsurf-browser.org?rev=9524&view=rev
Log:
Fix fast scrolling when scaled
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9524&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Aug 31 07:12:00 2009
@@ -2544,24 +2544,34 @@
if(vcurrent>oldv)
{
- ami_do_redraw_limits(g->bw->window,c,hcurrent,height+oldv,
- hcurrent+width,vcurrent+height,hcurrent,vcurrent);
+ ami_do_redraw_limits(g->bw->window, c,
+ hcurrent, (height / g->bw->scale) + oldv,
+ hcurrent + (width / g->bw->scale),
+ vcurrent+(height / g->bw->scale),
+ hcurrent, vcurrent);
}
else if(vcurrent<oldv)
{
- ami_do_redraw_limits(g->bw->window,c,hcurrent,vcurrent,
- hcurrent+width,oldv,hcurrent,vcurrent);
+ ami_do_redraw_limits(g->bw->window, c,
+ hcurrent, vcurrent,
+ hcurrent + (width / g->bw->scale),
+ oldv, hcurrent, vcurrent);
}
if(hcurrent>oldh)
{
- ami_do_redraw_limits(g->bw->window,c,width+oldh,vcurrent,
- hcurrent+width,vcurrent+height,hcurrent,vcurrent);
+ ami_do_redraw_limits(g->bw->window, c,
+ (width / g->bw->scale) + oldh, vcurrent,
+ hcurrent + (width / g->bw->scale),
+ vcurrent + (height / g->bw->scale),
+ hcurrent, vcurrent);
}
else if(hcurrent<oldh)
{
- ami_do_redraw_limits(g->bw->window,c,hcurrent,vcurrent,
- oldh,vcurrent+height,hcurrent,vcurrent);
+ ami_do_redraw_limits(g->bw->window, c,
+ hcurrent, vcurrent,
+ oldh, vcurrent+(height / g->bw->scale),
+ hcurrent, vcurrent);
}
}
else
14 years, 3 months
r9522 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Aug 31 07:05:35 2009
New Revision: 9522
URL: http://source.netsurf-browser.org?rev=9522&view=rev
Log:
Fix box redraw when scaled, fast scrolling now works in the upwards direction, but
not down :)
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=9522&r1=9...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Aug 31 07:05:35 2009
@@ -2397,11 +2397,19 @@
current_redraw_browser = g->shared->bw;
- width=bbox->Width;
- height=bbox->Height;
+ width=bbox->Width / g->shared->bw->scale;
+ height=bbox->Height / g->shared->bw->scale;
xoffset=bbox->Left;
yoffset=bbox->Top;
+/* x0 *= g->shared->bw->scale;
+ x1 *= g->shared->bw->scale;
+ y0 *= g->shared->bw->scale;
+ y1 *= g->shared->bw->scale;
+
+ sx *= g->shared->bw->scale;
+ sy *= g->shared->bw->scale;
+*/
plot=amiplot;
glob = &browserglob;
@@ -2417,15 +2425,13 @@
glob->scale = g->shared->bw->scale;
content_redraw(c,
- -sx,-sy,width-sx,height-sy,
- floorf((x0 *
- g->shared->bw->scale)-sx),
- ceilf((y0 *
- g->shared->bw->scale)-sy),
- (x1 *
- g->shared->bw->scale)-sx,
- (y1 *
- g->shared->bw->scale)-sy,
+ -sx, -sy,
+ width - sx,
+ height - sy,
+ (x0 - sx) * g->shared->bw->scale,
+ (y0 - sy) * g->shared->bw->scale,
+ (x1 - sx) * g->shared->bw->scale,
+ (y1 - sy) * g->shared->bw->scale,
g->shared->bw->scale,
0xFFFFFF);
@@ -2433,8 +2439,15 @@
ami_clearclipreg(&browserglob);
- BltBitMapRastPort(browserglob.bm,x0-sx,y0-sy,g->shared->win->RPort,
- xoffset+x0-sx,yoffset+y0-sy,x1-x0,y1-y0,0x0C0);
+ BltBitMapRastPort(browserglob.bm,
+ (x0 - sx) * g->shared->bw->scale,
+ (y0 - sy) * g->shared->bw->scale,
+ g->shared->win->RPort,
+ xoffset + ((x0 - sx) * g->shared->bw->scale),
+ yoffset + ((y0 - sy) * g->shared->bw->scale),
+ (x1 - x0) * g->shared->bw->scale,
+ (y1 - y0) * g->shared->bw->scale,
+ 0x0C0);
}
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
14 years, 3 months
r9521 MarkieB - in /branches/MarkieB/windows/windows: download.c download.h
by netsurf@semichrome.net
Author: MarkieB
Date: Mon Aug 31 06:55:05 2009
New Revision: 9521
URL: http://source.netsurf-browser.org?rev=9521&view=rev
Log:
improve accuracy of time estimates, including for larger files
Modified:
branches/MarkieB/windows/windows/download.c
branches/MarkieB/windows/windows/download.h
Modified: branches/MarkieB/windows/windows/download.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.c (original)
+++ branches/MarkieB/windows/windows/download.c Mon Aug 31 06:55:05 2009
@@ -186,30 +186,40 @@
char *size = human_friendly_bytesize(w->downloaded);
int i = 0, temp = w->time_remaining;
if (temp == -1) {
- w->time_left = strdup("unknown");
- i = SLEN("unknown");
+ w->time_left = strdup(messages_get("UnknownSize"));
+ i = strlen(w->time_left);
} else {
do {
temp = temp / 10;
i++;
} while (temp > 2);
w->time_left = malloc(i + SLEN(" s") + 1);
- if (w->time_left != NULL)
- sprintf(w->time_left, "%d s", w->time_remaining);
+ if (w->time_left != NULL) {
+ if (w->time_remaining > 3600)
+ sprintf(w->time_left, "%d h",
+ w->time_remaining / 3600);
+ else if (w->time_remaining > 60)
+ sprintf(w->time_left, "%d m",
+ w->time_remaining / 60);
+ else
+ sprintf(w->time_left, "%d s",
+ w->time_remaining);
+ }
}
char label[strlen(w->title) + strlen(size) + strlen(w->total_size) +
+ strlen(w->domain) + strlen(w->filename) +
SLEN("download from to \n[\t/\t]\n estimate of time"
" remaining ") + i + 1];
- sprintf(label, "download %s from %s to %s\n[%s\t/\t%s]\n estimate of "
- "time remaining %s", w->title, w->domain, w->filename,
- size, w->total_size, w->time_left);
+ sprintf(label, "download %s from %s to %s\n[%s\t/\t%s] [%d%%]\n"
+ "estimate of time remaining %s", w->title, w->domain,
+ w->filename, size, w->total_size, w->progress / 100,
+ w->time_left);
if (w->time_left != NULL) {
free(w->time_left);
w->time_left = NULL;
}
SendMessage(sub, WM_SETTEXT, (WPARAM)0, (LPARAM)label);
- if (w->progress < 100)
+ if (w->progress < 10000)
schedule(50, nsws_download_update_label, p);
}
@@ -221,8 +231,8 @@
return;
}
HWND sub = GetDlgItem(w->hwnd, NSWS_ID_DOWNLOAD_PROGRESS);
- SendMessage(sub, PBM_SETPOS, (WPARAM)w->progress, 0);
- if (w->progress < 100)
+ SendMessage(sub, PBM_SETPOS, (WPARAM)(w->progress / 100), 0);
+ if (w->progress < 10000)
schedule(50, nsws_download_update_progress, p);
}
@@ -258,11 +268,12 @@
if (res != size)
LOG(("file write error %d of %d", size - res, size));
w->downloaded += res;
- w->progress = (w->downloaded * 100) / w->size;
+ w->progress = (unsigned int)(((long long)(w->downloaded) * 10000)
+ / w->size);
gettimeofday(&val, NULL);
w->time_remaining = (w->progress == 0) ? -1 :
- (val.tv_sec - w->start_time.tv_sec) *
- (100 - w->progress) / w->progress;
+ (int)((val.tv_sec - w->start_time.tv_sec) *
+ (10000 - w->progress) / w->progress);
}
void gui_download_window_error(struct gui_download_window *w,
Modified: branches/MarkieB/windows/windows/download.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/downlo...
==============================================================================
--- branches/MarkieB/windows/windows/download.h (original)
+++ branches/MarkieB/windows/windows/download.h Mon Aug 31 06:55:05 2009
@@ -33,7 +33,7 @@
char *original_total_size;
int size;
int downloaded;
- int progress;
+ unsigned int progress;
int time_remaining;
struct timeval start_time;
int speed;
14 years, 3 months