let all function types return NO_TAG
[nedit-bw.git] / enhanced-fix-scrolltip-position.patch
blob322f57dc76ae649b32cbf434ad2320c606d475ba
1 This positions the scrolltip to the scrollbar handle and not the mouse pointer.
2 With respecting the scrollbar placement.
4 ---
6 source/calltips.c | 11 +++++++++--
7 source/calltips.h | 3 ++-
8 source/textDisp.c | 17 +++++++++++++++--
9 3 files changed, 26 insertions(+), 5 deletions(-)
11 diff --quilt old/source/calltips.c new/source/calltips.c
12 --- old/source/calltips.c
13 +++ new/source/calltips.c
14 @@ -401,12 +401,14 @@ Boolean getRangeOfLine(const char* textS
17 ** Pop up a scroll calltip.
19 Boolean ShowScrolltip(textDisp* textD, const char* text, const int x,
20 - const int y)
21 + const int y, int align)
23 + Dimension w = 0;
25 if (NULL == textD->scrolltip) {
26 textD->scrolltip = createTip(textD->w, textD->calltipFGPixel,
27 textD->calltipBGPixel, XmALIGNMENT_CENTER);
30 @@ -414,12 +416,17 @@ Boolean ShowScrolltip(textDisp* textD, c
31 XmTextSetString(textD->scrolltip, (char*) text);
33 /* Realize the calltip's shell so that its width and height are known */
34 XtRealizeWidget(XtParent(textD->scrolltip));
36 + /* Get the width of the tip to right align it on the x position */
37 + if (SCROLLTIP_RIGHT == align) {
38 + XtVaGetValues(XtParent(textD->scrolltip), XmNwidth, &w, NULL);
39 + }
41 /* Move the tip where it belongs and pop it up. */
42 - XtVaSetValues(XtParent(textD->scrolltip), XmNx, x, XmNy, y, NULL);
43 + XtVaSetValues(XtParent(textD->scrolltip), XmNx, x - w, XmNy, y, NULL);
44 XtPopup(XtParent(textD->scrolltip), XtGrabNone);
46 return True;
49 diff --quilt old/source/calltips.h new/source/calltips.h
50 --- old/source/calltips.h
51 +++ new/source/calltips.h
52 @@ -37,17 +37,18 @@
54 enum TipHAlignMode {TIP_LEFT, TIP_CENTER, TIP_RIGHT};
55 enum TipVAlignMode {TIP_ABOVE, TIP_BELOW};
56 enum TipAlignStrict {TIP_SLOPPY, TIP_STRICT};
57 enum TipHighlightError {CT_OK, CT_INVALID_ID, CT_NOLINE};
58 +enum ScrollTipAlignMode {SCROLLTIP_LEFT, SCROLLTIP_RIGHT};
60 int ShowCalltip(const WindowInfo *window, const char *text,
61 const Boolean anchored, const int pos, const int hAlign,
62 const int vAlign, const int alignMode);
63 void KillCalltip(WindowInfo *window, int calltipID);
64 Boolean ShowScrolltip(textDisp* textD, const char* text, const int x,
65 - const int y);
66 + const int y, int align);
67 void KillScrolltip(textDisp* textD);
68 void TextDKillCalltip(textDisp *textD, int calltipID);
69 int GetCalltipID(const WindowInfo *window);
70 void TextDRedrawCalltip(textDisp *textD, int calltipID);
71 int HighlightCalltipLine(const WindowInfo* window, const int calltipID,
72 diff --quilt old/source/textDisp.c new/source/textDisp.c
73 --- old/source/textDisp.c
74 +++ new/source/textDisp.c
75 @@ -3179,18 +3179,31 @@ static void vScrollCB(Widget w, XtPointe
76 /* Display a scrolltip showing the line number about one third down
77 from the top, the position a search jumps to. */
78 XEvent* event = ((XmScrollBarCallbackStruct*) callData)->event;
79 XMotionEvent* motionEvent = (XMotionEvent*) event;
80 char valueBuffer[TYPE_INT_STR_SIZE(int)];
81 + unsigned char placement = -1;
82 + int align = SCROLLTIP_RIGHT;
83 + Dimension w = -1;
85 + XtVaGetValues(XtParent(XtParent(textD->w)),
86 + XmNscrollBarPlacement, &placement,
87 + NULL);
88 + if (XmBOTTOM_LEFT == placement || XmTOP_LEFT == placement) {
89 + XtVaGetValues(textD->vScrollBar, XmNwidth, &w, NULL);
90 + align = SCROLLTIP_LEFT;
91 + }
93 sprintf(valueBuffer, "%i", newValue + (textD->nVisibleLines / 3));
94 - ShowScrolltip(textD, valueBuffer, motionEvent->x_root - 50,
95 - motionEvent->y_root);
96 + ShowScrolltip(textD, valueBuffer,
97 + motionEvent->x_root - motionEvent->x + w,
98 + motionEvent->y_root, align);
101 setScroll(textD, newValue, textD->horizOffset, False, True);
104 static void hScrollCB(Widget w, XtPointer clientData, XtPointer callData)
106 textDisp *textD = (textDisp *)clientData;
107 int newValue = ((XmScrollBarCallbackStruct *)callData)->value;