Ensure kiosk_mode and frame windows are (a) handled the same wrt menus and (b) not

trying to manipulate non-existant menus

svn path=/trunk/netsurf/; revision=10855
This commit is contained in:
Chris Young 2010-09-28 18:03:03 +00:00
parent 6e1639a032
commit c46e0e6015
4 changed files with 26 additions and 11 deletions

View File

@ -64,6 +64,8 @@ void gui_start_selection(struct gui_window *g)
{ {
if(!g) return; if(!g) return;
if(!g->shared->win) return; if(!g->shared->win) return;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(option_kiosk_mode == true) return;
OnMenu(g->shared->win, AMI_MENU_CLEAR); OnMenu(g->shared->win, AMI_MENU_CLEAR);
OnMenu(g->shared->win, AMI_MENU_COPY); OnMenu(g->shared->win, AMI_MENU_COPY);
@ -76,6 +78,8 @@ void gui_clear_selection(struct gui_window *g)
{ {
if(!g) return; if(!g) return;
if(!g->shared->win) return; if(!g->shared->win) return;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(option_kiosk_mode == true) return;
OffMenu(g->shared->win, AMI_MENU_CLEAR); OffMenu(g->shared->win, AMI_MENU_CLEAR);
OffMenu(g->shared->win, AMI_MENU_CUT); OffMenu(g->shared->win, AMI_MENU_CUT);

View File

@ -1274,19 +1274,22 @@ void ami_handle_msg(void)
switch(nskey) switch(nskey)
{ {
case 'n': case 'n':
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
browser_window_create(NULL, gwin->bw, browser_window_create(NULL, gwin->bw,
0, true, false); 0, true, false);
break; break;
case 't': case 't':
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
browser_window_create(NULL, gwin->bw, browser_window_create(NULL, gwin->bw,
0, true, true); 0, true, true);
break; break;
case 'k': case 'k':
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
browser_window_destroy(gwin->bw); browser_window_destroy(gwin->bw);
break; break;
@ -1295,7 +1298,8 @@ void ami_handle_msg(void)
break; break;
case 'q': case 'q':
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
ami_quit_netsurf(); ami_quit_netsurf();
break; break;
@ -1325,7 +1329,8 @@ void ami_handle_msg(void)
break; break;
case 'h': case 'h':
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
ami_open_tree(hotlist,AMI_TREE_HOTLIST); ami_open_tree(hotlist,AMI_TREE_HOTLIST);
break; break;
@ -1337,7 +1342,8 @@ void ami_handle_msg(void)
break; break;
case 'u': // open url case 'u': // open url
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
ActivateGadget((struct Gadget *)gwin->objects[GID_URL], ActivateGadget((struct Gadget *)gwin->objects[GID_URL],
gwin->win, NULL); gwin->win, NULL);
break; break;
@ -3490,6 +3496,7 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
if(option_kiosk_mode == true) return; if(option_kiosk_mode == true) return;
if(!g) return; if(!g) return;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current, if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
g->shared->objects[GID_TABS], g->shared->objects[GID_TABS],
@ -3638,7 +3645,8 @@ void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
g->c_y = y; g->c_y = y;
g->c_h = height; g->c_h = height;
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(g->shared->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
OnMenu(g->shared->win, AMI_MENU_PASTE); OnMenu(g->shared->win, AMI_MENU_PASTE);
} }
@ -3650,7 +3658,8 @@ void gui_window_remove_caret(struct gui_window *g)
if(!g) return; if(!g) return;
if(g->c_h == 0) return; if(g->c_h == 0) return;
if(option_kiosk_mode == false) if((option_kiosk_mode == false) &&
(g->shared->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
OffMenu(g->shared->win, AMI_MENU_PASTE); OffMenu(g->shared->win, AMI_MENU_PASTE);
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox); GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
@ -3678,9 +3687,6 @@ void gui_window_new_content(struct gui_window *g)
g->shared->oldv = 0; g->shared->oldv = 0;
g->favicon = NULL; g->favicon = NULL;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL ||
option_kiosk_mode == true) return;
ami_menu_update_disabled(g, c); ami_menu_update_disabled(g, c);
} }

View File

@ -847,6 +847,9 @@ void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c)
{ {
struct Window *win = g->shared->win; struct Window *win = g->shared->win;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(option_kiosk_mode == true) return;
OffMenu(win,AMI_MENU_CUT); OffMenu(win,AMI_MENU_CUT);
OffMenu(win,AMI_MENU_COPY); OffMenu(win,AMI_MENU_COPY);
OffMenu(win,AMI_MENU_PASTE); OffMenu(win,AMI_MENU_PASTE);

View File

@ -390,6 +390,7 @@ void gui_window_start_throbber(struct gui_window *g)
if(!g) return; if(!g) return;
if(option_kiosk_mode) return; if(option_kiosk_mode) return;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(g->tab_node && (g->shared->tabs > 1)) if(g->tab_node && (g->shared->tabs > 1))
{ {
@ -420,6 +421,7 @@ void gui_window_stop_throbber(struct gui_window *g)
if(!g) return; if(!g) return;
if(option_kiosk_mode) return; if(option_kiosk_mode) return;
if(g->shared->bw->browser_window_type != BROWSER_WINDOW_NORMAL) return;
if(g->tab_node && (g->shared->tabs > 1)) if(g->tab_node && (g->shared->tabs > 1))
{ {