r11868 chris_y - in /trunk/netsurf/amiga: context_menu.c gui.h
by netsurf@semichrome.net
Author: chris_y
Date: Mon Feb 28 17:46:49 2011
New Revision: 11868
URL: http://source.netsurf-browser.org?rev=11868&view=rev
Log:
Limit context menu history items to 10
Modified:
trunk/netsurf/amiga/context_menu.c
trunk/netsurf/amiga/gui.h
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Mon Feb 28 17:46:49 2011
@@ -173,6 +173,7 @@
ami_gadget_hit(gwin->objects[GID_BACK],
gwin->win->MouseX, gwin->win->MouseY))
{
+ gwin->temp = 0;
history_enumerate_back(gwin->bw->history, ami_context_menu_history, gwin);
IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
@@ -196,6 +197,7 @@
ami_gadget_hit(gwin->objects[GID_FORWARD],
gwin->win->MouseX, gwin->win->MouseY))
{
+ gwin->temp = 0;
history_enumerate_forward(gwin->bw->history, ami_context_menu_history, gwin);
IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
@@ -606,6 +608,9 @@
{
struct gui_window_2 *gwin = (struct gui_window_2 *)user_data;
+ gwin->temp++;
+ if(gwin->temp > 10) return false;
+
IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)history_entry_get_title(entry),
@@ -613,4 +618,6 @@
PMIA_UserData, entry,
TAG_DONE),
~0);
+
+ return true;
}
Modified: trunk/netsurf/amiga/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.h?rev=11868&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.h (original)
+++ trunk/netsurf/amiga/gui.h Mon Feb 28 17:46:49 2011
@@ -95,6 +95,7 @@
struct find_window *searchwin;
ULONG oldh;
ULONG oldv;
+ int temp;
bool redraw_scroll;
bool new_content;
char *menulab[AMI_MENU_AREXX_MAX + 1];
12 years, 6 months
r11866 chris_y - /trunk/netsurf/amiga/context_menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Feb 28 17:33:03 2011
New Revision: 11866
URL: http://source.netsurf-browser.org?rev=11866&view=rev
Log:
Add history context menu to the forward button too
Modified:
trunk/netsurf/amiga/context_menu.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Mon Feb 28 17:33:03 2011
@@ -29,9 +29,11 @@
#include "amiga/options.h"
#include "amiga/clipboard.h"
#include "amiga/bitmap.h"
+#include "amiga/history_local.h"
#include "amiga/iff_dr2d.h"
#include "desktop/textinput.h"
#include "desktop/selection.h"
+#include "desktop/searchweb.h"
#include "desktop/history_core.h"
#include "render/box.h"
#include "render/form.h"
@@ -123,7 +125,7 @@
{
int top, left, width, height;
- if(option_context_menu == false) return;
+ if(option_context_menu == false) return FALSE;
if((option_kiosk_mode == false) && (trap == FALSE) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
@@ -131,9 +133,13 @@
if(ami_gadget_hit(gwin->objects[GID_BACK],
gwin->win->MouseX, gwin->win->MouseY))
trap = TRUE;
+
+ if(ami_gadget_hit(gwin->objects[GID_FORWARD],
+ gwin->win->MouseX, gwin->win->MouseY))
+ trap = TRUE;
}
- if(gwin->rmbtrapped == trap) return;
+ if(gwin->rmbtrapped == trap) return trap;
SetWindowAttr(gwin->win, WA_RMBTrap, trap, 1);
gwin->rmbtrapped = trap;
@@ -163,10 +169,40 @@
TAG_DONE);
if(gwin->bw && gwin->bw->history &&
+ browser_window_back_available(gwin->bw) &&
ami_gadget_hit(gwin->objects[GID_BACK],
gwin->win->MouseX, gwin->win->MouseY))
{
history_enumerate_back(gwin->bw->history, ami_context_menu_history, gwin);
+
+ IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
+ NewObject(POPUPMENU_GetItemClass(), NULL,
+ PMIA_Title, ~0,
+ TAG_DONE),
+ ~0);
+
+ IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
+ NewObject(POPUPMENU_GetItemClass(), NULL,
+ PMIA_Title, (ULONG)ctxmenulab[CMID_HISTORY],
+ PMIA_ID, CMID_HISTORY,
+ PMIA_UserData, NULL,
+ TAG_DONE),
+ ~0);
+
+ menuhascontent = true;
+ }
+ else if(gwin->bw && gwin->bw->history &&
+ browser_window_forward_available(gwin->bw) &&
+ ami_gadget_hit(gwin->objects[GID_FORWARD],
+ gwin->win->MouseX, gwin->win->MouseY))
+ {
+ history_enumerate_forward(gwin->bw->history, ami_context_menu_history, gwin);
+
+ IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
+ NewObject(POPUPMENU_GetItemClass(), NULL,
+ PMIA_Title, ~0,
+ TAG_DONE),
+ ~0);
IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
12 years, 6 months
r11865 chris_y - /trunk/netsurf/amiga/context_menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Feb 28 16:35:53 2011
New Revision: 11865
URL: http://source.netsurf-browser.org?rev=11865&view=rev
Log:
Right-click back button now gives list of history items.
Probably needs tidying up - limiting number of entries etc
Modified:
trunk/netsurf/amiga/context_menu.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Mon Feb 28 16:35:53 2011
@@ -32,6 +32,7 @@
#include "amiga/iff_dr2d.h"
#include "desktop/textinput.h"
#include "desktop/selection.h"
+#include "desktop/history_core.h"
#include "render/box.h"
#include "render/form.h"
#include "utils/utf8.h"
@@ -40,9 +41,12 @@
#include <string.h>
-uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved);
-bool ami_context_menu_copy_selection(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text, size_t whitespace_length);
+static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved);
+static bool ami_context_menu_copy_selection(const char *text, size_t length,
+ struct box *box, void *handle, const char *whitespace_text,
+ size_t whitespace_length);
+static bool ami_context_menu_history(const struct history *history, int x0, int y0,
+ int x1, int y1, const struct history_entry *entry, void *user_data);
enum {
CMID_SELECTFILE,
@@ -162,10 +166,13 @@
ami_gadget_hit(gwin->objects[GID_BACK],
gwin->win->MouseX, gwin->win->MouseY))
{
+ history_enumerate_back(gwin->bw->history, ami_context_menu_history, gwin);
+
IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_HISTORY],
PMIA_ID, CMID_HISTORY,
+ PMIA_UserData, NULL,
TAG_DONE),
~0);
@@ -333,7 +340,7 @@
IDoMethod(gwin->objects[OID_MENU],PM_OPEN,gwin->win);
}
-uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
+static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
{
int32 itemid = 0;
struct gui_window_2 *gwin = hook->h_Data;
@@ -480,7 +487,15 @@
break;
case CMID_HISTORY:
- ami_history_open(gwin->bw, gwin->bw->history);
+ if(userdata == NULL)
+ {
+ ami_history_open(gwin->bw, gwin->bw->history);
+ }
+ else
+ {
+ history_go(gwin->bw, gwin->bw->history,
+ (struct history_entry *)userdata, false);
+ }
break;
case CMID_SELCUT:
@@ -530,8 +545,9 @@
return itemid;
}
-bool ami_context_menu_copy_selection(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text, size_t whitespace_length)
+static bool ami_context_menu_copy_selection(const char *text, size_t length,
+ struct box *box, void *handle, const char *whitespace_text,
+ size_t whitespace_length)
{
struct ami_context_menu_selection *sel = handle;
int len = length;
@@ -548,3 +564,17 @@
return true;
}
+
+static bool ami_context_menu_history(const struct history *history, int x0, int y0,
+ int x1, int y1, const struct history_entry *entry, void *user_data)
+{
+ struct gui_window_2 *gwin = (struct gui_window_2 *)user_data;
+
+ IDoMethod(gwin->objects[OID_MENU], PM_INSERT,
+ NewObject(POPUPMENU_GetItemClass(), NULL,
+ PMIA_Title, (ULONG)history_entry_get_title(entry),
+ PMIA_ID, CMID_HISTORY,
+ PMIA_UserData, entry,
+ TAG_DONE),
+ ~0);
+}
12 years, 6 months
r11864 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Feb 28 16:12:34 2011
New Revision: 11864
URL: http://source.netsurf-browser.org?rev=11864&view=rev
Log:
Memory leak
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=11864&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Feb 28 16:12:34 2011
@@ -2986,6 +2986,12 @@
DisposeObject(g->shared->objects[OID_MAIN]);
+ /* These aren't freed by the above.
+ * TODO: nav_west etc need freeing too */
+ DisposeObject(g->shared->objects[GID_ADDTAB_BM]);
+ DisposeObject(g->shared->objects[GID_CLOSETAB_BM]);
+ DisposeObject(g->shared->objects[GID_TABS_FLAG]);
+
ami_free_menulabs(g->shared);
free(g->shared->wintitle);
ami_utf8_free(g->shared->status);
12 years, 6 months
r11862 chris_y - /trunk/netsurf/amiga/context_menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon Feb 28 16:03:18 2011
New Revision: 11862
URL: http://source.netsurf-browser.org?rev=11862&view=rev
Log:
Avoid multiple duplicated menus
Allow selection menu to appear over blank area of text boxes
Modified:
trunk/netsurf/amiga/context_menu.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Mon Feb 28 16:03:18 2011
@@ -144,6 +144,7 @@
int box_x=0;
int box_y=0;
bool menuhascontent = false;
+ bool no_url = true, no_obj = true, no_sel = true;
if(!cc) return;
if(content_get_type(cc) != CONTENT_HTML) return;
@@ -180,7 +181,7 @@
css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN)
continue;
- if(curbox->href)
+ if(no_url && curbox->href)
{
IDoMethod(gwin->objects[OID_MENU],PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
@@ -210,10 +211,11 @@
TAG_DONE),
~0);
+ no_url = false;
menuhascontent = true;
}
- if (curbox->object)
+ if(no_obj && curbox->object)
{
IDoMethod(gwin->objects[OID_MENU],PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
@@ -248,10 +250,14 @@
TAG_DONE),
~0);
+ no_obj = false;
menuhascontent = true;
}
- if(curbox->text)
+ if(no_sel && (curbox->text) ||
+ (curbox->gadget && ((curbox->gadget->type == GADGET_TEXTBOX) ||
+ (curbox->gadget->type == GADGET_TEXTAREA) ||
+ (curbox->gadget->type == GADGET_PASSWORD))))
{
BOOL disabled_readonly = selection_read_only(gwin->bw->sel);
BOOL disabled_noselection = !selection_defined(gwin->bw->sel);
@@ -297,6 +303,7 @@
TAG_DONE),
~0);
+ no_sel = false;
menuhascontent = true;
}
12 years, 6 months
r11861 jmb - in /trunk/netsurf/content: content.c content.h content_protected.h
by netsurf@semichrome.net
Author: jmb
Date: Mon Feb 28 14:38:23 2011
New Revision: 11861
URL: http://source.netsurf-browser.org?rev=11861&view=rev
Log:
Purge CONTENT_STATUS_TYPE_UNKNOWN
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/content.h
trunk/netsurf/content/content_protected.h
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=118...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Mon Feb 28 14:38:23 2011
@@ -254,7 +254,6 @@
};
const char * const content_status_name[] = {
- "TYPE_UNKNOWN",
"LOADING",
"READY",
"DONE",
@@ -423,9 +422,6 @@
*
* \param url URL of content, copied
* \return the new content structure, or 0 on memory exhaustion
- *
- * The type is initialised to CONTENT_UNKNOWN, and the status to
- * CONTENT_STATUS_TYPE_UNKNOWN.
*/
struct content * content_create(llcache_handle *llcache,
@@ -643,8 +639,7 @@
if (status == token)
status = token + 4;
- if (c->status == CONTENT_STATUS_TYPE_UNKNOWN ||
- c->status == CONTENT_STATUS_LOADING ||
+ if (c->status == CONTENT_STATUS_LOADING ||
c->status == CONTENT_STATUS_READY)
time = wallclock() - c->time;
else
@@ -1262,7 +1257,7 @@
content_status content__get_status(struct content *c)
{
if (c == NULL)
- return CONTENT_STATUS_TYPE_UNKNOWN;
+ return CONTENT_STATUS_ERROR;
return c->status;
}
Modified: trunk/netsurf/content/content.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=118...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Mon Feb 28 14:38:23 2011
@@ -44,7 +44,6 @@
/** Status of a content */
typedef enum {
- CONTENT_STATUS_TYPE_UNKNOWN, /**< Type not yet known. */
CONTENT_STATUS_LOADING, /**< Content is being fetched or
converted and is not safe to display. */
CONTENT_STATUS_READY, /**< Some parts of content still being
Modified: trunk/netsurf/content/content_protected.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_protected...
==============================================================================
--- trunk/netsurf/content/content_protected.h (original)
+++ trunk/netsurf/content/content_protected.h Mon Feb 28 14:38:23 2011
@@ -167,8 +167,8 @@
/** Bitmap, for various image contents. */
struct bitmap *bitmap;
- unsigned int time; /**< Creation time, if TYPE_UNKNOWN,
- LOADING or READY,
+ unsigned int time; /**< Creation time,
+ if LOADING or READY,
otherwise total time. */
unsigned int reformat_time; /**< Earliest time to attempt a
12 years, 6 months
r11860 jmb - /trunk/netsurf/content/content.c
by netsurf@semichrome.net
Author: jmb
Date: Mon Feb 28 14:16:48 2011
New Revision: 11860
URL: http://source.netsurf-browser.org?rev=11860&view=rev
Log:
Remove bogus assertions: content handlers which spawn fetches may not transition out of the LOADING state until after the fetches have completed.
Modified:
trunk/netsurf/content/content.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=118...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Mon Feb 28 14:16:48 2011
@@ -697,13 +697,6 @@
content_set_ready(c);
content_set_done(c);
}
-
- /* After conversion, the content must be in error or either the
- * READY or DONE state and must not be locked */
- assert(c->status == CONTENT_STATUS_READY ||
- c->status == CONTENT_STATUS_DONE ||
- c->status == CONTENT_STATUS_ERROR);
- assert(c->locked == false);
}
/**
12 years, 6 months
r11859 jmb - /trunk/netsurf/content/content.c
by netsurf@semichrome.net
Author: jmb
Date: Mon Feb 28 13:58:08 2011
New Revision: 11859
URL: http://source.netsurf-browser.org?rev=11859&view=rev
Log:
Unlock the content when transitioning into the READY state.
Modified:
trunk/netsurf/content/content.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=118...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Mon Feb 28 13:58:08 2011
@@ -688,23 +688,36 @@
if (handler_map[c->type].convert) {
c->locked = true;
- if (!handler_map[c->type].convert(c)) {
+ if (handler_map[c->type].convert(c) == false) {
+ c->locked = false;
c->status = CONTENT_STATUS_ERROR;
}
- c->locked = false;
+ /* Conversion to the READY state will unlock the content */
} else {
content_set_ready(c);
content_set_done(c);
}
-}
-
-/**
- * Put a content in status CONTENT_STATUS_READY.
+
+ /* After conversion, the content must be in error or either the
+ * READY or DONE state and must not be locked */
+ assert(c->status == CONTENT_STATUS_READY ||
+ c->status == CONTENT_STATUS_DONE ||
+ c->status == CONTENT_STATUS_ERROR);
+ assert(c->locked == false);
+}
+
+/**
+ * Put a content in status CONTENT_STATUS_READY and unlock the content.
*/
void content_set_ready(struct content *c)
{
union content_msg_data msg_data;
+
+ /* The content must be locked at this point, as it can only
+ * become READY after conversion. */
+ assert(c->locked);
+ c->locked = false;
c->status = CONTENT_STATUS_READY;
content_update_status(c);
@@ -743,7 +756,7 @@
assert(c != 0);
assert(c->status == CONTENT_STATUS_READY ||
c->status == CONTENT_STATUS_DONE);
- assert(!c->locked);
+ assert(c->locked == false);
LOG(("%p %s", c, llcache_handle_get_url(c->llcache)));
c->locked = true;
c->available_width = width;
@@ -765,7 +778,7 @@
{
assert(c);
LOG(("content %p %s", c, llcache_handle_get_url(c->llcache)));
- assert(!c->locked);
+ assert(c->locked == false);
if (c->type < HANDLER_MAP_COUNT && handler_map[c->type].destroy)
handler_map[c->type].destroy(c);
12 years, 6 months