1 Close without prompting if close-tab button pressed with Shift or Control
5 source/window.c | 18 +++++++++++++++---
6 1 files changed, 15 insertions(+), 3 deletions(-)
8 diff --quilt old/source/window.c new/source/window.c
9 --- old/source/window.c
10 +++ new/source/window.c
11 @@ -157,11 +157,11 @@ static Widget addTab(Widget folder, cons
12 static int compareWindowNames(const void *windowA, const void *windowB);
13 static int getTabPosition(Widget tab);
14 static Widget manageToolBars(Widget toolBarsForm);
15 static void hideTearOffs(Widget menuPane);
16 static void CloseDocumentWindow(Widget w, WindowInfo *window, XtPointer callData);
17 -static void closeTabCB(Widget w, Widget mainWin, caddr_t callData);
18 +static void closeTabCB(Widget w, Widget mainWin, XmAnyCallbackStruct *callData);
19 static void raiseTabCB(Widget w, XtPointer clientData, XtPointer callData);
20 static Widget createTextArea(Widget parent, WindowInfo *window, int rows,
21 int cols, int emTabDist, char *delimiters, int wrapMargin,
23 static void showStats(WindowInfo *window, int state);
24 @@ -4918,14 +4918,19 @@ static void hideTooltip(Widget tab)
25 static void closeTabProc(XtPointer clientData, XtIntervalId *id)
27 CloseFileAndWindow((WindowInfo*)clientData, PROMPT_SBC_DIALOG_RESPONSE);
30 +static void closeTabNoSaveProc(XtPointer clientData, XtIntervalId *id)
32 + CloseFileAndWindow((WindowInfo*)clientData, NO_SBC_DIALOG_RESPONSE);
36 ** callback to close-tab button.
38 -static void closeTabCB(Widget w, Widget mainWin, caddr_t callData)
39 +static void closeTabCB(Widget w, Widget mainWin, XmAnyCallbackStruct *callData)
41 /* FIXME: XtRemoveActionHook() related coredump
43 An unknown bug seems to be associated with the XtRemoveActionHook()
44 call in FinishLearn(), which resulted in coredump if a tab was
45 @@ -4940,12 +4945,19 @@ static void closeTabCB(Widget w, Widget
46 however, was without any trouble.
48 While its actual mechanism is not well understood, we somehow
49 managed to workaround the bug by delaying the action of closing
52 + XtTimerCallbackProc pCloseTabProc = closeTabProc;
54 + /* don't prompt for save if the Ctrl or Shift key was pressed */
55 + if (callData->event->xbutton.state & (ShiftMask | ControlMask))
56 + pCloseTabProc = closeTabNoSaveProc;
58 XtAppAddTimeOut(XtWidgetToApplicationContext(w), 0,
59 - closeTabProc, GetTopDocument(mainWin));
60 + pCloseTabProc, GetTopDocument(mainWin));
64 ** callback to clicks on a tab to raise it's document.