79 Commits

Author SHA1 Message Date
Allan Odgaard
88481bdd12 Add NSWindow’s new toolbarStyle property to sdk-compat.h 2021-01-17 14:09:53 +01:00
Allan Odgaard
b42bbfc5fe Organize the sdk-compat.h file 2021-01-17 14:09:53 +01:00
Allan Odgaard
f000204330 Remove PUBLIC macro 2020-06-05 21:22:50 +07:00
Allan Odgaard
e4f61f12b7 Change a few leading spaces to tabs 2020-04-30 13:28:24 +07:00
Allan Odgaard
b514114ec7 Access most system singletons using dot syntax
These are identified by having a prefix of shared, default, or standard in the class method.
2020-04-23 12:25:11 +07:00
Allan Odgaard
e59f9fcfa6 Remove oak::cap from algorithm.h 2019-08-01 10:28:35 +02:00
Allan Odgaard
caefacb911 Add missing space (according to syntax style guide) 2019-08-01 10:05:58 +02:00
Ronald Wampler
9fe62089ef Remove forward declarations for macOS 10.12 SDK
Although our minimum target is 10.10, we currently (dd41b992f7) only support compiling with Xcode 9, which has the macOS 10.13 SDK.
2018-11-15 09:38:15 +07:00
Ronald Wampler
a7339d3860 Add some more forward declarations for macOS 10.14 SDK 2018-11-15 09:38:15 +07:00
Allan Odgaard
dd41b992f7 Assume @available directive is available (Xcode 9) 2018-10-31 22:56:24 +07:00
Ronald Wampler
b43abb13a6 Use a dynamic color for the dark divider style (10.14) 2018-10-28 12:13:39 +07:00
Ronald Wampler
e64b09b688 Introduce overloads for the new divider styles
Also, switch to use the new divider styles in most places. The remaining usage of the old "OakCreateLine" functions are in the OakChooser windows. These will be refactor for better dark mode support next.
2018-10-28 11:07:03 +07:00
Ronald Wampler
9049d995ed Introduce OAK_AVAILABLE macro
Newer versions of clang now warn when using API's that are only available on OS version newer than the target OS unless they are guarded using `@available`.

This is temporary and should be remove when we move away from older versions of Xcode.
2018-10-12 19:37:41 +02:00
Ronald Wampler
9198c496b0 OakBackgroundFillView: Add support of Mojave Dark mode
This introduces the `OakBackgroundFillViewStyle` enum with styles that are dark mode aware and should lead to more consistent use between UI elements in the future. Also, convert OTVStatusBar and OFBHeaderView to use the new style enum.
2018-10-07 11:28:52 +02:00
Allan Odgaard
43fc65805d Add NSAppearanceName stuff from the macOS 10.14 SDK 2018-08-21 11:42:25 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
1b0eafddeb Add the 10.12 NSAlertStyle constants to sdk-compat.h 2017-09-12 20:43:52 +02:00
Allan Odgaard
a0a15caa2a Introduce sdk-compat.h for redeclaring stuff in latest SDK
This is when we are not yet ready to require building with the latest SDK but need to use some of symbols defined there.
2017-09-12 20:43:52 +02:00
Ronald Wampler
a5323b4f77 Add oak::random_shuffle algorithm 2016-10-18 23:06:49 +02:00
Allan Odgaard
182d4aa140 Add oak::has_prefix for comparing std::string with string literal 2016-10-17 11:03:41 +02:00
Ronald Wampler
1658d6356a Use thread_local instead of our own implementation
Apple's clang (Apple LLVM version 8.0.0 (clang-800.0.24.1)) as shipped with Xcode 8 now supports `thread_local`. This effectively reverts commits: 14c6a70 f3d1aba 9d1d1a1a and 172ce9d.
2016-09-15 07:17:52 +02:00
Allan Odgaard
46fb745bbe Use perrorf when printing errors with dynamic strings
Also revise error messages to be more consistent.
2016-08-28 17:25:26 +02:00
Allan Odgaard
fe301508c8 Introduce perrorf as shorthand for fprintf with strerror 2016-08-28 17:25:19 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
a415576827 Disable deprecation warning for Gestalt API
The replacement API¹ did not appear until the 10.10 SDK, although it might be usable from 10.9.2, but as we currently support 10.8, we cannot use it.

¹ [[NSProcessInfo processInfo] operatingSystemVersion]
2016-07-05 10:45:02 +02:00
Allan Odgaard
96508d81c3 Remove unused function (os_tuple) 2016-06-22 20:44:41 +02:00
Allan Odgaard
437f640e74 Implement move assignment and constructor for oak::basic_tree_t 2016-06-20 18:19:13 +02:00
Allan Odgaard
8e8a647e25 Add algorithm to erase descendent keys form a std::map
This can be used when the key is name spaced, e.g. `/foo/bar` or `foo.bar`. Here we can erase everything under foo by using `/foo/` or `foo.` respectively.
2016-06-02 21:07:43 +02:00
Ronald Wampler
f3d1abaeca Introduce tls_ptr_t
This is a lightweight wrapper around the pthread methods to access thread local memory.
2015-08-11 21:01:07 +02:00
Allan Odgaard
457969788e Use std::tuple for the OS version
This makes compatibility checks simpler, since we can use a single comparison operator.
2015-06-23 22:46:58 +02:00
Allan Odgaard
29a576ffbe Don’t go via helper for pthread_setname_np
This was previously done because the function wasn’t available until 10.7, but since that is (now) our deployment target, there is no need to wrap the call.
2014-12-25 09:36:01 +01:00
Allan Odgaard
0bdefafac3 Remove dependency graph support to only framework using this API 2014-12-25 09:33:56 +01:00
Allan Odgaard
aeb9ab7d00 Move server.h to the only framework left using this legacy API 2014-12-25 09:33:13 +01:00
Allan Odgaard
0c99cb0699 Remove unused helper function 2014-12-25 09:32:23 +01:00
Allan Odgaard
7cb2330aae Log error if curl_easy_init() or accept() fails 2014-09-30 14:15:11 +02:00
Allan Odgaard
ec81a045af Force a layout before opening window (from tests)
This appears to be a requirement (to do it manually). Running 10.9.4.
2014-09-17 10:35:25 +02:00
Allan Odgaard
57e43f27e3 Return 0 if Gestalt() fails 2014-08-21 16:06:33 +02:00
Allan Odgaard
c272afaff2 Cleanup/harmonize whitespace
Leading indent should consist only of tabs, beyond that, only spaces should be used.
2014-04-25 16:55:31 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
10d94644f7 Switch oak::server_t implementation from pthread → libdispatch
This makes the abstraction redundant and it should be removed. I am doing that as a multi-step process, since the previous implementation was blocking tests from being updated to the new (dispatch queue based) test system.
2014-04-08 15:43:20 +07:00
Allan Odgaard
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
2c20ab23b0 Ask for maximum queue length for pending socket connections
This is mainly because the SOMAXCONN constant looks better (in the source) than some arbitrarily chosen number. The constant is presently defined as 128 so it doesn’t seem wasteful, and presumably the queue will only take up space if we are not actually responding to socket connections.
2014-03-23 22:47:16 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
02e64d17e6 Remove unused operation queue type 2013-09-03 12:27:20 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
374f8a2248 Make oak::callbacks_t somewhat thread safe
If we only add, remove, and signal callbacks, the data type is now thread safe. This is mainly for the purpose of the concurrent tests.
2013-08-24 01:19:29 +02:00
Allan Odgaard
7a12fd1c41 Don’t define global macros that are only used in QuickLook target 2013-08-16 22:40:07 +02:00
Allan Odgaard
b25f716f86 Remove rforeach macro 2013-08-12 19:32:23 +02:00
Allan Odgaard
12067e806a Don’t keep mutex locked when calling client code
The mutex was locked to ensure that the client object did not go away, but the client’s code may terminate the program which destroys the server_t instance and thereby the mutex itself, which would previously cause an assertion to trigger, since the mutex was locked during destruction.

In practice there is no issue with the mutex not being locked while accessing the client object, as “unregister_client” and “master_run” are both called from the main thread, except for tests, but here we do not unregister client objects before their requests have been handled.
2013-08-12 19:32:23 +02:00