Avoid multiple duplicated menus

Allow selection menu to appear over blank area of text boxes

svn path=/trunk/netsurf/; revision=11862
This commit is contained in:
Chris Young 2011-02-28 22:03:18 +00:00
parent 8373123b71
commit 4213bd41fb
1 changed files with 10 additions and 3 deletions

View File

@ -144,6 +144,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
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 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
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 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
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 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
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 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
TAG_DONE),
~0);
no_sel = false;
menuhascontent = true;
}