0
0
mirror of https://github.com/vim/vim.git synced 2025-10-18 07:54:29 -04:00

patch 8.1.2380: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar
2019-12-01 22:11:18 +01:00
parent 217e1b8359
commit 306139005c
10 changed files with 1821 additions and 1859 deletions

File diff suppressed because it is too large Load Diff

989
src/gui.c

File diff suppressed because it is too large Load Diff

View File

@@ -43,11 +43,11 @@
#include "vim.h" #include "vim.h"
/* Only include this when using the file browser */ // Only include this when using the file browser
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
/* Weird complication: for "make lint" Text.h doesn't combine with Xm.h */ // Weird complication: for "make lint" Text.h doesn't combine with Xm.h
#if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT) #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT)
# undef FMT8BIT # undef FMT8BIT
#endif #endif
@@ -56,7 +56,7 @@
# include "gui_at_sb.h" # include "gui_at_sb.h"
#endif #endif
/***************** SFinternal.h */ ////////////////// SFinternal.h
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include <X11/StringDefs.h> #include <X11/StringDefs.h>
@@ -170,7 +170,7 @@ static int (*SFfunc)();
static int SFstatus = SEL_FILE_NULL; static int SFstatus = SEL_FILE_NULL;
/***************** forward declare static functions */ ///////////////// forward declare static functions
static void SFsetText(char *path); static void SFsetText(char *path);
static void SFtextChanged(void); static void SFtextChanged(void);
@@ -184,7 +184,7 @@ static void SFvSliderMovedCallback(Widget w, int n, int nw);
static Boolean SFworkProc(void); static Boolean SFworkProc(void);
static int SFcompareEntries(const void *p, const void *q); static int SFcompareEntries(const void *p, const void *q);
/***************** xstat.h */ ////////////////// xstat.h
#ifndef S_IXUSR #ifndef S_IXUSR
# define S_IXUSR 0100 # define S_IXUSR 0100
@@ -198,7 +198,7 @@ static int SFcompareEntries(const void *p, const void *q);
#define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH)) #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH))
/***************** Path.c */ ////////////////// Path.c
#include <pwd.h> #include <pwd.h>
@@ -515,7 +515,7 @@ SFgetHomeDirs(void)
SFhomeDir.path = SFcurrentPath; SFhomeDir.path = SFcurrentPath;
SFhomeDir.entries = entries; SFhomeDir.entries = entries;
SFhomeDir.nEntries = i; SFhomeDir.nEntries = i;
SFhomeDir.vOrigin = 0; /* :-) */ SFhomeDir.vOrigin = 0; // :-)
SFhomeDir.nChars = maxChars + 2; SFhomeDir.nChars = maxChars + 2;
SFhomeDir.hOrigin = 0; SFhomeDir.hOrigin = 0;
SFhomeDir.changed = 1; SFhomeDir.changed = 1;
@@ -969,7 +969,7 @@ SFdirModTimer(XtPointer cl UNUSED, XtIntervalId *id UNUSED)
SFdirModTimer, (XtPointer) NULL); SFdirModTimer, (XtPointer) NULL);
} }
/* Return a single character describing what kind of file STATBUF is. */ // Return a single character describing what kind of file STATBUF is.
static char static char
SFstatChar(stat_T *statBuf) SFstatChar(stat_T *statBuf)
@@ -981,11 +981,11 @@ SFstatChar(stat_T *statBuf)
#ifdef S_ISSOCK #ifdef S_ISSOCK
if (S_ISSOCK (statBuf->st_mode)) if (S_ISSOCK (statBuf->st_mode))
return '='; return '=';
#endif /* S_ISSOCK */ #endif // S_ISSOCK
return ' '; return ' ';
} }
/***************** Draw.c */ ////////////////// Draw.c
#ifdef FEAT_GUI_NEXTAW #ifdef FEAT_GUI_NEXTAW
# include <X11/neXtaw/Cardinals.h> # include <X11/neXtaw/Cardinals.h>
@@ -1604,7 +1604,7 @@ SFenterList(Widget w UNUSED, int n, XEnterWindowEvent *event)
{ {
int nw; int nw;
/* sanity */ // sanity
if (SFcurrentInvert[n] != -1) if (SFcurrentInvert[n] != -1)
{ {
SFinvertEntry(n); SFinvertEntry(n);
@@ -1980,7 +1980,7 @@ SFworkProc(void)
return True; return True;
} }
/***************** Dir.c */ ////////////////// Dir.c
static int static int
SFcompareEntries(const void *p, const void *q) SFcompareEntries(const void *p, const void *q)
@@ -2020,7 +2020,7 @@ SFgetDir(
while ((dp = readdir(dirp))) while ((dp = readdir(dirp)))
{ {
/* Ignore "." and ".." */ // Ignore "." and ".."
if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
continue; continue;
if (i >= Alloc) if (i >= Alloc)
@@ -2051,7 +2051,7 @@ SFgetDir(
return 0; return 0;
} }
/***************** SFinternal.h */ ////////////////// SFinternal.h
#include <sys/param.h> #include <sys/param.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@@ -2202,7 +2202,7 @@ SFsetColors(
XSetForeground(gui.dpy, SFtextGC, fg); XSetForeground(gui.dpy, SFtextGC, fg);
XSetForeground(gui.dpy, SFlineGC, fg); XSetForeground(gui.dpy, SFlineGC, fg);
/* This is an xor GC, so combine the fg and background */ // This is an xor GC, so combine the fg and background
XSetBackground(gui.dpy, SFinvertGC, fg ^ bg); XSetBackground(gui.dpy, SFinvertGC, fg ^ bg);
XSetForeground(gui.dpy, SFinvertGC, fg ^ bg); XSetForeground(gui.dpy, SFinvertGC, fg ^ bg);
} }
@@ -2250,7 +2250,7 @@ SFcreateWidgets(
XtNtitle, prompt, XtNtitle, prompt,
NULL); NULL);
/* Add WM_DELETE_WINDOW protocol */ // Add WM_DELETE_WINDOW protocol
XtAppAddActions(XtWidgetToApplicationContext(selFile), XtAppAddActions(XtWidgetToApplicationContext(selFile),
actions, XtNumber(actions)); actions, XtNumber(actions));
XtOverrideTranslations(selFile, XtOverrideTranslations(selFile,
@@ -2522,7 +2522,7 @@ SFcreateWidgets(
XtSetMappedWhenManaged(selFile, False); XtSetMappedWhenManaged(selFile, False);
XtRealizeWidget(selFile); XtRealizeWidget(selFile);
/* Add WM_DELETE_WINDOW protocol */ // Add WM_DELETE_WINDOW protocol
SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False); SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False);
XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1); XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1);
@@ -2609,7 +2609,7 @@ SFgetText(void)
XtNstring, &wcbuf, XtNstring, &wcbuf,
NULL); NULL);
mbslength = wcstombs(NULL, wcbuf, 0); mbslength = wcstombs(NULL, wcbuf, 0);
/* Hack: some broken wcstombs() returns zero, just get a large buffer */ // Hack: some broken wcstombs() returns zero, just get a large buffer
if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0) if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0)
mbslength = MAXPATHL; mbslength = MAXPATHL;
buf=(char *)XtMalloc(mbslength + 1); buf=(char *)XtMalloc(mbslength + 1);
@@ -2645,7 +2645,7 @@ vim_SelFile(
guicolor_T fg, guicolor_T fg,
guicolor_T bg, guicolor_T bg,
guicolor_T scroll_fg, guicolor_T scroll_fg,
guicolor_T scroll_bg) /* The "Scrollbar" group colors */ guicolor_T scroll_bg) // The "Scrollbar" group colors
{ {
static int firstTime = 1; static int firstTime = 1;
XEvent event; XEvent event;
@@ -2731,4 +2731,4 @@ vim_SelFile(
} }
} }
} }
#endif /* FEAT_BROWSE */ #endif // FEAT_BROWSE

View File

@@ -56,9 +56,9 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* ScrollBar.c */ // ScrollBar.c
/* created by weissman, Mon Jul 7 13:20:03 1986 */ // created by weissman, Mon Jul 7 13:20:03 1986
/* converted by swick, Thu Aug 27 1987 */ // converted by swick, Thu Aug 27 1987
#include "vim.h" #include "vim.h"
@@ -70,7 +70,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xmu/Drawing.h> #include <X11/Xmu/Drawing.h>
/* Private definitions. */ // Private definitions.
static char defaultTranslations[] = static char defaultTranslations[] =
"<Btn1Down>: NotifyScroll()\n\ "<Btn1Down>: NotifyScroll()\n\
@@ -164,7 +164,7 @@ static XtActionsRec actions[] =
ScrollbarClassRec vim_scrollbarClassRec = ScrollbarClassRec vim_scrollbarClassRec =
{ {
{ /* core fields */ { // core fields
/* superclass */ (WidgetClass) &simpleClassRec, /* superclass */ (WidgetClass) &simpleClassRec,
/* class_name */ "Scrollbar", /* class_name */ "Scrollbar",
/* size */ sizeof(ScrollbarRec), /* size */ sizeof(ScrollbarRec),
@@ -198,13 +198,13 @@ ScrollbarClassRec vim_scrollbarClassRec =
/* display_accelerator*/ XtInheritDisplayAccelerator, /* display_accelerator*/ XtInheritDisplayAccelerator,
/* extension */ NULL /* extension */ NULL
}, },
{ /* simple fields */ { // simple fields
/* change_sensitive */ XtInheritChangeSensitive, /* change_sensitive */ XtInheritChangeSensitive,
#ifndef OLDXAW #ifndef OLDXAW
/* extension */ NULL /* extension */ NULL
#endif #endif
}, },
{ /* scrollbar fields */ { // scrollbar fields
/* empty */ 0 /* empty */ 0
} }
}; };
@@ -240,7 +240,7 @@ FillArea(
int fill, int fill,
int draw_shadow) int draw_shadow)
{ {
int tlen = bottom - top; /* length of thumb in pixels */ int tlen = bottom - top; // length of thumb in pixels
int sw, margin, floor; int sw, margin, floor;
int lx, ly, lw, lh; int lx, ly, lw, lh;
@@ -273,24 +273,24 @@ FillArea(
{ {
if (!(sbw->scrollbar.orientation == XtorientHorizontal)) if (!(sbw->scrollbar.orientation == XtorientHorizontal))
{ {
/* Top border */ // Top border
XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.top_shadow_GC, sbw->scrollbar.top_shadow_GC,
lx, ly, lx + lw - 1, ly); lx, ly, lx + lw - 1, ly);
/* Bottom border */ // Bottom border
XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.bot_shadow_GC, sbw->scrollbar.bot_shadow_GC,
lx, ly + lh - 1, lx + lw - 1, ly + lh - 1); lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
} }
else else
{ {
/* Left border */ // Left border
XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.top_shadow_GC, sbw->scrollbar.top_shadow_GC,
lx, ly, lx, ly + lh - 1); lx, ly, lx, ly + lh - 1);
/* Right border */ // Right border
XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.bot_shadow_GC, sbw->scrollbar.bot_shadow_GC,
lx + lw - 1, ly, lx + lw - 1, ly + lh - 1); lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
@@ -306,24 +306,24 @@ FillArea(
if (!(sbw->scrollbar.orientation == XtorientHorizontal)) if (!(sbw->scrollbar.orientation == XtorientHorizontal))
{ {
/* Left border */ // Left border
XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.top_shadow_GC, sbw->scrollbar.top_shadow_GC,
lx, ly, lx, ly + lh - 1); lx, ly, lx, ly + lh - 1);
/* Right border */ // Right border
XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.bot_shadow_GC, sbw->scrollbar.bot_shadow_GC,
lx + lw - 1, ly, lx + lw - 1, ly + lh - 1); lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
} }
else else
{ {
/* Top border */ // Top border
XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.top_shadow_GC, sbw->scrollbar.top_shadow_GC,
lx, ly, lx + lw - 1, ly); lx, ly, lx + lw - 1, ly);
/* Bottom border */ // Bottom border
XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.bot_shadow_GC, sbw->scrollbar.bot_shadow_GC,
lx, ly + lh - 1, lx + lw - 1, ly + lh - 1); lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
@@ -336,11 +336,11 @@ FillArea(
} }
} }
/* Paint the thumb in the area specified by sbw->top and /*
sbw->shown. The old area is erased. The painting and * Paint the thumb in the area specified by sbw->top and
erasing is done cleverly so that no flickering will occur. * sbw->shown. The old area is erased. The painting and
* erasing is done cleverly so that no flickering will occur.
*/ */
static void static void
PaintThumb(ScrollbarWidget sbw) PaintThumb(ScrollbarWidget sbw)
{ {
@@ -369,7 +369,7 @@ PaintThumb(ScrollbarWidget sbw)
if (newbot > oldbot) if (newbot > oldbot)
FillArea(sbw, AT_MAX(newtop, oldbot-1), newbot, 1,0); FillArea(sbw, AT_MAX(newtop, oldbot-1), newbot, 1,0);
/* Only draw the missing shadows */ // Only draw the missing shadows
FillArea(sbw, newtop, newbot, 0, 1); FillArea(sbw, newtop, newbot, 0, 1);
} }
} }
@@ -408,7 +408,7 @@ PaintArrows(ScrollbarWidget sbw)
point[5].x = thickness / 2; point[5].x = thickness / 2;
point[5].y = sbw->scrollbar.length - sbw->scrollbar.shadow_width - 1; point[5].y = sbw->scrollbar.length - sbw->scrollbar.shadow_width - 1;
/* horizontal arrows require that x and y coordinates be swapped */ // horizontal arrows require that x and y coordinates be swapped
if (sbw->scrollbar.orientation == XtorientHorizontal) if (sbw->scrollbar.orientation == XtorientHorizontal)
{ {
int n; int n;
@@ -420,7 +420,7 @@ PaintArrows(ScrollbarWidget sbw)
point[n].y = swap; point[n].y = swap;
} }
} }
/* draw the up/left arrow */ // draw the up/left arrow
XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.gc, sbw->scrollbar.gc,
point, 3, point, 3,
@@ -433,7 +433,7 @@ PaintArrows(ScrollbarWidget sbw)
sbw->scrollbar.top_shadow_GC, sbw->scrollbar.top_shadow_GC,
point[0].x, point[0].y, point[0].x, point[0].y,
point[2].x, point[2].y); point[2].x, point[2].y);
/* draw the down/right arrow */ // draw the down/right arrow
XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
sbw->scrollbar.gc, sbw->scrollbar.gc,
point+3, 3, point+3, 3,
@@ -497,8 +497,8 @@ CreateGC(Widget w)
gcValues.fill_style = FillSolid; gcValues.fill_style = FillSolid;
mask |= GCFillStyle; mask |= GCFillStyle;
} }
/* the creation should be non-caching, because */ // the creation should be non-caching, because
/* we now set and clear clip masks on the gc returned */ // we now set and clear clip masks on the gc returned
sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues); sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues);
} }
@@ -519,8 +519,8 @@ SetDimensions(ScrollbarWidget sbw)
static void static void
Initialize( Initialize(
Widget request UNUSED, /* what the client asked for */ Widget request UNUSED, // what the client asked for
Widget new, /* what we're going to give him */ Widget new, // what we're going to give him
ArgList args UNUSED, ArgList args UNUSED,
Cardinal *num_args UNUSED) Cardinal *num_args UNUSED)
{ {
@@ -551,16 +551,16 @@ Realize(
Mask *valueMask, Mask *valueMask,
XSetWindowAttributes *attributes) XSetWindowAttributes *attributes)
{ {
/* The Simple widget actually stuffs the value in the valuemask. */ // The Simple widget actually stuffs the value in the valuemask.
(*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize) (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize)
(w, valueMask, attributes); (w, valueMask, attributes);
} }
static Boolean static Boolean
SetValues( SetValues(
Widget current, /* what I am */ Widget current, // what I am
Widget request UNUSED, /* what he wants me to be */ Widget request UNUSED, // what he wants me to be
Widget desired, /* what I will become */ Widget desired, // what I will become
ArgList args UNUSED, ArgList args UNUSED,
Cardinal *num_args UNUSED) Cardinal *num_args UNUSED)
{ {
@@ -600,8 +600,8 @@ SetValues(
static void static void
Resize(Widget w) Resize(Widget w)
{ {
/* ForgetGravity has taken care of background, but thumb may // ForgetGravity has taken care of background, but thumb may
* have to move as a result of the new size. */ // have to move as a result of the new size.
SetDimensions ((ScrollbarWidget) w); SetDimensions ((ScrollbarWidget) w);
Redisplay(w, (XEvent*) NULL, (Region)NULL); Redisplay(w, (XEvent*) NULL, (Region)NULL);
} }
@@ -633,11 +633,11 @@ Redisplay(Widget w, XEvent *event, Region region)
if (region == NULL || if (region == NULL ||
XRectInRegion (region, x, y, width, height) != RectangleOut) XRectInRegion (region, x, y, width, height) != RectangleOut)
{ {
/* Forces entire thumb to be painted. */ // Forces entire thumb to be painted.
sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1); sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1);
PaintThumb (sbw); PaintThumb (sbw);
} }
/* we'd like to be region aware here!!!! */ // we'd like to be region aware here!!!!
PaintArrows(sbw); PaintArrows(sbw);
} }
@@ -693,7 +693,7 @@ PeekNotifyEvent(Display *dpy, XEvent *event, char *args)
{ {
struct EventData *eventData = (struct EventData*)args; struct EventData *eventData = (struct EventData*)args;
return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */ return ((++eventData->count == QLength(dpy)) // since PeekIf blocks
|| CompareEvents(event, eventData->oldEvent)); || CompareEvents(event, eventData->oldEvent));
} }
@@ -719,9 +719,9 @@ LookAhead(Widget w, XEvent *event)
static void static void
ExtractPosition( ExtractPosition(
XEvent *event, XEvent *event,
Position *x, /* RETURN */ Position *x, // RETURN
Position *y, /* RETURN */ Position *y, // RETURN
unsigned int *state) /* RETURN */ unsigned int *state) // RETURN
{ {
switch (event->type) switch (event->type)
{ {
@@ -771,8 +771,8 @@ HandleThumb(
ExtractPosition(event, &x, &y, (unsigned int *)NULL); ExtractPosition(event, &x, &y, (unsigned int *)NULL);
loc = PICKLENGTH(sbw, x, y); loc = PICKLENGTH(sbw, x, y);
/* if the motion event puts the pointer in thumb, call Move and Notify */ // if the motion event puts the pointer in thumb, call Move and Notify
/* also call Move and Notify if we're already in continuous scroll mode */ // also call Move and Notify if we're already in continuous scroll mode
if (sbw->scrollbar.scroll_mode == SMODE_CONT || if (sbw->scrollbar.scroll_mode == SMODE_CONT ||
(loc >= sbw->scrollbar.topLoc && (loc >= sbw->scrollbar.topLoc &&
loc <= sbw->scrollbar.topLoc + (int)sbw->scrollbar.shownLength)) loc <= sbw->scrollbar.topLoc + (int)sbw->scrollbar.shownLength))
@@ -876,7 +876,7 @@ ScrollSome(
{ {
ScrollbarWidget sbw = (ScrollbarWidget) w; ScrollbarWidget sbw = (ScrollbarWidget) w;
if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous
return; return;
if (LookAhead(w, event)) if (LookAhead(w, event))
@@ -900,7 +900,7 @@ NotifyScroll(
int call_data = 0; int call_data = 0;
unsigned int state; unsigned int state;
if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous
return; return;
if (LookAhead (w, event)) if (LookAhead (w, event))
@@ -968,7 +968,7 @@ NotifyScroll(
if (call_data) if (call_data)
XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data); XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data);
/* establish autoscroll */ // establish autoscroll
if (delay) if (delay)
sbw->scrollbar.timer_id = sbw->scrollbar.timer_id =
XtAppAddTimeOut(XtWidgetToApplicationContext(w), XtAppAddTimeOut(XtWidgetToApplicationContext(w),
@@ -985,9 +985,9 @@ EndScroll(
ScrollbarWidget sbw = (ScrollbarWidget) w; ScrollbarWidget sbw = (ScrollbarWidget) w;
sbw->scrollbar.scroll_mode = SMODE_NONE; sbw->scrollbar.scroll_mode = SMODE_NONE;
/* no need to remove any autoscroll timeout; it will no-op */ // no need to remove any autoscroll timeout; it will no-op
/* because the scroll_mode is SMODE_NONE */ // because the scroll_mode is SMODE_NONE
/* but be sure to remove timeout in destroy proc */ // but be sure to remove timeout in destroy proc
} }
static float static float
@@ -1016,7 +1016,7 @@ MoveThumb(
float top; float top;
char old_mode = sbw->scrollbar.scroll_mode; char old_mode = sbw->scrollbar.scroll_mode;
sbw->scrollbar.scroll_mode = SMODE_CONT; /* indicate continuous scroll */ sbw->scrollbar.scroll_mode = SMODE_CONT; // indicate continuous scroll
if (LookAhead(w, event)) if (LookAhead(w, event))
return; return;
@@ -1028,7 +1028,7 @@ MoveThumb(
top = FractionLoc(sbw, x, y); top = FractionLoc(sbw, x, y);
if (old_mode != SMODE_CONT) /* start dragging: set offset */ if (old_mode != SMODE_CONT) // start dragging: set offset
{ {
if (event->xbutton.button == Button2) if (event->xbutton.button == Button2)
sbw->scrollbar.scroll_off = sbw->scrollbar.shown / 2.; sbw->scrollbar.scroll_off = sbw->scrollbar.shown / 2.;
@@ -1045,7 +1045,7 @@ MoveThumb(
sbw->scrollbar.top = top; sbw->scrollbar.top = top;
PaintThumb(sbw); PaintThumb(sbw);
XFlush(XtDisplay(w)); /* re-draw it before Notifying */ XFlush(XtDisplay(w)); // re-draw it before Notifying
} }
@@ -1057,8 +1057,8 @@ NotifyThumb(
Cardinal *num_params UNUSED) Cardinal *num_params UNUSED)
{ {
ScrollbarWidget sbw = (ScrollbarWidget)w; ScrollbarWidget sbw = (ScrollbarWidget)w;
/* Use a union to avoid a warning for the weird conversion from float to // Use a union to avoid a warning for the weird conversion from float to
* XtPointer. Comes from Xaw/Scrollbar.c. */ // XtPointer. Comes from Xaw/Scrollbar.c.
union { union {
XtPointer xtp; XtPointer xtp;
float xtf; float xtf;
@@ -1067,9 +1067,9 @@ NotifyThumb(
if (LookAhead(w, event)) if (LookAhead(w, event))
return; return;
/* thumbProc is not pretty, but is necessary for backwards // thumbProc is not pretty, but is necessary for backwards
compatibility on those architectures for which it work{s,ed}; // compatibility on those architectures for which it work{s,ed};
the intent is to pass a (truncated) float by value. */ // the intent is to pass a (truncated) float by value.
xtpf.xtf = sbw->scrollbar.top; xtpf.xtf = sbw->scrollbar.top;
XtCallCallbacks(w, XtNthumbProc, xtpf.xtp); XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
@@ -1137,7 +1137,7 @@ _Xaw3dDrawShadows(
bot = sbw->scrollbar.top_shadow_GC; bot = sbw->scrollbar.top_shadow_GC;
} }
/* top-left shadow */ // top-left shadow
if ((region == NULL) || if ((region == NULL) ||
(XRectInRegion (region, 0, 0, w, s) != RectangleOut) || (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
(XRectInRegion (region, 0, 0, s, h) != RectangleOut)) (XRectInRegion (region, 0, 0, s, h) != RectangleOut))
@@ -1151,7 +1151,7 @@ _Xaw3dDrawShadows(
XFillPolygon (dpy, win, top, pt, 6, Complex, CoordModeOrigin); XFillPolygon (dpy, win, top, pt, 6, Complex, CoordModeOrigin);
} }
/* bottom-right shadow */ // bottom-right shadow
if ((region == NULL) || if ((region == NULL) ||
(XRectInRegion (region, 0, hms, w, s) != RectangleOut) || (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
(XRectInRegion (region, wms, 0, s, h) != RectangleOut)) (XRectInRegion (region, wms, 0, s, h) != RectangleOut))
@@ -1176,7 +1176,7 @@ vim_XawScrollbarSetThumb(Widget w, double top, double shown, double max)
{ {
ScrollbarWidget sbw = (ScrollbarWidget) w; ScrollbarWidget sbw = (ScrollbarWidget) w;
if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if still thumbing */ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if still thumbing
return; return;
sbw->scrollbar.max = (max > 1.0) ? 1.0 : sbw->scrollbar.max = (max > 1.0) ? 1.0 :

View File

@@ -34,7 +34,7 @@
# include <X11/Xaw/Dialog.h> # include <X11/Xaw/Dialog.h>
# include <X11/Xaw/Text.h> # include <X11/Xaw/Text.h>
# include <X11/Xaw/AsciiText.h> # include <X11/Xaw/AsciiText.h>
#endif /* FEAT_GUI_NEXTAW */ #endif // FEAT_GUI_NEXTAW
#ifndef FEAT_GUI_NEXTAW #ifndef FEAT_GUI_NEXTAW
# include "gui_at_sb.h" # include "gui_at_sb.h"
@@ -46,9 +46,9 @@ static Widget vimForm = (Widget)0;
Widget textArea = (Widget)0; Widget textArea = (Widget)0;
#ifdef FEAT_MENU #ifdef FEAT_MENU
static Widget menuBar = (Widget)0; static Widget menuBar = (Widget)0;
static XtIntervalId timer = 0; /* 0 = expired, otherwise active */ static XtIntervalId timer = 0; // 0 = expired, otherwise active
/* Used to figure out menu ordering */ // Used to figure out menu ordering
static vimmenu_T *a_cur_menu = NULL; static vimmenu_T *a_cur_menu = NULL;
static Cardinal athena_calculate_ins_pos(Widget); static Cardinal athena_calculate_ins_pos(Widget);
@@ -96,7 +96,7 @@ gui_athena_scroll_cb_jump(
if (sb == NULL) if (sb == NULL)
return; return;
else if (sb->wp != NULL) /* Left or right scrollbar */ else if (sb->wp != NULL) // Left or right scrollbar
{ {
/* /*
* Careful: need to get scrollbar info out of first (left) scrollbar * Careful: need to get scrollbar info out of first (left) scrollbar
@@ -105,7 +105,7 @@ gui_athena_scroll_cb_jump(
*/ */
sb_info = &sb->wp->w_scrollbars[0]; sb_info = &sb->wp->w_scrollbars[0];
} }
else /* Bottom scrollbar */ else // Bottom scrollbar
sb_info = sb; sb_info = sb;
value = (long)(*((float *)call_data) * (float)(sb_info->max + 1) + 0.001); value = (long)(*((float *)call_data) * (float)(sb_info->max + 1) + 0.001);
@@ -134,7 +134,7 @@ gui_athena_scroll_cb_scroll(
if (sb == NULL) if (sb == NULL)
return; return;
if (sb->wp != NULL) /* Left or right scrollbar */ if (sb->wp != NULL) // Left or right scrollbar
{ {
/* /*
* Careful: need to get scrollbar info out of first (left) scrollbar * Careful: need to get scrollbar info out of first (left) scrollbar
@@ -144,7 +144,7 @@ gui_athena_scroll_cb_scroll(
sb_info = &sb->wp->w_scrollbars[0]; sb_info = &sb->wp->w_scrollbars[0];
if (sb_info->size > 5) if (sb_info->size > 5)
page = sb_info->size - 2; /* use two lines of context */ page = sb_info->size - 2; // use two lines of context
else else
page = sb_info->size; page = sb_info->size;
#ifdef FEAT_GUI_NEXTAW #ifdef FEAT_GUI_NEXTAW
@@ -177,7 +177,7 @@ gui_athena_scroll_cb_scroll(
} }
#endif #endif
} }
else /* Bottom scrollbar */ else // Bottom scrollbar
{ {
sb_info = sb; sb_info = sb;
#ifdef FEAT_GUI_NEXTAW #ifdef FEAT_GUI_NEXTAW
@@ -194,14 +194,14 @@ gui_athena_scroll_cb_scroll(
data = 1; data = 1;
} }
#endif #endif
if (data < -1) /* page-width left */ if (data < -1) // page-width left
{ {
if (sb->size > 8) if (sb->size > 8)
data = -(sb->size - 5); data = -(sb->size - 5);
else else
data = -sb->size; data = -sb->size;
} }
else if (data > 1) /* page-width right */ else if (data > 1) // page-width right
{ {
if (sb->size > 8) if (sb->size > 8)
data = (sb->size - 5); data = (sb->size - 5);
@@ -216,8 +216,8 @@ gui_athena_scroll_cb_scroll(
else if (value < 0) else if (value < 0)
value = 0; value = 0;
/* Update the bottom scrollbar an extra time (why is this needed?? */ // Update the bottom scrollbar an extra time (why is this needed??
if (sb->wp == NULL) /* Bottom scrollbar */ if (sb->wp == NULL) // Bottom scrollbar
gui_mch_set_scrollbar_thumb(sb, value, sb->size, sb->max); gui_mch_set_scrollbar_thumb(sb, value, sb->size, sb->max);
gui_drag_scrollbar(sb, value, FALSE); gui_drag_scrollbar(sb, value, FALSE);
@@ -235,7 +235,7 @@ gui_x11_create_widgets(void)
*/ */
gui.border_offset = gui.border_width; gui.border_offset = gui.border_width;
/* The form containing all the other widgets */ // The form containing all the other widgets
vimForm = XtVaCreateManagedWidget("vimForm", vimForm = XtVaCreateManagedWidget("vimForm",
formWidgetClass, vimShell, formWidgetClass, vimShell,
XtNborderWidth, 0, XtNborderWidth, 0,
@@ -243,7 +243,7 @@ gui_x11_create_widgets(void)
gui_athena_scroll_colors(vimForm); gui_athena_scroll_colors(vimForm);
#ifdef FEAT_MENU #ifdef FEAT_MENU
/* The top menu bar */ // The top menu bar
menuBar = XtVaCreateManagedWidget("menuBar", menuBar = XtVaCreateManagedWidget("menuBar",
boxWidgetClass, vimForm, boxWidgetClass, vimForm,
XtNresizable, True, XtNresizable, True,
@@ -259,8 +259,8 @@ gui_x11_create_widgets(void)
#endif #endif
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
/* Don't create it Managed, it will be managed when creating the first // Don't create it Managed, it will be managed when creating the first
* item. Otherwise an empty toolbar shows up. */ // item. Otherwise an empty toolbar shows up.
toolBar = XtVaCreateWidget("toolBar", toolBar = XtVaCreateWidget("toolBar",
boxWidgetClass, vimForm, boxWidgetClass, vimForm,
XtNresizable, True, XtNresizable, True,
@@ -276,7 +276,7 @@ gui_x11_create_widgets(void)
gui_athena_menu_colors(toolBar); gui_athena_menu_colors(toolBar);
#endif #endif
/* The text area. */ // The text area.
textArea = XtVaCreateManagedWidget("textArea", textArea = XtVaCreateManagedWidget("textArea",
coreWidgetClass, vimForm, coreWidgetClass, vimForm,
XtNresizable, True, XtNresizable, True,
@@ -315,7 +315,7 @@ gui_x11_create_widgets(void)
XtNumber(pullAction)); XtNumber(pullAction));
#endif #endif
/* Pretend we don't have input focus, we will get an event if we do. */ // Pretend we don't have input focus, we will get an event if we do.
gui.in_focus = FALSE; gui.in_focus = FALSE;
} }
@@ -352,10 +352,9 @@ gui_athena_create_pullright_pixmap(Widget w)
to.addr = (XtPointer)&font; to.addr = (XtPointer)&font;
to.size = sizeof(XFontStruct *); to.size = sizeof(XFontStruct *);
#endif #endif
/* Assumption: The menuBar children will use the same font as the // Assumption: The menuBar children will use the same font as the
* pulldown menu items AND they will all be of type // pulldown menu items AND they will all be of type
* XtNfont. // XtNfont.
*/
XtVaGetValues(menuBar, XtNchildren, &children, XtVaGetValues(menuBar, XtNchildren, &children,
XtNnumChildren, &num_children, XtNnumChildren, &num_children,
NULL); NULL);
@@ -369,7 +368,7 @@ gui_athena_create_pullright_pixmap(Widget w)
#endif #endif
) == False) ) == False)
return None; return None;
/* "font" should now contain data */ // "font" should now contain data
} }
else else
#ifdef FONTSET_ALWAYS #ifdef FONTSET_ALWAYS
@@ -449,18 +448,18 @@ static void createXpmImages(char_u *path, char **xpm, Pixmap *sen);
static void static void
get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen) get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen)
{ {
char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ char_u buf[MAXPATHL]; // buffer storing expanded pathname
char **xpm = NULL; /* xpm array */ char **xpm = NULL; // xpm array
buf[0] = NUL; /* start with NULL path */ buf[0] = NUL; // start with NULL path
if (menu->iconfile != NULL) if (menu->iconfile != NULL)
{ {
/* Use the "icon=" argument. */ // Use the "icon=" argument.
gui_find_iconfile(menu->iconfile, buf, "xpm"); gui_find_iconfile(menu->iconfile, buf, "xpm");
createXpmImages(buf, NULL, sen); createXpmImages(buf, NULL, sen);
/* If it failed, try using the menu name. */ // If it failed, try using the menu name.
if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK) if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
createXpmImages(buf, NULL, sen); createXpmImages(buf, NULL, sen);
if (*sen != (Pixmap)0) if (*sen != (Pixmap)0)
@@ -511,7 +510,7 @@ createXpmImages(char_u *path, char **xpm, Pixmap *sen)
&color[TOP_SHADOW].pixel, &color[TOP_SHADOW].pixel,
&color[HIGHLIGHT].pixel); &color[HIGHLIGHT].pixel);
/* Setup the color substitution table */ // Setup the color substitution table
attrs.valuemask = XpmColorSymbols; attrs.valuemask = XpmColorSymbols;
attrs.colorsymbols = color; attrs.colorsymbols = color;
attrs.numsymbols = 5; attrs.numsymbols = 5;
@@ -519,7 +518,7 @@ createXpmImages(char_u *path, char **xpm, Pixmap *sen)
screenNum = DefaultScreen(gui.dpy); screenNum = DefaultScreen(gui.dpy);
rootWindow = RootWindow(gui.dpy, screenNum); rootWindow = RootWindow(gui.dpy, screenNum);
/* Create the "sensitive" pixmap */ // Create the "sensitive" pixmap
if (xpm != NULL) if (xpm != NULL)
status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm, status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm,
&map, &mask, &attrs); &map, &mask, &attrs);
@@ -532,13 +531,13 @@ createXpmImages(char_u *path, char **xpm, Pixmap *sen)
GC back_gc; GC back_gc;
GC mask_gc; GC mask_gc;
/* Need to create new Pixmaps with the mask applied. */ // Need to create new Pixmaps with the mask applied.
gcvalues.foreground = color[BACKGROUND].pixel; gcvalues.foreground = color[BACKGROUND].pixel;
back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
XSetClipMask(gui.dpy, mask_gc, mask); XSetClipMask(gui.dpy, mask_gc, mask);
/* Create the "sensitive" pixmap. */ // Create the "sensitive" pixmap.
*sen = XCreatePixmap(gui.dpy, rootWindow, *sen = XCreatePixmap(gui.dpy, rootWindow,
attrs.width, attrs.height, attrs.width, attrs.height,
DefaultDepth(gui.dpy, screenNum)); DefaultDepth(gui.dpy, screenNum));
@@ -567,7 +566,7 @@ gui_mch_set_toolbar_pos(
Dimension border; Dimension border;
int height; int height;
if (!XtIsManaged(toolBar)) /* nothing to do */ if (!XtIsManaged(toolBar)) // nothing to do
return; return;
XtUnmanageChild(toolBar); XtUnmanageChild(toolBar);
XtVaGetValues(toolBar, XtVaGetValues(toolBar,
@@ -602,7 +601,7 @@ gui_mch_set_text_area_pos(
NULL); NULL);
XtManageChild(textArea); XtManageChild(textArea);
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
/* Give keyboard focus to the textArea instead of the toolbar. */ // Give keyboard focus to the textArea instead of the toolbar.
gui_mch_reset_focus(); gui_mch_reset_focus();
#endif #endif
} }
@@ -686,7 +685,7 @@ gui_mch_set_menu_pos(
XtUnmanageChild(menuBar); XtUnmanageChild(menuBar);
XtVaGetValues(menuBar, XtNborderWidth, &border, NULL); XtVaGetValues(menuBar, XtNborderWidth, &border, NULL);
/* avoid trouble when there are no menu items, and h is 1 */ // avoid trouble when there are no menu items, and h is 1
height = h - 2 * border; height = h - 2 * border;
if (height < 0) if (height < 0)
height = 1; height = 1;
@@ -709,19 +708,17 @@ gui_mch_set_menu_pos(
static Cardinal static Cardinal
athena_calculate_ins_pos(Widget widget) athena_calculate_ins_pos(Widget widget)
{ {
/* Assume that if the parent of the vimmenu_T is NULL, then we can get // Assume that if the parent of the vimmenu_T is NULL, then we can get
* to this menu by traversing "next", starting at "root_menu". // to this menu by traversing "next", starting at "root_menu".
* //
* This holds true for popup menus, toolbar, and toplevel menu items. // This holds true for popup menus, toolbar, and toplevel menu items.
*/
/* Popup menus: "id" is NULL. Only submenu_id is valid */ // Popup menus: "id" is NULL. Only submenu_id is valid
/* Menus that are not toplevel: "parent" will be non-NULL, "id" & // Menus that are not toplevel: "parent" will be non-NULL, "id" &
* "submenu_id" will be non-NULL. // "submenu_id" will be non-NULL.
*/
/* Toplevel menus: "parent" is NULL, id is the widget of the menu item */ // Toplevel menus: "parent" is NULL, id is the widget of the menu item
WidgetList children; WidgetList children;
Cardinal num_children = 0; Cardinal num_children = 0;
@@ -793,7 +790,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx UNUSED)
gui_athena_menu_colors(menu->submenu_id); gui_athena_menu_colors(menu->submenu_id);
gui_athena_menu_font(menu->submenu_id); gui_athena_menu_font(menu->submenu_id);
/* Don't update the menu height when it was set at a fixed value */ // Don't update the menu height when it was set at a fixed value
if (!gui.menu_height_fixed) if (!gui.menu_height_fixed)
{ {
/* /*
@@ -827,9 +824,8 @@ gui_mch_add_menu(vimmenu_T *menu, int idx UNUSED)
XtVaSetValues(menu->id, XtNrightBitmap, pullerBitmap, XtVaSetValues(menu->id, XtNrightBitmap, pullerBitmap,
NULL); NULL);
/* If there are other menu items that are not pulldown menus, // If there are other menu items that are not pulldown menus,
* we need to adjust the right margins of those, too. // we need to adjust the right margins of those, too.
*/
{ {
WidgetList children; WidgetList children;
Cardinal num_children; Cardinal num_children;
@@ -865,11 +861,10 @@ gui_mch_add_menu(vimmenu_T *menu, int idx UNUSED)
a_cur_menu = NULL; a_cur_menu = NULL;
} }
/* Used to determine whether a SimpleMenu has pulldown entries. // Used to determine whether a SimpleMenu has pulldown entries.
* //
* "id" is the parent of the menu items. // "id" is the parent of the menu items.
* Ignore widget "ignore" in the pane. // Ignore widget "ignore" in the pane.
*/
static Boolean static Boolean
gui_athena_menu_has_submenus(Widget id, Widget ignore) gui_athena_menu_has_submenus(Widget id, Widget ignore)
{ {
@@ -900,8 +895,8 @@ gui_athena_menu_font(Widget id)
{ {
XtUnmanageChild(id); XtUnmanageChild(id);
XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL); XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL);
/* We should force the widget to recalculate its // We should force the widget to recalculate its
* geometry now. */ // geometry now.
XtManageChild(id); XtManageChild(id);
} }
else else
@@ -929,7 +924,7 @@ gui_athena_menu_font(Widget id)
if (has_submenu(id)) if (has_submenu(id))
XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL); XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL);
/* Force the widget to recalculate its geometry now. */ // Force the widget to recalculate its geometry now.
if (managed) if (managed)
XtManageChild(id); XtManageChild(id);
} }
@@ -953,10 +948,9 @@ gui_mch_new_menu_font(void)
gui_mch_submenu_change(root_menu, FALSE); gui_mch_submenu_change(root_menu, FALSE);
{ {
/* Iterate through the menubar menu items and get the height of // Iterate through the menubar menu items and get the height of
* each one. The menu bar height is set to the maximum of all // each one. The menu bar height is set to the maximum of all
* the heights. // the heights.
*/
vimmenu_T *mp; vimmenu_T *mp;
int max_height = 9999; int max_height = 9999;
@@ -975,7 +969,7 @@ gui_mch_new_menu_font(void)
} }
if (max_height != 9999) if (max_height != 9999)
{ {
/* Don't update the menu height when it was set at a fixed value */ // Don't update the menu height when it was set at a fixed value
if (!gui.menu_height_fixed) if (!gui.menu_height_fixed)
{ {
Dimension space, border; Dimension space, border;
@@ -988,12 +982,11 @@ gui_mch_new_menu_font(void)
} }
} }
} }
/* Now, to simulate the window being resized. Only, this // Now, to simulate the window being resized. Only, this
* will resize the window to its current state. // will resize the window to its current state.
* //
* There has to be a better way, but I do not see one at this time. // There has to be a better way, but I do not see one at this time.
* (David Harrison) // (David Harrison)
*/
{ {
Position w, h; Position w, h;
@@ -1048,7 +1041,7 @@ gui_mch_new_tooltip_colors(void)
static void static void
gui_mch_submenu_change( gui_mch_submenu_change(
vimmenu_T *menu, vimmenu_T *menu,
int colors) /* TRUE for colors, FALSE for font */ int colors) // TRUE for colors, FALSE for font
{ {
vimmenu_T *mp; vimmenu_T *mp;
@@ -1060,8 +1053,8 @@ gui_mch_submenu_change(
{ {
gui_athena_menu_colors(mp->id); gui_athena_menu_colors(mp->id);
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
/* For a toolbar item: Free the pixmap and allocate a new one, // For a toolbar item: Free the pixmap and allocate a new one,
* so that the background color is right. */ // so that the background color is right.
if (mp->image != (Pixmap)0) if (mp->image != (Pixmap)0)
{ {
XFreePixmap(gui.dpy, mp->image); XFreePixmap(gui.dpy, mp->image);
@@ -1071,7 +1064,7 @@ gui_mch_submenu_change(
} }
# ifdef FEAT_BEVAL_GUI # ifdef FEAT_BEVAL_GUI
/* If we have a tooltip, then we need to change its colors */ // If we have a tooltip, then we need to change its colors
if (mp->tip != NULL) if (mp->tip != NULL)
{ {
Arg args[2]; Arg args[2];
@@ -1089,9 +1082,8 @@ gui_mch_submenu_change(
{ {
gui_athena_menu_font(mp->id); gui_athena_menu_font(mp->id);
#ifdef FEAT_BEVAL_GUI #ifdef FEAT_BEVAL_GUI
/* If we have a tooltip, then we need to change its font */ // If we have a tooltip, then we need to change its font
/* Assume XtNinternational == True (in createBalloonEvalWindow) // Assume XtNinternational == True (in createBalloonEvalWindow)
*/
if (mp->tip != NULL) if (mp->tip != NULL)
{ {
Arg args[1]; Arg args[1];
@@ -1106,7 +1098,7 @@ gui_mch_submenu_change(
if (mp->children != NULL) if (mp->children != NULL)
{ {
/* Set the colors/font for the tear off widget */ // Set the colors/font for the tear off widget
if (mp->submenu_id != (Widget)0) if (mp->submenu_id != (Widget)0)
{ {
if (colors) if (colors)
@@ -1114,7 +1106,7 @@ gui_mch_submenu_change(
else else
gui_athena_menu_font(mp->submenu_id); gui_athena_menu_font(mp->submenu_id);
} }
/* Set the colors for the children */ // Set the colors for the children
gui_mch_submenu_change(mp->children, colors); gui_mch_submenu_change(mp->children, colors);
} }
} }
@@ -1171,18 +1163,15 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED)
} }
XtSetArg(args[n], XtNhighlightThickness, 0); n++; XtSetArg(args[n], XtNhighlightThickness, 0); n++;
type = commandWidgetClass; type = commandWidgetClass;
/* TODO: figure out the position in the toolbar? // TODO: figure out the position in the toolbar?
* This currently works fine for the default toolbar, but // This currently works fine for the default toolbar, but
* what if we add/remove items during later runtime? // what if we add/remove items during later runtime?
*/
/* NOTE: "idx" isn't used here. The position is calculated by // NOTE: "idx" isn't used here. The position is calculated by
* athena_calculate_ins_pos(). The position it calculates // athena_calculate_ins_pos(). The position it calculates
* should be equal to "idx". // should be equal to "idx".
*/ // TODO: Could we just store "idx" and use that as the child
/* TODO: Could we just store "idx" and use that as the child // placement?
* placement?
*/
if (menu->id == NULL) if (menu->id == NULL)
{ {
@@ -1206,10 +1195,10 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED)
gui_mch_show_toolbar(TRUE); gui_mch_show_toolbar(TRUE);
gui.toolbar_height = gui_mch_compute_toolbar_height(); gui.toolbar_height = gui_mch_compute_toolbar_height();
return; return;
} /* toolbar menu item */ } // toolbar menu item
# endif # endif
/* Add menu separator */ // Add menu separator
if (menu_is_separator(menu->name)) if (menu_is_separator(menu->name))
{ {
menu->submenu_id = (Widget)0; menu->submenu_id = (Widget)0;
@@ -1235,10 +1224,9 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED)
if (menu->id == (Widget)0) if (menu->id == (Widget)0)
return; return;
/* If there are other "pulldown" items in this pane, then adjust // If there are other "pulldown" items in this pane, then adjust
* the right margin to accommodate the arrow pixmap, otherwise // the right margin to accommodate the arrow pixmap, otherwise
* the right margin will be the same as the left margin. // the right margin will be the same as the left margin.
*/
{ {
Dimension left_margin; Dimension left_margin;
@@ -1263,16 +1251,15 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED)
void void
gui_mch_show_toolbar(int showit) gui_mch_show_toolbar(int showit)
{ {
Cardinal numChildren; /* how many children toolBar has */ Cardinal numChildren; // how many children toolBar has
if (toolBar == (Widget)0) if (toolBar == (Widget)0)
return; return;
XtVaGetValues(toolBar, XtNnumChildren, &numChildren, NULL); XtVaGetValues(toolBar, XtNnumChildren, &numChildren, NULL);
if (showit && numChildren > 0) if (showit && numChildren > 0)
{ {
/* Assume that we want to show the toolbar if p_toolbar contains valid // Assume that we want to show the toolbar if p_toolbar contains valid
* option settings, therefore p_toolbar must not be NULL. // option settings, therefore p_toolbar must not be NULL.
*/
WidgetList children; WidgetList children;
XtVaGetValues(toolBar, XtNchildren, &children, NULL); XtVaGetValues(toolBar, XtNchildren, &children, NULL);
@@ -1296,12 +1283,11 @@ gui_mch_show_toolbar(int showit)
for (toolbar = root_menu; toolbar; toolbar = toolbar->next) for (toolbar = root_menu; toolbar; toolbar = toolbar->next)
if (menu_is_toolbar(toolbar->dname)) if (menu_is_toolbar(toolbar->dname))
break; break;
/* Assumption: toolbar is NULL if there is no toolbar, // Assumption: toolbar is NULL if there is no toolbar,
* otherwise it contains the toolbar menu structure. // otherwise it contains the toolbar menu structure.
* //
* Assumption: "numChildren" == the number of items in the list // Assumption: "numChildren" == the number of items in the list
* of items beginning with toolbar->children. // of items beginning with toolbar->children.
*/
if (toolbar) if (toolbar)
{ {
for (cur = toolbar->children; cur; cur = cur->next) for (cur = toolbar->children; cur; cur = cur->next)
@@ -1309,9 +1295,8 @@ gui_mch_show_toolbar(int showit)
Arg args[2]; Arg args[2];
int n = 0; int n = 0;
/* Enable/Disable tooltip (OK to enable while currently // Enable/Disable tooltip (OK to enable while currently
* enabled) // enabled)
*/
if (cur->tip != NULL) if (cur->tip != NULL)
(*action)(cur->tip); (*action)(cur->tip);
if (text == 1) if (text == 1)
@@ -1387,12 +1372,12 @@ gui_mch_show_toolbar(int showit)
int int
gui_mch_compute_toolbar_height(void) gui_mch_compute_toolbar_height(void)
{ {
Dimension height; /* total Toolbar height */ Dimension height; // total Toolbar height
Dimension whgt; /* height of each widget */ Dimension whgt; // height of each widget
Dimension marginHeight; /* XmNmarginHeight of toolBar */ Dimension marginHeight; // XmNmarginHeight of toolBar
Dimension shadowThickness; /* thickness of Xtparent(toolBar) */ Dimension shadowThickness; // thickness of Xtparent(toolBar)
WidgetList children; /* list of toolBar's children */ WidgetList children; // list of toolBar's children
Cardinal numChildren; /* how many children toolBar has */ Cardinal numChildren; // how many children toolBar has
int i; int i;
height = 0; height = 0;
@@ -1438,7 +1423,7 @@ gui_mch_get_toolbar_colors(
void void
gui_mch_toggle_tearoffs(int enable UNUSED) gui_mch_toggle_tearoffs(int enable UNUSED)
{ {
/* no tearoff menus */ // no tearoff menus
} }
void void
@@ -1464,23 +1449,21 @@ gui_mch_destroy_menu(vimmenu_T *menu)
{ {
Widget parent; Widget parent;
/* There is no item for the toolbar. */ // There is no item for the toolbar.
if (menu->id == (Widget)0) if (menu->id == (Widget)0)
return; return;
parent = XtParent(menu->id); parent = XtParent(menu->id);
/* When removing the last "pulldown" menu item from a pane, adjust the // When removing the last "pulldown" menu item from a pane, adjust the
* right margins of the remaining widgets. // right margins of the remaining widgets.
*/
if (menu->submenu_id != (Widget)0) if (menu->submenu_id != (Widget)0)
{ {
/* Go through the menu items in the parent of this item and // Go through the menu items in the parent of this item and
* adjust their margins, if necessary. // adjust their margins, if necessary.
* This takes care of the case when we delete the last menu item in a // This takes care of the case when we delete the last menu item in a
* pane that has a submenu. In this case, there will be no arrow // pane that has a submenu. In this case, there will be no arrow
* pixmaps shown anymore. // pixmaps shown anymore.
*/
{ {
WidgetList children; WidgetList children;
Cardinal num_children; Cardinal num_children;
@@ -1515,11 +1498,10 @@ gui_mch_destroy_menu(vimmenu_T *menu)
} }
} }
} }
/* Please be sure to destroy the parent widget first (i.e. menu->id). // Please be sure to destroy the parent widget first (i.e. menu->id).
* //
* This code should be basically identical to that in the file gui_motif.c // This code should be basically identical to that in the file gui_motif.c
* because they are both Xt based. // because they are both Xt based.
*/
if (menu->id != (Widget)0) if (menu->id != (Widget)0)
{ {
Cardinal num_children; Cardinal num_children;
@@ -1535,15 +1517,14 @@ gui_mch_destroy_menu(vimmenu_T *menu)
#if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI)
if (parent == toolBar && menu->tip != NULL) if (parent == toolBar && menu->tip != NULL)
{ {
/* We try to destroy this before the actual menu, because there are // We try to destroy this before the actual menu, because there are
* callbacks, etc. that will be unregistered during the tooltip // callbacks, etc. that will be unregistered during the tooltip
* destruction. // destruction.
* //
* If you call "gui_mch_destroy_beval_area()" after destroying // If you call "gui_mch_destroy_beval_area()" after destroying
* menu->id, then the tooltip's window will have already been // menu->id, then the tooltip's window will have already been
* deallocated by Xt, and unknown behaviour will ensue (probably // deallocated by Xt, and unknown behaviour will ensue (probably
* a core dump). // a core dump).
*/
gui_mch_destroy_beval_area(menu->tip); gui_mch_destroy_beval_area(menu->tip);
menu->tip = NULL; menu->tip = NULL;
} }
@@ -1555,15 +1536,14 @@ gui_mch_destroy_menu(vimmenu_T *menu)
* will be deleted soon anyway, and it will delete its children like * will be deleted soon anyway, and it will delete its children like
* all good widgets do. * all good widgets do.
*/ */
/* NOTE: The cause of the BadValue X Protocol Error is because when the // NOTE: The cause of the BadValue X Protocol Error is because when the
* last child is destroyed, it is first unmanaged, thus causing a // last child is destroyed, it is first unmanaged, thus causing a
* geometry resize request from the parent Shell widget. // geometry resize request from the parent Shell widget.
* Since the Shell widget has no more children, it is resized to have // Since the Shell widget has no more children, it is resized to have
* width/height of 0. XConfigureWindow() is then called with the // width/height of 0. XConfigureWindow() is then called with the
* width/height of 0, which generates the BadValue. // width/height of 0, which generates the BadValue.
* //
* This happens in phase two of the widget destruction process. // This happens in phase two of the widget destruction process.
*/
{ {
if (parent != menuBar if (parent != menuBar
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
@@ -1588,7 +1568,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
else if (parent == toolBar) else if (parent == toolBar)
{ {
/* When removing last toolbar item, don't display the toolbar. */ // When removing last toolbar item, don't display the toolbar.
XtVaGetValues(toolBar, XtNnumChildren, &num_children, NULL); XtVaGetValues(toolBar, XtNnumChildren, &num_children, NULL);
if (num_children == 0) if (num_children == 0)
gui_mch_show_toolbar(FALSE); gui_mch_show_toolbar(FALSE);
@@ -1620,7 +1600,7 @@ gui_athena_menu_timeout(
XtVaGetValues(w, XtNrightBitmap, &p, NULL); XtVaGetValues(w, XtNrightBitmap, &p, NULL);
if ((p != None) && (p != XtUnspecifiedPixmap)) if ((p != None) && (p != XtUnspecifiedPixmap))
{ {
/* We are dealing with an item that has a submenu */ // We are dealing with an item that has a submenu
popup = get_popup_entry(XtParent(w)); popup = get_popup_entry(XtParent(w));
if (popup == (Widget)0) if (popup == (Widget)0)
return; return;
@@ -1629,7 +1609,8 @@ gui_athena_menu_timeout(
} }
} }
/* This routine is used to calculate the position (in screen coordinates) /*
* This routine is used to calculate the position (in screen coordinates)
* where a submenu should appear relative to the menu entry that popped it * where a submenu should appear relative to the menu entry that popped it
* up. It should appear even with and just slightly to the left of the * up. It should appear even with and just slightly to the left of the
* rightmost end of the menu entry that caused the popup. * rightmost end of the menu entry that caused the popup.
@@ -1642,12 +1623,12 @@ gui_athena_popup_callback(
XtPointer client_data, XtPointer client_data,
XtPointer call_data UNUSED) XtPointer call_data UNUSED)
{ {
/* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */ // Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass)
vimmenu_T *menu = (vimmenu_T *)client_data; vimmenu_T *menu = (vimmenu_T *)client_data;
Dimension width; Dimension width;
Position root_x, root_y; Position root_x, root_y;
/* First, popdown any siblings that may have menus popped up */ // First, popdown any siblings that may have menus popped up
{ {
vimmenu_T *i; vimmenu_T *i;
@@ -1660,8 +1641,8 @@ gui_athena_popup_callback(
XtVaGetValues(XtParent(w), XtVaGetValues(XtParent(w),
XtNwidth, &width, XtNwidth, &width,
NULL); NULL);
/* Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id */ // Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id
/* i.e. This IS the active entry */ // i.e. This IS the active entry
XtTranslateCoords(menu->id,width - 5, 0, &root_x, &root_y); XtTranslateCoords(menu->id,width - 5, 0, &root_x, &root_y);
XtVaSetValues(w, XtNx, root_x, XtVaSetValues(w, XtNx, root_x,
XtNy, root_y, XtNy, root_y,
@@ -1696,7 +1677,9 @@ gui_athena_popdown_submenus_action(
} }
} }
/* Used to determine if the given widget has a submenu that can be popped up. */ /*
* Used to determine if the given widget has a submenu that can be popped up.
*/
static Boolean static Boolean
has_submenu(Widget widget) has_submenu(Widget widget)
{ {
@@ -1740,7 +1723,7 @@ gui_athena_delayed_arm_action(
{ {
if (timer) if (timer)
{ {
/* If the timeout hasn't been triggered, remove it */ // If the timeout hasn't been triggered, remove it
XtRemoveTimeOut(timer); XtRemoveTimeOut(timer);
} }
gui_athena_popdown_submenus_action(w,event,args,nargs); gui_athena_popdown_submenus_action(w,event,args,nargs);
@@ -1760,22 +1743,22 @@ get_popup_entry(Widget w)
{ {
Widget menuw; Widget menuw;
/* Get the active entry for the current menu */ // Get the active entry for the current menu
if ((menuw = XawSimpleMenuGetActiveEntry(w)) == (Widget)0) if ((menuw = XawSimpleMenuGetActiveEntry(w)) == (Widget)0)
return NULL; return NULL;
return submenu_widget(menuw); return submenu_widget(menuw);
} }
/* Given the widget that has been determined to have a submenu, return the submenu widget /*
* that is to be popped up. * Given the widget that has been determined to have a submenu, return the
* submenu widget that is to be popped up.
*/ */
static Widget static Widget
submenu_widget(Widget widget) submenu_widget(Widget widget)
{ {
/* Precondition: has_submenu(widget) == True // Precondition: has_submenu(widget) == True
* XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True // XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True
*/
char_u *pullright_name; char_u *pullright_name;
Widget popup; Widget popup;
@@ -1785,8 +1768,8 @@ submenu_widget(Widget widget)
vim_free(pullright_name); vim_free(pullright_name);
return popup; return popup;
/* Postcondition: (popup != NULL) implies // Postcondition: (popup != NULL) implies
* (XtIsSubclass(popup,simpleMenuWidgetClass) == True) */ // (XtIsSubclass(popup,simpleMenuWidgetClass) == True)
} }
void void
@@ -1799,7 +1782,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
if (menu->submenu_id == (Widget)0) if (menu->submenu_id == (Widget)0)
return; return;
/* Position the popup menu at the pointer */ // Position the popup menu at the pointer
if (XQueryPointer(gui.dpy, XtWindow(vimShell), &root, &child, if (XQueryPointer(gui.dpy, XtWindow(vimShell), &root, &child,
&rootx, &rooty, &winx, &winy, &mask)) &rootx, &rooty, &winx, &winy, &mask))
{ {
@@ -1819,7 +1802,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
XtPopupSpringLoaded(menu->submenu_id); XtPopupSpringLoaded(menu->submenu_id);
} }
#endif /* FEAT_MENU */ #endif // FEAT_MENU
/* /*
* Set the menu and scrollbar colors to their default values. * Set the menu and scrollbar colors to their default values.
@@ -1866,7 +1849,7 @@ gui_mch_set_scrollbar_thumb(
*/ */
if (max == 0) if (max == 0)
{ {
/* So you can't scroll it at all (normally it scrolls past end) */ // So you can't scroll it at all (normally it scrolls past end)
#ifdef FEAT_GUI_NEXTAW #ifdef FEAT_GUI_NEXTAW
XawScrollbarSetThumb(sb->id, 0.0, 1.0); XawScrollbarSetThumb(sb->id, 0.0, 1.0);
#else #else
@@ -1921,7 +1904,7 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
void void
gui_mch_create_scrollbar( gui_mch_create_scrollbar(
scrollbar_T *sb, scrollbar_T *sb,
int orient) /* SBAR_VERT or SBAR_HORIZ */ int orient) // SBAR_VERT or SBAR_HORIZ
{ {
sb->id = XtVaCreateWidget("scrollBar", sb->id = XtVaCreateWidget("scrollBar",
#ifdef FEAT_GUI_NEXTAW #ifdef FEAT_GUI_NEXTAW
@@ -1971,7 +1954,7 @@ gui_mch_set_scrollbar_colors(scrollbar_T *sb)
XtNbackground, gui.scroll_bg_pixel, XtNbackground, gui.scroll_bg_pixel,
NULL); NULL);
/* This is needed for the rectangle below the vertical scrollbars. */ // This is needed for the rectangle below the vertical scrollbars.
if (sb == &gui.bottom_sbar && vimForm != (Widget)0) if (sb == &gui.bottom_sbar && vimForm != (Widget)0)
gui_athena_scroll_colors(vimForm); gui_athena_scroll_colors(vimForm);
} }
@@ -1992,17 +1975,17 @@ gui_x11_get_wid(void)
*/ */
char_u * char_u *
gui_mch_browse( gui_mch_browse(
int saving UNUSED, /* select file to write */ int saving UNUSED, // select file to write
char_u *title, /* title for the window */ char_u *title, // title for the window
char_u *dflt, /* default name */ char_u *dflt, // default name
char_u *ext UNUSED, /* extension added */ char_u *ext UNUSED, // extension added
char_u *initdir, /* initial directory, NULL for current dir */ char_u *initdir, // initial directory, NULL for current dir
char_u *filter UNUSED) /* file name filter */ char_u *filter UNUSED) // file name filter
{ {
Position x, y; Position x, y;
char_u dirbuf[MAXPATHL]; char_u dirbuf[MAXPATHL];
/* Concatenate "initdir" and "dflt". */ // Concatenate "initdir" and "dflt".
if (initdir == NULL || *initdir == NUL) if (initdir == NULL || *initdir == NUL)
mch_dirname(dirbuf, MAXPATHL); mch_dirname(dirbuf, MAXPATHL);
else if (STRLEN(initdir) + 2 < MAXPATHL) else if (STRLEN(initdir) + 2 < MAXPATHL)
@@ -2016,7 +1999,7 @@ gui_mch_browse(
STRCAT(dirbuf, dflt); STRCAT(dirbuf, dflt);
} }
/* Position the file selector just below the menubar */ // Position the file selector just below the menubar
XtTranslateCoords(vimShell, (Position)0, (Position) XtTranslateCoords(vimShell, (Position)0, (Position)
#ifdef FEAT_MENU #ifdef FEAT_MENU
gui.menu_height gui.menu_height
@@ -2111,13 +2094,13 @@ gui_mch_dialog(
title = (char_u *)_("Vim dialog"); title = (char_u *)_("Vim dialog");
dialogStatus = -1; dialogStatus = -1;
/* if our pointer is currently hidden, then we should show it. */ // if our pointer is currently hidden, then we should show it.
gui_mch_mousehide(FALSE); gui_mch_mousehide(FALSE);
/* Check 'v' flag in 'guioptions': vertical button placement. */ // Check 'v' flag in 'guioptions': vertical button placement.
vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL); vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
/* The shell is created each time, to make sure it is resized properly */ // The shell is created each time, to make sure it is resized properly
dialogshell = XtVaCreatePopupShell("dialogShell", dialogshell = XtVaCreatePopupShell("dialogShell",
transientShellWidgetClass, vimShell, transientShellWidgetClass, vimShell,
XtNtitle, title, XtNtitle, title,
@@ -2170,7 +2153,7 @@ gui_mch_dialog(
XtSetKeyboardFocus(dialog, dialogtextfield); XtSetKeyboardFocus(dialog, dialogtextfield);
} }
/* make a copy, so that we can insert NULs */ // make a copy, so that we can insert NULs
buts = vim_strsave(buttons); buts = vim_strsave(buttons);
if (buts == NULL) if (buts == NULL)
return -1; return -1;
@@ -2213,7 +2196,7 @@ gui_mch_dialog(
XtRealizeWidget(dialogshell); XtRealizeWidget(dialogshell);
/* Setup for catching the close-window event, don't let it close Vim! */ // Setup for catching the close-window event, don't let it close Vim!
dialogatom = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False); dialogatom = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(gui.dpy, XtWindow(dialogshell), &dialogatom, 1); XSetWMProtocols(gui.dpy, XtWindow(dialogshell), &dialogatom, 1);
XtAddEventHandler(dialogshell, NoEventMask, True, dialog_wm_handler, NULL); XtAddEventHandler(dialogshell, NoEventMask, True, dialog_wm_handler, NULL);
@@ -2236,8 +2219,8 @@ gui_mch_dialog(
y = 0; y = 0;
XtVaSetValues(dialogshell, XtNx, x, XtNy, y, NULL); XtVaSetValues(dialogshell, XtNx, x, XtNy, y, NULL);
/* Position the mouse pointer in the dialog, required for when focus // Position the mouse pointer in the dialog, required for when focus
* follows mouse. */ // follows mouse.
XWarpPointer(gui.dpy, (Window)0, XtWindow(dialogshell), 0, 0, 0, 0, 20, 40); XWarpPointer(gui.dpy, (Window)0, XtWindow(dialogshell), 0, 0, 0, 0, 20, 40);

View File

@@ -12,7 +12,7 @@
#if defined(FEAT_BEVAL_GUI) || defined(PROTO) #if defined(FEAT_BEVAL_GUI) || defined(PROTO)
/* on Win32 only get_beval_info() is required */ // on Win32 only get_beval_info() is required
#if !defined(FEAT_GUI_MSWIN) || defined(PROTO) #if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
#ifdef FEAT_GUI_GTK #ifdef FEAT_GUI_GTK
@@ -32,7 +32,7 @@
# include <Xm/AtomMgr.h> # include <Xm/AtomMgr.h>
# include <Xm/Protocols.h> # include <Xm/Protocols.h>
# else # else
/* Assume Athena */ // Assume Athena
# include <X11/Shell.h> # include <X11/Shell.h>
# ifdef FEAT_GUI_NEXTAW # ifdef FEAT_GUI_NEXTAW
# include <X11/neXtaw/Label.h> # include <X11/neXtaw/Label.h>
@@ -95,7 +95,7 @@ gui_mch_create_beval_area(
void *clientData) void *clientData)
{ {
#ifndef FEAT_GUI_GTK #ifndef FEAT_GUI_GTK
char *display_name; /* get from gui.dpy */ char *display_name; // get from gui.dpy
int screen_num; int screen_num;
char *p; char *p;
#endif #endif
@@ -157,7 +157,7 @@ gui_mch_destroy_beval_area(BalloonEval *beval)
{ {
cancelBalloon(beval); cancelBalloon(beval);
removeEventHandler(beval); removeEventHandler(beval);
/* Children will automatically be destroyed */ // Children will automatically be destroyed
# ifdef FEAT_GUI_GTK # ifdef FEAT_GUI_GTK
gtk_widget_destroy(beval->balloonShell); gtk_widget_destroy(beval->balloonShell);
# else # else
@@ -198,7 +198,7 @@ gui_mch_currently_showing_beval(void)
return current_beval; return current_beval;
} }
#endif #endif
#endif /* !FEAT_GUI_MSWIN */ #endif // !FEAT_GUI_MSWIN
#if defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL) || defined(PROTO) #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL) || defined(PROTO)
# if !defined(FEAT_GUI_MSWIN) || defined(PROTO) # if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
@@ -216,8 +216,8 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
else else
undrawBalloon(beval); undrawBalloon(beval);
} }
# endif /* !FEAT_GUI_MSWIN */ # endif // !FEAT_GUI_MSWIN
#endif /* FEAT_NETBEANS_INTG || PROTO */ #endif // FEAT_NETBEANS_INTG || PROTO
#if !defined(FEAT_GUI_MSWIN) || defined(PROTO) #if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
#if defined(FEAT_BEVAL_TIP) || defined(PROTO) #if defined(FEAT_BEVAL_TIP) || defined(PROTO)
@@ -344,7 +344,7 @@ target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
break; break;
} }
return FALSE; /* continue emission */ return FALSE; // continue emission
} }
static gint static gint
@@ -364,7 +364,7 @@ mainwin_event_cb(GtkWidget *widget UNUSED, GdkEvent *event, gpointer data)
break; break;
} }
return FALSE; /* continue emission */ return FALSE; // continue emission
} }
static void static void
@@ -383,7 +383,7 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
beval->state = state; beval->state = state;
cancelBalloon(beval); cancelBalloon(beval);
/* Mouse buttons are pressed - no balloon now */ // Mouse buttons are pressed - no balloon now
if (!(state & ((int)GDK_BUTTON1_MASK | (int)GDK_BUTTON2_MASK if (!(state & ((int)GDK_BUTTON1_MASK | (int)GDK_BUTTON2_MASK
| (int)GDK_BUTTON3_MASK))) | (int)GDK_BUTTON3_MASK)))
{ {
@@ -431,8 +431,8 @@ key_event(BalloonEval *beval, unsigned keyval, int is_keypress)
? (int)GDK_CONTROL_MASK : 0); ? (int)GDK_CONTROL_MASK : 0);
break; break;
default: default:
/* Don't do this for key release, we apparently get these with // Don't do this for key release, we apparently get these with
* focus changes in some GTK version. */ // focus changes in some GTK version.
if (is_keypress) if (is_keypress)
cancelBalloon(beval); cancelBalloon(beval);
break; break;
@@ -455,7 +455,7 @@ timeout_cb(gpointer data)
*/ */
requestBalloon(beval); requestBalloon(beval);
return FALSE; /* don't call me again */ return FALSE; // don't call me again
} }
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
@@ -499,11 +499,11 @@ balloon_expose_event_cb(GtkWidget *widget,
&event->area, widget, "tooltip", &event->area, widget, "tooltip",
0, 0, -1, -1); 0, 0, -1, -1);
return FALSE; /* continue emission */ return FALSE; // continue emission
} }
# endif /* !GTK_CHECK_VERSION(3,0,0) */ # endif // !GTK_CHECK_VERSION(3,0,0)
#else /* !FEAT_GUI_GTK */ #else // !FEAT_GUI_GTK
static void static void
addEventHandler(Widget target, BalloonEval *beval) addEventHandler(Widget target, BalloonEval *beval)
@@ -551,8 +551,8 @@ pointerEventEH(
static void static void
pointerEvent(BalloonEval *beval, XEvent *event) pointerEvent(BalloonEval *beval, XEvent *event)
{ {
Position distance; /* a measure of how much the pointer moved */ Position distance; // a measure of how much the pointer moved
Position delta; /* used to compute distance */ Position delta; // used to compute distance
switch (event->type) switch (event->type)
{ {
@@ -575,7 +575,7 @@ pointerEvent(BalloonEval *beval, XEvent *event)
beval->state = event->xmotion.state; beval->state = event->xmotion.state;
if (beval->state & (Button1Mask|Button2Mask|Button3Mask)) if (beval->state & (Button1Mask|Button2Mask|Button3Mask))
{ {
/* Mouse buttons are pressed - no balloon now */ // Mouse buttons are pressed - no balloon now
cancelBalloon(beval); cancelBalloon(beval);
} }
else if (beval->state & (Mod1Mask|Mod2Mask|Mod3Mask)) else if (beval->state & (Mod1Mask|Mod2Mask|Mod3Mask))
@@ -663,9 +663,9 @@ pointerEvent(BalloonEval *beval, XEvent *event)
break; break;
case LeaveNotify: case LeaveNotify:
/* Ignore LeaveNotify events that are not "normal". // Ignore LeaveNotify events that are not "normal".
* Apparently we also get it when somebody else grabs focus. // Apparently we also get it when somebody else grabs focus.
* Happens for me every two seconds (some clipboard tool?) */ // Happens for me every two seconds (some clipboard tool?)
if (event->xcrossing.mode == NotifyNormal) if (event->xcrossing.mode == NotifyNormal)
cancelBalloon(beval); cancelBalloon(beval);
break; break;
@@ -694,14 +694,14 @@ timerRoutine(XtPointer dx, XtIntervalId *id UNUSED)
requestBalloon(beval); requestBalloon(beval);
} }
#endif /* !FEAT_GUI_GTK */ #endif // !FEAT_GUI_GTK
static void static void
requestBalloon(BalloonEval *beval) requestBalloon(BalloonEval *beval)
{ {
if (beval->showState != ShS_PENDING) if (beval->showState != ShS_PENDING)
{ {
/* Determine the beval to display */ // Determine the beval to display
if (beval->msgCB != NULL) if (beval->msgCB != NULL)
{ {
beval->showState = ShS_PENDING; beval->showState = ShS_PENDING;
@@ -733,7 +733,7 @@ set_printable_label_text(GtkLabel *label, char_u *text)
int uc; int uc;
PangoAttrList *attr_list; PangoAttrList *attr_list;
/* Convert to UTF-8 if it isn't already */ // Convert to UTF-8 if it isn't already
if (output_conv.vc_type != CONV_NONE) if (output_conv.vc_type != CONV_NONE)
{ {
convbuf = string_convert(&output_conv, text, NULL); convbuf = string_convert(&output_conv, text, NULL);
@@ -741,14 +741,14 @@ set_printable_label_text(GtkLabel *label, char_u *text)
text = convbuf; text = convbuf;
} }
/* First let's see how much we need to allocate */ // First let's see how much we need to allocate
len = 0; len = 0;
for (p = text; *p != NUL; p += charlen) for (p = text; *p != NUL; p += charlen)
{ {
if ((*p & 0x80) == 0) /* be quick for ASCII */ if ((*p & 0x80) == 0) // be quick for ASCII
{ {
charlen = 1; charlen = 1;
len += IS_NONPRINTABLE(*p) ? 2 : 1; /* nonprintable: ^X */ len += IS_NONPRINTABLE(*p) ? 2 : 1; // nonprintable: ^X
} }
else else
{ {
@@ -756,14 +756,14 @@ set_printable_label_text(GtkLabel *label, char_u *text)
uc = utf_ptr2char(p); uc = utf_ptr2char(p);
if (charlen != utf_char2len(uc)) if (charlen != utf_char2len(uc))
charlen = 1; /* reject overlong sequences */ charlen = 1; // reject overlong sequences
if (charlen == 1 || uc < 0xa0) /* illegal byte or */ if (charlen == 1 || uc < 0xa0) // illegal byte or
len += 4; /* control char: <xx> */ len += 4; // control char: <xx>
else if (!utf_printable(uc)) else if (!utf_printable(uc))
/* Note: we assume here that utf_printable() doesn't // Note: we assume here that utf_printable() doesn't
* care about characters outside the BMP. */ // care about characters outside the BMP.
len += 6; /* nonprintable: <xxxx> */ len += 6; // nonprintable: <xxxx>
else else
len += charlen; len += charlen;
} }
@@ -772,7 +772,7 @@ set_printable_label_text(GtkLabel *label, char_u *text)
attr_list = pango_attr_list_new(); attr_list = pango_attr_list_new();
buf = alloc(len + 1); buf = alloc(len + 1);
/* Now go for the real work */ // Now go for the real work
if (buf != NULL) if (buf != NULL)
{ {
attrentry_T *aep; attrentry_T *aep;
@@ -787,7 +787,7 @@ set_printable_label_text(GtkLabel *label, char_u *text)
GdkColor color = { 0, 0, 0, 0 }; GdkColor color = { 0, 0, 0, 0 };
#endif #endif
/* Look up the RGB values of the SpecialKey foreground color. */ // Look up the RGB values of the SpecialKey foreground color.
aep = syn_gui_attr2entry(HL_ATTR(HLF_8)); aep = syn_gui_attr2entry(HL_ATTR(HLF_8));
pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR; pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR;
if (pixel != INVALCOLOR) if (pixel != INVALCOLOR)
@@ -807,7 +807,7 @@ set_printable_label_text(GtkLabel *label, char_u *text)
p = text; p = text;
while (*p != NUL) while (*p != NUL)
{ {
/* Be quick for ASCII */ // Be quick for ASCII
if ((*p & 0x80) == 0 && !IS_NONPRINTABLE(*p)) if ((*p & 0x80) == 0 && !IS_NONPRINTABLE(*p))
{ {
*pdest++ = *p++; *pdest++ = *p++;
@@ -818,29 +818,29 @@ set_printable_label_text(GtkLabel *label, char_u *text)
uc = utf_ptr2char(p); uc = utf_ptr2char(p);
if (charlen != utf_char2len(uc)) if (charlen != utf_char2len(uc))
charlen = 1; /* reject overlong sequences */ charlen = 1; // reject overlong sequences
if (charlen == 1 || uc < 0xa0 || !utf_printable(uc)) if (charlen == 1 || uc < 0xa0 || !utf_printable(uc))
{ {
int outlen; int outlen;
/* Careful: we can't just use transchar_byte() here, // Careful: we can't just use transchar_byte() here,
* since 'encoding' is not necessarily set to "utf-8". */ // since 'encoding' is not necessarily set to "utf-8".
if (*p & 0x80 && charlen == 1) if (*p & 0x80 && charlen == 1)
{ {
transchar_hex(pdest, *p); /* <xx> */ transchar_hex(pdest, *p); // <xx>
outlen = 4; outlen = 4;
} }
else if (uc >= 0x80) else if (uc >= 0x80)
{ {
/* Note: we assume here that utf_printable() doesn't // Note: we assume here that utf_printable() doesn't
* care about characters outside the BMP. */ // care about characters outside the BMP.
transchar_hex(pdest, uc); /* <xx> or <xxxx> */ transchar_hex(pdest, uc); // <xx> or <xxxx>
outlen = (uc < 0x100) ? 4 : 6; outlen = (uc < 0x100) ? 4 : 6;
} }
else else
{ {
transchar_nonprint(pdest, *p); /* ^X */ transchar_nonprint(pdest, *p); // ^X
outlen = 2; outlen = 2;
} }
if (pixel != INVALCOLOR) if (pixel != INVALCOLOR)
@@ -940,36 +940,36 @@ drawBalloon(BalloonEval *beval)
pango_layout_set_wrap(layout, PANGO_WRAP_WORD); pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
# endif # endif
pango_layout_set_width(layout, pango_layout_set_width(layout,
/* try to come up with some reasonable width */ // try to come up with some reasonable width
PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width, PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width,
screen_w / 2, screen_w / 2,
MAX(20, screen_w - 20))); MAX(20, screen_w - 20)));
/* Calculate the balloon's width and height. */ // Calculate the balloon's width and height.
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL); gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL);
# else # else
gtk_widget_size_request(beval->balloonShell, &requisition); gtk_widget_size_request(beval->balloonShell, &requisition);
# endif # endif
/* Compute position of the balloon area */ // Compute position of the balloon area
gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y); gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y);
x += beval->x; x += beval->x;
y += beval->y; y += beval->y;
/* Get out of the way of the mouse pointer */ // Get out of the way of the mouse pointer
if (x + x_offset + requisition.width > screen_x + screen_w) if (x + x_offset + requisition.width > screen_x + screen_w)
y_offset += 15; y_offset += 15;
if (y + y_offset + requisition.height > screen_y + screen_h) if (y + y_offset + requisition.height > screen_y + screen_h)
y_offset = -requisition.height - EVAL_OFFSET_Y; y_offset = -requisition.height - EVAL_OFFSET_Y;
/* Sanitize values */ // Sanitize values
x = CLAMP(x + x_offset, 0, x = CLAMP(x + x_offset, 0,
MAX(0, screen_x + screen_w - requisition.width)); MAX(0, screen_x + screen_w - requisition.width));
y = CLAMP(y + y_offset, 0, y = CLAMP(y + y_offset, 0,
MAX(0, screen_y + screen_h - requisition.height)); MAX(0, screen_y + screen_h - requisition.height));
/* Show the balloon */ // Show the balloon
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y);
# else # else
@@ -1048,7 +1048,7 @@ createBalloonEvalWindow(BalloonEval *beval)
gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel); gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel);
} }
#else /* !FEAT_GUI_GTK */ #else // !FEAT_GUI_GTK
/* /*
* Draw a balloon. * Draw a balloon.
@@ -1063,15 +1063,15 @@ drawBalloon(BalloonEval *beval)
if (beval->msg != NULL) if (beval->msg != NULL)
{ {
/* Show the Balloon */ // Show the Balloon
/* Calculate the label's width and height */ // Calculate the label's width and height
#ifdef FEAT_GUI_MOTIF #ifdef FEAT_GUI_MOTIF
XmString s; XmString s;
/* For the callback function we parse NL characters to create a // For the callback function we parse NL characters to create a
* multi-line label. This doesn't work for all languages, but // multi-line label. This doesn't work for all languages, but
* XmStringCreateLocalized() doesn't do multi-line labels... */ // XmStringCreateLocalized() doesn't do multi-line labels...
if (beval->msgCB != NULL) if (beval->msgCB != NULL)
s = XmStringCreateLtoR((char *)beval->msg, XmFONTLIST_DEFAULT_TAG); s = XmStringCreateLtoR((char *)beval->msg, XmFONTLIST_DEFAULT_TAG);
else else
@@ -1092,8 +1092,8 @@ drawBalloon(BalloonEval *beval)
h += gui.border_offset << 1; h += gui.border_offset << 1;
XtVaSetValues(beval->balloonLabel, XmNlabelString, s, NULL); XtVaSetValues(beval->balloonLabel, XmNlabelString, s, NULL);
XmStringFree(s); XmStringFree(s);
#else /* Athena */ #else // Athena
/* Assume XtNinternational == True */ // Assume XtNinternational == True
XFontSet fset; XFontSet fset;
XFontSetExtents *ext; XFontSetExtents *ext;
@@ -1108,7 +1108,7 @@ drawBalloon(BalloonEval *beval)
XtVaSetValues(beval->balloonLabel, XtNlabel, beval->msg, NULL); XtVaSetValues(beval->balloonLabel, XtNlabel, beval->msg, NULL);
#endif #endif
/* Compute position of the balloon area */ // Compute position of the balloon area
tx = beval->x_root + EVAL_OFFSET_X; tx = beval->x_root + EVAL_OFFSET_X;
ty = beval->y_root + EVAL_OFFSET_Y; ty = beval->y_root + EVAL_OFFSET_Y;
if ((tx + w) > beval->screen_width) if ((tx + w) > beval->screen_width)
@@ -1121,13 +1121,13 @@ drawBalloon(BalloonEval *beval)
XmNy, ty, XmNy, ty,
NULL); NULL);
#else #else
/* Athena */ // Athena
XtVaSetValues(beval->balloonShell, XtVaSetValues(beval->balloonShell,
XtNx, tx, XtNx, tx,
XtNy, ty, XtNy, ty,
NULL); NULL);
#endif #endif
/* Set tooltip colors */ // Set tooltip colors
{ {
Arg args[2]; Arg args[2];
@@ -1136,7 +1136,7 @@ drawBalloon(BalloonEval *beval)
args[0].value = gui.tooltip_bg_pixel; args[0].value = gui.tooltip_bg_pixel;
args[1].name = XmNforeground; args[1].name = XmNforeground;
args[1].value = gui.tooltip_fg_pixel; args[1].value = gui.tooltip_fg_pixel;
#else /* Athena */ #else // Athena
args[0].name = XtNbackground; args[0].name = XtNbackground;
args[0].value = gui.tooltip_bg_pixel; args[0].value = gui.tooltip_bg_pixel;
args[1].name = XtNforeground; args[1].name = XtNforeground;
@@ -1194,7 +1194,7 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
overrideShellWidgetClass, gui.dpy, args, n); overrideShellWidgetClass, gui.dpy, args, n);
#else #else
/* Athena */ // Athena
XtSetArg(args[n], XtNallowShellResize, True); n++; XtSetArg(args[n], XtNallowShellResize, True); n++;
beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
overrideShellWidgetClass, gui.dpy, args, n); overrideShellWidgetClass, gui.dpy, args, n);
@@ -1213,7 +1213,7 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonLabel = XtCreateManagedWidget("balloonLabel", beval->balloonLabel = XtCreateManagedWidget("balloonLabel",
xmLabelWidgetClass, beval->balloonShell, args, n); xmLabelWidgetClass, beval->balloonShell, args, n);
} }
#else /* FEAT_GUI_ATHENA */ #else // FEAT_GUI_ATHENA
XtSetArg(args[n], XtNforeground, gui.tooltip_fg_pixel); n++; XtSetArg(args[n], XtNforeground, gui.tooltip_fg_pixel); n++;
XtSetArg(args[n], XtNbackground, gui.tooltip_bg_pixel); n++; XtSetArg(args[n], XtNbackground, gui.tooltip_bg_pixel); n++;
XtSetArg(args[n], XtNinternational, True); n++; XtSetArg(args[n], XtNinternational, True); n++;
@@ -1223,7 +1223,7 @@ createBalloonEvalWindow(BalloonEval *beval)
#endif #endif
} }
#endif /* !FEAT_GUI_GTK */ #endif // !FEAT_GUI_GTK
#endif /* !FEAT_GUI_MSWIN */ #endif // !FEAT_GUI_MSWIN
#endif /* FEAT_BEVAL_GUI */ #endif // FEAT_BEVAL_GUI

File diff suppressed because it is too large Load Diff

View File

@@ -26,8 +26,8 @@
*/ */
#include "vim.h" #include "vim.h"
#include <gtk/gtk.h> /* without this it compiles, but gives errors at #include <gtk/gtk.h> // without this it compiles, but gives errors at
runtime! */ // runtime!
#include "gui_gtk_f.h" #include "gui_gtk_f.h"
#if !GTK_CHECK_VERSION(3,0,0) #if !GTK_CHECK_VERSION(3,0,0)
# include <gtk/gtksignal.h> # include <gtk/gtksignal.h>
@@ -44,8 +44,8 @@ struct _GtkFormChild
{ {
GtkWidget *widget; GtkWidget *widget;
GdkWindow *window; GdkWindow *window;
gint x; /* relative subwidget x position */ gint x; // relative subwidget x position
gint y; /* relative subwidget y position */ gint y; // relative subwidget y position
gint mapped; gint mapped;
}; };
@@ -101,8 +101,7 @@ static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data);
static GtkWidgetClass *parent_class = NULL; static GtkWidgetClass *parent_class = NULL;
#endif #endif
/* Public interface // Public interface
*/
GtkWidget * GtkWidget *
gtk_form_new(void) gtk_form_new(void)
@@ -128,7 +127,7 @@ gtk_form_put(GtkForm *form,
g_return_if_fail(GTK_IS_FORM(form)); g_return_if_fail(GTK_IS_FORM(form));
/* LINTED: avoid warning: conversion to 'unsigned long' */ // LINTED: avoid warning: conversion to 'unsigned long'
child = g_new(GtkFormChild, 1); child = g_new(GtkFormChild, 1);
if (child == NULL) if (child == NULL)
return; return;
@@ -147,11 +146,10 @@ gtk_form_put(GtkForm *form,
form->children = g_list_append(form->children, child); form->children = g_list_append(form->children, child);
/* child->window must be created and attached to the widget _before_ // child->window must be created and attached to the widget _before_
* it has been realized, or else things will break with GTK2. Note // it has been realized, or else things will break with GTK2. Note
* that gtk_widget_set_parent() realizes the widget if it's visible // that gtk_widget_set_parent() realizes the widget if it's visible
* and its parent is mapped. // and its parent is mapped.
*/
if (gtk_widget_get_realized(GTK_WIDGET(form))) if (gtk_widget_get_realized(GTK_WIDGET(form)))
gtk_form_attach_child_window(form, child); gtk_form_attach_child_window(form, child);
@@ -212,8 +210,7 @@ gtk_form_thaw(GtkForm *form)
} }
} }
/* Basic Object handling procedures // Basic Object handling procedures
*/
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER)
#else #else
@@ -237,7 +234,7 @@ gtk_form_get_type(void)
} }
return form_type; return form_type;
} }
#endif /* !GTK_CHECK_VERSION(3,0,0) */ #endif // !GTK_CHECK_VERSION(3,0,0)
static void static void
gtk_form_class_init(GtkFormClass *klass) gtk_form_class_init(GtkFormClass *klass)
@@ -364,14 +361,13 @@ gtk_form_realize(GtkWidget *widget)
} }
/* After reading the documentation at // After reading the documentation at
* http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html // http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html
* I think it should be possible to remove this function when compiling // I think it should be possible to remove this function when compiling
* against gtk-2.0. It doesn't seem to cause problems, though. // against gtk-2.0. It doesn't seem to cause problems, though.
* //
* Well, I reckon at least the gdk_window_show(form->bin_window) // Well, I reckon at least the gdk_window_show(form->bin_window)
* is necessary. GtkForm is anything but a usual container widget. // is necessary. GtkForm is anything but a usual container widget.
*/
static void static void
gtk_form_map(GtkWidget *widget) gtk_form_map(GtkWidget *widget)
{ {
@@ -480,7 +476,7 @@ gtk_form_get_preferred_height(GtkWidget *widget,
*minimal_height = requisition.height; *minimal_height = requisition.height;
*natural_height = requisition.height; *natural_height = requisition.height;
} }
#endif /* GTK_CHECK_VERSION(3,0,0) */ #endif // GTK_CHECK_VERSION(3,0,0)
static void static void
gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
@@ -559,16 +555,16 @@ gtk_form_draw(GtkWidget *widget, cairo_t *cr)
if (!gtk_widget_get_has_window(formchild->widget) && if (!gtk_widget_get_has_window(formchild->widget) &&
gtk_cairo_should_draw_window(cr, formchild->window)) gtk_cairo_should_draw_window(cr, formchild->window))
{ {
/* To get gtk_widget_draw() to work, it is required to call // To get gtk_widget_draw() to work, it is required to call
* gtk_widget_size_allocate() in advance with a well-posed // gtk_widget_size_allocate() in advance with a well-posed
* allocation for a given child widget in order to set a // allocation for a given child widget in order to set a
* certain private GtkWidget variable, called // certain private GtkWidget variable, called
* widget->priv->alloc_need, to the proper value; otherwise, // widget->priv->alloc_need, to the proper value; otherwise,
* gtk_widget_draw() fails and the relevant scrollbar won't // gtk_widget_draw() fails and the relevant scrollbar won't
* appear on the screen. // appear on the screen.
* //
* Calling gtk_form_position_child() like this is one of ways // Calling gtk_form_position_child() like this is one of ways
* to make sure of that. */ // to make sure of that.
gtk_form_position_child(form, formchild, TRUE); gtk_form_position_child(form, formchild, TRUE);
gtk_form_render_background(formchild->widget, cr); gtk_form_render_background(formchild->widget, cr);
@@ -577,7 +573,7 @@ gtk_form_draw(GtkWidget *widget, cairo_t *cr)
return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr);
} }
#else /* !GTK_CHECK_VERSION(3,0,0) */ #else // !GTK_CHECK_VERSION(3,0,0)
static gint static gint
gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
{ {
@@ -598,16 +594,15 @@ gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
return FALSE; return FALSE;
} }
#endif /* !GTK_CHECK_VERSION(3,0,0) */ #endif // !GTK_CHECK_VERSION(3,0,0)
/* Container method // Container method
*/
static void static void
gtk_form_remove(GtkContainer *container, GtkWidget *widget) gtk_form_remove(GtkContainer *container, GtkWidget *widget)
{ {
GList *tmp_list; GList *tmp_list;
GtkForm *form; GtkForm *form;
GtkFormChild *child = NULL; /* init for gcc */ GtkFormChild *child = NULL; // init for gcc
g_return_if_fail(GTK_IS_FORM(container)); g_return_if_fail(GTK_IS_FORM(container));
@@ -634,9 +629,8 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget)
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
FUNC2GENERIC(&gtk_form_child_unmap), child); FUNC2GENERIC(&gtk_form_child_unmap), child);
/* FIXME: This will cause problems for reparenting NO_WINDOW // FIXME: This will cause problems for reparenting NO_WINDOW
* widgets out of a GtkForm // widgets out of a GtkForm
*/
gdk_window_set_user_data(child->window, NULL); gdk_window_set_user_data(child->window, NULL);
gdk_window_destroy(child->window); gdk_window_destroy(child->window);
} }
@@ -676,14 +670,13 @@ gtk_form_forall(GtkContainer *container,
} }
} }
/* Operations on children // Operations on children
*/
static void static void
gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
{ {
if (child->window != NULL) if (child->window != NULL)
return; /* been there, done that */ return; // been there, done that
if (!gtk_widget_get_has_window(child->widget)) if (!gtk_widget_get_has_window(child->widget))
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2380,
/**/ /**/
2379, 2379,
/**/ /**/