re-fresh
[nedit-bw.git] / closeTabNoPrompt.diff
blob53aaca62367d455dbc1096d2f2f53b80531acfd5
1 From: Tony Balinski <ajbj@free.fr>
2 Subject: Close without prompting if close-tab button pressed with Shift or Control
4 ---
6 source/window.c | 18 +++++++++++++++---
7 1 file changed, 15 insertions(+), 3 deletions(-)
9 diff --quilt old/source/window.c new/source/window.c
10 --- old/source/window.c
11 +++ new/source/window.c
12 @@ -160,7 +160,7 @@ static int getTabPosition(Widget tab);
13 static Widget manageToolBars(Widget toolBarsForm);
14 static void hideTearOffs(Widget menuPane);
15 static void CloseDocumentWindow(Widget w, WindowInfo *window, XtPointer callData);
16 -static void closeTabCB(Widget w, Widget mainWin, caddr_t callData);
17 +static void closeTabCB(Widget w, Widget mainWin, XmAnyCallbackStruct *callData);
18 static void raiseTabCB(Widget w, XtPointer clientData, XtPointer callData);
19 static Widget createTextArea(Widget parent, WindowInfo *window, int rows,
20 int cols, int emTabDist, char *delimiters, int wrapMargin,
21 @@ -4929,10 +4929,15 @@ static void closeTabProc(XtPointer clien
22 CloseFileAndWindow((WindowInfo*)clientData, PROMPT_SBC_DIALOG_RESPONSE);
25 +static void closeTabNoSaveProc(XtPointer clientData, XtIntervalId *id)
27 + CloseFileAndWindow((WindowInfo*)clientData, NO_SBC_DIALOG_RESPONSE);
31 ** callback to close-tab button.
33 -static void closeTabCB(Widget w, Widget mainWin, caddr_t callData)
34 +static void closeTabCB(Widget w, Widget mainWin, XmAnyCallbackStruct *callData)
36 /* FIXME: XtRemoveActionHook() related coredump
38 @@ -4951,8 +4956,15 @@ static void closeTabCB(Widget w, Widget
39 While its actual mechanism is not well understood, we somehow
40 managed to workaround the bug by delaying the action of closing
41 the tab. For now. */
43 + XtTimerCallbackProc pCloseTabProc = closeTabProc;
45 + /* don't prompt for save if the Ctrl or Shift key was pressed */
46 + if (callData->event->xbutton.state & (ShiftMask | ControlMask))
47 + pCloseTabProc = closeTabNoSaveProc;
49 XtAppAddTimeOut(XtWidgetToApplicationContext(w), 0,
50 - closeTabProc, GetTopDocument(mainWin));
51 + pCloseTabProc, GetTopDocument(mainWin));