aboutsummaryrefslogtreecommitdiff
path: root/osx.m
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-11-13 21:45:44 +0000
committerSimon Tatham <anakin@pobox.com>2018-11-13 21:48:24 +0000
commit5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a (patch)
treef96b55a27088ae71d74dc83d7cc3731c5d5bf6dc /osx.m
parenta550ea0a47374705a37f36b0f05ffe9e4c8161fb (diff)
downloadpuzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.zip
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.gz
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.bz2
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.xz
Use C99 bool within source modules.
This is the main bulk of this boolification work, but although it's making the largest actual change, it should also be the least disruptive to anyone interacting with this code base downstream of me, because it doesn't modify any interface between modules: all the inter-module APIs were updated one by one in the previous commits. This just cleans up the code within each individual source file to use bool in place of int where I think that makes things clearer.
Diffstat (limited to 'osx.m')
-rw-r--r--osx.m30
1 files changed, 15 insertions, 15 deletions
diff --git a/osx.m b/osx.m
index 4eff5e8..0793817 100644
--- a/osx.m
+++ b/osx.m
@@ -392,7 +392,7 @@ struct frontend {
MyImageView *view;
NSColor **colours;
int ncolours;
- int clipped;
+ bool clipped;
int w, h;
};
@@ -522,7 +522,7 @@ struct frontend {
frame.origin.x = 0;
w = h = INT_MAX;
- midend_size(me, &w, &h, FALSE);
+ midend_size(me, &w, &h, false);
frame.size.width = w;
frame.size.height = h;
fe.w = w;
@@ -557,7 +557,7 @@ struct frontend {
*/
midend_new_game(me);
w = h = INT_MAX;
- midend_size(me, &w, &h, FALSE);
+ midend_size(me, &w, &h, false);
rect.size.width = w;
rect.size.height = h;
fe.w = w;
@@ -654,23 +654,23 @@ struct frontend {
* function key codes.
*/
if (c >= 0x80) {
- int mods = FALSE;
+ bool mods = false;
switch (c) {
case NSUpArrowFunctionKey:
c = CURSOR_UP;
- mods = TRUE;
+ mods = true;
break;
case NSDownArrowFunctionKey:
c = CURSOR_DOWN;
- mods = TRUE;
+ mods = true;
break;
case NSLeftArrowFunctionKey:
c = CURSOR_LEFT;
- mods = TRUE;
+ mods = true;
break;
case NSRightArrowFunctionKey:
c = CURSOR_RIGHT;
- mods = TRUE;
+ mods = true;
break;
default:
continue;
@@ -957,7 +957,7 @@ struct frontend {
int w, h;
w = h = INT_MAX;
- midend_size(me, &w, &h, FALSE);
+ midend_size(me, &w, &h, false);
size.width = w;
size.height = h;
fe.w = w;
@@ -1275,7 +1275,7 @@ struct frontend {
[self startConfigureSheet:CFG_SETTINGS];
}
-- (void)sheetEndWithStatus:(BOOL)update
+- (void)sheetEndWithStatus:(bool)update
{
assert(sheet != NULL);
[app endSheet:sheet];
@@ -1325,11 +1325,11 @@ struct frontend {
}
- (void)sheetOKButton:(id)sender
{
- [self sheetEndWithStatus:YES];
+ [self sheetEndWithStatus:true];
}
- (void)sheetCancelButton:(id)sender
{
- [self sheetEndWithStatus:NO];
+ [self sheetEndWithStatus:false];
}
- (void)setStatusLine:(const char *)text
@@ -1577,20 +1577,20 @@ static void osx_clip(void *handle, int x, int y, int w, int h)
if (!fe->clipped)
[[NSGraphicsContext currentContext] saveGraphicsState];
[NSBezierPath clipRect:r];
- fe->clipped = TRUE;
+ fe->clipped = true;
}
static void osx_unclip(void *handle)
{
frontend *fe = (frontend *)handle;
if (fe->clipped)
[[NSGraphicsContext currentContext] restoreGraphicsState];
- fe->clipped = FALSE;
+ fe->clipped = false;
}
static void osx_start_draw(void *handle)
{
frontend *fe = (frontend *)handle;
[fe->image lockFocus];
- fe->clipped = FALSE;
+ fe->clipped = false;
}
static void osx_end_draw(void *handle)
{