Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix devdraw's title and "open in top" on OSX and acme's infinite loop #1

Closed
wants to merge 1 commit into from

2 participants

Roi Martin Russ Cox
Roi Martin

On OSX 10.10, when you open an application that depends on devdraw, the
title bar only shows the first letter of the application's name. The
patch sets a default title as soon as the window is created, which
fixes this issue.

On OSX 10.10, when you open an application that depends on devdraw, this
application is opened in top of other windows, however the menu bar is
not updated. The patch calls topwin() at the end of makewin() in
src/cmd/devdraw/cocoa-screen.m .

An infinite loop has been detected in libdraw that affects acme. It
can be reproduced following the following steps in acme:
1. Open a new "win"
2. Execute any command, e.g. "ls"
3. Press "ESC"
4. Press left
5. Press "ESC"
6. Press "ESC"
7. Acme freezes up
This patch makes sure that len is greater that 0 in _string() at
/src/libdraw/string.c:81

Roi Martin jroimartin Fix devdraw's title and "open in top" on OSX and acme's infinite loop
On OSX 10.10, when you open an application that depends on devdraw, the
title bar only shows the first letter of the application's name. The
patch sets a default title as soon as the window is created, which
fixes this issue.

On OSX 10.10, when you open an application that depends on devdraw, this
application is opened in top of other windows, however the menu bar is
not updated. The patch calls topwin() at the end of makewin() in
src/cmd/devdraw/cocoa-screen.m .

An infinite loop has been detected in libdraw that affects acme. It
can be reproduced following the following steps in acme:
    1. Open a new "win"
    2. Execute any command, e.g. "ls"
    3. Press "ESC"
    4. Press left
    5. Press "ESC"
    6. Press "ESC"
    7. Acme freezes up
This patch makes sure that len is greater that 0 in _string() at
/src/libdraw/string.c:81
792bb95
Russ Cox
Owner
rsc commented

Please see codereview(1) or the new CONTRIBUTING.md for the contribution process. Pull requests are not the most convenient form. I merged the devdraw patch in with your commit message, but I left the string.c change out. I followed up with a different fix for the string problem. acme was making an incorrect higher-level call. Thanks for the easy reproduction instructions.

Russ Cox rsc closed this
Roi Martin jroimartin deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 16, 2014
  1. Roi Martin

    Fix devdraw's title and "open in top" on OSX and acme's infinite loop

    jroimartin authored
    On OSX 10.10, when you open an application that depends on devdraw, the
    title bar only shows the first letter of the application's name. The
    patch sets a default title as soon as the window is created, which
    fixes this issue.
    
    On OSX 10.10, when you open an application that depends on devdraw, this
    application is opened in top of other windows, however the menu bar is
    not updated. The patch calls topwin() at the end of makewin() in
    src/cmd/devdraw/cocoa-screen.m .
    
    An infinite loop has been detected in libdraw that affects acme. It
    can be reproduced following the following steps in acme:
        1. Open a new "win"
        2. Execute any command, e.g. "ls"
        3. Press "ESC"
        4. Press left
        5. Press "ESC"
        6. Press "ESC"
        7. Acme freezes up
    This patch makes sure that len is greater that 0 in _string() at
    /src/libdraw/string.c:81
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 2 deletions.
  1. +4 −1 src/cmd/devdraw/cocoa-screen.m
  2. +1 −1  src/libdraw/string.c
5 src/cmd/devdraw/cocoa-screen.m
View
@@ -98,7 +98,6 @@ @interface appdelegate : NSObject @end
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp setDelegate:[appdelegate new]];
- [NSApp activateIgnoringOtherApps:YES];
[NSApp run];
}
@@ -345,6 +344,8 @@ - (void)deminiaturize:(id)arg
initWithContentRect:r
styleMask:Winstyle
backing:NSBackingStoreBuffered defer:NO];
+ [w setTitle:@"devdraw"];
+
if(!set)
[w center];
#if OSX_VERSION >= 100700
@@ -366,6 +367,8 @@ - (void)deminiaturize:(id)arg
win.isofs = 0;
win.content = [contentview new];
[WIN setContentView:win.content];
+
+ topwin();
}
static Memimage*
2  src/libdraw/string.c
View
@@ -78,7 +78,7 @@ _string(Image *dst, Point pt, Image *src, Point sp, Font *f, char *s, Rune *r, i
}else
rptr = &r;
sf = nil;
- while((*s || *r) && len){
+ while((*s || *r) && len > 0){
max = Max;
if(len < max)
max = len;
Something went wrong with that request. Please try again.