diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-01-04 16:40:19 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-01-04 16:40:19 +0000 |
commit | 4a64ee085cebf685431fe2c5af7060c5e5a78eaf (patch) | |
tree | ce110d86f51f6bd5770727702c68a183da520a28 /app/xterm/menu.c | |
parent | d74c4945d1b4b45a68384735fc45585735cb36c0 (diff) |
Update to xterm 287. tested by mpi@ and krw@.
Diffstat (limited to 'app/xterm/menu.c')
-rw-r--r-- | app/xterm/menu.c | 167 |
1 files changed, 94 insertions, 73 deletions
diff --git a/app/xterm/menu.c b/app/xterm/menu.c index 4cc3e2ece..118ec282b 100644 --- a/app/xterm/menu.c +++ b/app/xterm/menu.c @@ -1,7 +1,7 @@ -/* $XTermId: menu.c,v 1.301 2011/12/14 01:21:57 tom Exp $ */ +/* $XTermId: menu.c,v 1.310 2012/09/22 14:53:45 tom Exp $ */ /* - * Copyright 1999-2010,2011 by Thomas E. Dickey + * Copyright 1999-2011,2012 by Thomas E. Dickey * * All Rights Reserved * @@ -967,45 +967,6 @@ SetItemSensitivity(Widget mi, Bool val) * action routines */ -#if OPT_MAXIMIZE -static void -do_fullscreen(Widget gw GCC_UNUSED, - XtPointer closure GCC_UNUSED, - XtPointer data GCC_UNUSED) -{ - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); - - if (resource.fullscreen != esNever) - FullScreen(xw, !screen->fullscreen); -} - -/* ARGSUSED */ -void -HandleFullscreen(Widget w, - XEvent * event GCC_UNUSED, - String * params GCC_UNUSED, - Cardinal *param_count GCC_UNUSED) -{ - do_fullscreen(w, (XtPointer) 0, (XtPointer) 0); -} - -void -update_fullscreen(void) -{ - if (resource.fullscreen <= 1) { - UpdateCheckbox("update_fullscreen", - mainMenuEntries, - mainMenu_fullscreen, - TScreenOf(term)->fullscreen); - } else { - SetItemSensitivity(mainMenuEntries[mainMenu_fullscreen].widget, - False); - } -} - -#endif /* OPT_MAXIMIZE */ - static void do_securekbd(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, @@ -1613,9 +1574,9 @@ do_activeicon(Widget gw GCC_UNUSED, if (screen->iconVwin.window) { Widget shell = XtParent(term); - ToggleFlag(term->misc.active_icon); + ToggleFlag(term->work.active_icon); XtVaSetValues(shell, XtNiconWindow, - term->misc.active_icon ? screen->iconVwin.window : None, + term->work.active_icon ? screen->iconVwin.window : None, (XtPointer) 0); update_activeicon(); } @@ -1747,7 +1708,7 @@ do_font_renderfont(Widget gw GCC_UNUSED, String name = TScreenOf(xw)->MenuFontName(fontnum); DefaultRenderFont(xw); - ToggleFlag(xw->misc.render_font); + ToggleFlag(xw->work.render_font); update_font_renderfont(); xtermLoadFont(xw, xtermFontName(name), True, fontnum); ScrnRefresh(term, 0, 0, @@ -1950,50 +1911,57 @@ do_tekhide(Widget gw GCC_UNUSED, /* * public handler routines */ - -static void -handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, - int var, - String * params, - Cardinal nparams, - Widget w, - XtPointer closure, - XtPointer data) +int +decodeToggle(XtermWidget xw, String * params, Cardinal nparams) { - XtermWidget xw = term; - int dir = -2; + int dir = toggleErr; switch (nparams) { case 0: - dir = -1; + dir = toggleAll; break; case 1: if (XmuCompareISOLatin1(params[0], "on") == 0) - dir = 1; + dir = toggleOn; else if (XmuCompareISOLatin1(params[0], "off") == 0) - dir = 0; + dir = toggleOff; else if (XmuCompareISOLatin1(params[0], "toggle") == 0) - dir = -1; + dir = toggleAll; break; } - switch (dir) { - case -2: + if (dir == toggleErr) { Bell(xw, XkbBI_MinorError, 0); - break; + } + + return dir; +} - case -1: +static void +handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, + int var, + String * params, + Cardinal nparams, + Widget w, + XtPointer closure, + XtPointer data) +{ + XtermWidget xw = term; + + switch (decodeToggle(xw, params, nparams)) { + + case toggleAll: (*proc) (w, closure, data); break; - case 0: + case toggleOff: if (var) (*proc) (w, closure, data); else Bell(xw, XkbBI_MinorError, 0); break; - case 1: + case toggleOn: if (!var) (*proc) (w, closure, data); else @@ -2186,6 +2154,56 @@ HandleBackarrow(Widget w, params, *param_count, w); } +#if OPT_MAXIMIZE +#if OPT_TEK4014 +#define WhichEWMH (TEK4014_ACTIVE(xw) != 0) +#else +#define WhichEWMH 0 +#endif +static void +do_fullscreen(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + XtermWidget xw = term; + + if (resource.fullscreen != esNever) + FullScreen(xw, !xw->work.ewmh[WhichEWMH].mode); +} + +/* ARGSUSED */ +void +HandleFullscreen(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + XtermWidget xw = term; + + if (resource.fullscreen != esNever) { + handle_vt_toggle(do_fullscreen, xw->work.ewmh[WhichEWMH].mode, + params, *param_count, w); + } +} + +void +update_fullscreen(void) +{ + XtermWidget xw = term; + + if (resource.fullscreen <= 1) { + UpdateCheckbox("update_fullscreen", + mainMenuEntries, + mainMenu_fullscreen, + xw->work.ewmh[WhichEWMH].mode); + } else { + SetItemSensitivity(mainMenuEntries[mainMenu_fullscreen].widget, + False); + } +} + +#endif /* OPT_MAXIMIZE */ + #if OPT_SUN_FUNC_KEYS void HandleSunFunctionKeys(Widget w, @@ -2573,7 +2591,7 @@ update_fontmenu(XtermWidget xw) int n; for (n = 0; n <= fontMenu_lastBuiltin; ++n) { - Boolean active = (Boolean) (xw->misc.render_font || + Boolean active = (Boolean) (xw->work.render_font || (screen->menu_font_sizes[n] >= 0)); SetItemSensitivity(fontMenuEntries[n].widget, active); } @@ -2589,7 +2607,7 @@ HandleRenderFont(Widget w, DefaultRenderFont(xw); - handle_vt_toggle(do_font_renderfont, xw->misc.render_font, + handle_vt_toggle(do_font_renderfont, xw->work.render_font, params, *param_count, w); update_fontmenu(xw); @@ -2839,7 +2857,7 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high) if (shell == toplevel) { XawSimpleMenuAddGlobalActions(app_con); XtRegisterGrabAction(HandlePopupMenu, True, - (ButtonPressMask | ButtonReleaseMask), + (unsigned) (ButtonPressMask | ButtonReleaseMask), GrabModeAsync, GrabModeAsync); } #if OPT_TOOLBAR @@ -3465,7 +3483,7 @@ update_activeicon(void) UpdateCheckbox("update_activeicon", vtMenuEntries, vtMenu_activeicon, - term->misc.active_icon); + term->work.active_icon); } #endif /* NO_ACTIVE_ICON */ @@ -3531,7 +3549,7 @@ update_font_renderfont(void) UpdateCheckbox("update_font_renderfont", fontMenuEntries, fontMenu_render_font, - (term->misc.render_font == True)); + (term->work.render_font == True)); SetItemSensitivity(fontMenuEntries[fontMenu_render_font].widget, !IsEmpty(term->misc.face_name)); update_fontmenu(term); @@ -3769,15 +3787,18 @@ update_tekshow(void) void update_vttekmode(void) { - if (!(TScreenOf(term)->inhibit & I_TEK)) { + XtermWidget xw = term; + + if (!(TScreenOf(xw)->inhibit & I_TEK)) { UpdateCheckbox("update_vtmode", vtMenuEntries, vtMenu_tekmode, - TEK4014_ACTIVE(term)); + TEK4014_ACTIVE(xw)); UpdateCheckbox("update_tekmode", tekMenuEntries, tekMenu_vtmode, - !TEK4014_ACTIVE(term)); + !TEK4014_ACTIVE(xw)); + update_fullscreen(); } } |