diff -pruN xterm-229.orig/charproc.c xterm-229/charproc.c --- xterm-229.orig/charproc.c 2007-07-17 22:09:48.000000000 +0100 +++ xterm-229/charproc.c 2007-11-03 02:30:28.000000000 +0000 @@ -206,6 +206,7 @@ static char *_Font_Selected_ = "yes"; /* static char defaultTranslations[] = "\ + Alt Return: fullscreen()\n\ Shift Prior:scroll-back(1,halfpage) \n\ Shift Next:scroll-forw(1,halfpage) \n\ Shift Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\ @@ -255,6 +256,7 @@ static char defaultTranslations[] = "; /* PROCURA added "Meta :clear-saved-lines()" */ /* *INDENT-OFF* */ static XtActionsRec actionsList[] = { + { "fullscreen", HandleFullscreen }, { "allow-send-events", HandleAllowSends }, { "bell", HandleBell }, { "clear-saved-lines", HandleClearSavedLines }, diff -pruN xterm-229.orig/menu.c xterm-229/menu.c --- xterm-229.orig/menu.c 2007-07-22 21:34:04.000000000 +0100 +++ xterm-229/menu.c 2007-11-03 03:36:02.000000000 +0000 @@ -150,6 +150,7 @@ static void do_terminate PROTO_XT_ static void do_titeInhibit PROTO_XT_CALLBACK_ARGS; static void do_visualbell PROTO_XT_CALLBACK_ARGS; static void do_vtfont PROTO_XT_CALLBACK_ARGS; +static void do_fullscreen PROTO_XT_CALLBACK_ARGS; #ifdef ALLOWLOGGING static void do_logging PROTO_XT_CALLBACK_ARGS; @@ -241,6 +242,7 @@ MenuEntry mainMenuEntries[] = { #if OPT_TOOLBAR { "toolbar", do_toolbar, NULL }, #endif + { "fullscreen", do_fullscreen, NULL }, { "securekbd", do_securekbd, NULL }, { "allowsends", do_allowsends, NULL }, { "redraw", do_redraw, NULL }, @@ -410,6 +412,9 @@ static MenuList vt_shell[NUM_POPUP_MENUS static MenuList tek_shell[NUM_POPUP_MENUS]; #endif +Atom atom_fullscreen = (Atom)0; +Atom atom_supported = (Atom)0; + static String setMenuLocale(Bool before, String substitute) { @@ -789,6 +794,209 @@ handle_send_signal(Widget gw GCC_UNUSED, #endif } +/********************************************************************/ +/* BEGIN: Simmons Fullscreen Hack */ +/********************************************************************/ + +#include + +static void +set_resize_increments (void) +{ + int min_width = + (2 * term->screen.border) + term->screen.fullVwin.sb_info.width; + int min_height = (2 * term->screen.border); + + XSizeHints sizehints; + + memset (&sizehints, 0, sizeof (XSizeHints)); + + sizehints.width_inc = FontWidth (&term->screen); + sizehints.height_inc = FontHeight (&term->screen); + sizehints.flags = PResizeInc; + + XSetWMNormalHints (term->screen.display, XtWindow (XtParent (term)), + &sizehints); + + XtVaSetValues (XtParent (term), + XtNbaseWidth, min_width, + XtNbaseHeight, min_height, + XtNminWidth, min_width + FontWidth (&term->screen), + XtNminHeight, min_height + FontHeight (&term->screen), + XtNwidthInc, FontWidth (&term->screen), + XtNheightInc, FontHeight (&term->screen), + (XtPointer) 0); + + XFlush (XtDisplay (term)); + +} + +static void +unset_resize_increments (void) +{ + XSizeHints sizehints; + + memset (&sizehints, 0, sizeof (XSizeHints)); + + sizehints.width_inc = 1; + sizehints.height_inc = 1; + sizehints.flags = PResizeInc; + + XSetWMNormalHints (term->screen.display, XtWindow (XtParent (term)), + &sizehints); + + XtVaSetValues (XtParent (term), XtNwidthInc, 1, XtNheightInc, 1, + (XtPointer) 0, (XtPointer) 0); + + XFlush (XtDisplay (term)); +} + +static void +netwm_fullscreen (int enable) +{ + XEvent e; + Display *display = term->screen.display; + Window window = XtWindow (XtParent (term)); + int operation = enable ? 1 : 0; + + int win_width = (2 * term->screen.border) + (FontWidth (&term->screen) * 80); + int win_height = (2 * term->screen.border) + (FontHeight (&term->screen) * 24); + + Atom atom_state = XInternAtom (term->screen.display, + "_NET_WM_STATE", False); + + memset (&e, 0, sizeof(e)); + + e.xclient.type = ClientMessage; + e.xclient.message_type = atom_state; + e.xclient.display = display; + e.xclient.window = window; + e.xclient.format = 32; + e.xclient.data.l[0] = operation; + e.xclient.data.l[1] = atom_fullscreen; + + XSendEvent (display, DefaultRootWindow (display), False, + SubstructureRedirectMask, &e); + + if (enable != 1) + /* set it back to an VT100 */ + XMoveResizeWindow (term->screen.display, XtWindow (XtParent (term)), + 0, 0, win_width, win_height); +} + +static int +probe_netwm_fullscreen_capability (void) +{ + Atom type; + int format; + unsigned int i; + unsigned long nitems, bytesafter; + unsigned char *args; + unsigned long *ldata; + char *name; + int retval = -1; + int netwm_fullscreen_capability = 0; + + atom_fullscreen = XInternAtom (term->screen.display, + "_NET_WM_STATE_FULLSCREEN", False); + atom_supported = XInternAtom (term->screen.display, + "_NET_SUPPORTED", False); + + if (Success != XGetWindowProperty (term->screen.display, + DefaultRootWindow(term->screen.display), + atom_supported, 0, (65536 / sizeof(long)), + False, AnyPropertyType, &type, &format, + &nitems, &bytesafter, &args)) + netwm_fullscreen_capability = 0; + else if (type != XA_ATOM) + netwm_fullscreen_capability = 0; + else + { + ldata = (unsigned long*)args; + + for (i = 0; i < nitems; i++) + { + if (ldata[i] == atom_fullscreen) + netwm_fullscreen_capability = 1; + } + XFree (ldata); + } + return netwm_fullscreen_capability; +} + +static void +do_fullscreen (Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + register TScreen *screen = &term->screen; + Time now = CurrentTime; /* XXX - wrong */ + Dimension width; + Dimension height; + Dimension replyWidth; + Dimension replyHeight; + XtGeometryResult stat; + XtWidgetGeometry geometry; + + static int have_probed = 0; + static int netwm_fullscreen_capability = 0; + + if (have_probed == 0) + { + have_probed = 1; + netwm_fullscreen_capability = probe_netwm_fullscreen_capability (); + } + + /* at this time, there is no support for lame window managers */ + if (!netwm_fullscreen_capability) + { + Bell (XkbBI_MinorError, 100); + return; + } + + Screen *xscreen = DefaultScreenOfDisplay (term->screen.display); + + if (!screen->fullscreen) + { + /* ENABLE FULLSCREEN */ + if (netwm_fullscreen_capability) + { + unset_resize_increments (); + netwm_fullscreen (1); + } + else + { + /* no support yet */ + } + screen->fullscreen = TRUE; + } + else + { + /* DISABLE FULLSCREEN */ + if (netwm_fullscreen_capability) + { + set_resize_increments (); + netwm_fullscreen (0); + } + else + { + /* no support yet */ + } + screen->fullscreen = FALSE; + } +} + +/* 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); +} + +/********************************************************************/ +/* END: Simmons Fullscreen Hack */ +/********************************************************************/ + /* * action routines */ diff -pruN xterm-229.orig/menu.h xterm-229/menu.h --- xterm-229.orig/menu.h 2007-03-17 00:00:37.000000000 +0000 +++ xterm-229/menu.h 2007-11-03 02:43:32.000000000 +0000 @@ -68,6 +68,7 @@ extern MenuEntry fontMenuEntries[]; extern MenuEntry tekMenuEntries[]; #endif +extern void HandleFullscreen PROTO_XT_ACTIONS_ARGS; extern void Handle8BitControl PROTO_XT_ACTIONS_ARGS; extern void HandleAllow132 PROTO_XT_ACTIONS_ARGS; extern void HandleAllowSends PROTO_XT_ACTIONS_ARGS; @@ -144,6 +145,7 @@ typedef enum { #if OPT_TOOLBAR mainMenu_toolbar, #endif + mainMenu_fullscreen, mainMenu_securekbd, mainMenu_allowsends, mainMenu_redraw, diff -pruN xterm-229.orig/ptyx.h xterm-229/ptyx.h --- xterm-229.orig/ptyx.h 2007-07-17 22:08:07.000000000 +0100 +++ xterm-229/ptyx.h 2007-11-03 02:44:52.000000000 +0000 @@ -1404,6 +1404,7 @@ typedef struct { Boolean allowWindowOp0; /* initial WindowOps mode */ Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ + Boolean fullscreen; /* terminal is fullscreen */ #ifdef ALLOWLOGGING int logging; /* logging mode */ int logfd; /* file descriptor of log */ diff -pruN xterm-229.orig/XTerm.ad xterm-229/XTerm.ad --- xterm-229.orig/XTerm.ad 2007-03-18 22:41:40.000000000 +0000 +++ xterm-229/XTerm.ad 2007-11-03 03:25:26.000000000 +0000 @@ -13,6 +13,7 @@ *mainMenu.Label: Main Options *mainMenu*toolbar*Label: Toolbar +*mainMenu*fullscreen*Label: Full Screen *mainMenu*securekbd*Label: Secure Keyboard *mainMenu*allowsends*Label: Allow SendEvents *mainMenu*redraw*Label: Redraw Window @@ -99,6 +100,9 @@ *VT100.utf8Fonts.font5: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 *VT100.utf8Fonts.font6: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 +*VT100.translations: #override \ + Alt Return: fullscreen() + *tekMenu.Label: Tek Options *tekMenu*tektextlarge*Label: Large Characters *tekMenu*tektext2*Label: #2 Size Characters