Merge commit 'origin'
[nedit-bw.git] / close_shift_menu_entry.patch
blobd501dfa0028a814d3661644b2e316cb83872c4a4
1 Subject: Ctrl+Shift+W closes window without modification warning
3 ---
5 source/menu.c | 22 +++++++++++++++++++++-
6 source/nedit.c | 3 ++-
7 2 files changed, 23 insertions(+), 2 deletions(-)
9 diff --quilt old/source/menu.c new/source/menu.c
10 --- old/source/menu.c
11 +++ new/source/menu.c
12 @@ -107,6 +107,7 @@ extern void _XmDismissTearOff(Widget, Xt
14 static void doActionCB(Widget w, XtPointer clientData, XtPointer callData);
15 static void doTabActionCB(Widget w, XtPointer clientData, XtPointer callData);
16 +static void closeCB(Widget w, XtPointer clientData, XtPointer callData);
17 static void pasteColCB(Widget w, XtPointer clientData, XtPointer callData);
18 static void shiftLeftCB(Widget w, XtPointer clientData, XtPointer callData);
19 static void shiftRightCB(Widget w, XtPointer clientData, XtPointer callData);
20 @@ -697,8 +698,11 @@ Widget CreateMenuBar(Widget parent, Wind
21 (XtCallbackProc)prevOpenMenuCB, window);
23 createMenuSeparator(menuPane, "sep1", SHORT);
25 window->closeItem = createMenuItem(menuPane, "close", "Close", 'C',
26 - doActionCB, "close", SHORT);
27 + closeCB, window, SHORT);
28 + createFakeMenuItem(menuPane, "closeShift", closeCB, window);
30 createMenuItem(menuPane, "save", "Save", 'S', doActionCB, "save", SHORT);
31 createMenuItem(menuPane, "saveAs", "Save As...", 'A', doActionCB,
32 "save_as_dialog", SHORT);
33 @@ -1450,6 +1454,22 @@ static void doActionCB(Widget w, XtPoint
34 XtCallActionProc(widget, action, event, NULL, 0);
37 +static void closeCB(Widget w, XtPointer clientData, XtPointer callData)
39 + static char *params[1] = { "nosave" };
41 + HidePointerOnKeyedEvent(WidgetToWindow(MENU_WIDGET(w))->lastFocus,
42 + ((XmAnyCallbackStruct *)callData)->event);
43 + if (((XmAnyCallbackStruct *)callData)->event->xbutton.state & ShiftMask) {
44 + XtCallActionProc(WidgetToWindow(MENU_WIDGET(w))->lastFocus, "close",
45 + ((XmAnyCallbackStruct *)callData)->event, params, 1);
46 + }
47 + else {
48 + XtCallActionProc(WidgetToWindow(MENU_WIDGET(w))->lastFocus, "close",
49 + ((XmAnyCallbackStruct *)callData)->event, NULL, 0);
50 + }
53 static void pasteColCB(Widget w, XtPointer clientData, XtPointer callData)
55 static char *params[1] = {"rect"};
56 diff --quilt old/source/nedit.c new/source/nedit.c
57 --- old/source/nedit.c
58 +++ new/source/nedit.c
59 @@ -241,7 +241,8 @@ static char *fallbackResources[] = {
60 "*fileMenu.openSelected.accelerator: Ctrl<Key>y",
61 "*fileMenu.openSelected.acceleratorText: Ctrl+Y",
62 "*fileMenu.close.accelerator: Ctrl<Key>w",
63 - "*fileMenu.close.acceleratorText: Ctrl+W",
64 + "*fileMenu.close.acceleratorText: [Shift]Ctrl+W",
65 + "*fileMenu.closeShift.accelerator: Shift Ctrl<Key>w",
66 "*fileMenu.save.accelerator: Ctrl<Key>s",
67 "*fileMenu.save.acceleratorText: Ctrl+S",
68 "*fileMenu.includeFile.accelerator: Alt<Key>i",