diff -Nru xterm-XF86-4.3.0.orig/charproc.c xterm-XF86-4.3.0/charproc.c --- xterm-XF86-4.3.0.orig/charproc.c 2003-02-25 15:36:55.000000000 -0800 +++ xterm-XF86-4.3.0/charproc.c 2003-06-28 00:26:26.000000000 -0700 @@ -213,6 +213,7 @@ 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(PRIMARY, CUT_BUFFER0) \n\ @@ -262,6 +263,7 @@ "; /* PROCURA added "Meta :clear-saved-lines()" */ /* *INDENT-OFF* */ static XtActionsRec actionsList[] = { + { "fullscreen", HandleFullscreen }, { "allow-send-events", HandleAllowSends }, { "bell", HandleBell }, { "clear-saved-lines", HandleClearSavedLines }, @@ -4965,6 +4967,11 @@ sizehints.flags = (PBaseSize | PMinSize | PResizeInc); sizehints.x = xpos; sizehints.y = ypos; + /* assure single-increment resize for fullscreen */ + if (term->screen.fullscreen) { + sizehints.width_inc = 1; + sizehints.height_inc = 1; + } if ((XValue & pr) || (YValue & pr)) { sizehints.flags |= USSize | USPosition; sizehints.flags |= PWinGravity; diff -Nru xterm-XF86-4.3.0.orig/menu.c xterm-XF86-4.3.0/menu.c --- xterm-XF86-4.3.0.orig/menu.c 2002-10-05 10:57:12.000000000 -0700 +++ xterm-XF86-4.3.0/menu.c 2003-06-28 00:42:25.000000000 -0700 @@ -132,6 +132,7 @@ static void do_visualbell PROTO_XT_CALLBACK_ARGS; static void do_poponbell 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; @@ -198,6 +199,7 @@ * The order of entries MUST match the values given in menu.h */ MenuEntry mainMenuEntries[] = { + { "fullscreen", do_fullscreen, NULL }, { "securekbd", do_securekbd, NULL }, { "allowsends", do_allowsends, NULL }, { "redraw", do_redraw, NULL }, @@ -510,6 +512,7 @@ switch (me) { case mainMenu: if (created) { + update_fullscreen(); update_securekbd(); update_allowsends(); update_logging(); @@ -667,6 +670,219 @@ do_securekbd(vt_shell[mainMenu].w, (XtPointer) 0, (XtPointer) 0); } +/********************************************************************/ +/* BEGIN: Simmons Fullscreen Hack */ +/********************************************************************/ + +#include + +static void +set_resize_increments() { + 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() { + 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 + ); + + 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; + Atom atom_fullscreen = XInternAtom(term->screen.display, "_NET_WM_STATE_FULLSCREEN", False); + 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); +} + +static int +probe_netwm_fullscreen_capability() { + Atom atom_fullscreen = XInternAtom(term->screen.display, "_NET_WM_STATE_FULLSCREEN", False); + Atom atom_supported = XInternAtom(term->screen.display, "_NET_SUPPORTED", False); + 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; + + if (Success != XGetWindowProperty( + term->screen.display, /* display */ + DefaultRootWindow(term->screen.display),/* window */ + atom_supported, /* property */ + 0, /* long_offset */ + (65536 / sizeof(long)), /* long_length */ + False, /* delete */ + AnyPropertyType, /* req_type */ + &type, /* actual_type_return */ + &format, /* actual_format_return */ + &nitems, /* nitems_return */ + &bytesafter, /* bytes_after_return */ + &args /* prop_return */ + )) { + 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 */ + } + +#if 0 + memset(&geometry, 0, sizeof(XtWidgetGeometry)); + + width = WidthOfScreen(xscreen); + height = HeightOfScreen(xscreen); + + stat = XtMakeResizeRequest( + (Widget) term, + width, + height, + &replyWidth, + &replyHeight + ); + + if (stat == XtGeometryYes || stat == XtGeometryDone) { + term->core.width = replyWidth; + term->core.height = replyHeight; + + XMoveWindow(XtDisplay(term), XtWindow(XtParent(term)), 0, 0); + ScreenResize(&term->screen, replyWidth, replyHeight, + &term->flags); + } +#endif + screen->fullscreen = TRUE; + + } else { + + /* DISABLE FULLSCREEN */ + + if (netwm_fullscreen_capability) { + set_resize_increments(); + netwm_fullscreen(0); + } else { + /* no support yet */ + } + + screen->fullscreen = FALSE; + } + update_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); +} + +/********************************************************************/ +/* END: Simmons Fullscreen Hack */ +/********************************************************************/ + static void do_securekbd(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, diff -Nru xterm-XF86-4.3.0.orig/menu.h xterm-XF86-4.3.0/menu.h --- xterm-XF86-4.3.0.orig/menu.h 2002-08-11 17:36:33.000000000 -0700 +++ xterm-XF86-4.3.0/menu.h 2003-06-27 21:19:41.000000000 -0700 @@ -72,6 +72,7 @@ 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; @@ -134,6 +135,7 @@ * items in primary menu */ typedef enum { + mainMenu_fullscreen, mainMenu_securekbd, mainMenu_allowsends, mainMenu_redraw, @@ -283,6 +285,10 @@ * there should be one of each of the following for each checkable item */ +#define update_fullscreen() \ + update_menu_item (term->screen.mainMenu, \ + mainMenuEntries[mainMenu_fullscreen].widget, \ + term->screen.fullscreen) #define update_securekbd() \ update_menu_item (term->screen.mainMenu, \ diff -Nru xterm-XF86-4.3.0.orig/ptyx.h xterm-XF86-4.3.0/ptyx.h --- xterm-XF86-4.3.0.orig/ptyx.h 2003-02-25 15:36:55.000000000 -0800 +++ xterm-XF86-4.3.0/ptyx.h 2003-06-27 17:12:50.000000000 -0700 @@ -1110,6 +1110,7 @@ Boolean allowWindowOps; /* 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 -Nru xterm-XF86-4.3.0.orig/scrollbar.c xterm-XF86-4.3.0/scrollbar.c --- xterm-XF86-4.3.0.orig/scrollbar.c 2002-12-27 13:05:23.000000000 -0800 +++ xterm-XF86-4.3.0/scrollbar.c 2003-06-28 01:11:51.000000000 -0700 @@ -168,6 +168,11 @@ + min_width; sizehints.height = (screen->max_row + 1) * FontHeight(screen) + min_height; + /* assure single-increment resize for fullscreen */ + if (term->screen.fullscreen) { + sizehints.width_inc = 1; + sizehints.height_inc = 1; + } #endif /* @@ -177,8 +182,9 @@ XtVaSetValues(XtParent(xw), XtNbaseWidth, min_width, XtNbaseHeight, min_height, - XtNwidthInc, FontWidth(screen), - XtNheightInc, FontHeight(screen), + /* assure single-increment resize for fullscreen */ + XtNwidthInc, term->screen.fullscreen ? 1 : FontWidth(screen), + XtNheightInc, term->screen.fullscreen ? 1 : FontHeight(screen), XtNminWidth, min_width + FontWidth(screen), XtNminHeight, min_height + FontHeight(screen), (XtPointer) 0); @@ -191,6 +197,14 @@ (screen->max_col + 1), reqHeight, reqWidth)); + /* compensate for fullscreen mode */ + if (screen->fullscreen) { + Screen *xscreen = DefaultScreenOfDisplay(term->screen.display); + reqWidth = WidthOfScreen(xscreen); + reqHeight = HeightOfScreen(xscreen); + ScreenResize(screen, reqWidth, reqHeight, &term->flags); + } + geomreqresult = XtMakeResizeRequest((Widget) xw, reqWidth, reqHeight, &repWidth, &repHeight); diff -Nru xterm-XF86-4.3.0.orig/XTerm.ad xterm-XF86-4.3.0/XTerm.ad --- xterm-XF86-4.3.0.orig/XTerm.ad 2002-09-29 17:39:05.000000000 -0700 +++ xterm-XF86-4.3.0/XTerm.ad 2003-06-28 00:20:05.000000000 -0700 @@ -18,6 +18,7 @@ *SimpleMenu*Cursor: left_ptr *mainMenu.Label: Main Options +*mainMenu*fullscreen*Label: Full Screen *mainMenu*securekbd*Label: Secure Keyboard *mainMenu*allowsends*Label: Allow SendEvents *mainMenu*redraw*Label: Redraw Window @@ -142,3 +143,7 @@ *VT100*color15: white *VT100*colorUL: yellow *VT100*colorBD: white + +*VT100.translations: #override \ +Alt Return: fullscreen() +