summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-02-05 16:40:14 -0500
committerJune McEnroe <programble@gmail.com>2018-02-05 16:40:14 -0500
commit1c1d6cff97156d5edf8f10b2bbd80ff8d40c09ff (patch)
tree26216e10ea4bb5c7b82c95dfc5d71d0f70094427
parentDouble-buffer gfb frontend (diff)
downloadsrc-1c1d6cff97156d5edf8f10b2bbd80ff8d40c09ff.tar.gz
src-1c1d6cff97156d5edf8f10b2bbd80ff8d40c09ff.zip
Set title in gfcocoa
Diffstat (limited to '')
-rw-r--r--bin/gfcocoa.m8
-rw-r--r--bin/gfxx.c21
2 files changed, 20 insertions, 9 deletions
diff --git a/bin/gfcocoa.m b/bin/gfcocoa.m
index 0e2fbe2c..13b218a7 100644
--- a/bin/gfcocoa.m
+++ b/bin/gfcocoa.m
@@ -23,6 +23,7 @@
 #define UNUSED __attribute__((unused))
 
 extern int init(int argc, char *argv[]);
+extern const char *title(void);
 extern void draw(uint32_t *buf, size_t xres, size_t yres);
 extern void input(char in);
 
@@ -40,6 +41,10 @@ extern void input(char in);
     return [super initWithFrame: frameRect];
 }
 
+- (void) setWindowTitle {
+    [[self window] setTitle: [NSString stringWithUTF8String: title()]];
+}
+
 - (void) draw {
     draw(buf, [self frame].size.width, [self frame].size.height);
     [self setNeedsDisplay: YES];
@@ -90,6 +95,7 @@ extern void input(char in);
     ];
     if (converted) {
         input(in);
+        [self setWindowTitle];
         [self draw];
     }
 }
@@ -138,11 +144,11 @@ int main(int argc, char *argv[]) {
         backing: NSBackingStoreBuffered
         defer: YES
     ];
-    [window setTitle: name];
     [window center];
 
     BufferView *view = [[BufferView alloc] initWithFrame: [window frame]];
     [window setContentView: view];
+    [view setWindowTitle];
 
     [window makeKeyAndOrderFront: nil];
     [NSApp activateIgnoringOtherApps: YES];
diff --git a/bin/gfxx.c b/bin/gfxx.c
index d451d22c..6d187cb9 100644
--- a/bin/gfxx.c
+++ b/bin/gfxx.c
@@ -59,7 +59,7 @@ extern int init(int argc, char *argv[]) {
     const char *path = NULL;
 
     int opt;
-    while (0 < (opt = getopt(argc, argv, "c:b:e:E:n:w:fmz:"))) {
+    while (0 < (opt = getopt(argc, argv, "c:b:e:E:n:fmw:z:"))) {
         switch (opt) {
             case 'c': switch (optarg[0]) {
                 case 'p': space = COLOR_PALETTE; break;
@@ -86,9 +86,9 @@ extern int init(int argc, char *argv[]) {
                 bits[3] = optarg[len-1] - '0';
             } break;
             case 'n': offset  = strtoul(optarg, NULL, 0); break;
-            case 'w': width   = strtoul(optarg, NULL, 0); break;
             case 'f': flip   ^= true; break;
             case 'm': mirror ^= true; break;
+            case 'w': width   = strtoul(optarg, NULL, 0); break;
             case 'z': scale   = strtoul(optarg, NULL, 0); break;
             default: return EX_USAGE;
         }
@@ -119,19 +119,24 @@ extern int init(int argc, char *argv[]) {
     return EX_OK;
 }
 
-static void printOpts(void) {
-    printf(
-        "gfxx -c %s -e %c -E %c -b %c%c%c%c -n %#zx -w %zu %s%s-z %zu\n",
+static char options[128];
+
+extern const char *title(void) {
+    snprintf(
+        options,
+        sizeof(options),
+        "gfxx -c %s -e%c -E%c -b %c%c%c%c -n %#zx %s%s-w %zu -z %zu",
         (const char *[COLOR__MAX]){ "palette", "grayscale", "rgb" }[space],
         "lb"[byteOrder],
         "lb"[bitOrder],
         bits[0] + '0', bits[1] + '0', bits[2] + '0', bits[3] + '0',
         offset,
-        width,
         flip ? "-f " : "",
         mirror ? "-m " : "",
+        width,
         scale
     );
+    return options;
 }
 
 struct Iter {
@@ -284,8 +289,8 @@ extern void input(char in) {
     size_t pixel = (BITS_TOTAL + 7) / 8;
     size_t row = width * pixel;
     switch (in) {
-        case 'q': printOpts(); exit(EX_OK);
-        break; case 'o': printOpts();
+        case 'q': title(); printf("%s\n", options); exit(EX_OK);
+        break; case 'o': title(); printf("%s\n", options);
         break; case '[': if (!space--) space = COLOR__MAX - 1;
         break; case ']': if (++space == COLOR__MAX) space = 0;
         break; case '{': if (!preset--) preset = PRESETS_LEN - 1; setPreset();
r'>2007-05-11Add submodule links in tree listingLars Hjemli When a submodule occurs in a tree, generate a link to show the module/commit. The link is specified as a sprintf string in /etc/cgitrc, using parameters 'module-link' and 'repo.module-link'. This should probably be extended with repo.module-link.$path. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Add submodules.sh and use it during buildsLars Hjemli This adds a shell script which can be be used to initialize, list and update submodules in a git repository. It reads the file .gitmodules to find a mapping between submodule path and repository url for the initial clone of all submodules. The script is used during cgit builds to enable automatic download and checkout of the git git repository. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Added git as a submoduleLars Hjemli This commit adds the subdirectory 'git' as a submodule containing the git git repository, but doesn't add support for automatically cloning the submodule. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-09Add support for downloading single blobsLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-21Layout updateLars Hjemli 2007-02-08Make snapshot feature configurableLars Hjemli Snapshots can now be enabled/disabled by default for all repositories in cgitrc with param "snapshots". Additionally, any repo can override the default setting with param "repo.snapshots". By default, no snapshotting is enabled. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-08Add support for snapshotsLars Hjemli Make a link from the commit viewer to a snapshot of the corresponding tree. Currently only zip-format is supported. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-05cgit v0.2Lars Hjemli Main changes since v0.1: -list tags in repo summary -allow search in log-view -read repository paths from cgitrc Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli This should improve the installation a little, especially since the new options are mentioned in the README. Also, add a make-rule to build the git binaries if necessary + a dependency between cgit and libgit.a. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Update cgitrc templateLars Hjemli Make the descriptions more helpfull. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Add support for lightweight tagsLars Hjemli There is nothing bad about a tag that has no tag-object, but the old code didn't handle such tags correctly. Fix it. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli This makes cgit read all repo-info from the configfile, instead of scanning for possible git-dirs below a common root path. This is primarily done to get better security (separate physical path from logical repo-name). In /etc/cgitrc each repo is registered with the following keys: repo.url repo.name repo.path repo.desc repo.owner Note: *Required keys are repo.url and repo.path, all others are optional *Each occurrence of repo.url starts a new repository registration *Default value for repo.name is taken from repo.url *The value of repo.url cannot contain characters with special meaning for urls (i.e. one of /?%&), while repo.name can contain anything. Example: repo.url=cgit-pub repo.name=cgit/public repo.path=/pub/git/cgit repo.desc=My public cgit repo repo.owner=Lars Hjemli repo.url=cgit-priv repo.name=cgit/private repo.path=/home/larsh/src/cgit/.git repo.desc=My private cgit repo repo.owner=Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Do not die if tag has no messageLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-03Fix search for non-virtual urlsLars Hjemli When cgit don't use virtual urls, the current repo and page url parameters must be included in the search form as hidden input fields. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-01-28Update README with install/config informationLars Hjemli