Mercurial > vim
comparison src/gui_at_fs.c @ 18781:79e10adc821d v8.1.2380
patch 8.1.2380: using old C style comments
Commit: https://github.com/vim/vim/commit/306139005c31ea7e6f892dd119beba3c94dcb982
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 1 22:11:18 2019 +0100
patch 8.1.2380: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Dec 2019 22:15:03 +0100 |
parents | ef00b6bc186b |
children | 1ab66a0a631a |
comparison
equal
deleted
inserted
replaced
18780:04ce3b8a50ed | 18781:79e10adc821d |
---|---|
41 * Heavely modified for Vim by Bram Moolenaar | 41 * Heavely modified for Vim by Bram Moolenaar |
42 */ | 42 */ |
43 | 43 |
44 #include "vim.h" | 44 #include "vim.h" |
45 | 45 |
46 /* Only include this when using the file browser */ | 46 // Only include this when using the file browser |
47 | 47 |
48 #ifdef FEAT_BROWSE | 48 #ifdef FEAT_BROWSE |
49 | 49 |
50 /* Weird complication: for "make lint" Text.h doesn't combine with Xm.h */ | 50 // Weird complication: for "make lint" Text.h doesn't combine with Xm.h |
51 #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT) | 51 #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT) |
52 # undef FMT8BIT | 52 # undef FMT8BIT |
53 #endif | 53 #endif |
54 | 54 |
55 #ifndef FEAT_GUI_NEXTAW | 55 #ifndef FEAT_GUI_NEXTAW |
56 # include "gui_at_sb.h" | 56 # include "gui_at_sb.h" |
57 #endif | 57 #endif |
58 | 58 |
59 /***************** SFinternal.h */ | 59 ////////////////// SFinternal.h |
60 | 60 |
61 #include <X11/Intrinsic.h> | 61 #include <X11/Intrinsic.h> |
62 #include <X11/StringDefs.h> | 62 #include <X11/StringDefs.h> |
63 #include <X11/Xos.h> | 63 #include <X11/Xos.h> |
64 #ifdef FEAT_GUI_NEXTAW | 64 #ifdef FEAT_GUI_NEXTAW |
168 | 168 |
169 static int (*SFfunc)(); | 169 static int (*SFfunc)(); |
170 | 170 |
171 static int SFstatus = SEL_FILE_NULL; | 171 static int SFstatus = SEL_FILE_NULL; |
172 | 172 |
173 /***************** forward declare static functions */ | 173 ///////////////// forward declare static functions |
174 | 174 |
175 static void SFsetText(char *path); | 175 static void SFsetText(char *path); |
176 static void SFtextChanged(void); | 176 static void SFtextChanged(void); |
177 static int SFgetDir(SFDir *dir); | 177 static int SFgetDir(SFDir *dir); |
178 static void SFdrawLists(int doScroll); | 178 static void SFdrawLists(int doScroll); |
182 static void SFmotionList(Widget w, int n, XMotionEvent *event); | 182 static void SFmotionList(Widget w, int n, XMotionEvent *event); |
183 static void SFvSliderMovedCallback(Widget w, int n, int nw); | 183 static void SFvSliderMovedCallback(Widget w, int n, int nw); |
184 static Boolean SFworkProc(void); | 184 static Boolean SFworkProc(void); |
185 static int SFcompareEntries(const void *p, const void *q); | 185 static int SFcompareEntries(const void *p, const void *q); |
186 | 186 |
187 /***************** xstat.h */ | 187 ////////////////// xstat.h |
188 | 188 |
189 #ifndef S_IXUSR | 189 #ifndef S_IXUSR |
190 # define S_IXUSR 0100 | 190 # define S_IXUSR 0100 |
191 #endif | 191 #endif |
192 #ifndef S_IXGRP | 192 #ifndef S_IXGRP |
196 # define S_IXOTH 0001 | 196 # define S_IXOTH 0001 |
197 #endif | 197 #endif |
198 | 198 |
199 #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH)) | 199 #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH)) |
200 | 200 |
201 /***************** Path.c */ | 201 ////////////////// Path.c |
202 | 202 |
203 #include <pwd.h> | 203 #include <pwd.h> |
204 | 204 |
205 typedef struct | 205 typedef struct |
206 { | 206 { |
513 SFhomeDir.dir = XtMalloc(1); | 513 SFhomeDir.dir = XtMalloc(1); |
514 SFhomeDir.dir[0] = 0; | 514 SFhomeDir.dir[0] = 0; |
515 SFhomeDir.path = SFcurrentPath; | 515 SFhomeDir.path = SFcurrentPath; |
516 SFhomeDir.entries = entries; | 516 SFhomeDir.entries = entries; |
517 SFhomeDir.nEntries = i; | 517 SFhomeDir.nEntries = i; |
518 SFhomeDir.vOrigin = 0; /* :-) */ | 518 SFhomeDir.vOrigin = 0; // :-) |
519 SFhomeDir.nChars = maxChars + 2; | 519 SFhomeDir.nChars = maxChars + 2; |
520 SFhomeDir.hOrigin = 0; | 520 SFhomeDir.hOrigin = 0; |
521 SFhomeDir.changed = 1; | 521 SFhomeDir.changed = 1; |
522 SFhomeDir.beginSelection = -1; | 522 SFhomeDir.beginSelection = -1; |
523 SFhomeDir.endSelection = -1; | 523 SFhomeDir.endSelection = -1; |
967 | 967 |
968 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000, | 968 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000, |
969 SFdirModTimer, (XtPointer) NULL); | 969 SFdirModTimer, (XtPointer) NULL); |
970 } | 970 } |
971 | 971 |
972 /* Return a single character describing what kind of file STATBUF is. */ | 972 // Return a single character describing what kind of file STATBUF is. |
973 | 973 |
974 static char | 974 static char |
975 SFstatChar(stat_T *statBuf) | 975 SFstatChar(stat_T *statBuf) |
976 { | 976 { |
977 if (S_ISDIR (statBuf->st_mode)) | 977 if (S_ISDIR (statBuf->st_mode)) |
979 if (S_ISREG (statBuf->st_mode)) | 979 if (S_ISREG (statBuf->st_mode)) |
980 return S_ISXXX (statBuf->st_mode) ? '*' : ' '; | 980 return S_ISXXX (statBuf->st_mode) ? '*' : ' '; |
981 #ifdef S_ISSOCK | 981 #ifdef S_ISSOCK |
982 if (S_ISSOCK (statBuf->st_mode)) | 982 if (S_ISSOCK (statBuf->st_mode)) |
983 return '='; | 983 return '='; |
984 #endif /* S_ISSOCK */ | 984 #endif // S_ISSOCK |
985 return ' '; | 985 return ' '; |
986 } | 986 } |
987 | 987 |
988 /***************** Draw.c */ | 988 ////////////////// Draw.c |
989 | 989 |
990 #ifdef FEAT_GUI_NEXTAW | 990 #ifdef FEAT_GUI_NEXTAW |
991 # include <X11/neXtaw/Cardinals.h> | 991 # include <X11/neXtaw/Cardinals.h> |
992 #else | 992 #else |
993 # include <X11/Xaw/Cardinals.h> | 993 # include <X11/Xaw/Cardinals.h> |
1602 static void | 1602 static void |
1603 SFenterList(Widget w UNUSED, int n, XEnterWindowEvent *event) | 1603 SFenterList(Widget w UNUSED, int n, XEnterWindowEvent *event) |
1604 { | 1604 { |
1605 int nw; | 1605 int nw; |
1606 | 1606 |
1607 /* sanity */ | 1607 // sanity |
1608 if (SFcurrentInvert[n] != -1) | 1608 if (SFcurrentInvert[n] != -1) |
1609 { | 1609 { |
1610 SFinvertEntry(n); | 1610 SFinvertEntry(n); |
1611 SFcurrentInvert[n] = -1; | 1611 SFcurrentInvert[n] = -1; |
1612 } | 1612 } |
1978 SFworkProcAdded = 0; | 1978 SFworkProcAdded = 0; |
1979 | 1979 |
1980 return True; | 1980 return True; |
1981 } | 1981 } |
1982 | 1982 |
1983 /***************** Dir.c */ | 1983 ////////////////// Dir.c |
1984 | 1984 |
1985 static int | 1985 static int |
1986 SFcompareEntries(const void *p, const void *q) | 1986 SFcompareEntries(const void *p, const void *q) |
1987 { | 1987 { |
1988 return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real); | 1988 return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real); |
2018 (void)mch_stat(".", &statBuf); | 2018 (void)mch_stat(".", &statBuf); |
2019 dir->mtime = statBuf.st_mtime; | 2019 dir->mtime = statBuf.st_mtime; |
2020 | 2020 |
2021 while ((dp = readdir(dirp))) | 2021 while ((dp = readdir(dirp))) |
2022 { | 2022 { |
2023 /* Ignore "." and ".." */ | 2023 // Ignore "." and ".." |
2024 if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) | 2024 if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) |
2025 continue; | 2025 continue; |
2026 if (i >= Alloc) | 2026 if (i >= Alloc) |
2027 { | 2027 { |
2028 Alloc = 2 * (Alloc + 1); | 2028 Alloc = 2 * (Alloc + 1); |
2049 closedir(dirp); | 2049 closedir(dirp); |
2050 | 2050 |
2051 return 0; | 2051 return 0; |
2052 } | 2052 } |
2053 | 2053 |
2054 /***************** SFinternal.h */ | 2054 ////////////////// SFinternal.h |
2055 | 2055 |
2056 #include <sys/param.h> | 2056 #include <sys/param.h> |
2057 #include <X11/cursorfont.h> | 2057 #include <X11/cursorfont.h> |
2058 #include <X11/Composite.h> | 2058 #include <X11/Composite.h> |
2059 #include <X11/Shell.h> | 2059 #include <X11/Shell.h> |
2200 { | 2200 { |
2201 XSetBackground(gui.dpy, SFtextGC, bg); | 2201 XSetBackground(gui.dpy, SFtextGC, bg); |
2202 XSetForeground(gui.dpy, SFtextGC, fg); | 2202 XSetForeground(gui.dpy, SFtextGC, fg); |
2203 XSetForeground(gui.dpy, SFlineGC, fg); | 2203 XSetForeground(gui.dpy, SFlineGC, fg); |
2204 | 2204 |
2205 /* This is an xor GC, so combine the fg and background */ | 2205 // This is an xor GC, so combine the fg and background |
2206 XSetBackground(gui.dpy, SFinvertGC, fg ^ bg); | 2206 XSetBackground(gui.dpy, SFinvertGC, fg ^ bg); |
2207 XSetForeground(gui.dpy, SFinvertGC, fg ^ bg); | 2207 XSetForeground(gui.dpy, SFinvertGC, fg ^ bg); |
2208 } | 2208 } |
2209 if (selFileHScroll) | 2209 if (selFileHScroll) |
2210 { | 2210 { |
2248 transientShellWidgetClass, SFdisplay, | 2248 transientShellWidgetClass, SFdisplay, |
2249 XtNtransientFor, toplevel, | 2249 XtNtransientFor, toplevel, |
2250 XtNtitle, prompt, | 2250 XtNtitle, prompt, |
2251 NULL); | 2251 NULL); |
2252 | 2252 |
2253 /* Add WM_DELETE_WINDOW protocol */ | 2253 // Add WM_DELETE_WINDOW protocol |
2254 XtAppAddActions(XtWidgetToApplicationContext(selFile), | 2254 XtAppAddActions(XtWidgetToApplicationContext(selFile), |
2255 actions, XtNumber(actions)); | 2255 actions, XtNumber(actions)); |
2256 XtOverrideTranslations(selFile, | 2256 XtOverrideTranslations(selFile, |
2257 XtParseTranslationTable(wmDeleteWindowTranslation)); | 2257 XtParseTranslationTable(wmDeleteWindowTranslation)); |
2258 | 2258 |
2520 NULL); | 2520 NULL); |
2521 | 2521 |
2522 XtSetMappedWhenManaged(selFile, False); | 2522 XtSetMappedWhenManaged(selFile, False); |
2523 XtRealizeWidget(selFile); | 2523 XtRealizeWidget(selFile); |
2524 | 2524 |
2525 /* Add WM_DELETE_WINDOW protocol */ | 2525 // Add WM_DELETE_WINDOW protocol |
2526 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False); | 2526 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False); |
2527 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1); | 2527 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1); |
2528 | 2528 |
2529 SFcreateGC(); | 2529 SFcreateGC(); |
2530 | 2530 |
2607 | 2607 |
2608 XtVaGetValues(selFileField, | 2608 XtVaGetValues(selFileField, |
2609 XtNstring, &wcbuf, | 2609 XtNstring, &wcbuf, |
2610 NULL); | 2610 NULL); |
2611 mbslength = wcstombs(NULL, wcbuf, 0); | 2611 mbslength = wcstombs(NULL, wcbuf, 0); |
2612 /* Hack: some broken wcstombs() returns zero, just get a large buffer */ | 2612 // Hack: some broken wcstombs() returns zero, just get a large buffer |
2613 if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0) | 2613 if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0) |
2614 mbslength = MAXPATHL; | 2614 mbslength = MAXPATHL; |
2615 buf=(char *)XtMalloc(mbslength + 1); | 2615 buf=(char *)XtMalloc(mbslength + 1); |
2616 wcstombs(buf, wcbuf, mbslength +1); | 2616 wcstombs(buf, wcbuf, mbslength +1); |
2617 return buf; | 2617 return buf; |
2643 int x, | 2643 int x, |
2644 int y, | 2644 int y, |
2645 guicolor_T fg, | 2645 guicolor_T fg, |
2646 guicolor_T bg, | 2646 guicolor_T bg, |
2647 guicolor_T scroll_fg, | 2647 guicolor_T scroll_fg, |
2648 guicolor_T scroll_bg) /* The "Scrollbar" group colors */ | 2648 guicolor_T scroll_bg) // The "Scrollbar" group colors |
2649 { | 2649 { |
2650 static int firstTime = 1; | 2650 static int firstTime = 1; |
2651 XEvent event; | 2651 XEvent event; |
2652 char *name_return; | 2652 char *name_return; |
2653 | 2653 |
2729 case SEL_FILE_NULL: | 2729 case SEL_FILE_NULL: |
2730 break; | 2730 break; |
2731 } | 2731 } |
2732 } | 2732 } |
2733 } | 2733 } |
2734 #endif /* FEAT_BROWSE */ | 2734 #endif // FEAT_BROWSE |